# How to Access and Utilize New DeFi Datasets with Chainbase as a Developer **Published by:** [Chainbase](https://paragraph.com/@chainbase-2/) **Published on:** 2023-06-15 **URL:** https://paragraph.com/@chainbase-2/how-to-access-and-utilize-new-defi-datasets-with-chainbase-as-a-developer ## Content The author: masterdai In this tutorial, we will introduce a collection of new datasets recently added to Chainbase. These datasets provide developers with valuable information related to various decentralized finance (DeFi) protocols and platforms. With the help of these datasets, developers can organize and manage data more efficiently, enabling them to build decentralized applications (dApps) and streamline the development process.Dataset OverviewThis update includes 8 new datasets from prominent DeFi projects such as Orion Protocol, SashimiSwap, Verse Ecosystem, DeFiSwap, SaitaSwap, VesperFi, TokenReactor, and Level Finance. These datasets cover different types of dex & yield aggregator protocols & Derivatives, offering a comprehensive range of data for developers to utilize. To give you an idea of the available data, let's explore some typical scenarios:Historical Records of Liquidity and Trading: For protocols like Orion Protocol, SashimiSwap, Verse Ecosystem, and SaitaSwap, developers can access historical records of liquidity and trading. This includes details such as transaction IDs, timestamps, pool information, token pairs, input/output amounts, and wallet addresses involved.Vaults Data: VesperFi dataset provides indexing of vaults data. Developers can query information about various vaults, including their names, symbols, input/output tokens, reward tokens, deposit limits, fees, creation timestamps, total value locked in USD, and more. This data helps developers gain insights into vault performance and management.Wallet Actions: By utilizing the "GetWalletActions" query, developers can retrieve deposit and withdraw information associated with a specific wallet address. This query provides details such as transaction amounts, timestamps, block numbers, sender/receiver addresses, and transaction hashes.Token Information: Dataset6 also includes information about tokens used in the protocols. Developers can retrieve data such as token IDs, names, symbols, and decimal precision, which are crucial for working with token-related operations.How to Access the DataTo access the datasets, you can use the provided GraphQL queries in combination with the ChainBase API. For example, to retrieve liquidity and trading data from Orion, SashimiSwap, Verse Ecosystem, and SaitaSwap, you can use the "transactionsQuery" with the necessary parameters. The query provides information about swaps, deposits, and withdrawals, including transaction IDs, timestamps, pool details, token symbols, wallet addresses, and amounts involved. Similarly, you can utilize the "GetVaults" query to access vaults data from VesperFi and retrieve information such as vault IDs, names, symbols, input/output tokens, reward tokens, deposit limits, fees, creation timestamps, and more. If you need to query specific wallet actions related to deposits and withdrawals, you can use the "GetWalletActions" query and provide the wallet address as a parameter. This query will retrieve the corresponding deposit and withdraw information, including amounts, timestamps, block numbers, and transaction hashes. The dataset outputs provided in the JSON format demonstrate the structure and sample data returned by the queries. Developers can parse and process this data as needed for their applications.GraphQL DemoOrion、Sashimi、Verse、SaitaswapView all historical records related to liquidity and trading. query transactionsQuery($poolAddresses: [Bytes]!) { swaps( orderBy: timestamp orderDirection: desc where: {pool_in: $poolAddresses} ) { id timestamp pool { id __typename } tokenIn { symbol __typename } tokenOut { symbol __typename } from amountIn amountOut to _walletAddress __typename } deposits( orderBy: timestamp orderDirection: desc where: {pool_in: $poolAddresses} ) { id timestamp pool { inputTokens { symbol __typename } outputToken { symbol __typename } __typename } from inputTokenAmounts outputTokenAmount to _walletAddress __typename } withdraws( orderBy: timestamp orderDirection: desc where: {pool_in: $poolAddresses} ) { id timestamp pool { id __typename } inputTokens { symbol __typename } outputToken { symbol __typename } from inputTokenAmounts outputTokenAmount to _walletAddress __typename } } { "poolAddresses": [ "0x76fe189e4fa5ff997872ddf44023b04cd7cb03d2", "target-wallect-address2" ] } Below are the dataset outputs.{ "data": { "swaps": [ { "id": "0xa6f63fcb6bec8818864d96a5b1bb19e8bd85ee37b2cc916412e720988440b2aa-36", "timestamp": "1675353395", "pool": { "id": "0x76fe189e4fa5ff997872ddf44023b04cd7cb03d2", "__typename": "LiquidityPool" }, "tokenIn": { "symbol": "USDC", "__typename": "Token" }, "tokenOut": { "symbol": "ATK", "__typename": "Token" }, "from": "0x420a50a62b17c18b36c64478784536ba980feac8", "amountIn": "100", "amountOut": "99680123783317", "to": "0x13e557c51c0a37e25e051491037ee546597c689f", "_walletAddress": "0x13e557c51c0a37e25e051491037ee546597c689f", "__typename": "Swap" } ], "deposits": [ { "id": "0x19091db3c1985005a31582b28791b7c9c67ab563a4af63473b4d194f237a9f82-221", "timestamp": "1675353059", "pool": { "inputTokens": [ { "symbol": "ATK", "__typename": "Token" }, { "symbol": "USDC", "__typename": "Token" } ], "outputToken": { "symbol": "tokenA/USD Coin", "__typename": "Token" }, "__typename": "LiquidityPool" }, "from": "0x837962b686fd5a407fb4e5f92e8be86a230484bd", "inputTokenAmounts": [ "500000000000000000", "500000" ], "outputTokenAmount": "499999999000", "to": "0x76fe189e4fa5ff997872ddf44023b04cd7cb03d2", "_walletAddress": "0x837962b686fd5a407fb4e5f92e8be86a230484bd", "__typename": "Deposit" } ], "withdraws": [] } } VesperfiIndexing the vaults data. query GetVaults { vaults { id name symbol inputToken { id name symbol decimals } outputToken { id name symbol decimals } rewardTokens { id token { id name symbol decimals } type } depositLimit fees { id feePercentage feeType } createdTimestamp createdBlockNumber totalValueLockedUSD cumulativeSupplySideRevenueUSD cumulativeProtocolSideRevenueUSD cumulativeTotalRevenueUSD inputTokenBalance outputTokenSupply outputTokenPriceUSD pricePerShare stakedOutputTokenAmount rewardTokenEmissionsAmount rewardTokenEmissionsUSD deposits { id hash logIndex to from blockNumber timestamp asset { id name symbol decimals } amount amountUSD } withdraws { id hash logIndex to from blockNumber timestamp asset { id name symbol decimals } amount amountUSD } } } Below are the dataset outputs.{ "data": { "vaults": [ { "id": "0x01e1d41c1159b745298724c5fd3eaff3da1c6efd", "name": "vaWBTC Pool", "symbol": "vaWBTC", "inputToken": { "id": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", "name": "Wrapped BTC", "symbol": "WBTC", "decimals": 8 }, "outputToken": { "id": "0x01e1d41c1159b745298724c5fd3eaff3da1c6efd", "name": "vaWBTC Pool", "symbol": "vaWBTC", "decimals": 18 }, "rewardTokens": [ { "id": "0x1b40183efb4dd766f11bda7a7c3ad8982e998421", "token": { "id": "0x1b40183efb4dd766f11bda7a7c3ad8982e998421", "name": "VesperToken", "symbol": "VSP", "decimals": 18 }, "type": "DEPOSIT" } ], "depositLimit": "0", "fees": [ { "id": "performance-fee-0x01e1d41c1159b745298724c5fd3eaff3da1c6efd", "feePercentage": "0", "feeType": "PERFORMANCE_FEE" } ..... Query the withdraw and deposit information from a specific address. query GetWalletActions($wallet: String) { withdraws(where: {from: $wallet}) { amount amountUSD blockNumber from hash id logIndex timestamp to } deposits(where: {from: $wallet}) { amount amountUSD blockNumber from hash id logIndex timestamp to } } TokemakIndexing the vaults data.query GetVaults { vaults { id name symbol inputToken { id name symbol decimals } outputToken { id name symbol decimals } rewardTokens { id token { id name symbol decimals } type } depositLimit fees { id feePercentage feeType } createdTimestamp createdBlockNumber totalValueLockedUSD inputTokenBalance outputTokenSupply outputTokenPriceUSD pricePerShare stakedOutputTokenAmount rewardTokenEmissionsAmount rewardTokenEmissionsUSD deposits { id hash logIndex to from blockNumber timestamp asset { id name symbol decimals } amount amountUSD } withdraws { id hash logIndex to from blockNumber timestamp asset { id name symbol decimals } amount amountUSD } } } Below are the dataset outputs."vaults": [ { "id": "0x03dcccd17cc36ee61f9004bcfd7a85f58b2d360d", "name": "TokemaktFEI", "symbol": "tFEI", "inputToken": { "id": "0x956f47f50a910163d8bf957cf5846d573e7f87ca", "name": "Fei USD", "symbol": "FEI", "decimals": 18 }, "outputToken": { "id": "0x03dcccd17cc36ee61f9004bcfd7a85f58b2d360d", "name": "TokemaktFEI", "symbol": "tFEI", "decimals": 18 }, "rewardTokens": [ { "id": "0x2e9d63788249371f1dfc918a52f8d799f4a38c94", "token": { "id": "0x2e9d63788249371f1dfc918a52f8d799f4a38c94", "name": "", "symbol": "", "decimals": 18 }, "type": "DEPOSIT" } ], "depositLimit": "0", "fees": [], "createdTimestamp": "1644421806", "createdBlockNumber": "14172800", "totalValueLockedUSD": "762.80706", "inputTokenBalance": "1140783329820937940379", "outputTokenSupply": "1140783329820937940379", "outputTokenPriceUSD": "669129000000000000", "pricePerShare": "1000000000000000000", "stakedOutputTokenAmount": null, "rewardTokenEmissionsAmount": null, "rewardTokenEmissionsUSD": null, "deposits": [ { "id": "deposit-0x06d22097be2493b0e82f55b9f079ef94bba21f9802c7dd8e060765663123ed1a", "hash": "0x06d22097be2493b0e82f55b9f079ef94bba21f9802c7dd8e060765663123ed1a", "logIndex": 105, "to": "0x03dcccd17cc36ee61f9004bcfd7a85f58b2d360d", "from": "0x72005e19120cf05eda67f44e3e1204d274c5529b", "blockNumber": "14528625", "timestamp": "1649197907", "asset": { "id": "0x956f47f50a910163d8bf957cf5846d573e7f87ca", "name": "Fei USD", "symbol": "FEI", "decimals": 18 }, "amount": "41175434606179035985446", "amountUSD": "46110.392794598805806373673992" }, { "id": "deposit-0x157506f481992d9b6f29258fb2ed497fbf13549a9cffc812774a9a819e031125", "hash": "0x157506f481992d9b6f29258fb2ed497fbf13549a9cffc812774a9a819e031125", "logIndex": 192, "to": "0x03dcccd17cc36ee61f9004bcfd7a85f58b2d360d", "from": "0x9c073ee3701a5cc639b4f12a3a6db50c2ac36aa0", "blockNumber": "14309547", "timestamp": "1646249803", "asset": { "id": "0x956f47f50a910163d8bf957cf5846d573e7f87ca", "name": "Fei USD", "symbol": "FEI", "decimals": 18 }, "amount": "1101207888839650000000", "amountUSD": "1100.39189379401981935" }, Query the withdraw and deposit information from a specific address. query GetWalletActions($wallets: [Bytes]!) { withdraws(where: {from_in: $wallets}) { amount amountUSD blockNumber from hash id logIndex timestamp to } deposits(where: {from_in: $wallets}) { amount amountUSD blockNumber from hash id logIndex timestamp to } } { "wallets": [ "target-wallect-address", "target-wallect-address1" ] } ConclusionWith these datasets, developers can access valuable data related to liquidity, trading, vaults, and wallet actions. This information allows developers to build decentralized applications, analyze protocol performance, and make data-driven decisions. The provided GraphQL queries and dataset outputs serve as starting points for accessing the data. More datasets mean more possibilities! We're excited to see how this growing collection of datasets will help unlock new innovations and drive the future of blockchain technology. Happy coding and exploring the possibilities with Chainbase Dataset!About ChainbaseChainbase is an all-in-one data infrastructure for Web3 that allows you to index, transform, and use on-chain data at scale. By leveraging enriched on-chain data and streaming computing technologies across one data infrastructure, Chainbase automates the indexing and querying of blockchain data, enabling developers to accomplish more with less effort. Want to learn more about Chainbase? Visit our website chainbase.com Sign up for a free account, and Check out our documentation. Website|Blog|Twitter|Discord|Link3 Original Link: How to Access and Utilize New DeFi Datasets with Chainbase as a Developer ## Publication Information - [Chainbase](https://paragraph.com/@chainbase-2/): Publication homepage - [All Posts](https://paragraph.com/@chainbase-2/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@chainbase-2): Subscribe to updates