# Table of Contents - [DefiLlama and our methodology | DefiLlama](#defillama-and-our-methodology-defillama) - [How to write an SDK adapter | DefiLlama](#how-to-write-an-sdk-adapter-defillama) - [How to list a DeFi project | DefiLlama](#how-to-list-a-defi-project-defillama) - [Staking and Pool2 | DefiLlama](#staking-and-pool2-defillama) - [Functions we've written so you don't have to | DefiLlama](#functions-we-ve-written-so-you-don-t-have-to-defillama) - [General EVM contract calls | DefiLlama](#general-evm-contract-calls-defillama) - [How to add a new Blockchain | DefiLlama](#how-to-add-a-new-blockchain-defillama) - [Fork helpers | DefiLlama](#fork-helpers-defillama) - [What to include as TVL? | DefiLlama](#what-to-include-as-tvl-defillama) - [How to update a project | DefiLlama](#how-to-update-a-project-defillama) - [Emission Sections | DefiLlama](#emission-sections-defillama) - [Protocol Files | DefiLlama](#protocol-files-defillama) - [Testing | DefiLlama](#testing-defillama) - [Emissions dashboard | DefiLlama](#emissions-dashboard-defillama) - [Oracles TVS | DefiLlama](#oracles-tvs-defillama) - [Overview | DefiLlama](#overview-defillama) - [How to write dimensions adapters | DefiLlama](#how-to-write-dimensions-adapters-defillama) - [Coin Prices API | DefiLlama](#coin-prices-api-defillama) - [Add a new RPC endpoint | DefiLlama](#add-a-new-rpc-endpoint-defillama) - [Pricing | DefiLlama](#pricing-defillama) - [How to change Ethereum's RPC | DefiLlama](#how-to-change-ethereum-s-rpc-defillama) - [Data Definitions | DefiLlama](#data-definitions-defillama) - [DAT Methodology | DefiLlama](#dat-methodology-defillama) - [Custom columns | DefiLlama](#custom-columns-defillama) - [Frequently Asked Questions | DefiLlama](#frequently-asked-questions-defillama) - [Function Reference | DefiLlama](#function-reference-defillama) - [DefiLlama and our methodology | DefiLlama](#defillama-and-our-methodology-defillama) - [Email Protection | Cloudflare](#email-protection-cloudflare) - [How to change Ethereum's RPC | DefiLlama](#how-to-change-ethereum-s-rpc-defillama) - [Overview | DefiLlama](#overview-defillama) - [Data Definitions | DefiLlama](#data-definitions-defillama) - [Frequently Asked Questions | DefiLlama](#frequently-asked-questions-defillama) --- # DefiLlama and our methodology | DefiLlama We pride ourselves in producing inclusive, non-biased, and community driven statistics for the decentralised finance industry. We do our best to treat all projects equally with regards to what is and isn't included in TVL, how long it takes to list or update a project's TVL, and everything else. ### [](https://docs.llama.fi/#our-methodology) Our Methodology At DefiLlama we consider the value of any tokens locked in the contracts of a protocol / platform as TVL. Below are some notes about how our calculations work. Valuing different tokens: * Almost all tokens are priced using CoinGecko's API. Where this can't be done, we can accommodate using on-chain methods to quantify the value of a token. This is most commonly done by comparing the pool weights of a very liquid Uniswap V2 market. * We don't count any tokens that are not circulating or are yet to be issued. For example if a team locks a share of their tokens in a vesting contract we won't count these as TVL, since these tokens haven't been issued yet. * We don't double-count within the same protocol. If users can deposit a token, get a receipt token and deposit that in another part of your protocol we'll only count it once. For example Cream has an ETH2 liquid staking token, which can be lent on their money market, we only count it once. Node validators and other chain-native token staking: * We don't count native token staking. For example, ATOM staking to secure the Cosmos hub isn't counted. Liquid staking protocols are tracked but not counted towards chain TVL by default. Bridges: * There are arguments both for including bridge TVL on the origin chain and the destination chain. Therefore we count the TVL of bridge projects but do not contribute them towards the TVL of any chain. Smart Wallets: * We don't count funds in smart contract wallets, such as Argent or Gnosis Safe. In the case of protocols that move money to different chains, TVL is counted on the chain where the users deposited the money and interacted with the protocol. [NextHow to list a DeFi project](https://docs.llama.fi/list-your-project/submit-a-project) Last updated 5 months ago Was this helpful? --- # How to write an SDK adapter | DefiLlama ### [](https://docs.llama.fi/list-your-project/how-to-write-an-sdk-adapter#adapters-101) Adapters 101 An adapter is just some code that takes in a UNIX timestamp and chain block heights, and returns the balances of assets locked in a protocol, including all the decimals (that is, the way it's stored on chain). Our SDK will convert all raw asset balances into their USD equivalent and sum to obtain total TVL, so you need minimal processing inside the adapter. ### [](https://docs.llama.fi/list-your-project/how-to-write-an-sdk-adapter#basic-adapter) Basic adapter Below, you can see the adapter we use for Mint Club on Binance Smart Chain (BSC). Let's walk through it to get a better understanding of how it works. projects/mint-club/index.js Copy const MINT_TOKEN_CONTRACT = '0x1f3Af095CDa17d63cad238358837321e95FC5915'; const MINT_CLUB_BOND_CONTRACT = '0x8BBac0C7583Cc146244a18863E708bFFbbF19975'; async function tvl(api) { const collateralBalance = await api.call({ abi: 'erc20:balanceOf', target: MINT_TOKEN_CONTRACT, params: [MINT_CLUB_BOND_CONTRACT], }); api.add(MINT_TOKEN_CONTRACT, collateralBalance) } module.exports = { methodology: 'counts the number of MINT tokens in the Club Bonding contract.', start: 1000235, bsc: { tvl, } }; The adapter consists of 3 main sections. First, any dependencies we want to use. Next, an async function containing the code for calculating TVL (where the bulk of the code usually is). Finally, the module exports. #### [](https://docs.llama.fi/list-your-project/how-to-write-an-sdk-adapter#line-4-input-parameter) Line 4 - Input Parameter: It is an injected `sdk.ChainApi` object with which you can interact with a given chain through `call/multiCall/batchCall` method based on your need, also stores tvl balances DefiLlama uses a wide variety of sources to price tokens, such as CoinGecko and chain calls to price exotic tokens such as Curve and uniswap LPs. If you find that a token is missing and it's not getting priced in your adapter, just let us know in our discord! #### [](https://docs.llama.fi/list-your-project/how-to-write-an-sdk-adapter#line-5-on-chain-function-calls) Line 5 - On Chain Function Calls Here we use the SDK to get the erc20 token balance of a contract, but this api.call() function can be used to call all sorts of contract functions. Parameters used: * abi - Because we have used a common erc20 function for Mint Club, we're able to use a string for the 'abi' parameter. However for other contract functions you will need to pass a [JSON ABI (or human-readable abi string)](https://www.quicknode.com/guides/solidity/what-is-an-abi) (can find these on etherscan). * target - The target address of the contract call. * params - Optional, must take the same amount of params expected by the on-chain contract function. #### [](https://docs.llama.fi/list-your-project/how-to-write-an-sdk-adapter#line-11-adding-data-to-the-balances-object) Line 11 - Adding Data To The Balances Object In the SDK we have utilities to add data to the balances dictionary. api.add() takes 2 parameters: 1. The token key you want to add to. We will transform the MINT token address so that we can fetch the CoinGecko price. 2. The balance we want to add. (NB: If we were using a CoinGecko ID in position 2, we'd need to divide collateralBalance by 10 \*\* to convert the raw balance to a real balance). Note: if you want to add balances of multiple tokens at the same time, you can do so by running `api.addTokens(tokens, balances)` [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/CthulhuFinance/index.js at 2cbe2f0c40848c3cf3d683dfb62d8a5077939ba4 · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/2cbe2f0c40848c3cf3d683dfb62d8a5077939ba4/projects/CthulhuFinance/index.js#L27) Example add tokens #### [](https://docs.llama.fi/list-your-project/how-to-write-an-sdk-adapter#line-23-module-exports) Line 23 - Module Exports The module exports must be constructed correctly, and use the correct keys, so that the DefiLlama UI can show your data. Nest chain TVL (and separate types of TVL like staking, pool2 etc) inside the chain key (eg 'bsc', 'ethereum'). Please also let us know: * timetravel (bool \[default: true\]) - if we can backfill data with your adapter. Most SDK adapters will allow this, but not all. For example, if you fetch a list of live contracts from an API before querying data on-chain, timetravel should be 'false'. * misrepresentedTokens (bool \[default: false\]) - if you have used token substitutions at any point in the adapter this should be 'true'. * methodology (string) - this is a small description that will explain to DefiLlama users how the adapter works out your protocol's TVL. * start (number - optional) - the earliest timestamp the adapter will work at. * hallmarks (array of \[number, string\]) - set of events that greatly affected protocol TVL and we display on the chart ([example](https://defillama.com/protocol/uniswap) ). ### [](https://docs.llama.fi/list-your-project/how-to-write-an-sdk-adapter#testing) Testing Once you are done writing it you can verify that it returns the correct value by running the following code: Copy $ npm install # if you want debug logs $ export LLAMA_DEBUG_MODE="true" # Replace with your adapter's name $ node test.js projects/mint-club/index.js If the adapter runs successfully, the console will show you a breakdown of your project's TVL in USD. If it all looks accurate, you're ready to submit. ### [](https://docs.llama.fi/list-your-project/how-to-write-an-sdk-adapter#submit) Submit 🎉 Just submit a PR to [the adapter repository on Github](https://github.com/DefiLlama/DefiLlama-Adapters) ! [PreviousHow to add a new Blockchain](https://docs.llama.fi/list-your-project/how-to-add-a-new-blockchain) [NextFunctions we've written so you don't have to](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to) Last updated 5 months ago Was this helpful? --- # How to list a DeFi project | DefiLlama The majority of adapters on DefiLlama are contributed and maintained by their respective communities, with all changes being coordinated through the [DefiLlama/DefiLlama-Adapters](https://github.com/DefiLlama/DefiLlama-Adapters) github repo. Do you want to list a project on our yields or stablecoin dashboard? Check the following guides then: * [Yields](https://github.com/DefiLlama/yield-server/blob/master/README.md) * [Stablecoin](https://github.com/DefiLlama/peggedassets-server/blob/master/README.md) * [Liquidations](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/liquidations/README.md) * [Volume and fees dashboards](https://docs.llama.fi/list-your-project/other-dashboards) If you'd like to list a DeFi project on DefiLlama: 1. Fork the [Adapters repo](https://github.com/DefiLlama/DefiLlama-Adapters) (button towards the top right of the repo page). 2. Add a new folder with the same name as the project to projects/. 3. Write an [SDK adapter](https://docs.llama.fi/list-your-project/how-to-write-an-sdk-adapter) in the new folder. 4. Make a Pull Request with the changes on your fork, to the main DefiLlama Adapters repo, with a brief explanation of what you changed. 5. Wait for someone to either comment on or merge your Pull Request. There is no need to ask for someone to check your PR as they are monitored regularly. 6. Once your PR has been merged, please give 24 hours for the front-end team to load your listing onto the UI. 7. If protocol is already listed and you want to add a new product/version, just make a new adapter and submit a PR. DefiLlama team will make the necessary changes afterwards (adding all protocols under a parent listing). [](https://docs.llama.fi/list-your-project/submit-a-project#how-to-build-an-adapter) How to build an adapter ----------------------------------------------------------------------------------------------------------------- And adapter is just some code that: 1. Collects data on a protocol by calling some endpoints or making some blockchain calls 2. Computes the TVL of a protocol and returns it ### [](https://docs.llama.fi/list-your-project/submit-a-project#next-steps) Next steps You probably need to write an SDK adapter, for which you could use the following guide: [How to write an SDK adapter](https://docs.llama.fi/list-your-project/how-to-write-an-sdk-adapter) [PreviousDefiLlama and our methodology](https://docs.llama.fi/) [NextHow to add a new Blockchain](https://docs.llama.fi/list-your-project/how-to-add-a-new-blockchain) Last updated 5 months ago Was this helpful? --- # Staking and Pool2 | DefiLlama The stakings and pool2 functions make it really simple to add any native token TVL. Copy const { stakings } = require("../helper/staking"); const { pool2s } = require("../helper/pool2"); [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/bitpif/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/bitpif/index.js) Example Stakings Adapter If your protocol token isn't on GitHub, you can estimate the USD value of the token using stakingPriceLP. This function will use uniV2 pool weights we determine the value of the staked tokens. (NB: there must be a Uni V2 pool with your coin in, which has significant liquidity. Otherwise the price oracle will be unreliable and vulnerable to manipulation.) Copy const { stakingPricedLP } = require("../helper/staking"); [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/corgiswap.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/corgiswap.js) Example Price From LP Adapter [PreviousFunctions we've written so you don't have to](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to) [NextFork helpers](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to/fork-helpers) Last updated 3 years ago Was this helpful? --- # Functions we've written so you don't have to | DefiLlama ### [](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to#exports-helpers) Exports Helpers Exporting empty TVL - if your project has filtered TVL only, here's an easy way to export core TVL as empty. Copy module.exports = { bsc: { tvl: () => ({}), staking } }; [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/arcx.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/arcx.js) Example adapter ### [](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to#token-balance-queries) Token balance queries if you have a known set of tokens and contract addresses, there are few ways to fetch and export it as tvl using `sumTokensExport` if single contract and multiple tokens Copy const { sumTokensExport } = require("./helper/unwrapLPs"); module.exports = { fantom: { tvl: sumTokensExport({ owner: '0x..., tokens: [ '0x...',... ], }), } }; if there are multiple contracts to look up: Copy const { sumTokensExport } = require("./helper/unwrapLPs"); module.exports = { fantom: { tvl: sumTokensExport({ owners: ['0x...', '0x...', ...], tokens: [ '0x...',... ], }), } }; if all contracts dont share same set of tokens: Copy const { sumTokensExport } = require("./helper/unwrapLPs"); module.exports = { fantom: { tvl: sumTokensExport({ tokensAndOwners: [\ // [tokenAddress, ownerContractAddress]\ ['0x...', '0x...'],\ ['0x...', '0x...'],\ ], }), } }; if any of these tokens are LP tokens, set `resolveLP: true` to resolve them into underlying tokens [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/velaro/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/velaro/index.js) Example adapter [https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/aevo/index.jsgithub.com](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/aevo/index.js) Example adapter ### [](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to#solana-helpers) Solana Helpers getTokenBalance is used for getting a solana account's balance of a particular token. Copy const { getTokenBalance } = require("../helper/solana"); [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/solend/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/solend/index.js) Example Solana Adapter ### [](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to#transforming-tokens-that-arent-on-coingecko) Transforming Tokens That Aren't On CoinGecko DefiLlama uses a wide variety of sources to price tokens, such as CoinGecko and chain calls to price exotic tokens such as Curve and uniswap LPs. If you find that a token is missing and it's not getting priced in your adapter, just let us know in our discord! To count the TVL of LP token balances, the positions must be unwrapped into their underlying tokens. Copy const { sumTokens2 } = require('../helper/unwrapLPs'); const balances = {}; ... return sumTokens2({ balances, tokensAndOwners: [...], api, resolveLP: true }) [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/drachma/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/drachma/index.js) Example Unwrap Uni V2 Adapter ### [](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to#getting-block-heights) Getting Block Heights For lesser known EVM chains sometimes the block height wont be available in the third parameter passed to the adapter's TVL function. In this case you can use getBlock to fetch the block height. Copy const { getBlock } = require('../helper/http'); block = await getBlock(timestamp, chain, chainBlocks); [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/atlendis/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/atlendis/index.js) Example Get Block Adapter [PreviousHow to write an SDK adapter](https://docs.llama.fi/list-your-project/how-to-write-an-sdk-adapter) [NextStaking and Pool2](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to/staking-and-pool2) Last updated 2 years ago Was this helpful? --- # General EVM contract calls | DefiLlama ### [](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to/general-evm-contract-calls#balance-calls) Balance Calls use `sumTokens2` method from helper to return token balances For example, you have a vault with USDC and ETH tokens in it in arbitrum Copy const { sumTokensExport, sumTokens } = require('./helper/unwrapLPs') const owner = '0x...' // vault address const tokens = [\ '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8', // USDC\ '0x0000000000000000000000000000000000000000', // ETH\ ] module.exports = { arbitrum: { tvl: sumTokensExport({ owner, tokens }) } } // or module.exports = { arbitrum: { tvl: async (api) => { return sumTokens2({ owner, tokens, api, }) } } } [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/twindex/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/twindex/index.js) Example ERC20 Token Balance Adapter ### [](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to/general-evm-contract-calls#custom-contract-calls) Custom Contract Calls Contract calls are the most common ways of recording TVL. Copy const response = await api.call({}) Often after a single contract call you'll also want to add the balance to your balances object, which can be easily done with sumSingleBalance. Copy await sdk.util.sumSingleBalance(balances, tokenAddress, balanceOfToken); [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/manarium/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/manarium/index.js) When you have lots of calls to functions with the same ABI, it's easier to use multiCall and sumMultiBalanceOf. Copy const tokensInacBTC = [\ '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',\ '0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D'\ ]; const acBTCTokenHolder = '0x73FddFb941c11d16C827169Bb94aCC227841C396'; const underlyingacBTC = await api.multiCall({ calls: tokensInacBTC.map(token => ({ target: token, params: [acBTCTokenHolder] })), abi: 'erc20:balanceOf', withMetadata: true, }); sdk.util.sumMultiBalanceOf(balances, underlyingacBTC); [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/acoconut/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/acoconut/index.js) Example MultiCall Adapter [PreviousFork helpers](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to/fork-helpers) [NextWhat to include as TVL?](https://docs.llama.fi/list-your-project/what-to-include-as-tvl) Last updated 1 year ago Was this helpful? --- # How to add a new Blockchain | DefiLlama For non-EVM chains just follow the same steps but instead of picking the shortName from chainlist, make one up that adjusts to your chain. #### [](https://docs.llama.fi/list-your-project/how-to-add-a-new-blockchain#id-1.-fork-the-defillama-adapters-repo) 1\. Fork the [DefiLlama-Adapters](https://github.com/DefiLlama/DefiLlama-Adapters) repo [https://github.com/DefiLlama/DefiLlama-Adapters](https://github.com/DefiLlama/DefiLlama-Adapters) #### [](https://docs.llama.fi/list-your-project/how-to-add-a-new-blockchain#id-2.-add-the-blockchain-to-chains.json) 2\. **Add the Blockchain to** `**chains.json**` You need to add the name of the blockchain in the `projects/helper/chains.json` file to recognize it as a new supported chain. **Example Change**: Copy "chains": [\ "ethereum",\ "binance-smart-chain",\ "polygon",\ "zklink", // Add your new blockchain here. \ "fraxtal",\ "zksync"\ ] You should use the field shortName from [https://chainlist.org/rpcs.json](https://chainlist.org/rpcs.json) * * * #### [](https://docs.llama.fi/list-your-project/how-to-add-a-new-blockchain#id-3.-add-token-mappings-in-tokenmapping.js) 3\. **Add Token Mappings in** `**tokenMapping.js**` Add the token mappings for the new blockchain to the [`projects/helper/tokenMapping.js` file](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/helper/tokenMapping.js#L41) . This file maps token addresses to their respective identifiers for accurate tracking and handling. **Example Change**: Copy const fixBalancesTokens = { zklink: { [ADDRESSES.zklink.WETH]: { coingeckoId: "ethereum", decimals: 18 }, }, ozone: { '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, }, }; This ensures tokens on the new blockchain (`zklink`) are properly recognized, including their `coingeckoId` for price tracking and their decimals. * * * #### [](https://docs.llama.fi/list-your-project/how-to-add-a-new-blockchain#id-4.-submit-a-protocol-using-your-blockchain-e.g.-projects-savmswap-index.js) 4\. Submit a Protocol **using your blockchain (e.g.,** projects/savmswap/index.js**)** Lastly, update the project’s configuration file to add your new blockchain as a valid supported chain. If we don't track any protocol on your blockchain, we can not add it. So make sure to add the new chain under a current project or add a new adapter to track the project on your blockchain **Example Change**: Copy const { uniTvlExport } = require('../helper/unknownTokens') module.exports = uniTvlExport('zklink', '0x1842c9bD09bCba88b58776c7995A9A9bD220A925') //blockchain, factory address 1. Submit a Pull Request [PreviousHow to list a DeFi project](https://docs.llama.fi/list-your-project/submit-a-project) [NextHow to write an SDK adapter](https://docs.llama.fi/list-your-project/how-to-write-an-sdk-adapter) Last updated 5 months ago Was this helpful? --- # Fork helpers | DefiLlama ### [](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to/fork-helpers#uniswap-v2) Uniswap V2 There are a few different helpers for Uni V2 forks but we recommend using `uniTvlExport`. Copy const { uniTvlExport } = require('../helper/unknownTokens') const chain = 'yourChain' const factory = '0x...' // v2 factory address module.exports = uniTvlExport(chain, factory) [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/kekswap/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/kekswap/index.js) Example Uni V2 Adapter ### [](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to/fork-helpers#uniswap-v3) Uniswap V3 There are a few different helpers for Uni V3 forks but we recommend using `uniTvlExport`. Copy const { uniV3Export } = require('../helper/uniswapV3') module.exports = uniV3Export({ chainX: { factory: '0x...', fromBlock: 'block when factory contract was deployed' }, chainY: { factory: '0x...', fromBlock: 'block when factory contract was deployed' }, }) [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/beamswap-v3/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/beamswap-v3/index.js) Example Uni V3 Adapter ### [](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to/fork-helpers#gmx) GMX Copy const { gmxExports } = require('../helper/gmx') module.exports = { bsc: { tvl: gmxExports({ vault: '0x...', }) } } [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/nex/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/nex/index.js) Example GMX Adapter ### [](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to/fork-helpers#aave) Aave Copy const { aaveExports } = require("../helper/aave") [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/klap/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/klap/index.js) Example Aave Fork Adapter ### [](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to/fork-helpers#compound) Compound Copy const { compoundExports2 } = require("../helper/compound"); module.exports = { polygon: compoundExports2({ comptroller: '0x...', cether: '0x...', // optional, needed if gas token is used }), }; [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/basilisk/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/basilisk/index.js) Example Compound Fork Adapter ### [](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to/fork-helpers#liquity) Liquity Copy const { getLiquityTvl } = require("../helper/liquity.js") module.exports = { chainX: { tvl: getLiquityTvl('0x...'), } } [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/liquidloans-io/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/liquidloans-io/index.js) Example Liquity Fork Adapter ### [](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to/fork-helpers#balancer-v2) Balancer V2 Copy const { onChainTvl } = require('../helper/balancer') module.exports = { metis: { tvl: onChainTvl('0x...', ), } } [![Logo](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fgithub.com%2Ffluidicon.png&width=20&dpr=4&quality=100&sign=c76ba632&sv=2)DefiLlama-Adapters/projects/hummus-weighted/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/hummus-weighted/index.js) Example Balancer V2 Fork Adapter [PreviousStaking and Pool2](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to/staking-and-pool2) [NextGeneral EVM contract calls](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to/general-evm-contract-calls) Last updated 1 year ago Was this helpful? --- # What to include as TVL? | DefiLlama ### [](https://docs.llama.fi/list-your-project/what-to-include-as-tvl#tvl) TVL Total value locked inside a platform / protocol's own contracts by users. ### [](https://docs.llama.fi/list-your-project/what-to-include-as-tvl#tvl-filters) TVL Filters We separate TVL into different types. This lets users decide what they do and do not want to include in the dashboard data. These types are: * Staking - the platform's own tokens * Pool2 - staked LP tokens where one side of the market is the platform's own governance token. * Borrows - deposits borrowed from the platform * Vesting - Tokens that are not circulating or not issued yet. This mostly applies to vesting protocols where a token with 10M mcap and 1B FDV could have 500M locked, in these cases it makes no sense for TVL from that token to be 500M when mcap of it is only 10M * Offers - funds that are approved for spending on a non-custodial platform, but not actually deposited into the platform contracts ### [](https://docs.llama.fi/list-your-project/what-to-include-as-tvl#not-tvl) Not TVL * Assets that aren't on the blockchain, such as bonds or fiat currency. We don't consider the dollars stored on Tether's bank account as TVL, for example. * We also don't accept assets that your protocol generates and are locked into other protocols, as that's the later protocols TVL, not your project's. See [this](https://github.com/DefiLlama/DefiLlama-Adapters/pull/60#issuecomment-807045050) for rationale. * We don't count native token staking. For example, ATOM staking to secure the Cosmos hub isn't counted. ### [](https://docs.llama.fi/list-your-project/what-to-include-as-tvl#edge-cases) Edge Cases * **Real-World Assets (RWA)**: At present, we only track the tokenization of real-world assets (RWAs), such as bonds, treasuries, and real estate. Only tokenized representations of these assets, issued and traded on the blockchain, are counted towards TVL. ### [](https://docs.llama.fi/list-your-project/what-to-include-as-tvl#unproductive-assets) Unproductive Assets We are improving the Total Value Locked (TVL) metric by removing unproductive or artificial liquidity. Some assets are deposited only to earn rewards or boost metrics without taking real market risk or providing value to users. These positions often come from a small number of large wallets and do not support actual liquidity for the ecosystem. In some cases, TVL may also be inflated through circular or non-backed assets, making the data misleading. Our goal is to ensure TVL reflects real economic activity and remains transparent for all users. While we are not placing blame on any team or chain, there may be instances where whales or large liquidity providers attempt to farm incentives without taking meaningful risks. We have also observed cases where unproductive assets are included in TVL through undisclosed arrangements or recycled liquidity. We understand that some projects may have adopted these practices to remain competitive or support growth during early stages. However, these positions can distort the perception of real usage and user participation. There are common cases to be considered: * Liquidity pools with a few providers and no trading activities. * Assets deposited into lending pools with a few lenders and no borrowers. * Assets deposited into yield/staking pools from a few depositors only to earn points or rewards. * Wrapper assets that lack verified or provable backing. * Assets without real user deposits or that can no longer be withdrawn by users. Our intention is not to call out or discredit any individual protocol. Instead, we want to give all teams and chains the opportunity to align with a more accurate and honest standard. By excluding these unproductive assets, we ensure that TVL remains a reliable and trustworthy metric. This supports meaningful liquidity, real user engagement, and a more representative measurement of value across DeFi. Our commitment is to provide the community with accurate data, improve transparency, and ensure fair representation for all participants in the ecosystem. [PreviousGeneral EVM contract calls](https://docs.llama.fi/list-your-project/functions-weve-written-so-you-dont-have-to/general-evm-contract-calls) [NextHow to update a project](https://docs.llama.fi/list-your-project/how-to-update-a-project) Last updated 15 days ago Was this helpful? --- # How to update a project | DefiLlama ### [](https://docs.llama.fi/list-your-project/how-to-update-a-project#update-tvl) Update TVL If you'd like to update the code used to calculate the TVL of a DeFi project already listed on DefiLlama: 1. Fork the [Adapters repo](https://github.com/DefiLlama/DefiLlama-Adapters) (button towards the top right of the repo page). 2. Make your changes to the fork (generally easiest by cloning your new fork into a desktop IDE). 3. Make a Pull Request from your fork, to the main DefiLlama Adapters repo, with a brief explanation of what you changed. 4. Wait for someone to either comment on or merge your Pull Request. There is no need to ask for someone to check your PR as they are monitored regularly. ### [](https://docs.llama.fi/list-your-project/how-to-update-a-project#events) Events If you'd like to update or add an **Event** to a DeFi project listed on DefiLlama: 1. Same as steps 1 & 2 above, fork the [Adapters repo](https://github.com/DefiLlama/DefiLlama-Adapters) (button towards the top right of the repo page) so that you can make your changes. 2. Add a "hallmarks" export to module.exports and add your hallmark as an array inside of an array (i.e. hallmarks: \[\["2025-05-29", "what happened"\]\]. You can add more by separating the inner arrays with a comma(","). View an example of hallmark entries [here](https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/uniswap/index.js#L57) . The dates must follow the YYYY-MM-DD standard. 3. Once you have added the Hallmarks make a Pull Request from your fork, to the main DefiLlama Adapters repo, with a brief explanation of what you changed. 4. Hallmarks is not for adding any product development but instead its meant to explain changes in TVL. Only add events that had an impact on the TVL of a project. 5. Wait for someone to either comment on or merge your Pull Request. There is no need to ask for someone to check your PR. ### [](https://docs.llama.fi/list-your-project/how-to-update-a-project#update-metadata-name-description) Update metadata (name, description...) If you'd like to update the metadata (name, description, adding an audit, etc) of a project already listed on DefiLlama: 1. This information can be updated from the [data.ts](https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data.ts) , [data2.ts](https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data2.ts) , data3.ts and data4.ts files. 2. Fork the [defillama-server repo](https://github.com/DefiLlama/defillama-server) (button towards the top right of the repo page). 3. Find your protocol and make your changes to the fork (generally easiest by cloning your new fork into a desktop IDE). 4. Make a Pull Request from your fork, to the main defiLlama-server repo, with a brief explanation of what you changed. 5. Wait for someone to either comment on or merge your Pull Request. ### [](https://docs.llama.fi/list-your-project/how-to-update-a-project#update-logo) Update logo To update the logo: 1. Fork the [icons repo](https://github.com/DefiLlama/icons) (button towards the top right of the repo page). 2. Add your icon to the public [icons](https://github.com/DefiLlama/defillama-app/tree/main/public/icons) file as a 240px x 240px .jpg \*\*Please save the file under the very same name as the protocol. 3. Make a Pull Request from your fork 4. Wait for someone to either comment on or merge your Pull Request. [PreviousWhat to include as TVL?](https://docs.llama.fi/list-your-project/what-to-include-as-tvl) [NextHow to write dimensions adapters](https://docs.llama.fi/list-your-project/other-dashboards) Last updated 5 months ago Was this helpful? --- # Emission Sections | DefiLlama [](https://docs.llama.fi/list-your-project/emissions-dashboard/emission-sections#manual-entry-functions) Manual Entry Functions ------------------------------------------------------------------------------------------------------------------------------------ 90% of the time you'll only need the `manual...` functions (imported on line 1). There are 4 of them: * manualStep( start: unixTimestamp OR date string <- time of the first vest stepDuration: unixTimestamp OR date string <- time period between vests number: number <- number of discreet unlocks in the vesting schedule amount: number <- number of coins emitted **in each** discreet unlock dateFormat: string, optional <- if date strings are used, the format can be specified here. Default is "YYYY/MM/DD" ) * manualCliff( start: unixTimestamp OR date string <- timestamp of the cliff amount: number <- number of coins emitted in the cliff dateFormat: string, optional <- if date strings are used, the format can be specified here. Default is "YYYY/MM/DD" ) * manualLinear( start: unixTimestamp OR date string<- start of the linear vesting period end: unixTimestamp OR date string <- end of the linear vesting period amount: number <- number of coins emitted over the period dateFormat: string, optional <- if date strings are used, the format can be specified here. Default is "YYYY/MM/DD" ) * manualLog( start: unixTimestamp OR date string<- start of the linear vesting period end: unixTimestamp OR date string <- end of the linear vesting period amount: number <- number of coins emitted over the period periodLength: number <- the length in time between each change in rate percentDecreasePerPeriod: number <- the regular decrease in emission rate dateFormat: string, optional <- if date strings are used, the format can be specified here. Default is "YYYY/MM/DD" ) [](https://docs.llama.fi/list-your-project/emissions-dashboard/emission-sections#more-complex-emission-shapes) More Complex Emission Shapes ------------------------------------------------------------------------------------------------------------------------------------------------ Sometimes you might need to make more advanced shapes, for example, if the rate of emissions decrease over time. In this example, We created a rewards() function which makes a complex shape out of smaller linear sections (line 9, used on line 33). NB this particular shape could've been done with the manualLog() function. Emissions sections should return real quantities of tokens. Not percentages, and accounting for any token decimals. [](https://docs.llama.fi/list-your-project/emissions-dashboard/emission-sections#on-chain-data) On Chain Data ------------------------------------------------------------------------------------------------------------------ Some protocol files use on-chain data (Aave, Tornado etc). Where possible we like to use on chain data. The time sensitive nature of emissions schedules can make on-chain data more difficult to research and write. If you think using on-chain data is a better option for you, contact us through Discord and we can help out. [PreviousProtocol Files](https://docs.llama.fi/list-your-project/emissions-dashboard/protocol-files) [NextTesting](https://docs.llama.fi/list-your-project/emissions-dashboard/testing) Last updated 2 years ago Was this helpful? --- # Protocol Files | DefiLlama Protocol files each export a `Protocol` object (line 55) which contains these properties: * Each distinct section of token allocation, function | function\[\], required: These sections can take on whatever keys are required. These keys will be used to label the chart on our UI, so please make them readable and nice to look at. The value for each chart section key will usually either be a `manual....()` or `manual....()[]` (more info [on the next page](https://docs.llama.fi/list-your-project/emissions-dashboard/emission-sections) ). For example, the Liquity adapter has: * Stability Pool rewards * Uniswap LPs * Endowment * Team and advisors * Service providers * Investors. * notes, string\[\], optional: Anything you think DefiLlama users should know about the emissions data. Maybe you made an assumption somewhere, or have excluded certain allocations because they were impossible to quantify. * token, string, required: The token address, preferably on the chain it was first deployed. * sources, string\[\], required: Links to wherever you got the data. Official protocol docs are preferred, but discord servers etc can also be used if needed. * ProtocolIds, string\[\], required: Please leave this as an empty array (`[]`) and the DefiLlama team will complete this for you. [PreviousEmissions dashboard](https://docs.llama.fi/list-your-project/emissions-dashboard) [NextEmission Sections](https://docs.llama.fi/list-your-project/emissions-dashboard/emission-sections) Last updated 2 years ago Was this helpful? --- # Testing | DefiLlama Once you're ready to debug your protocol file, add it to `protocols/index.ts` (preferably in alphabetical order). Run `ts-node utils/test.ts [name of your protocol]` and it should save a `result.png` where you can see the result of your protocol file. Check that the values make sense and it looks like what you expected. Thanks for reading this guide. If you have any further questions, don't hesitate to reach out on our Discord. We are all very responsive and happy to help. We always appreciate feedback on our developer experience. If anything seems unintuitive or complicated, let us know and we'll do our best to improve our processes. ![](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2F2397802182-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MVnGnXr5_eAilN_e5PP%252Fuploads%252Fgit-blob-1edc217db599635fda31bf7041c28df9ba042d2b%252Fpatagonia%2520Aug%2520%2722.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=329f94e0&sv=2) Bentura and Shaman, Patagonia, August 2021 [PreviousEmission Sections](https://docs.llama.fi/list-your-project/emissions-dashboard/emission-sections) [NextOracles TVS](https://docs.llama.fi/list-your-project/oracles-tvs) Last updated 2 years ago Was this helpful? --- # Emissions dashboard | DefiLlama [](https://docs.llama.fi/list-your-project/emissions-dashboard#example) **Example** ---------------------------------------------------------------------------------------- Throughout the pages in this guide we will refer to the [Liquity emissions adapter](https://github.com/DefiLlama/emissions-adapters/blob/master/protocols/liquity.ts) . [](https://docs.llama.fi/list-your-project/emissions-dashboard#format) **Format** -------------------------------------------------------------------------------------- Once a day we run all of the protocol files in the emissions adapters repo (listed in `protocols/index.ts` ). Protocol files give us a schedule and metadata for a specified token. When adding a new emissions schedule to DefiLlama, it's vital to test your code before you submit it. If your code doesn't produce an expected result it won't be accepted, so please read the [Testing section](https://docs.llama.fi/list-your-project/emissions-dashboard/testing) . [](https://docs.llama.fi/list-your-project/emissions-dashboard#how-to-contribute-your-code) How To Contribute Your Code ---------------------------------------------------------------------------------------------------------------------------- Just like for TVL adapters, if you'd like to add an emissions schedule to DefiLlama: 1. Fork the [emissions-adapters repo](https://github.com/DefiLlama/emissions-adapters) (button towards the top right of the repo page). 2. Add a new [protocol file](https://docs.llama.fi/list-your-project/emissions-dashboard/protocol-files) to protocols/ . 3. Make a Pull Request with the changes on your fork, to the main DefiLlama emissions-adapters repo, with a brief explanation of what you changed. 4. Wait for someone to either comment on or merge your Pull Request. There is no need to ask for someone to check your PR as they are monitored regularly. 5. Once your PR has been merged, **please give 24 hours** for the team to load your listing onto the UI. ![](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2Fcdn.discordapp.com%2Femojis%2F1011049613186318376.webp%3Fsize%3D48%26quality%3Dlossless&width=768&dpr=4&quality=100&sign=42546ea7&sv=2) prayge [PreviousHow to write dimensions adapters](https://docs.llama.fi/list-your-project/other-dashboards) [NextProtocol Files](https://docs.llama.fi/list-your-project/emissions-dashboard/protocol-files) Last updated 5 months ago Was this helpful? * [Example](https://docs.llama.fi/list-your-project/emissions-dashboard#example) * [Format](https://docs.llama.fi/list-your-project/emissions-dashboard#format) * [How To Contribute Your Code](https://docs.llama.fi/list-your-project/emissions-dashboard#how-to-contribute-your-code) Was this helpful? --- # Oracles TVS | DefiLlama **Total Value Secured (TVS)** is a metric used to calculate the value secured by each oracle. It estimates the potential financial loss in case an oracle malfunctions or reports incorrect data. The TVS for an oracle is determined by summing the Total Value Locked (TVL) of all protocols dependent on that oracle, which would be susceptible to loss if the oracle fails. [](https://docs.llama.fi/list-your-project/oracles-tvs#methodology) Methodology ------------------------------------------------------------------------------------ * **Primary Calculation**: * TVS is calculated by aggregating the TVL of all protocols that rely on a specific oracle. * If an oracle failure would result in loss of funds in a protocol, that protocol's TVL is added to the oracle's TVS. * **Edge Cases**: * **Protocols Using Multiple Oracles**: * If the failure of any oracle used by a protocol could cause a total TVL loss, the full protocol TVL is added to the TVS of all involved oracles. * Example: Euler uses Chainlink and Uniswap v3 TWAPs for pricing different assets. A failure in either oracle could lead to the protocol being drained. Thus, Euler's TVL is included in the TVS of both Chainlink and Uniswap TWAPs. * **Different Oracles for Different Chains**: * TVL on each chain is attributed to the oracle used on that chain. * Example: If a protocol uses Chainlink on Ethereum and Switchboard on Solana, Ethereum's TVL counts towards Chainlink, and Solana's TVL counts towards Switchboard. * **Partial Oracle Usage**: * If an oracle secures only a small portion of a protocol (e.g., 5% of TVL), and a hack of the oracle won't lead to >50% TVL loss, that oracle is not counted. * These cases are rare and generally negligible (<0.1% effect on TVS numbers). * **Failover Mechanisms**: * For protocols with failover oracles, the primary question remains: _If the failover oracle malfunctioned, would assets be lost?_ * If assets are unaffected by the failover oracle's failure, its TVS is not impacted. Loss occurs only if both the primary and failover oracles fail simultaneously. * **Exclusions**: * **Centralized Exchanges (CEXs)**: * Oracles used in CEXs, such as index price feeds for perpetuals, are excluded from TVS due to: 1. Aggregation with multiple data sources (e.g., spot prices from other CEXs). 2. Fail-safes in place (e.g., withdrawal rate limits, rollback of positions in case of manipulation). [](https://docs.llama.fi/list-your-project/oracles-tvs#oracle-to-blockchain-assignment) Oracle to Blockchain Assignment ---------------------------------------------------------------------------------------------------------------------------- ### [](https://docs.llama.fi/list-your-project/oracles-tvs#explanation-of-oraclesbreakdown) Explanation of oraclesBreakdown Use the `oraclesBreakdown` field to declare how your protocol uses oracles. ⚠️ **Do not use** `**oracles**` **or** `**oraclesByChain**` **— they are deprecated.** Add the `oraclesBreakdown` field to your protocol entry in `data.ts`, `data1.ts`, `data2.ts`, `data3.ts` or `data4.ts` in the DefiLlama Server repo. **Example:** **Supported type values:** * **"Primary"**: Main oracle that secures >50% of TVL. If compromised, a majority of funds would be at risk. * **"Secondary"**: Actively used oracle that secures <50% of TVL. * **"Fallback"**: Not used under normal conditions; used only if primary/secondary fails. * **"Aggregator"**: Used alongside other oracles in a combined feed (e.g., median across 3 sources). Failure alone does not cause TVL loss. * **"RNG"**: Used for randomness only (e.g., in games or lottery apps). No TVL is at risk. * **"Reference"**: Used for price display or off-chain quoting. Not directly used for critical protocol operations that would result in TVL loss if the oracle fails. **Required fields:** * `name`: Name of the oracle provider (e.g., Chainlink, Pyth). * `type`: Oracle classification as defined above. * `proof`: At least one link (docs, code, or audit) showing the oracle integration. **Optional fields:** * `startDate` / `endDate`: Use these to indicate the active period (format: YYYY-MM-DD). If `startDate` is not provided, we assume the oracle has been active since the protocol's launch. * `chains`: List of chain slugs from [`normalizeChain.ts`](https://github.com/DefiLlama/defillama-server/blob/master/defi/src/utils/normalizeChain.ts) , with optional start/end dates per chain. If `chains` is not specified, we assume the oracle is used on **all chains** where the protocol is live. This structured format ensures accurate attribution of TVL to oracles based on actual usage and risk exposure. [](https://docs.llama.fi/list-your-project/oracles-tvs#how-to-add-a-new-oracle-to-defillama) How to Add a New Oracle to DefiLlama -------------------------------------------------------------------------------------------------------------------------------------- To add a new oracle to DefiLlama, follow these steps: #### [](https://docs.llama.fi/list-your-project/oracles-tvs#id-1.-identify-a-protocol-using-the-oracle) 1\. **Identify a Protocol Using the Oracle** * Find a protocol that uses the oracle and is tracked by DefiLlama. If it's not yet tracked, let us know on Discord. #### [](https://docs.llama.fi/list-your-project/oracles-tvs#id-2.-edit-the-appropriate-file) 2\. **Edit the Appropriate File** * Locate the appropriate `data.ts`, `data1.ts`, `data2.ts`, `data3.ts` or `data4.ts` file in the [DefiLlama Server repository](https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/) . * Add or update the protocol entry using the `oraclesBreakdown` format. #### [](https://docs.llama.fi/list-your-project/oracles-tvs#id-3.-include-the-following-in-your-pull-request) 3\. **Include the Following in Your Pull Request** When submitting your changes, include answers to the following questions in your pull request description: * **Oracle Provider(s)**: Specify the oracle(s) used (e.g., Chainlink, Band, API3, TWAP, etc.). * **Implementation Details**: Briefly describe how the oracle is integrated into your project. * **Documentation/Proof**: Provide links to documentation or other resources that verify the oracle's usage. * **Failure Scenario & Loss Quantification** _(for non-price oracles)_: Describe a realistic scenario in which your oracle provides incorrect, stale, or manipulated non-price data. How would such a malfunction lead to on-chain asset loss or protocol malfunction, and what is the estimated TVL at risk under that scenario? #### [](https://docs.llama.fi/list-your-project/oracles-tvs#id-4.-submit-a-pull-request) 4\. **Submit a Pull Request** * Open a PR in the [DefiLlama GitHub repository](https://github.com/DefiLlama/defillama-server/) . * Clearly describe the protocol(s) updated and the oracle usage. * Include all necessary references and documentation. [PreviousTesting](https://docs.llama.fi/list-your-project/emissions-dashboard/testing) [NextOverview](https://docs.llama.fi/spreadsheet-functions/spreadsheet-functions) Last updated 3 months ago Was this helpful? * [Methodology](https://docs.llama.fi/list-your-project/oracles-tvs#methodology) * [Oracle to Blockchain Assignment](https://docs.llama.fi/list-your-project/oracles-tvs#oracle-to-blockchain-assignment) * [Explanation of oraclesBreakdown](https://docs.llama.fi/list-your-project/oracles-tvs#explanation-of-oraclesbreakdown) * [How to Add a New Oracle to DefiLlama](https://docs.llama.fi/list-your-project/oracles-tvs#how-to-add-a-new-oracle-to-defillama) Was this helpful? Copy oraclesBreakdown: [\ {\ name: "Chainlink",\ type: "Primary",\ proof: ["https://docs.yourprotocol.com/oracles"],\ startDate: "2023-01-01",\ chains: [\ { chain: "ethereum" },\ { chain: "polygon", startDate: "2023-03-01" },\ ]\ },\ {\ name: "RedStone",\ type: "Fallback",\ proof: ["https://github.com/yourprotocol/contracts/blob/main/RedstoneOracle.sol"]\ },\ {\ name: "AnotherOracle",\ type: "RNG",\ proof: ["https://docs.yourprotocol.com/randomness"]\ }\ ] --- # Overview | DefiLlama [](https://docs.llama.fi/spreadsheet-functions/spreadsheet-functions#google-sheets) Google Sheets ------------------------------------------------------------------------------------------------------ ### [](https://docs.llama.fi/spreadsheet-functions/spreadsheet-functions#installation) Installation Open the listing on [Google Workspace Marketplace](https://workspace.google.com/marketplace/app/defillama_sheets/571407189628) to install the add-on. ### [](https://docs.llama.fi/spreadsheet-functions/spreadsheet-functions#setup) Setup 1. **Extensions** → **DefiLlama** → **Open Sidebar** 2. Click **Sign In** 3. Authorize with your defillama account ### [](https://docs.llama.fi/spreadsheet-functions/spreadsheet-functions#test) Test Copy =DEFILLAMA("price", "Bitcoin") * * * [](https://docs.llama.fi/spreadsheet-functions/spreadsheet-functions#quick-examples) Quick Examples -------------------------------------------------------------------------------------------------------- Copy // Current data =DEFILLAMA("tvl", "Ethereum") =DEFILLAMA("fees", "Uniswap", "24h") =DEFILLAMA("price", "Bitcoin") // Historical =DEFILLAMA_HISTORICAL("tvl", "Aave", "2024-01-01") // Yields =DEFILLAMA_YIELD("Arbitrum", "USDC", "apy", 10) =DEFILLAMA_YIELD_TOP_POOLS(20) // Stablecoins =DEFILLAMA_STABLECOIN_MCAP() // Total market cap =DEFILLAMA_STABLECOIN_MCAP("USDC", "Ethereum") [](https://docs.llama.fi/spreadsheet-functions/spreadsheet-functions#next-steps) Next Steps ------------------------------------------------------------------------------------------------ * [Function Reference](https://docs.llama.fi/spreadsheet-functions/function-reference) - Complete parameter documentation [PreviousOracles TVS](https://docs.llama.fi/list-your-project/oracles-tvs) [NextFunction Reference](https://docs.llama.fi/spreadsheet-functions/function-reference) Last updated 21 days ago Was this helpful? * [Google Sheets](https://docs.llama.fi/spreadsheet-functions/spreadsheet-functions#google-sheets) * [Installation](https://docs.llama.fi/spreadsheet-functions/spreadsheet-functions#installation) * [Setup](https://docs.llama.fi/spreadsheet-functions/spreadsheet-functions#setup) * [Test](https://docs.llama.fi/spreadsheet-functions/spreadsheet-functions#test) * [Quick Examples](https://docs.llama.fi/spreadsheet-functions/spreadsheet-functions#quick-examples) * [Next Steps](https://docs.llama.fi/spreadsheet-functions/spreadsheet-functions#next-steps) Was this helpful? --- # How to write dimensions adapters | DefiLlama This guide will help you create adapters for DefiLlama's various dashboards, including [fees](https://defillama.com/fees) , [volumes](https://defillama.com/dexs) , [aggregators](https://defillama.com/aggregators) , [derivatives](https://defillama.com/derivatives) , [Bridge Aggregators](https://defillama.com/bridge-aggregators) , [Options](https://defillama.com/options) , and others. [](https://docs.llama.fi/list-your-project/other-dashboards#what-is-an-adapter) What is an Adapter? -------------------------------------------------------------------------------------------------------- An adapter is some code that: 1. Collects data on a protocol by calling some endpoints or making blockchain calls 2. Computes a response and returns it It's a TypeScript file that exports an async function which takes a FetchOptions object containing: * startTimestamp: Unix timestamp for start of period * endTimestamp: Unix timestamp for end of period * startBlock: Block number corresponding to start timestamp * endBlock: Block number corresponding to end timestamp * createBalances: Helper function to track token balances * api: Helper for making contract calls * getLogs: Helper for fetching event logs The function returns an object with metrics (like fees, volume, etc.) for that time range. [](https://docs.llama.fi/list-your-project/other-dashboards#introduction-to-dimension-adapters) Introduction to Dimension Adapters --------------------------------------------------------------------------------------------------------------------------------------- DefiLlama's dashboards track various metrics (dimensions) for DeFi protocols. Each dashboard focuses on specific dimensions: * **Dexs dashboard**: Tracks trading volume from DEXs (spot/swaps) * **Fees dashboard**: Tracks fees and revenue from all types of protocols * **Aggregators dashboard**: Tracks volume from DEX aggregators * **Derivatives dashboard**: Tracks volume from derivatives protocols * **Aggregator-Derivatives dashboard**: Tracks volume from aggregator-derivatives protocols * **Bridge Aggregators dashboard**: Tracks volume from bridge aggregators * **Options dashboard**: Tracks notional and premium volume from options DEXs [](https://docs.llama.fi/list-your-project/other-dashboards#how-to-list-your-project) How to List Your Project ------------------------------------------------------------------------------------------------------------------- The majority of adapters for DefiLlama dashboards are contributed and maintained by their respective communities, with all changes being coordinated through the [`DefiLlama/dimension-adapters` GitHub repo](https://github.com/DefiLlama/dimension-adapters) . To add your protocol to any dashboard, follow these steps: 1. Fork the [`dimension-adapters`](https://github.com/DefiLlama/dimension-adapters) repository 2. Create a new file at `[dashboard]/yourProtocolName/index.ts` or `[dashboard]/yourProtocolName.ts` (where `[dashboard]` is the relevant folder like `fees`, `dexs`, `aggregators`, `aggregator-derivatives`, `bridge-aggregators`, `options`, etc.) 3. Implement your adapter following the guidelines in this document 4. Test your adapter using `npm test [dashboard] yourProtocolName` 5. Submit a PR! A llama will review it and merge it. Once merged, it can take up to 24h to be available in the dashboard Seeing issues getting logs or with calls at historical blocks? You can replace the RPC being used by creating a .env file and filling it with rows like this: ETHEREUM\_RPC="https://..." BSC\_RPC="https://..." POLYGON\_RPC="https://..." ... [](https://docs.llama.fi/list-your-project/other-dashboards#basic-example) Basic Example --------------------------------------------------------------------------------------------- Let's start with a simple, complete example of a fees adapter: ### [](https://docs.llama.fi/list-your-project/other-dashboards#adapter-structure) Adapter Structure The object exported by your adapter file defines its behavior. The main configuration object holds a `version` key and supports two different structures: **Recommended Structure**: For protocols with the same fetch logic across all chains, you can use the simplified structure with `fetch`, `chains`, `start`, and `methodology` at the root level. ### [](https://docs.llama.fi/list-your-project/other-dashboards#simpleadapter-properties) SimpleAdapter Properties * **fetch**: The core async function that returns different dimensions of a protocol. The dimensions returned depend on which dashboard you're targeting (e.g., `dailyVolume` for the dexs dashboard, `dailyFees` for the fees dashboard). See "Core Dimensions" below. * **chains**: Array of chain constants (e.g., `[CHAIN.ETHEREUM, CHAIN.POLYGON]`) indicating which chains this adapter supports. * **start**: The earliest timestamp (as YYYY-MM-DD or unix timestamp) we can pass to the fetch function. This tells our servers how far back we can get historical data. * **methodology**: (Optional) Object describing how different dimensions are calculated. See "Metadata and Methodology" below. * **runAtCurrTime**: (Optional, defaults to `false`) Boolean flag. Set to `true` if the adapter can only return the latest data (e.g., last 24h) and cannot reliably use the `startTimestamp` and `endTimestamp` passed to `fetch`. #### [](https://docs.llama.fi/list-your-project/other-dashboards#example-of-multi-chain-root-level-structure) Example of Multi-chain Root-level Structure [](https://docs.llama.fi/list-your-project/other-dashboards#testing-your-adapter) Testing Your Adapter ----------------------------------------------------------------------------------------------------------- Test your adapter locally before submitting a PR: To test at specific day (unix format or yyyy-mm-dd): This checks if your adapter correctly returns data for the requested time period. ### [](https://docs.llama.fi/list-your-project/other-dashboards#adapter-version) Adapter Version The top-level `version` key specifies the adapter version: * **Version 2 (Recommended)**: `version: 2`. These adapters accept arbitrary start and end timestamps as input to `fetch`, allowing for flexible time ranges. * **Version 1**: `version: 1`. Use this only if your `fetch` function can run for fixed time periods only (00:00 to 23:59 of a given day), typically because the underlying data source only provides daily data. ### [](https://docs.llama.fi/list-your-project/other-dashboards#core-dimensions) Core Dimensions Your `fetch` function should return an object containing properties corresponding to the metrics (dimensions) relevant to the dashboard you are targeting. All dimensions should be returned as balance objects (`Object`) where keys are the token identifiers (e.g., `ethereum:0x...`) and values are the raw amounts (no decimal adjustments). > **Minimum Requirements:** To be listed, your adapter **must** provide accurate `dailyFees` and `dailyRevenue` dimensions. Other daily dimensions like `dailyHoldersRevenue` are highly encouraged for better insights but are secondary. Cumulative `total*` dimensions are deprecated and should not be used. Here are the standard dimensions grouped by dashboard type: **Dexs and Dex Aggregators Dimensions:** * `dailyVolume`: (**Required**) Trading volume for the period. **Derivatives and Aggregators-Derivatives Dimensions:** * `dailyVolume`: (**Required**) Perpetual trading volume for the period. * `openInterestAtEnd`: (Optional) Open interest at the end of the period. * `longOpenInterestAtEnd`: (Optional) Long open interest at the end of the period. * `shortOpenInterestAtEnd`: (Optional) Short open interest at the end of the period. **Bridge Aggregators Dimensions:** * `dailyBridgeVolume`: (**Required**) Bridge volume for the period. **Options Dimensions:** * `dailyNotionalVolume`: (**Required**) Notional volume of options contracts traded/settled. * `dailyPremiumVolume`: (**Required**) Premium volume collected/paid. * `openInterestAtEnd`: (Optional) Open interest at the end of the period. * `longOpenInterestAtEnd`: (Optional) Long open interest at the end of the period. * `shortOpenInterestAtEnd`: (Optional) Short open interest at the end of the period. **Fees Dimensions:** * `dailyFees`: (**Required**) All fees and value collected from _all_ sources (users, LPs, yield generation, liquid staking rewards, etc.), excluding direct transaction/gas costs paid by users to the network. This represents the total value flow into the protocol's ecosystem due to its operation. * `dailyUserFees`: (Optional, but helpful) The portion of `dailyFees` directly paid by end-users (e.g., swap fees, borrow interest, liquidation penalties, marketplace commissions paid by buyers/sellers). * `dailyRevenue`: (**Required**) The portion of `dailyFees` kept by the protocol entity itself, distributed either to the treasury (`dailyProtocolRevenue`) or governance token holders (`dailyHoldersRevenue`). * `dailyRevenue = dailyProtocolRevenue + dailyHoldersRevenue` * `dailyProtocolRevenue`: (Optional, clarifies revenue split) The portion of `dailyRevenue` allocated to the protocol's treasury or core team. * `dailyHoldersRevenue`: (Optional, but important for protocols distributing to holders) The portion of `dailyRevenue` distributed to governance token holders (e.g., via staking rewards, buybacks, burns). * `dailySupplySideRevenue`: (Optional, but helpful) The portion of `dailyFees` distributed to liquidity providers, lenders, or other suppliers of capital/resources essential to the protocol's function. * `dailyBribeRevenue`: (Optional, specific use case) Governance token paid as bribe/incentive for token holder action. * `dailyTokenTax`: (Optional, specific use case) Fees generated from a tax applied to token transfers. **Fee/Revenue Attribution Examples by Protocol Type:** If you are unsure how to classify fees and revenues, refer to this table or contact us at [\[email protected\]](https://docs.llama.fi/cdn-cgi/l/email-protection) or ask on Discord: ![](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2F2397802182-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MVnGnXr5_eAilN_e5PP%252Fuploads%252Fgit-blob-6a74c9bfc5226afb0906fbc2f5ccbeb5dd3d8a60%252Fimage.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=d20161e3&sv=2) Attribute DEXs Lending Chains NFT Marketplace Derivatives CDP Liquid Staking Yield Synthetics UserFees Swap fees paid by users Interest paid by borrowers Gas fees paid by users Fees paid by users Fees paid by users Interest paid by borrowers % of rewards paid to protocol Paid management + performance fees Fees paid by users Fees \=UserFees \=UserFees \=UserFees \=UserFees UserFees + burn/mint fees \=UserFees Staking rewards Yield \=UserFees Revenue % of swap fees going to protocol governance % of interest going to protocol governance Burned coins (fees-sequencerCosts for rollups) Marketplace revenue + creator earnings Protocol governance revenue \=ProtocolRevenue \=ProtocolRevenue \=ProtocolRevenue \=ProtocolRevenue ProtocolRevenue % of swap fees going to treasury % of interest going to protocol \* Marketplace revenue Value going to treasury Interest going to treasury \=UserFees \=UserFees % of fees going to treasury HoldersRevenue Money going to gov token holders \* \* \* Value going to gov token holders \* \* \* % of fees going to token holders SupplySideRevenue LPs revenue Interest paid to lenders \* \* LP revenue \* Revenue earned by stETH holders Yield excluding protocol fees LPs revenue > **Notes:** > > * Protocol governance includes treasury + gov token holders. > > * `Revenue = HoldersRevenue + ProtocolRevenue`. > > * Asterisk (\*) indicates typically not applicable or zero for that category. > [](https://docs.llama.fi/list-your-project/other-dashboards#implementation-steps) Implementation Steps ----------------------------------------------------------------------------------------------------------- Building the `fetch` function is the core task. Here's a breakdown: 1. **Identify Supported Chains**: Determine which blockchains your protocol runs on by referencing the [chains.ts](https://github.com/DefiLlama/dimension-adapters/blob/master/helpers/chains.ts) file. For the recommended root-level structure, add these to the `chains` array. For chain-specific configurations, you'll need a `BaseAdapter` entry for each chain. 2. **Define Start Dates**: Find your protocol's deployment date to set the `start` property (root-level for consistent dates, or per-chain for different deployment dates). This enables proper data backfilling. 3. **Choose Data Source(s)**: Select the appropriate method(s) to retrieve the necessary data for calculating dimensions. Common approaches are detailed below. [](https://docs.llama.fi/list-your-project/other-dashboards#data-source-examples) Data Source Examples ----------------------------------------------------------------------------------------------------------- Choose the appropriate data source based on your protocol's architecture. The `fetch` function receives an `options` object containing helper utilities like `createBalances`, `getLogs`, `api` (for contract calls), `queryDuneSql`, etc. ### [](https://docs.llama.fi/list-your-project/other-dashboards#on-chain-event-logs) On-Chain Event Logs Ideal for tracking specific events that generate fees or volume: Example: [Ostium](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/ostium/index.ts) ### [](https://docs.llama.fi/list-your-project/other-dashboards#token-transfer-tracking) Token Transfer Tracking Track tokens received by protocol treasury/fee addresses: Example: [Synthetix](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/synthetix.ts) ### [](https://docs.llama.fi/list-your-project/other-dashboards#subgraphs) Subgraphs Fast queries for protocols with well-maintained subgraphs: Examples: * [Curve](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/curve.ts) * [LlamaLend](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/llamalend.ts) * [TheGraph](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/thegraph.ts) * [Dackieswap](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/dackieswap.ts) ### [](https://docs.llama.fi/list-your-project/other-dashboards#query-engines-dune-flipside-allium) Query Engines (Dune, Flipside, Allium) For complex queries or when direct blockchain access is too expensive: Example: [Pumpswap](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/pump-swap/index.ts) ### [](https://docs.llama.fi/list-your-project/other-dashboards#contract-calls) Contract Calls For protocols where data is accessible through view functions or requires multiple contract interactions: Example: [Beradrome](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/beradrome/index.ts) [](https://docs.llama.fi/list-your-project/other-dashboards#metadata-and-methodology) Metadata and Methodology ------------------------------------------------------------------------------------------------------------------- Always include a `methodology` object to explain how your metrics are calculated. This is crucial for transparency. [](https://docs.llama.fi/list-your-project/other-dashboards#breakdown-labels-and-income-statement) Breakdown Labels & Income Statement ------------------------------------------------------------------------------------------------------------------------------------------- Our adapter allows to break data into multiple sub-parts, you may want to use breakdown labels when: * Adapter has multiple sources of fees * Adapter has multiple destinations to distribute fees #### [](https://docs.llama.fi/list-your-project/other-dashboards#add-breakdown-labels) Add breakdown labels Because label is a string, you can put anything into it, please check our redefine labels and use them except your adapter has specific labels. [https://github.com/DefiLlama/dimension-adapters/blob/master/helpers/metrics.ts](https://github.com/DefiLlama/dimension-adapters/blob/master/helpers/metrics.ts) #### [](https://docs.llama.fi/list-your-project/other-dashboards#describe-your-labels) Describe your labels If you add labels to adapter, always include a `breakdownMethodology` object to explain how your labels are calculated. Example: [Lido](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/lido.ts) [](https://docs.llama.fi/list-your-project/other-dashboards#important-considerations) Important Considerations ------------------------------------------------------------------------------------------------------------------- ### [](https://docs.llama.fi/list-your-project/other-dashboards#precision) Precision Use the `BigNumber` library (available via `options.createBalances()` or direct import) for mathematical operations involving token amounts, especially when dealing with different decimals or potentially large/small numbers, to avoid JavaScript precision issues. [](https://docs.llama.fi/list-your-project/other-dashboards#helper-functions-reference) Helper Functions Reference ----------------------------------------------------------------------------------------------------------------------- DeFiLlama provides numerous helper functions to simplify common tasks in adapter development. These are available either via direct import or through the `options` object passed to your `fetch` function. ### [](https://docs.llama.fi/list-your-project/other-dashboards#protocol-specific-helpers-common-abstractions) Protocol-Specific Helpers (Common Abstractions) These helpers provide high-level abstractions for common DeFi protocol archetypes. #### [](https://docs.llama.fi/list-your-project/other-dashboards#uniswap-v2-v3-like-protocols) Uniswap V2/V3-like Protocols * `**uniV2Exports**` **/** `**getUniV2LogAdapter**`: Generates adapter configurations for Uniswap V2-style DEXes across multiple chains. Examples: * [Nile Exchange V1](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/nile-exchange-v1/index.ts) (V2-style) * [Hydrometer](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/hydrometer/index.ts) * [ABCDEFX](https://github.com/DefiLlama/dimension-adapters/blob/master/dexs/abcdefx/index.ts) * `**uniV3Exports**`: Creates adapters for Uniswap V3-style DEXes, supporting variable fees and multiple pools. Example: * [2thick](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/2thick.ts) (V3-style) #### [](https://docs.llama.fi/list-your-project/other-dashboards#compound-v2-like-protocols) Compound V2-like Protocols * `**compoundV2Export**`: Creates an adapter for Compound V2-like protocols, taking config parameters and returning an object that tracks fees, revenue, and distribution among holders and suppliers. Example: * [Strike](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/strike/index.ts) ### [](https://docs.llama.fi/list-your-project/other-dashboards#token-tracking-helpers) Token Tracking Helpers Functions for tracking native and ERC20 token movements. * `**addTokensReceived**`: Tracks ERC20 token transfers received by specified addresses. Supports filtering by sender/receiver and custom token transformations. Uses indexer first, then logs. Example: * [Synthetix](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/synthetix.ts) * `**addGasTokensReceived**`: Tracks native token transfers (like ETH) received by specified multisig addresses. * `**getETHReceived**`: Tracks native token transfers on EVM chains via Allium DB queries. [Example Implementation - DexTools](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/dextools.ts) * `**getSolanaReceived**`: Fetches token transfers to specified Solana addresses, allows blacklisting senders/signers. Example: * [Axiom](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/axiom.ts) ### [](https://docs.llama.fi/list-your-project/other-dashboards#evm-data-helpers) EVM Data Helpers Functions for querying EVM logs and indexers. * `**getLogs**` (Available via `options.getLogs`): Retrieves event logs based on filters (target, signature, topics). [Example Implementation - Ostium](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/ostium/index.ts) * `**queryIndexer**`: Executes queries against DefiLlama's indexers (transfers, events, etc.). [Example Implementation - Sudoswap V2](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/sudoswap-v2.ts) ### [](https://docs.llama.fi/list-your-project/other-dashboards#query-engine-helpers) Query Engine Helpers Functions for querying external data platforms. * `**queryDuneSql**` (Available via `options.queryDuneSql`): Executes SQL queries against Dune Analytics. [Example Implementation - Pumpswap](https://github.com/DefiLlama/dimension-adapters/blob/master/fees/pump-swap/index.ts) * `**queryAllium**` (Available via `options.queryAllium`): Queries the Allium database. ### [](https://docs.llama.fi/list-your-project/other-dashboards#chain-specific-helpers) Chain-Specific Helpers Helpers tailored for specific chains or L2s. * `**fetchTransactionFees**` (Available via `options.fetchTransactionFees`): Retrieves total native token transaction fees burned/collected by the network. ### [](https://docs.llama.fi/list-your-project/other-dashboards#general-helpers) General Helpers Utility functions for common adapter patterns. * `**startOfDay**` (Available via `options.startOfDay`): Converts `options.endTimestamp` to 00:00:00 UTC for data sources requiring exact day timestamps. ### [](https://docs.llama.fi/list-your-project/other-dashboards#helper-source-code-reference) Helper Source Code Reference You can find the full source code for these helper functions in the DefiLlama GitHub repository: * [Token Helpers](https://github.com/DefiLlama/dimension-adapters/blob/master/helpers/token.ts) - Contains functions like addTokensReceived, getETHReceived, getSolanaReceived, etc. * [Uniswap Helpers](https://github.com/DefiLlama/dimension-adapters/blob/master/helpers/uniswap.ts) - Contains uniV2Exports, uniV3Exports * [Compound Helpers](https://github.com/DefiLlama/dimension-adapters/blob/master/helpers/compoundV2.ts) - Contains compoundV2Export * [Aave Helpers](https://github.com/DefiLlama/dimension-adapters/blob/master/helpers/aave/index.ts) - Contains aaveExports [](https://docs.llama.fi/list-your-project/other-dashboards#frequently-asked-questions) Frequently Asked Questions ----------------------------------------------------------------------------------------------------------------------- ### [](https://docs.llama.fi/list-your-project/other-dashboards#how-does-defillama-ensure-data-quality-and-accuracy) How does DeFiLlama ensure data quality and accuracy? **Code Review Process**: Each protocol adapter undergoes peer review by llamas through GitHub pull requests. This ensures code quality, data accuracy, and that a consistent methodology is applied to all protocols for the same metrics before any adapter goes live. **Methodology Consistency**: We maintain a uniform methodology across all protocol adapters and chains. Whenever the methodology evolves, our team propagates the update to every relevant adapter to ensure figures remain fully comparable across protocols. **Monitoring Systems**: We maintain internal alert systems that detect unusual data spikes, broken adapters, and anomalies across both TVL and dimension adapters (fees/revenue/volume). This allows the team to quickly identify and fix issues. **Historical Data Integrity**: When protocols add new components (like treasury wallets, new contracts, etc.), we backfill historical data to maintain completeness and accuracy. This ensures users have access to accurate historical insights. ### [](https://docs.llama.fi/list-your-project/other-dashboards#how-we-handle-data-integrity-and-keep-data-organic) How we handle data integrity and keep data organic? **Wash Trading Detection**: We actively identify and remove wash trading volumes to prevent them from undermining legitimate trading data. **TVL Percentage Rules**: For pools with very low fee percentages (like 0.01%) that enable wash trading, we apply minimum TVL percentage rules. Only volume from pools meeting these thresholds is counted, effectively filtering out wash trading while preserving legitimate activity. **Chain-Specific Considerations**: * **Solana**: Due to lower transaction fees that make wash trading more viable, we apply TVL percentage filters to major Solana DEXs while maintaining legitimate volumes * **BSC**: During farming campaigns that create wash trading incentives for low-liquidity pairs, we remove affected pairs to maintain data integrity ### [](https://docs.llama.fi/list-your-project/other-dashboards#how-can-i-report-data-issues-or-provide-feedback) How can I report data issues or provide feedback? You can report issues or provide feedback by sending an email to [\[email protected\]](https://docs.llama.fi/cdn-cgi/l/email-protection) Llamas regularly review feedback and implement necessary fixes to maintain the highest data quality standards across all adapters. [PreviousHow to update a project](https://docs.llama.fi/list-your-project/how-to-update-a-project) [NextEmissions dashboard](https://docs.llama.fi/list-your-project/emissions-dashboard) Last updated 2 days ago Was this helpful? * [What is an Adapter?](https://docs.llama.fi/list-your-project/other-dashboards#what-is-an-adapter) * [Introduction to Dimension Adapters](https://docs.llama.fi/list-your-project/other-dashboards#introduction-to-dimension-adapters) * [How to List Your Project](https://docs.llama.fi/list-your-project/other-dashboards#how-to-list-your-project) * [Basic Example](https://docs.llama.fi/list-your-project/other-dashboards#basic-example) * [Adapter Structure](https://docs.llama.fi/list-your-project/other-dashboards#adapter-structure) * [SimpleAdapter Properties](https://docs.llama.fi/list-your-project/other-dashboards#simpleadapter-properties) * [Testing Your Adapter](https://docs.llama.fi/list-your-project/other-dashboards#testing-your-adapter) * [Adapter Version](https://docs.llama.fi/list-your-project/other-dashboards#adapter-version) * [Core Dimensions](https://docs.llama.fi/list-your-project/other-dashboards#core-dimensions) * [Implementation Steps](https://docs.llama.fi/list-your-project/other-dashboards#implementation-steps) * [Data Source Examples](https://docs.llama.fi/list-your-project/other-dashboards#data-source-examples) * [On-Chain Event Logs](https://docs.llama.fi/list-your-project/other-dashboards#on-chain-event-logs) * [Token Transfer Tracking](https://docs.llama.fi/list-your-project/other-dashboards#token-transfer-tracking) * [Subgraphs](https://docs.llama.fi/list-your-project/other-dashboards#subgraphs) * [Query Engines (Dune, Flipside, Allium)](https://docs.llama.fi/list-your-project/other-dashboards#query-engines-dune-flipside-allium) * [Contract Calls](https://docs.llama.fi/list-your-project/other-dashboards#contract-calls) * [Metadata and Methodology](https://docs.llama.fi/list-your-project/other-dashboards#metadata-and-methodology) * [Breakdown Labels & Income Statement](https://docs.llama.fi/list-your-project/other-dashboards#breakdown-labels-and-income-statement) * [Important Considerations](https://docs.llama.fi/list-your-project/other-dashboards#important-considerations) * [Precision](https://docs.llama.fi/list-your-project/other-dashboards#precision) * [Helper Functions Reference](https://docs.llama.fi/list-your-project/other-dashboards#helper-functions-reference) * [Protocol-Specific Helpers (Common Abstractions)](https://docs.llama.fi/list-your-project/other-dashboards#protocol-specific-helpers-common-abstractions) * [Token Tracking Helpers](https://docs.llama.fi/list-your-project/other-dashboards#token-tracking-helpers) * [EVM Data Helpers](https://docs.llama.fi/list-your-project/other-dashboards#evm-data-helpers) * [Query Engine Helpers](https://docs.llama.fi/list-your-project/other-dashboards#query-engine-helpers) * [Chain-Specific Helpers](https://docs.llama.fi/list-your-project/other-dashboards#chain-specific-helpers) * [General Helpers](https://docs.llama.fi/list-your-project/other-dashboards#general-helpers) * [Helper Source Code Reference](https://docs.llama.fi/list-your-project/other-dashboards#helper-source-code-reference) * [Frequently Asked Questions](https://docs.llama.fi/list-your-project/other-dashboards#frequently-asked-questions) * [How does DeFiLlama ensure data quality and accuracy?](https://docs.llama.fi/list-your-project/other-dashboards#how-does-defillama-ensure-data-quality-and-accuracy) * [How we handle data integrity and keep data organic?](https://docs.llama.fi/list-your-project/other-dashboards#how-we-handle-data-integrity-and-keep-data-organic) * [How can I report data issues or provide feedback?](https://docs.llama.fi/list-your-project/other-dashboards#how-can-i-report-data-issues-or-provide-feedback) Was this helpful? Copy import { FetchOptions, SimpleAdapter } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; const FeeCollectedEvent = "event FeesCollected(address indexed _token, address indexed _integrator, uint256 _integratorFee, uint256 _lifiFee)" const LIFIFeeCollector = '0xbD6C7B0d2f68c2b7805d88388319cfB6EcB50eA9'; const fetch = async (options: FetchOptions) => { const dailyFees = options.createBalances(); const data: any[] = await options.getLogs({ target: LIFIFeeCollector, eventAbi: FeeCollectedEvent, }); data.forEach((log: any) => { dailyFees.add(log._token, log._integratorFee); }); return { dailyFees, dailyRevenue: dailyFees, dailyProtocolRevenue: dailyFees }; }; const methodology = { Fees: 'All fees paid by users for swap and bridge tokens via LI.FI.', Revenue: 'Fees are distributed to LI.FI.', ProtocolRevenue: 'Fees are distributed to LI.FI.', } const adapter: SimpleAdapter = { version: 2, fetch, chains: [CHAIN.ETHEREUM], start: '2023-07-27', methodology } export default adapter; Copy import { CHAIN } from "../../helpers/chains"; const methodology = { Fees: 'All fees paid by users for protocol operations.', Revenue: 'Fees distributed to the protocol.', ProtocolRevenue: 'Fees distributed to the protocol treasury.', } const adapter: SimpleAdapter = { version: 2, fetch, chains: [CHAIN.ETHEREUM, CHAIN.POLYGON, CHAIN.ARBITRUM], start: '2023-01-01', methodology } Copy > npm test [dashboard] [protocolSlug] > npm test [dashboard] [protocolSlug] [timestamp] Copy npm test fees katana Copy npm test fees katana 1662110960 npm test dexs katana 2025-04-10 Copy const fetch = async ({ getLogs, createBalances }) => { const dailyFees = createBalances(); const dailyRevenue = createBalances(); const logs = await getLogs({ target: "0xcf205808ed36593aa40a44f10c7f7c2f67d4a4d4", eventAbi: 'event Trade(address trader, address subject, bool isBuy, uint256 shareAmount, uint256 ethAmount, uint256 protocolEthAmount, uint256 subjectEthAmount, uint256 supply)' }); logs.forEach(log => { dailyFees.addGasToken(log.protocolEthAmount * 2); // Example: Total fees dailyRevenue.addGasToken(log.protocolEthAmount); // Example: Protocol's share }); return { dailyFees, dailyRevenue }; }; Copy import { addTokensReceived } from '../../helpers/token'; const fetch = async (options: FetchOptions) => { // Track ERC20 token transfers to treasury const dailyFees = await addTokensReceived({ options, tokens: ["0x4200000000000000000000000000000000000006"], // WETH on Base targets: ["0xbcb4a982d3c2786e69a0fdc0f0c4f2db1a04e875"] // Treasury }); // Example: Assuming all received tokens are fees and revenue return { dailyFees, dailyRevenue: dailyFees } } Copy import { request } from "graphql-request"; const fetch = async (options: FetchOptions) => { const dailyVolume = options.createBalances(); const query = `{ volumeStats(where: {timestamp_gte: ${options.startTimestamp}, timestamp_lt: ${options.endTimestamp}}) { volumeUSD token } }`; const { volumeStats } = await request("https://api.thegraph.com/subgraphs/name/protocol/subgraph", query); volumeStats.forEach(stat => { // Assuming volumeUSD needs conversion if not directly usable dailyVolume.add(stat.token, stat.volumeUSD); }); return { dailyVolume }; }; Copy const fetch = async (options: FetchOptions) => { const dailyFees = options.createBalances(); const results = await options.queryDuneSql(` SELECT SUM(amount) as fees, token_address FROM ethereum.transactions WHERE to_address = '0x123...abc' -- Example fee address AND block_time >= FROM_UNIXTIME(${options.startTimestamp}) AND block_time < FROM_UNIXTIME(${options.endTimestamp}) GROUP BY token_address `); if (results && results.length > 0) { results.forEach(row => { dailyFees.add(row.token_address, row.fees); }); } return { dailyFees }; }; Copy const fetch = async (options: FetchOptions) => { const dailyFees = options.createBalances(); // Example: Get plugin data through contract calls const plugins = await options.api.call({ target: "0xd7ea36ECA1cA3E73bC262A6D05DB01E60AE4AD47", // Contract address abi: "address[]:getPlugins", }); // Use multiCall for efficiency when making multiple similar calls const bribes = await options.api.multiCall({ abi: "function getBribe() returns (address)", calls: plugins }); // Example: Collect fee data from events emitted by bribe contracts for (const bribe of bribes) { const logs = await options.getLogs({ target: bribe, eventAbi: "event Bribe__RewardNotified(address indexed rewardToken, uint256 reward)", }); logs.forEach((log) => { dailyFees.add(log.rewardToken, log.reward); }); } return { dailyFees }; }; Copy const methodology = { Fees: "Describes how total fees are calculated (e.g., Users pay 0.3% on each swap).", Revenue: "Describes how protocol revenue is calculated (e.g., Protocol keeps 0.05% of each swap).", SupplySideRevenue: "Describes how revenue distributed to LPs/suppliers is calculated (e.g., LPs receive 0.25% of each swap)." // Add methodology for other dimensions like Volume, PremiumVolume etc. as applicable } const adapter: SimpleAdapter = { version: 2, fetch, chains: [CHAIN.ETHEREUM], start: '2023-01-01', methodology } Copy // instead add all fees into dailyFees dailyFees.add('0x0000000000000000000000000000000000000000', 1e18) // you can break fees into subparts - for Lido dailyFees.add('0x0000000000000000000000000000000000000000', 5e17, 'Staking Rewards') dailyFees.add('0x0000000000000000000000000000000000000000', 5e17, 'MEV Rewards') // you can break fees into subparts - for Aave dailyFees.add('0x0000000000000000000000000000000000000000', 6e17, 'Borrow Interest') dailyFees.add('0x0000000000000000000000000000000000000000', 2e17, 'GHO Borrow Interest') dailyFees.add('0x0000000000000000000000000000000000000000', 2e17, 'Liquidation Fees') // you can break fees into subparts - for Euler dailyFees.add('0x0000000000000000000000000000000000000000', 6e17, 'Borrow Interest') dailyFees.add('0x0000000000000000000000000000000000000000', 2e17, 'Protocol Fees') dailyFees.add('0x0000000000000000000000000000000000000000', 2e17, 'Curators Fees') Copy const breakdownMethodology = { Fees: { "Staking Rewards": "ETH validators rewards.", "MEV Rewards": "MEV rewards from ETH execution layer.", }, Revenue: "Lido takes 10% all validators and NEV rewards.", } const adapter: SimpleAdapter = { version: 2, fetch, chains: [CHAIN.ETHEREUM], start: '2023-01-01', methodology, // explain common metrics breakdownMethodology, // explain breakdown labels } Copy import BigNumber from "bignumber.js"; // ... inside fetch function const feesInGas = new BigNumber(graphRes["fees"]); const ethGasPrice = await getGasPrice(timestamp); // Assuming getGasPrice helper exists const dailyFees = options.createBalances(); // Create a Balances object dailyFees.addGasToken(feesInGas.multipliedBy(ethGasPrice).toString()); return { dailyFees, dailyRevenue: dailyFees }; Copy import { uniV2Exports } from '../helpers/uniswap'; // Example for a Uniswap V2 fork on BSC export default uniV2Exports({ [CHAIN.BSC]: { factories: ['0x123...abc'], // Factory address fees: { type: 'fixed', // Or 'variable' or 'stable' feesPercentage: 0.3 // Swap fee percentage } } // Other chains... }); Copy import { uniV3Exports } from '../helpers/uniswap'; // Example for a Uniswap V3 fork on Scroll export default uniV3Exports({ [CHAIN.SCROLL]: { factory: '0xAAA32926fcE6bE95ea2c51cB4Fcb60836D320C42', // Optional custom fee handling or additional configurations } // Other chains... }) Copy import { compoundV2Export } from '../helpers/compound'; // Example for a Compound V2 fork on Ethereum export default compoundV2Export({ reserveFactor: 0.1, // Example: 10% of interest goes to protocol markets: { [CHAIN.ETHEREUM]: { comptroller: '0x123...abc', // Comptroller address // ... other market parameters like specific cToken addresses if needed } // Other chains... } }); Copy import { addTokensReceived } from '../../helpers/token'; const fetch: any = async (options: FetchOptions) => { const dailyFees = await addTokensReceived({ options, tokens: ["0x4200000000000000000000000000000000000006"], // WETH on Base targets: ["0xbcb4a982d3c2786e69a0fdc0f0c4f2db1a04e875"] // Treasury }) return { dailyFees, dailyRevenue: dailyFees } } Copy import { addGasTokensReceived } from '../../helpers/token'; const fetch = async (options: FetchOptions) => { const dailyFees = await addGasTokensReceived({ options, multisigs: ["0x123...abc", "0x456...def"] // Treasury multisig addresses }); return { dailyFees, dailyRevenue: dailyFees }; } Copy import { getETHReceived } from '../../helpers/token'; const fetch = async (options: FetchOptions) => { const balances = options.createBalances(); await getETHReceived({ options, balances, target: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" // Treasury address }); return { dailyFees: balances, dailyRevenue: balances }; } Copy import { getSolanaReceived } from '../../helpers/token'; const fetch = async (options: FetchOptions) => { const dailyFees = options.createBalances(); await getSolanaReceived({ options, balances: dailyFees, target: "9yMwSPk9mrXSN7yDHUuZurAh1sjbJsfpUqjZ7SvVtdco", // Treasury blacklists: ["3xxxx..."] // Optional senders to exclude }); return { dailyFees, dailyRevenue: dailyFees }; } Copy const fetch = async (options: FetchOptions) => { // options includes getLogs const dailyFees = options.createBalances(); const logs = await options.getLogs({ target: "0xcf205808ed36593aa40a44f10c7f7c2f67d4a4d4", eventAbi: 'event Trade(address trader, address subject, bool isBuy, uint256 shareAmount, uint256 ethAmount, uint256 protocolEthAmount, uint256 subjectEthAmount, uint256 supply)' }); logs.forEach(log => { dailyFees.addGasToken(log.protocolEthAmount); }); return { dailyFees }; } Copy import { queryIndexer } from '../../helpers/indexer'; const fetch = async (options: FetchOptions) => { const transfers = await queryIndexer({ chain: options.chain, fromTimestamp: options.startTimestamp, toTimestamp: options.endTimestamp, type: 'Transfer', // Example: query token transfers filter: { to: "0x123...abc" } }); const dailyFees = options.createBalances(); transfers.forEach(t => dailyFees.add(t.token, t.value)); return { dailyFees }; } Copy const fetch = async (options: FetchOptions) => { // options includes queryDuneSql const dailyFees = options.createBalances(); const results = await options.queryDuneSql(` SELECT SUM(fee_amount) as fees FROM ethereum.transactions WHERE to = '0x123...abc' AND block_time BETWEEN to_timestamp(${options.startTimestamp}) AND to_timestamp(${options.endTimestamp})` ); if (results && results.length > 0) { dailyFees.addGasToken(results[0].fees); } return { dailyFees }; } Copy const fetch = async (options: FetchOptions) => { // options includes queryAllium const dailyFees = options.createBalances(); const result = await options.queryAllium(` SELECT SUM(value) as revenue FROM ethereum.transactions WHERE to_address = '0x123...abc' AND block_timestamp BETWEEN TO_TIMESTAMP_NTZ(${options.startTimestamp}) AND TO_TIMESTAMP_NTZ(${options.endTimestamp}) `); if (result && result.length > 0) { dailyFees.addGasToken(result[0].revenue); } return { dailyFees }; } Copy const fetch = async (options: FetchOptions) => { // options includes fetchTransactionFees const dailyFees = await options.fetchTransactionFees(); // Assumes network fees are protocol revenue return { dailyFees, dailyRevenue: dailyFees }; } Copy const fetch = async (options: FetchOptions) => { const startOfDayTimestamp = options.startOfDay; // Use startOfDayTimestamp in API calls requiring a 00:00:00 timestamp // e.g., const data = await fetchAPI(`...?date=${startOfDayTimestamp}`); // ... } --- # Coin Prices API | DefiLlama ### [](https://docs.llama.fi/coin-prices-api#how-to-list-a-new-protocol-or-coin) How to list a new protocol or coin 1. Fork [this repository](https://github.com/DefiLlama/defillama-server/tree/master/coins) 2. Create a new folder within one of the protocol category folders in \[coins/src/adapters/\], with your protocol name. Eg, if you wanted to add an adapter for a yield aggregator called 'yieldAgg', you'd create a folder with the path \[coins/src/adapters/yieldAgg/\]. 3. Write an adaptor for your protocol (tutorial below), titled \[index.ts\] 4. Test your adaptor by logging the output of your getTokenPrices() function in the adapter file, and running `ts-node ` (remember to install dependencies with `npm i` first!) 5. If the DB writes look as expected, submit a PR! ### [](https://docs.llama.fi/coin-prices-api#adapter-exports) Adapter Exports An adapter is just a javascript file that exports an async function that returns an array of database writes, describing the state of a protocol's coins at a given timestamp. Coins follow the following schema (all values are just examples): Copy { PK: "asset#ethereum:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // unique identifier showing the chain and address of the token SK: 0, // 10 digit unix timestamp, or 0 for current timestamp price: 1.45632, adapter: 'aave', // unique adapters identifier, used for traceability inside the database symbol: "USDT", // symbol of the token confidence: 0.7, // number 0-1 describing the reliability of the price data (more information below) redirect: 'coingecko#ethereum', // some coins will in theory always have the same price as another token in the DB. In this case a 'redirect' can be used instead of a 'price'. This will usually be undefined decimals: 18, // the number of a decimals that a token has }; Some notes: 1. The PK may look complicated, but this can be formed for you using the addToDBWritesList() function. 2. All adapters must make a timestamp as input, therefore no effort is required to export timestamp. 3. In some cases, confidence scores can be hardcoded as a value depending on the reliability of a protocol. In other cases (eg where prices are determined by pool weights in Uniswap V2) confidence scores should be: 'a value between 0 and 1, proportional to the cost of manipulating the token's price' 1. The coins database only supports redirects to a depth of 1. Therefore any redirects are likely to point to a 'coingecko#...' entry. ### [](https://docs.llama.fi/coin-prices-api#adapter-walkthrough) Adapter Walkthrough In this section we'll walk through the Euler money market adapter with the goal of learning to write an adapter for a protocol of our choice. [](https://docs.llama.fi/coin-prices-api#file-structure) File structure ---------------------------------------------------------------------------- In \[/coins/src/adapters/moneyMarkets/\] there is a 'euler' folder. This contains all the adapter code specific to Euler. 1. \[abi.json\] contains any ABIs for onchain function calls. 2. \[index.ts\] where adapter parameters are given, for entering coin data to the database. 3. \[euler.ts\] the bulk of the adapter code, where third party data is used to find token price etc. We can see that \[index.ts\] exports a function with the same name as the protocol. This function runs getTokenPrices() from \[euler.ts\]. getTokenPrices() uses a variety of functions and libraries to find token prices: 1. Axios is used in fetchFromIpfs(), to fetch market information from IPFS by a REST get call. API calls don't necessarily have to be to IPFS, however we do prefer on-chain data to protocol APIs. Especially for numerical data used to calculate price. 2. The getBlock() utility is used to find the block height of the given chain at the given timestamp. It is worth checking the utils folder for any functions you need that may have already been written. 3. getTokenAndRedirectData() fetches information from the DefiLlama coins database, about coins deposited to the Euler markets. 4. multiCall()is a function from the DefiLlama SDK which allows us to fetch on-chain data from many functions at once. There are lots of examples on how to use the DefiLlama SDK in the DefiLlama/DefiLlama-Adapters repo. The last part of the adapter code to run is formWrites(). This function is used to create the array returned by the adapter. At this stage of the adapter it is crucial to handle any errors effectively so that faulty data doesn't enter the database. Notice on lines 57 and 64 where unexpected data is excluded from the writes list by returning from the map function. To test the Euler adapter, we can run `ts-node coins/src/test.ts euler`. If the command successfully logs an array of database writes containing expected data, we're ready to make a PR! [PreviousFrequently Asked Questions](https://docs.llama.fi/faqs/frequently-asked-questions) [NextPricing](https://docs.llama.fi/pro-api) Last updated 6 days ago Was this helpful? * [How to list a new protocol or coin](https://docs.llama.fi/coin-prices-api#how-to-list-a-new-protocol-or-coin) * [Adapter Exports](https://docs.llama.fi/coin-prices-api#adapter-exports) * [Adapter Walkthrough](https://docs.llama.fi/coin-prices-api#adapter-walkthrough) * [File structure](https://docs.llama.fi/coin-prices-api#file-structure) Was this helpful? --- # Add a new RPC endpoint | DefiLlama Send a Pull Request to [https://github.com/DefiLlama/chainlist/blob/main/constants/extraRpcs.js](https://github.com/DefiLlama/chainlist/blob/main/constants/extraRpcs.js) adding any RPCs to the array of each chain. [PreviousHow to change Ethereum's RPC](https://docs.llama.fi/chainlist/how-to-change-ethereums-rpc) [NextFrequently Asked Questions](https://docs.llama.fi/faqs/frequently-asked-questions) Last updated 2 years ago Was this helpful? Was this helpful? --- # Pricing | DefiLlama ### [](https://docs.llama.fi/pro-api#subscription-tiers) **Subscription Tiers** #### [](https://docs.llama.fi/pro-api#open-free) **Open** (Free) The Open plan provides essential access to DefiLlama’s comprehensive DeFi data. **Features:** * Access to TVL (Total Value Locked), revenue/fees, and prices. * Access to **LlamaFeed** for real-time updates. * Support via public Discord channel. **API Limits:** * 10 to 200 requests per minute. **Docs Page**: [https://defillama.com/docs/api](https://defillama.com/docs/api) * * * #### [](https://docs.llama.fi/pro-api#pro-usd300-month) **Pro** ($300/month) Unlock the full potential of DefiLlama with the Pro plan, designed for businesses and developers requiring high-performance API access. **Features:** * All features of the Open plan. * Access to all data categories, including unlocks, active users, and token liquidity. * Priority support for technical assistance. * Enhanced API performance with Pro API limits. **API Limits:** * 1000 requests per minute. * Up to 1 million API calls per month. **Docs Page**: [https://defillama.com/pro-api/docs](https://defillama.com/pro-api/docs) * * * * * * **Payment Options:** * Stablecoins * Credit card through Stripe **How to Upgrade** Go to https://defillama.com/subscription [PreviousCoin Prices API](https://docs.llama.fi/coin-prices-api) Last updated 7 months ago Was this helpful? Was this helpful? --- # How to change Ethereum's RPC | DefiLlama To change the RPC endpoint used for Ethereum follow these steps: 1. Enter your MetaMask and click on your RPC endpoint at the top of your MetaMask. By default it says “Ethereum Mainnet.” 2. Click “Add Network” 3. Add the RPC URL you want to use, with a chainID of `1` and currency of `ETH`. 4. Click “Save” ![](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2F2397802182-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MVnGnXr5_eAilN_e5PP%252Fuploads%252Fgit-blob-97eb2952f5e31d751f06dd70169cb49c7d67083d%252Fmetamask-add.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=ed12da80&sv=2) [PreviousDAT Methodology](https://docs.llama.fi/analysts/dat-methodology) [NextAdd a new RPC endpoint](https://docs.llama.fi/chainlist/add-a-new-rpc-endpoint) Last updated 3 years ago Was this helpful? Was this helpful? --- # Data Definitions | DefiLlama ### [](https://docs.llama.fi/analysts/data-definitions#total-value-locked-tvl) Total Value Locked (TVL) For protocols: Value of all coins held in smart contracts of the protocol For chains: Sum of TVL of the protocols in that chain In traditional finance terms, TVL is similar to Assets Under Management (AUM). It represents the total value of assets that users deposit into a protocol. This is similar to how a fund or bank might report the total value of client deposits or managed assets. ### [](https://docs.llama.fi/analysts/data-definitions#fees) Fees Total fees paid by users when using the protocol. Fees are equivalent to what would traditionally be considered Revenue in most off-chain businesses. They reflect the total amount paid by users for using the service, regardless of where those fees end up. This is the top-line number that shows how much the protocol is facilitating in economic activity. ### [](https://docs.llama.fi/analysts/data-definitions#revenue) Revenue Subset of fees that the protocol collects for itself, usually going to the protocol treasury, the team or distributed among token holders. This doesn't include any fees distributed to Liquidity Providers. Revenue, in the way we define it here, is closer to Gross Income in traditional accounting. It’s the portion of fees that the protocol keeps for itself after paying out costs to actors like liquidity providers. This is what goes to the team, the treasury, or tokenholders. ### [](https://docs.llama.fi/analysts/data-definitions#token-holder-revenue) Token Holder Revenue Subset of revenue that is distributed to tokenholders by means of buyback and burn, burning fees or direct distribution to stakers. Token Holder Revenue is similar to Dividends in traditional finance terms. It’s the part of protocol revenue that is returned to tokenholders through staking rewards, fee burns, or direct payouts. Like dividends, this shows how much value the protocol is distributing back to its investors. ### [](https://docs.llama.fi/analysts/data-definitions#usd-inflows) USD Inflows A protocol's TVL might go down even if more assets are deposited in the scenario where the prices of assets comprising TVL go down, so just looking at the TVL chart is not the best way to see if a protocol is receiving deposits or money is exiting, as that info gets mixed with price movements. USD Inflows is a metric that fixes that by representing the net asset inflows into a protocol's TVL. It's calculated by taking the balance difference for each asset between two consecutive days, multiplying that difference by asset price and then summing that for all assets. If a protocol has all of its TVL in ETH and one day ETH price drops 20% while there are no new deposits or withdrawals, TVL will drop by 20% while USD inflows will be 0$. ### [](https://docs.llama.fi/analysts/data-definitions#staked) Staked Value of governance coins that are staked in the protocol's staking system. ### [](https://docs.llama.fi/analysts/data-definitions#annual-operational-expenses) Annual Operational Expenses Operational costs for salaries, audits... throughout the year. We collect this data mainly from annual protocol reports on their forums, so it's always referencing old data and likely to be outdated up till 1 year. ### [](https://docs.llama.fi/analysts/data-definitions#total-raised) Total Raised Sum of all money raised by the protocol, including VC funding rounds, public sales and ICOs. ### [](https://docs.llama.fi/analysts/data-definitions#active-addresses-24h) Active Addresses (24h) Number of unique addresses that have interacted with the protocol directly in the last 24 hours. Interactions are counted as transactions sent directly against the protocol, thus transactions that go through an aggregator or some other middleman contract are not counted here. The reasoning for this is that this is meant to help measure stickiness/loyalty of users, and users that are interacting with the protocol through another product aren't likely to be sticky. ### [](https://docs.llama.fi/analysts/data-definitions#treasury) Treasury Value of coins held in ownership by the protocol. By default this excludes coins created by the protocol itself. In traditional finance, terms, the Treasury is the protocol’s Total Assets. This is what the protocol controls directly, and is often used to fund operations, growth initiatives, or serve as a reserve. ### [](https://docs.llama.fi/analysts/data-definitions#token-volume) Token Volume Sum of value in all swaps to or from that token across all Centralized and Decentralized exchanges tracked by coingecko. Example: for SBR this was all the volume done on SBR/ANY pairs on FTX, Serum... Data for this metric is imported directly from CoinGecko. ### [](https://docs.llama.fi/analysts/data-definitions#token-liquidity) Token liquidity Sum of value locked in DEX pools that include that token across all DEXs for which DefiLlama tracks pool data. Example: There's a SOL/SBR pool on Orca (Solana DEX) with 25k of TVL on that pool, so this 25k counts towards the liquidity of SBR. ### [](https://docs.llama.fi/analysts/data-definitions#fully-diluted-valuation-fdv) Fully Diluted Valuation (FDV) Fully Diluted Valuation, this is calculated by taking the expected maximum supply of the token and multiplying it by the price. It's mainly used to calculate the hypothetical marketcap of the token if all the tokens were unlocked and circulating. Data for this metric is imported directly from coingecko. ### [](https://docs.llama.fi/analysts/data-definitions#volume) Volume Volume traded on the DEX, this metric is only applicable to protocols that are DEXs (in this case only Saber), and it's just the sum of value of all trades that went through the DEX on a given day. ### [](https://docs.llama.fi/analysts/data-definitions#events) Events This is a manually curated list of events that impacted the protocol. The reason why we display this is just to help the user understand the reason behind changes in the protocol metrics. Example: When there's a hack that causes a sudden drop in TVL we add an event at that date explaining that a hack was the reason why TVL dropped. ### [](https://docs.llama.fi/analysts/data-definitions#median-apy) Median APY Median APY across DeFi pools tracked by DefiLlama that include a given asset. This is calculated by finding all pools for an asset, then sorting them by APY and finding the median weighted by TVL. ### [](https://docs.llama.fi/analysts/data-definitions#contributors) Contributors Number of unique github accounts that made at least one commit to a repository in the github organization of a given project. ### [](https://docs.llama.fi/analysts/data-definitions#developers) Developers Number of unique github accounts that made at least one commit on three distinct months to a repository in the github organization of a given project. ### [](https://docs.llama.fi/analysts/data-definitions#assets-for-cexs) Assets (for CEXs) This includes all the assets that the CEX has under their custody, excluding any assets that are under a different custodian but are credited inside the CEX for use as collateral. [PreviousFunction Reference](https://docs.llama.fi/spreadsheet-functions/function-reference) [NextCustom columns](https://docs.llama.fi/analysts/custom-columns) Last updated 5 months ago Was this helpful? * [Total Value Locked (TVL)](https://docs.llama.fi/analysts/data-definitions#total-value-locked-tvl) * [Fees](https://docs.llama.fi/analysts/data-definitions#fees) * [Revenue](https://docs.llama.fi/analysts/data-definitions#revenue) * [Token Holder Revenue](https://docs.llama.fi/analysts/data-definitions#token-holder-revenue) * [USD Inflows](https://docs.llama.fi/analysts/data-definitions#usd-inflows) * [Staked](https://docs.llama.fi/analysts/data-definitions#staked) * [Annual Operational Expenses](https://docs.llama.fi/analysts/data-definitions#annual-operational-expenses) * [Total Raised](https://docs.llama.fi/analysts/data-definitions#total-raised) * [Active Addresses (24h)](https://docs.llama.fi/analysts/data-definitions#active-addresses-24h) * [Treasury](https://docs.llama.fi/analysts/data-definitions#treasury) * [Token Volume](https://docs.llama.fi/analysts/data-definitions#token-volume) * [Token liquidity](https://docs.llama.fi/analysts/data-definitions#token-liquidity) * [Fully Diluted Valuation (FDV)](https://docs.llama.fi/analysts/data-definitions#fully-diluted-valuation-fdv) * [Volume](https://docs.llama.fi/analysts/data-definitions#volume) * [Events](https://docs.llama.fi/analysts/data-definitions#events) * [Median APY](https://docs.llama.fi/analysts/data-definitions#median-apy) * [Contributors](https://docs.llama.fi/analysts/data-definitions#contributors) * [Developers](https://docs.llama.fi/analysts/data-definitions#developers) * [Assets (for CEXs)](https://docs.llama.fi/analysts/data-definitions#assets-for-cexs) Was this helpful? --- # DAT Methodology | DefiLlama Every other data provider lists a single mNAV number per DAT, but we believe that this can lead to incorrect assumptions, so instead we provide 3 numbers that define a range. ### [](https://docs.llama.fi/analysts/dat-methodology#why-one-mnav-number-can-mislead-you) Why one mNAV number can mislead you Look at Greenlane Holdings on November 30th, 2025: Stat Value Total BERA holdings ~54.23 million BERA Treasury value ~54.34 million dollars Share price ~3.38$ Outstanding Share Count ~4.8 million shares mNAV (marketcap / crypto treasury value) 0.33 Looking at this mNAV number you would conclude “Greenlane trades at 0.33 times its crypto treasury. This looks extremely cheap.” However, the company has many active contracts (that filings indicate are effectively certain to dilute over time / that are very likely to result in future share issuance), and when you account for this future dilution, the total share count that will have a claim on the treasury will be ~35.4m shares, resulting in an mNAV of ~2.42. So you might buy thinking you're getting a heavy discount to the crypto treasury and you're protected when in reality you're buying at ~2.42x premium over the crypto treasury value, very expensive and exposing yourself to a ~60% loss. To help investors avoid falling into this pitfall, and to provide more accurate metrics on the market, we created 3 versions of mNAV, each using a different share count: * **Realized mNAV**: The ratio of marketcap to crypto treasury value where marketcap = share price × currently issued shares. * **Realistic mNAV**: The ratio of marketcap to crypto treasury value, where marketcap uses the economically most probable share count multiplied by the share price. * **Maximum mNAV**: The ratio of marketcap to crypto treasury value, where the marketcap is based on the fixed-count contractual dilution ceiling times the share price. Covers the case of the maximum number of shares that could be minted based on the current active contracts. ### [](https://docs.llama.fi/analysts/dat-methodology#definitions) Definitions #### [](https://docs.llama.fi/analysts/dat-methodology#realized-mnav) Realized mNAV The ratio of marketcap to crypto treasury value where the marketcap is calculated by multiplying the share price by factual, legal share count today. Includes all completed share events after the latest filing using the outstanding share count and including all new issuances, settled ATM sales, executed conversions, exercises, repurchases, cancellations, splits, and ADS ratio changes. It answers: > “How is the market valuing the crypto treasury on the shares that exist right now?” #### [](https://docs.llama.fi/analysts/dat-methodology#realistic-mnav) Realistic mNAV The ratio of marketcap to crypto treasury value, where the marketcap uses the economically most probable share count multiplied by the share price. Builds on the fully diluted realized share count, also known as outstanding shares, and adds dilution that is unavoidable under GAAP, such as diluted EPS share count, prefunded warrants, triggered convertibles or earnouts and mandatory conversions. Uses basic instead of diluted if the company reports a net loss. It answers: > “What does valuation look like once unavoidable dilution is priced in?” #### [](https://docs.llama.fi/analysts/dat-methodology#maximum-mnav) Maximum mNAV The ratio of marketcap to crypto treasury value, where the marketcap is based on the fixed-count contractual dilution ceiling times the share price. Covers all fixed share contracts such as options, warrants, RSUs, PSUs, fixed convertibles, and fixed share earnouts. Excludes dollar-based programs such as ATMs, shelves and equity lines because these are not fixed share counts, are not guaranteed to be used and are highly price and path dependent. It answers: > “What does valuation look like under the full fixed share contractual scenario?” ### [](https://docs.llama.fi/analysts/dat-methodology#why-this-three-line-system-is-better) Why this three line system is better * It reveals dilution instead of hiding it inside one opaque denominator. * It shows the factual baseline, the economic central case and the fixed contract ceiling. * It maintains one clear numerator and one clear denominator. * It provides consistent comparability across issuers. * It prevents errors caused by stale share counts, ATM capacity, ADS ratio drift and vague “fully diluted” claims. * * * ### [](https://docs.llama.fi/analysts/dat-methodology#exact-methodology-and-sourcing-to-replicate-defillamas-mnav) Exact methodology and sourcing to replicate DefiLlama's mNAV The sections above explain the intuition and definitions behind the three mNAV lines. This section specifies the exact data inputs and calculations used so that DefiLlama’s DAT mNAV can be replicated. #### [](https://docs.llama.fi/analysts/dat-methodology#id-1.-mnav-formula-and-notation) 1\. mNAV formula and notation For each dilution bucket `B` (Realized, Realistic, Maximum): `mNAV_B = (FD shares_B × Share price) ÷ Crypto Treasury Value` Where: * `FD shares_B` is the fully diluted share count for bucket `B`. * `Share price` is the last trade on the primary exchange. * `Crypto Treasury Value` is the total USD value of crypto tokens the company directly holds. Numerator: * `Marketcap_B = FD shares_B × Share price` Denominator: * `Crypto Treasury Value` Interpretation: * `mNAV_B > 1` → the company trades at a **premium** to its crypto treasury. * `mNAV_B < 1` → the company trades at a **discount** to its crypto treasury. #### [](https://docs.llama.fi/analysts/dat-methodology#id-2.-crypto-treasury-value) 2\. Crypto Treasury Value **Crypto Treasury Value** is the total USD value of all crypto tokens the company directly holds on a given date. Treasury includes: * Tokens in company-controlled wallets. * Tokens held with custodians. * Wrapped assets representing the same economic exposure. * Staked assets, valued at principal token units (not including future rewards). * Stablecoins classified as treasury reserves. **Multi-token treasuries** If a company holds multiple tokens, each token is valued separately and then summed: `Crypto Treasury Value = (BTC units × BTC price in USD) + (ETH units × ETH price in USD) + (WLD units × WLD price in USD) + …` **Not included:** * Customer assets. * Cash, bonds, equities, or other non-crypto assets. * Equity stakes in other publicly traded companies, including other DAT names. Examples: * BMNR holding ORBS stock is **not** counted. * BMNR holding WLD tokens directly **is** counted. **Token count sourcing** DefiLlama uses authoritative, up-to-date sources in the following priority order: 1. SEC filings. 2. Company IR pages. 3. Treasury dashboards. 4. Custodian disclosures. 5. Verified wallets. 6. Official press releases via PR Newswire, GlobeNewswire, Business Wire, Accesswire. **Handling vague language** When disclosures are not precise: * “At least 10,000 BTC” → recorded as **10,000 BTC**. * “Around $1m of ETH” → converted into ETH units using DefiLlama pricing at the reference date. * “Substantial amount” → ignored unless a quantifiable range can be derived. If only USD values are disclosed, DefiLlama uses that USD figure directly as part of **Crypto Treasury Value**. **Token pricing** DefiLlama uses aggregated, volume-weighted exchange pricing that is consistent across all DefiLlama products. #### [](https://docs.llama.fi/analysts/dat-methodology#id-3.-fully-diluted-share-buckets-fd) 3\. Fully diluted share buckets (FD) For a given date, **Crypto Treasury Value** is the same across all buckets. The difference between the three mNAV lines comes from the **FD share count used in the numerator** through `Marketcap_B`. All buckets: * Adjust for stock splits. * Adjust for reverse splits. * Normalize ADS structures and ADS ratio changes. **FD realized (Shares Outstanding, used for Realized mNAV)** FD realized corresponds to the **currently existing shares** that have legal claim today. The FD realized share count is composed of: * Shares outstanding from the latest filing. * Plus **completed** corporate actions after that filing: * New issuances (including ATM settlements). * Executed conversions. * Option and warrant exercises. * Repurchases and cancellations. * Splits and reverse splits. * ADS ratio changes. This FD share count is used as the `FD shares` input when calculating the **Realized mNAV** line. **FD realistic (GAAP likely dilution, used for Realistic mNAV)** FD realistic incorporates dilution that is effectively unavoidable under GAAP, starting from FD realized. The FD realistic share count is composed of: * FD realized shares. * Diluted weighted average shares from GAAP EPS. * Prefunded warrants. * Earnouts or conversions that filings indicate are certain or already triggered. * For issuers with a **net loss**, diluted EPS share count is replaced by basic (GAAP rule). This FD share count is used as the `FD shares` input when calculating the **Realistic mNAV** line. **FD maximum (fixed share contractual dilution, used for Maximum mNAV)** FD maximum captures the full fixed-share contractual ceiling, starting from FD realistic. The FD maximum share count is composed of: * FD realistic. * All fixed-share instruments, whether in- or out-of-the-money: * Options. * Warrants. * RSUs. * PSUs. * Fixed convertibles. * Fixed-share earnouts. Explicitly **excludes**: * Dollar-denominated ATM capacity. * Shelf registration capacity. * Equity lines and similar dollar-based facilities. These are excluded because they: * Are not fixed share counts. * Are not guaranteed to be used. * Are highly price- and path-dependent. This FD share count is used as the `FD shares` input when calculating the **Maximum mNAV** line. #### [](https://docs.llama.fi/analysts/dat-methodology#id-4.-equity-prices) 4\. Equity prices Share prices are sourced from Yahoo Finance: * Last traded price. * On the primary listing exchange. * Matched as closely as possible to the treasury valuation date used for token pricing. #### [](https://docs.llama.fi/analysts/dat-methodology#id-5.-how-mnav-is-calculated) 5\. How mNAV is calculated For each bucket `B`: 1. **Compute Crypto Treasury Value.** Aggregate all directly held tokens at their USD prices. 2. **Compute** `**Marketcap_B**`**.** `Marketcap_B = FD shares_B × Share price`. 3. **Compute** `**mNAV_B**`**.** `mNAV_B = Marketcap_B ÷ Crypto Treasury Value`. DefiLlama then publishes three lines: * `mNAV_realized` * `mNAV_realistic` * `mNAV_maximum` #### [](https://docs.llama.fi/analysts/dat-methodology#id-6.-why-mnav-may-differ-from-other-sources) 6\. Why mNAV may differ from other sources mNAV values shown on DefiLlama may differ from other dashboards or broker data because: * DefiLlama **excludes** equity stakes in other DATs from Crypto Treasury Value. * Token counts can vary across IR pages, filings, custodians and PRs; DefiLlama reconciles and prioritizes sources as described. * Vague PR language is interpreted **conservatively**. * Some platforms include ATM capacity in their “fully diluted” share counts; DefiLlama does **not**. * Some platforms do not normalize for ADS structures or historical splits. * Pricing sources and reference times can differ. * Disclosure dates can differ across data vendors. * The method of calculating “mNAV” or “NAV multiple” can vary by platform and by company. #### [](https://docs.llama.fi/analysts/dat-methodology#id-7.-acronyms) 7\. Acronyms * **DAT**: Digital Asset Treasury * **Crypto Treasury Value**: USD value of directly held tokens * **FD**: Fully Diluted * **FD realized**: Completed events only (shares outstanding plus completed actions) * **FD realistic**: GAAP likely dilution (FD realized plus unavoidable GAAP dilution) * **FD maximum**: All fixed-count contractual dilution (FD realistic plus all fixed-share instruments) * **mNAV**: Market to Net Asset Value multiple * **ATM**: At The Market program * **OTM**: Out of the Money * **ITM**: In the Money * **EPS**: Earnings Per Share * **RSU**: Restricted Stock Unit * **PSU**: Performance Stock Unit * **ADS**: American Depositary Share [PreviousCustom columns](https://docs.llama.fi/analysts/custom-columns) [NextHow to change Ethereum's RPC](https://docs.llama.fi/chainlist/how-to-change-ethereums-rpc) Last updated 18 days ago Was this helpful? * [Why one mNAV number can mislead you](https://docs.llama.fi/analysts/dat-methodology#why-one-mnav-number-can-mislead-you) * [Definitions](https://docs.llama.fi/analysts/dat-methodology#definitions) * [Why this three line system is better](https://docs.llama.fi/analysts/dat-methodology#why-this-three-line-system-is-better) * [Exact methodology and sourcing to replicate DefiLlama's mNAV](https://docs.llama.fi/analysts/dat-methodology#exact-methodology-and-sourcing-to-replicate-defillamas-mnav) Was this helpful? --- # Custom columns | DefiLlama Transform your DeFiLlama experience with **Custom Columns**. Go beyond our standard metrics and define your own, turning the protocol table into a personalized analysis powerhouse. Calculate bespoke ratios, track hyper-specific growth rates, combine data points in novel ways, or set conditional flags to instantly spot protocols meeting your criteria – all directly within DeFiLlama. ### [](https://docs.llama.fi/analysts/custom-columns#adding-custom-columns) Adding Custom Columns You can access this feature on the main page, at the bottom of the column selection dropdown. After pressing "Add Custom Column" you'll be able to input name and formula for your custom columns ### [](https://docs.llama.fi/analysts/custom-columns#defining-your-columns) Defining Your Columns * Formula: Input your custom expression here. This field supports a rich syntax leveraging available protocol data, mathematical operators, and curated functions (detailed below). Real-time feedback warns about unrecognized inputs, and a preview shows the calculated result. * Format: Select the desired display format for your calculated values (`Auto`, `Number`, `USD`, `Percent`, `Boolean (✅/❌)`). "Auto" intelligently handles most types, including rendering boolean results as checkmarks. ### [](https://docs.llama.fi/analysts/custom-columns#crafting-formulas) Crafting Formulas The formula engine supports curated set of powerful operations, giving you flexibility in creating the metrics that you need **Available Data Fields** * `mcap`, `tvl` * `tvlPrevDay`, `tvlPrevWeek`, `tvlPrevMonth` * `change_1d`, `change_7d`, `change_1m` (TVL changes in decimal format, e.g., `0.05`) * `fees_24h`, `fees_7d`, `fees_30d`, `fees_1y`, `average_fees_1y`, `cumulativeFees` * `pf` (Market Cap / Annualized Fees), `ps` (Market Cap / Annualized Revenue) * `revenue_24h`, `revenue_7d`, `revenue_30d`, `revenue_1y`, `average_revenue_1y`, `cumulativeRevenue` * `volume_24h`, `volume_7d`, `volumeChange_7d`, `cumulativeVolume` * `category` (String, e.g., "DEX", "Lending") Not every field is available in all protocols, for example volume is only available to protocol with DEXs category, if a protocol lacks a field your formula depends on, the result will be skipped for that row **Operators** Standard mathematical (`+`, `-`, `*`, `/`, `%`, `^`) and logical (`and`, `or`, `not`) operators are available, along with comparison operators (`==`, `!=`, `>`, `>=`, `<`, `<=`). Use parentheses `()` for grouping. The ternary operator (`condition ? value_if_true : value_if_false`) is supported for conditional expressions. **Built-in Functions** We provide a focused set of functions relevant for protocol analysis. Autocomplete (`ƒ` prefix) suggests these as you type, and selecting one adds `()` automatically. * `abs(x)`: Absolute value of x. * `ceil(x)`: Smallest integer greater than or equal to x (rounds up). * `floor(x)`: Largest integer less than or equal to x (rounds down). * `round(x)`: Rounds x to the nearest integer. * `roundTo(x, n)`: Rounds x to n decimal places. **(Highly useful for ratios)** * `sqrt(x)`: Square root of x. * `min(a, b, ...)`: Minimum value from the provided arguments. * `max(a, b, ...)`: Maximum value from the provided arguments. * `if(condition, true_val, false_val)`: Returns `true_val` if `condition` is true, else `false_val`. (Ternary `? :` is often cleaner). * `not(x)`: Logical NOT (inverts a boolean value). **Conditional Expressions & Flags** Create formulas that evaluate to `true` or `false`. Ideal for flagging protocols meeting specific criteria. With the "Format" set to "Auto" or "Boolean (✅/❌)", these display as intuitive checkmarks. * Example: `change_7d > 0.1 and revenue_7d > 100000` (Is 7d TVL growth > 10% AND 7d revenue > $100k?) -> ✅ / ❌ * Example: `category == "Lending" and tvl > 50000000` (Is it a Lending protocol with TVL > $50M?) -> ✅ / ❌ **Formatting** * Use the **Format** dropdown to control the appearance of results (Number, USD, Percent, etc.). "Auto" is often sufficient and handles booleans correctly. ### [](https://docs.llama.fi/analysts/custom-columns#use-case-examples) Use-Case examples 1. High Growth Alert * Formula: `change_7d > 0.15 and fees_7d > (fees_30d / 30 * 7 * 1.2)` * This will show you protocols that have >15% gain in the last 7 days and recent 7d fees significantly above prior run rate. 1. Revenue per TVL * Formula: `revenue_30d / tvl` * Give you ratio of protocol revenue (for the last 30 days) compared to their TVL 1. Annualized Fee Yield * Formula: `fees_1y / tvl` * Measures how well protocol monetizes its TVL [PreviousData Definitions](https://docs.llama.fi/analysts/data-definitions) [NextDAT Methodology](https://docs.llama.fi/analysts/dat-methodology) Last updated 5 months ago Was this helpful? * [Adding Custom Columns](https://docs.llama.fi/analysts/custom-columns#adding-custom-columns) * [Defining Your Columns](https://docs.llama.fi/analysts/custom-columns#defining-your-columns) * [Crafting Formulas](https://docs.llama.fi/analysts/custom-columns#crafting-formulas) * [Use-Case examples](https://docs.llama.fi/analysts/custom-columns#use-case-examples) Was this helpful? --- # Frequently Asked Questions | DefiLlama #### [](https://docs.llama.fi/faqs/frequently-asked-questions#what-is-defillama) What is DefiLlama? DefiLlama is the largest TVL aggregator for DeFi (Decentralized Finance). Our data is fully open-source and maintained by a team of passionate individuals and contributors from hundreds of protocols. Our focus is on accurate data and transparency. #### [](https://docs.llama.fi/faqs/frequently-asked-questions#what-is-tvl) What is TVL? Total Value Locked, or TVL, is the sum of the value of crypto assets that have been deposited by users to a protocol for the purpose of earning rewards or interest. #### [](https://docs.llama.fi/faqs/frequently-asked-questions#how-does-defillama-get-tvl-data) How does DefiLlama get TVL data? Each project that is listed has an adapter/code that returns its TVL. Preference is given to protocols that make on-chain calls to return the TVL and these make up the majority, but some adapters use subgraphs or APIs. The adapters are all open-source, so they are open for review to everyone. #### [](https://docs.llama.fi/faqs/frequently-asked-questions#how-is-defillama-funded) How is DefiLlama funded? Previously DefiLlama was funded by self-funding, donations and grants. Currently DefiLlama is mainly funded by kickbacks from aggregators used on LlamaSwap and subscriptions. #### [](https://docs.llama.fi/faqs/frequently-asked-questions#at-what-frequency-is-data-updated-on-defillama) At what frequency is data updated on DefiLlama? * TVL, Total Borrows, Treasury, Stablecoin Supply, CEX Assets and Oracle TVS update every hour * For DEX Volume, Fees, Revenues, Earnings and other metrics that aren't based on snapshots like TVL but instead on time ranges: Most protocols are updated hourly, but some protocols only update daily, with updates happening on 0:00 UTC * Yield data (APY, Borrow APY, Pool TVL...) is updated hourly * Bridge data is updated hourly #### [](https://docs.llama.fi/faqs/frequently-asked-questions#why-are-the-numbers-from-the-api-different-from-the-numbers-on-the-webpage) Why are the numbers from the API different from the numbers on the webpage? The webpage feeds off the API, so data from API is updated first and then webpage updates afterwards. Because website pages are cached for performance, you might see different values between both sources, but the delay will be 1 hour at most. #### [](https://docs.llama.fi/faqs/frequently-asked-questions#what-is-pool2-tvl) What is Pool2 TVL? Pool2 refers to a type of farm that requires users to take exposure to native tokens issued by the protocol. It is a sort of “secondary pool” to incentivize farmers to continue holding on to the protocol's tokens, or to provide liquidity for these tokens, instead of selling them. #### [](https://docs.llama.fi/faqs/frequently-asked-questions#what-is-staking-tvl) What is Staking TVL? * In many cases, a DeFi protocol will have their core smart contracts with TVL that provides some service, such as a DEX or a lending market, and then separately they'll have a contract where users can stake the protocol's governance token to earn rewards (usually revenue distribution or token inflation). Staking TVL refers to the TVL in these staking contracts, which are independent from the main protocol function. * Examples are CRV locked into veCRV, AAVE locked into stkAAVE, locked CAKE for veCAKE on PancakeSwap... * Staking TVL is never used for staking in Chains (eg ETH PoS staking), it's only for DeFi protocols. * Why we don't include this staking into core TVL by default: - To avoid penalizing protocols that don't have a token or a staking program. - Because this staking is independent from the core protocol function and so a large staking TVL doesn't mean that protocol has traction, it muddies TVL as a proxy for traction. - This staking is largely riskless because if the contracts got hacked the protocol can always cover the loss by minting more governance tokens, and the risk of protocol hack is already baked into the protocol's token. However, for other tokens deposited into the protocol, if the protocol is hacked they would be completely lost. So core TVL provides a signal that the market considers the protocol trustworthy, but staking TVL doesn't provide that signal. Also, staking contracts are independent and simpler than core protocol contracts. #### [](https://docs.llama.fi/faqs/frequently-asked-questions#what-are-borrows) What are borrows? Borrows is a metric found in Lending platforms and refers to the amount of value that has been borrowed through the protocol. #### [](https://docs.llama.fi/faqs/frequently-asked-questions#what-is-doublecount) What is doublecount? Doublecount is a toggle found on the DefiLlama website that gives users the option to count or not count tokens such as receipt tokens or LP tokens received from providing liquidity to a protocol and which have since been deposited to another protocol. #### [](https://docs.llama.fi/faqs/frequently-asked-questions#why-doesnt-defillama-count-ada-sol-eth-staked-into-tvl) Why doesn't DefiLlama count ADA/SOL/ETH staked into TVL? * At DefiLlama we don't count chain staked assets for ANY chain. Users use us to track DeFi adoption, and adding Chain Staking would overshadow the TVL from their DeFi protocols, making chain TVL just a proxy of token marketcap, completely removing usage as a metric to track DeFi adoption. We track liquid staking protocols but these are not included by default into chain TVL. * Example: As of 2025-03-20, Cardano TVL is 330m$, while 15.84bn$ in ADA are staked. Thus if we included staked ADA into TVL, DeFi would make up only 2% of TVL, and due to the frequent 2-5% daily movements in the price of ADA, users wouldn't be able to tell anything about DeFi from that chart. DeFi adoption could double overnight but if ADA price drops -2.5% the chart would go down. #### [](https://docs.llama.fi/faqs/frequently-asked-questions#how-to-list-your-protocol) How to list your protocol? Getting your protocol listed on DefiLlama is very easy and only requires that we have an adapter that returns your projects TVL. We have a guide available on how to write an adapter [here](https://docs.llama.fi/list-your-project/submit-a-project) . #### [](https://docs.llama.fi/faqs/frequently-asked-questions#what-is-treasury-tvl) What is Treasury TVL? Treasury TVL refers funds in the protocol's treasury, not including the platform's own governance token. #### [](https://docs.llama.fi/faqs/frequently-asked-questions#does-defillama-have-an-api) Does DefiLlama have an api? Yes. Our API is an open API and it free to use. Citing DefiLlama as the source is much appreciated. Find the API docs [here](https://defillama.com/docs/api) . #### [](https://docs.llama.fi/faqs/frequently-asked-questions#how-can-i-download-defillama-data) How can I download DefiLlama data? DefiLlama data is available to download in CSV format. You can find a “download” .csv button on various areas of the website: protocol page, chains page, overview and the bottom of the side menu bar. The amount of data retrieved depends on where the button is used, using it on the protocol page retrieves data for the specific protocol, using it on the chains page retrieves info by chain, the others retrieve all TVL data on the website. #### [](https://docs.llama.fi/faqs/frequently-asked-questions#why-dont-we-include-assets-in-other-custodian-under-a-cexs-assets) Why don't we include assets in other custodian under a CEX's assets? * Our users use our CEX asset metrics in order to see how much the market trusts a CEX with their capital, which is used as a proxy for how safe a CEX is to leave their money in. Deposits in a different custodian are completely independent from this and don't provide that safety market signal. * If we included custodians it'd open the door for our metric to be abused, for example by hypothetical CEX with 100m and 2bn in custodian vaults, displaying their assets as 2.1bn would give the signal that 2.1bn trust them with their money, when actually the opposite is true and 95% of their users trust them so little to keep the custody safe that theyre paying extra to have the custody segregated. If that CEX got hacked or had some issue and 95m was withdrawn, our metrics would show a 4.5% outflow, giving the signal that outflow is minimal and there's no danger of a run on the bank, when 95% have been withdrawn and actually the CEX is on the late stages of a bank run. * TLDR: by including custodian assets we'd end up giving the opposite signals for our users, and our goal is to provide data that helps in their decisions, not the opposite. #### [](https://docs.llama.fi/faqs/frequently-asked-questions#why-does-defillama-rank-protocols-by-premium-volume-instead-of-notional-volume) Why does DefiLlama rank protocols by premium volume instead of notional volume? There was a huge problem with washtrading options that had huge notional value but tiny premiums, which led to highly inflated notional volumes. That's why we switched to using premium volume because it reflected usage much better. [PreviousAdd a new RPC endpoint](https://docs.llama.fi/chainlist/add-a-new-rpc-endpoint) [NextCoin Prices API](https://docs.llama.fi/coin-prices-api) Last updated 5 months ago Was this helpful? Was this helpful? --- # Function Reference | DefiLlama [](https://docs.llama.fi/spreadsheet-functions/function-reference#available-metrics) Available Metrics ----------------------------------------------------------------------------------------------------------- Metric Description `tvl` Total Value Locked `borrows` Total borrowed amounts `fees` Protocol fees `revenue` Protocol revenue `holders-revenue` Revenue distributed to token holders `volume` DEX trading volume `perps` Perpetuals trading volume `mcap` Market capitalization `stablecoins` Stablecoin market cap `fdv` Fully diluted valuation `ofdv` Outstanding FDV `price` Token price [](https://docs.llama.fi/spreadsheet-functions/function-reference#core-functions) Core Functions ----------------------------------------------------------------------------------------------------- ### [](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama) DEFILLAMA Get current metrics for any protocol or chain. Copy DEFILLAMA(metric, name, [timeframe]) **Parameters:** * `metric`: See [Available Metrics](https://docs.llama.fi/spreadsheet-functions/function-reference#available-metrics) * `name`: Protocol or chain name * `timeframe`: `24h` (default), `7d`, `30d`, `all` (optional) - used for metrics like fees/volume/revenue **Returns:** Numeric value **Examples:** * * * ### [](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_historical) DEFILLAMA\_HISTORICAL Get historical data for any metric. **Parameters:** * `metric`: See [Available Metrics](https://docs.llama.fi/spreadsheet-functions/function-reference#available-metrics) * `name`: Protocol or chain name * `startDate`: Date format `yyyy-mm-dd` or numeric date * `endDate`: Optional, returns array if provided **Returns:** Single numeric value or 2-column array (dates, values) **Examples:** * * * ### [](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_info) DEFILLAMA\_INFO Get all available metrics for a protocol or chain. **Parameters:** * `entity`: Protocol or chain name **Returns:** 2-column array with metric names and values **Example:** * * * [](https://docs.llama.fi/spreadsheet-functions/function-reference#utility-functions) Utility Functions ----------------------------------------------------------------------------------------------------------- ### [](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_metrics) DEFILLAMA\_METRICS List all available metrics. [](https://docs.llama.fi/spreadsheet-functions/function-reference#returns-2-column-array-with-metric-names-and-descriptions) **Returns:** 2-column array with metric names and descriptions ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ### [](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_chains) DEFILLAMA\_CHAINS List all supported blockchains. **Returns:** 3-column array with chain name, ticker symbol, and TVL * * * ### [](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_protocols) DEFILLAMA\_PROTOCOLS List all tracked protocols. **Returns:** 5-column array with protocol name, category, symbol, TVL, and market cap [](https://docs.llama.fi/spreadsheet-functions/function-reference#yield-functions) Yield Functions ------------------------------------------------------------------------------------------------------- ### [](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_yield) DEFILLAMA\_YIELD Filter and find yield pools. **Parameters (all optional):** * `chain`: Blockchain name (e.g., "Ethereum", "Arbitrum") * `token`: Token symbol (e.g., "USDC", "ETH") * `sortBy`: `apy` (default), `tvl`, `apyBase`, `apyReward` * `limit`: Max results (default: 50) **Returns:** Array with pool name, chain, project, TVL, APY, tokens **Examples:** * * * ### [](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_yield_pool) DEFILLAMA\_YIELD\_POOL Get detailed information for a specific pool. **Parameters:** * `poolId`: Unique pool identifier **Returns:** Array with pool details (name, chain, TVL, APY breakdown, tokens, risk metrics) **Example:** * * * ### [](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_yield_top_pools) DEFILLAMA\_YIELD\_TOP\_POOLS Get top performing yield pools. **Parameters:** * `limit`: Number of pools (default: 20) **Returns:** Array with top pools sorted by APY **Example:** * * * ### [](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_yield_chains) DEFILLAMA\_YIELD\_CHAINS List available chains for yield filtering. **Returns:** Array of chain names available in yield pools **Example:** * * * ### [](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_yield_projects) DEFILLAMA\_YIELD\_PROJECTS List available projects for yield filtering. **Returns:** Array of project names available in yield pools * * * [](https://docs.llama.fi/spreadsheet-functions/function-reference#stablecoin-functions) Stablecoin Functions ----------------------------------------------------------------------------------------------------------------- ### [](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_stablecoins) DEFILLAMA\_STABLECOINS List all tracked stablecoins. **Returns:** Array with stablecoin name, symbol, market cap, price, dominant chain * * * ### [](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_stablecoin_mcap) DEFILLAMA\_STABLECOIN\_MCAP Get stablecoin market cap. **Parameters (all optional):** * `name`: Stablecoin name or symbol (default: "all" for total) * `chain`: Blockchain filter (default: "all" for aggregate) **Returns:** Numeric value (market cap in USD) **Examples:** * * * ### [](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_stablecoin_history) DEFILLAMA\_STABLECOIN\_HISTORY Get historical stablecoin data. **Parameters:** * `name`: Stablecoin name, symbol, or "all" * `startDate`: Date format `yyyy-mm-dd` or numeric date * `endDate`: Optional end date (returns array if provided) * `chain`: Optional blockchain filter (default: "all") **Returns:** Single value or 2-column array (dates, market caps) **Examples:** * * * [PreviousOverview](https://docs.llama.fi/spreadsheet-functions/spreadsheet-functions) [NextData Definitions](https://docs.llama.fi/analysts/data-definitions) Last updated 21 days ago Was this helpful? * [Available Metrics](https://docs.llama.fi/spreadsheet-functions/function-reference#available-metrics) * [Core Functions](https://docs.llama.fi/spreadsheet-functions/function-reference#core-functions) * [DEFILLAMA](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama) * [DEFILLAMA\_HISTORICAL](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_historical) * [DEFILLAMA\_INFO](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_info) * [Utility Functions](https://docs.llama.fi/spreadsheet-functions/function-reference#utility-functions) * [DEFILLAMA\_METRICS](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_metrics) * [Returns: 2-column array with metric names and descriptions](https://docs.llama.fi/spreadsheet-functions/function-reference#returns-2-column-array-with-metric-names-and-descriptions) * [DEFILLAMA\_CHAINS](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_chains) * [DEFILLAMA\_PROTOCOLS](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_protocols) * [Yield Functions](https://docs.llama.fi/spreadsheet-functions/function-reference#yield-functions) * [DEFILLAMA\_YIELD](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_yield) * [DEFILLAMA\_YIELD\_POOL](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_yield_pool) * [DEFILLAMA\_YIELD\_TOP\_POOLS](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_yield_top_pools) * [DEFILLAMA\_YIELD\_CHAINS](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_yield_chains) * [DEFILLAMA\_YIELD\_PROJECTS](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_yield_projects) * [Stablecoin Functions](https://docs.llama.fi/spreadsheet-functions/function-reference#stablecoin-functions) * [DEFILLAMA\_STABLECOINS](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_stablecoins) * [DEFILLAMA\_STABLECOIN\_MCAP](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_stablecoin_mcap) * [DEFILLAMA\_STABLECOIN\_HISTORY](https://docs.llama.fi/spreadsheet-functions/function-reference#defillama_stablecoin_history) Was this helpful? Copy =DEFILLAMA("tvl", "Ethereum") =DEFILLAMA("fees", "Uniswap-v2", "24h") =DEFILLAMA("volume", "GMX", "7d") Copy DEFILLAMA_HISTORICAL(metric, name, startDate, [endDate]) Copy =DEFILLAMA_HISTORICAL("tvl", "Ethereum", "2024-01-01") =DEFILLAMA_HISTORICAL("fees", "Uniswap", "2024-01-01", "2024-01-31") Copy DEFILLAMA_INFO(entity) Copy =DEFILLAMA_INFO("Aave") Copy DEFILLAMA_METRICS() Copy DEFILLAMA_CHAINS() Copy DEFILLAMA_PROTOCOLS() Copy DEFILLAMA_YIELD([chain], [token], [sortBy], [limit]) Copy =DEFILLAMA_YIELD() =DEFILLAMA_YIELD("Ethereum", "USDC") =DEFILLAMA_YIELD("", "ETH", "tvl", 10) Copy DEFILLAMA_YIELD_POOL(poolId) Copy =DEFILLAMA_YIELD_POOL("747c1d2a-c668-4682-b9f9-296708a3dd90") Copy DEFILLAMA_YIELD_TOP_POOLS([limit]) Copy =DEFILLAMA_YIELD_TOP_POOLS(50) Copy DEFILLAMA_YIELD_CHAINS() Copy =DEFILLAMA_YIELD_CHAINS() Copy DEFILLAMA_YIELD_PROJECTS() Copy DEFILLAMA_STABLECOINS() Copy DEFILLAMA_STABLECOIN_MCAP([name], [chain]) Copy =DEFILLAMA_STABLECOIN_MCAP() =DEFILLAMA_STABLECOIN_MCAP("USDC") =DEFILLAMA_STABLECOIN_MCAP("USDT", "Ethereum") Copy DEFILLAMA_STABLECOIN_HISTORY(name, startDate, [endDate], [chain]) Copy =DEFILLAMA_STABLECOIN_HISTORY("USDC", "2024-01-01") =DEFILLAMA_STABLECOIN_HISTORY("USDT", "2024-01-01", "2024-12-31") =DEFILLAMA_STABLECOIN_HISTORY("all", "2024-01-01", "2024-12-31", "Ethereum") --- # DefiLlama and our methodology | DefiLlama We pride ourselves in producing inclusive, non-biased, and community driven statistics for the decentralised finance industry. We do our best to treat all projects equally with regards to what is and isn't included in TVL, how long it takes to list or update a project's TVL, and everything else. ### [](https://docs.llama.fi/list-your-project#our-methodology) Our Methodology At DefiLlama we consider the value of any tokens locked in the contracts of a protocol / platform as TVL. Below are some notes about how our calculations work. Valuing different tokens: * Almost all tokens are priced using CoinGecko's API. Where this can't be done, we can accommodate using on-chain methods to quantify the value of a token. This is most commonly done by comparing the pool weights of a very liquid Uniswap V2 market. * We don't count any tokens that are not circulating or are yet to be issued. For example if a team locks a share of their tokens in a vesting contract we won't count these as TVL, since these tokens haven't been issued yet. * We don't double-count within the same protocol. If users can deposit a token, get a receipt token and deposit that in another part of your protocol we'll only count it once. For example Cream has an ETH2 liquid staking token, which can be lent on their money market, we only count it once. Node validators and other chain-native token staking: * We don't count native token staking. For example, ATOM staking to secure the Cosmos hub isn't counted. Liquid staking protocols are tracked but not counted towards chain TVL by default. Bridges: * There are arguments both for including bridge TVL on the origin chain and the destination chain. Therefore we count the TVL of bridge projects but do not contribute them towards the TVL of any chain. Smart Wallets: * We don't count funds in smart contract wallets, such as Argent or Gnosis Safe. In the case of protocols that move money to different chains, TVL is counted on the chain where the users deposited the money and interacted with the protocol. [NextHow to list a DeFi project](https://docs.llama.fi/list-your-project/submit-a-project) Last updated 5 months ago Was this helpful? --- # Email Protection | Cloudflare Please enable cookies. Email Protection ================ You are unable to access this email address docs.llama.fi --------------------------------------------------------- The website from which you got to this page is protected by Cloudflare. Email addresses on that page have been hidden in order to keep them from being accessed by malicious bots. **You must enable Javascript in your browser in order to decode the e-mail address**. If you have a website and are interested in protecting it in a similar way, you can [sign up for Cloudflare](https://www.cloudflare.com/sign-up?utm_source=email_protection) . * [How does Cloudflare protect email addresses on website from spammers?](https://developers.cloudflare.com/waf/tools/scrape-shield/email-address-obfuscation/) * [Can I sign up for Cloudflare?](https://developers.cloudflare.com/fundamentals/setup/account/create-account/) Cloudflare Ray ID: **9b2aaa67890ef3c4** • Your IP: Click to reveal 54.237.218.47 • Performance & security by [Cloudflare](https://www.cloudflare.com/5xx-error-landing) --- # How to change Ethereum's RPC | DefiLlama To change the RPC endpoint used for Ethereum follow these steps: 1. Enter your MetaMask and click on your RPC endpoint at the top of your MetaMask. By default it says “Ethereum Mainnet.” 2. Click “Add Network” 3. Add the RPC URL you want to use, with a chainID of `1` and currency of `ETH`. 4. Click “Save” ![](https://docs.llama.fi/~gitbook/image?url=https%3A%2F%2F2397802182-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MVnGnXr5_eAilN_e5PP%252Fuploads%252Fgit-blob-97eb2952f5e31d751f06dd70169cb49c7d67083d%252Fmetamask-add.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=ed12da80&sv=2) [PreviousDAT Methodology](https://docs.llama.fi/analysts/dat-methodology) [NextAdd a new RPC endpoint](https://docs.llama.fi/chainlist/add-a-new-rpc-endpoint) Last updated 3 years ago Was this helpful? --- # Overview | DefiLlama [](https://docs.llama.fi/spreadsheet-functions#google-sheets) Google Sheets -------------------------------------------------------------------------------- ### [](https://docs.llama.fi/spreadsheet-functions#installation) Installation Open the listing on [Google Workspace Marketplace](https://workspace.google.com/marketplace/app/defillama_sheets/571407189628) to install the add-on. ### [](https://docs.llama.fi/spreadsheet-functions#setup) Setup 1. **Extensions** → **DefiLlama** → **Open Sidebar** 2. Click **Sign In** 3. Authorize with your defillama account ### [](https://docs.llama.fi/spreadsheet-functions#test) Test Copy =DEFILLAMA("price", "Bitcoin") * * * [](https://docs.llama.fi/spreadsheet-functions#quick-examples) Quick Examples ---------------------------------------------------------------------------------- Copy // Current data =DEFILLAMA("tvl", "Ethereum") =DEFILLAMA("fees", "Uniswap", "24h") =DEFILLAMA("price", "Bitcoin") // Historical =DEFILLAMA_HISTORICAL("tvl", "Aave", "2024-01-01") // Yields =DEFILLAMA_YIELD("Arbitrum", "USDC", "apy", 10) =DEFILLAMA_YIELD_TOP_POOLS(20) // Stablecoins =DEFILLAMA_STABLECOIN_MCAP() // Total market cap =DEFILLAMA_STABLECOIN_MCAP("USDC", "Ethereum") [](https://docs.llama.fi/spreadsheet-functions#next-steps) Next Steps -------------------------------------------------------------------------- * [Function Reference](https://docs.llama.fi/spreadsheet-functions/function-reference) - Complete parameter documentation [PreviousOracles TVS](https://docs.llama.fi/list-your-project/oracles-tvs) [NextFunction Reference](https://docs.llama.fi/spreadsheet-functions/function-reference) Last updated 21 days ago Was this helpful? --- # Data Definitions | DefiLlama ### [](https://docs.llama.fi/analysts#total-value-locked-tvl) Total Value Locked (TVL) For protocols: Value of all coins held in smart contracts of the protocol For chains: Sum of TVL of the protocols in that chain In traditional finance terms, TVL is similar to Assets Under Management (AUM). It represents the total value of assets that users deposit into a protocol. This is similar to how a fund or bank might report the total value of client deposits or managed assets. ### [](https://docs.llama.fi/analysts#fees) Fees Total fees paid by users when using the protocol. Fees are equivalent to what would traditionally be considered Revenue in most off-chain businesses. They reflect the total amount paid by users for using the service, regardless of where those fees end up. This is the top-line number that shows how much the protocol is facilitating in economic activity. ### [](https://docs.llama.fi/analysts#revenue) Revenue Subset of fees that the protocol collects for itself, usually going to the protocol treasury, the team or distributed among token holders. This doesn't include any fees distributed to Liquidity Providers. Revenue, in the way we define it here, is closer to Gross Income in traditional accounting. It’s the portion of fees that the protocol keeps for itself after paying out costs to actors like liquidity providers. This is what goes to the team, the treasury, or tokenholders. ### [](https://docs.llama.fi/analysts#token-holder-revenue) Token Holder Revenue Subset of revenue that is distributed to tokenholders by means of buyback and burn, burning fees or direct distribution to stakers. Token Holder Revenue is similar to Dividends in traditional finance terms. It’s the part of protocol revenue that is returned to tokenholders through staking rewards, fee burns, or direct payouts. Like dividends, this shows how much value the protocol is distributing back to its investors. ### [](https://docs.llama.fi/analysts#usd-inflows) USD Inflows A protocol's TVL might go down even if more assets are deposited in the scenario where the prices of assets comprising TVL go down, so just looking at the TVL chart is not the best way to see if a protocol is receiving deposits or money is exiting, as that info gets mixed with price movements. USD Inflows is a metric that fixes that by representing the net asset inflows into a protocol's TVL. It's calculated by taking the balance difference for each asset between two consecutive days, multiplying that difference by asset price and then summing that for all assets. If a protocol has all of its TVL in ETH and one day ETH price drops 20% while there are no new deposits or withdrawals, TVL will drop by 20% while USD inflows will be 0$. ### [](https://docs.llama.fi/analysts#staked) Staked Value of governance coins that are staked in the protocol's staking system. ### [](https://docs.llama.fi/analysts#annual-operational-expenses) Annual Operational Expenses Operational costs for salaries, audits... throughout the year. We collect this data mainly from annual protocol reports on their forums, so it's always referencing old data and likely to be outdated up till 1 year. ### [](https://docs.llama.fi/analysts#total-raised) Total Raised Sum of all money raised by the protocol, including VC funding rounds, public sales and ICOs. ### [](https://docs.llama.fi/analysts#active-addresses-24h) Active Addresses (24h) Number of unique addresses that have interacted with the protocol directly in the last 24 hours. Interactions are counted as transactions sent directly against the protocol, thus transactions that go through an aggregator or some other middleman contract are not counted here. The reasoning for this is that this is meant to help measure stickiness/loyalty of users, and users that are interacting with the protocol through another product aren't likely to be sticky. ### [](https://docs.llama.fi/analysts#treasury) Treasury Value of coins held in ownership by the protocol. By default this excludes coins created by the protocol itself. In traditional finance, terms, the Treasury is the protocol’s Total Assets. This is what the protocol controls directly, and is often used to fund operations, growth initiatives, or serve as a reserve. ### [](https://docs.llama.fi/analysts#token-volume) Token Volume Sum of value in all swaps to or from that token across all Centralized and Decentralized exchanges tracked by coingecko. Example: for SBR this was all the volume done on SBR/ANY pairs on FTX, Serum... Data for this metric is imported directly from CoinGecko. ### [](https://docs.llama.fi/analysts#token-liquidity) Token liquidity Sum of value locked in DEX pools that include that token across all DEXs for which DefiLlama tracks pool data. Example: There's a SOL/SBR pool on Orca (Solana DEX) with 25k of TVL on that pool, so this 25k counts towards the liquidity of SBR. ### [](https://docs.llama.fi/analysts#fully-diluted-valuation-fdv) Fully Diluted Valuation (FDV) Fully Diluted Valuation, this is calculated by taking the expected maximum supply of the token and multiplying it by the price. It's mainly used to calculate the hypothetical marketcap of the token if all the tokens were unlocked and circulating. Data for this metric is imported directly from coingecko. ### [](https://docs.llama.fi/analysts#volume) Volume Volume traded on the DEX, this metric is only applicable to protocols that are DEXs (in this case only Saber), and it's just the sum of value of all trades that went through the DEX on a given day. ### [](https://docs.llama.fi/analysts#events) Events This is a manually curated list of events that impacted the protocol. The reason why we display this is just to help the user understand the reason behind changes in the protocol metrics. Example: When there's a hack that causes a sudden drop in TVL we add an event at that date explaining that a hack was the reason why TVL dropped. ### [](https://docs.llama.fi/analysts#median-apy) Median APY Median APY across DeFi pools tracked by DefiLlama that include a given asset. This is calculated by finding all pools for an asset, then sorting them by APY and finding the median weighted by TVL. ### [](https://docs.llama.fi/analysts#contributors) Contributors Number of unique github accounts that made at least one commit to a repository in the github organization of a given project. ### [](https://docs.llama.fi/analysts#developers) Developers Number of unique github accounts that made at least one commit on three distinct months to a repository in the github organization of a given project. ### [](https://docs.llama.fi/analysts#assets-for-cexs) Assets (for CEXs) This includes all the assets that the CEX has under their custody, excluding any assets that are under a different custodian but are credited inside the CEX for use as collateral. [PreviousFunction Reference](https://docs.llama.fi/spreadsheet-functions/function-reference) [NextCustom columns](https://docs.llama.fi/analysts/custom-columns) Last updated 5 months ago Was this helpful? --- # Frequently Asked Questions | DefiLlama #### [](https://docs.llama.fi/faqs#what-is-defillama) What is DefiLlama? DefiLlama is the largest TVL aggregator for DeFi (Decentralized Finance). Our data is fully open-source and maintained by a team of passionate individuals and contributors from hundreds of protocols. Our focus is on accurate data and transparency. #### [](https://docs.llama.fi/faqs#what-is-tvl) What is TVL? Total Value Locked, or TVL, is the sum of the value of crypto assets that have been deposited by users to a protocol for the purpose of earning rewards or interest. #### [](https://docs.llama.fi/faqs#how-does-defillama-get-tvl-data) How does DefiLlama get TVL data? Each project that is listed has an adapter/code that returns its TVL. Preference is given to protocols that make on-chain calls to return the TVL and these make up the majority, but some adapters use subgraphs or APIs. The adapters are all open-source, so they are open for review to everyone. #### [](https://docs.llama.fi/faqs#how-is-defillama-funded) How is DefiLlama funded? Previously DefiLlama was funded by self-funding, donations and grants. Currently DefiLlama is mainly funded by kickbacks from aggregators used on LlamaSwap and subscriptions. #### [](https://docs.llama.fi/faqs#at-what-frequency-is-data-updated-on-defillama) At what frequency is data updated on DefiLlama? * TVL, Total Borrows, Treasury, Stablecoin Supply, CEX Assets and Oracle TVS update every hour * For DEX Volume, Fees, Revenues, Earnings and other metrics that aren't based on snapshots like TVL but instead on time ranges: Most protocols are updated hourly, but some protocols only update daily, with updates happening on 0:00 UTC * Yield data (APY, Borrow APY, Pool TVL...) is updated hourly * Bridge data is updated hourly #### [](https://docs.llama.fi/faqs#why-are-the-numbers-from-the-api-different-from-the-numbers-on-the-webpage) Why are the numbers from the API different from the numbers on the webpage? The webpage feeds off the API, so data from API is updated first and then webpage updates afterwards. Because website pages are cached for performance, you might see different values between both sources, but the delay will be 1 hour at most. #### [](https://docs.llama.fi/faqs#what-is-pool2-tvl) What is Pool2 TVL? Pool2 refers to a type of farm that requires users to take exposure to native tokens issued by the protocol. It is a sort of “secondary pool” to incentivize farmers to continue holding on to the protocol's tokens, or to provide liquidity for these tokens, instead of selling them. #### [](https://docs.llama.fi/faqs#what-is-staking-tvl) What is Staking TVL? * In many cases, a DeFi protocol will have their core smart contracts with TVL that provides some service, such as a DEX or a lending market, and then separately they'll have a contract where users can stake the protocol's governance token to earn rewards (usually revenue distribution or token inflation). Staking TVL refers to the TVL in these staking contracts, which are independent from the main protocol function. * Examples are CRV locked into veCRV, AAVE locked into stkAAVE, locked CAKE for veCAKE on PancakeSwap... * Staking TVL is never used for staking in Chains (eg ETH PoS staking), it's only for DeFi protocols. * Why we don't include this staking into core TVL by default: - To avoid penalizing protocols that don't have a token or a staking program. - Because this staking is independent from the core protocol function and so a large staking TVL doesn't mean that protocol has traction, it muddies TVL as a proxy for traction. - This staking is largely riskless because if the contracts got hacked the protocol can always cover the loss by minting more governance tokens, and the risk of protocol hack is already baked into the protocol's token. However, for other tokens deposited into the protocol, if the protocol is hacked they would be completely lost. So core TVL provides a signal that the market considers the protocol trustworthy, but staking TVL doesn't provide that signal. Also, staking contracts are independent and simpler than core protocol contracts. #### [](https://docs.llama.fi/faqs#what-are-borrows) What are borrows? Borrows is a metric found in Lending platforms and refers to the amount of value that has been borrowed through the protocol. #### [](https://docs.llama.fi/faqs#what-is-doublecount) What is doublecount? Doublecount is a toggle found on the DefiLlama website that gives users the option to count or not count tokens such as receipt tokens or LP tokens received from providing liquidity to a protocol and which have since been deposited to another protocol. #### [](https://docs.llama.fi/faqs#why-doesnt-defillama-count-ada-sol-eth-staked-into-tvl) Why doesn't DefiLlama count ADA/SOL/ETH staked into TVL? * At DefiLlama we don't count chain staked assets for ANY chain. Users use us to track DeFi adoption, and adding Chain Staking would overshadow the TVL from their DeFi protocols, making chain TVL just a proxy of token marketcap, completely removing usage as a metric to track DeFi adoption. We track liquid staking protocols but these are not included by default into chain TVL. * Example: As of 2025-03-20, Cardano TVL is 330m$, while 15.84bn$ in ADA are staked. Thus if we included staked ADA into TVL, DeFi would make up only 2% of TVL, and due to the frequent 2-5% daily movements in the price of ADA, users wouldn't be able to tell anything about DeFi from that chart. DeFi adoption could double overnight but if ADA price drops -2.5% the chart would go down. #### [](https://docs.llama.fi/faqs#how-to-list-your-protocol) How to list your protocol? Getting your protocol listed on DefiLlama is very easy and only requires that we have an adapter that returns your projects TVL. We have a guide available on how to write an adapter [here](https://docs.llama.fi/list-your-project/submit-a-project) . #### [](https://docs.llama.fi/faqs#what-is-treasury-tvl) What is Treasury TVL? Treasury TVL refers funds in the protocol's treasury, not including the platform's own governance token. #### [](https://docs.llama.fi/faqs#does-defillama-have-an-api) Does DefiLlama have an api? Yes. Our API is an open API and it free to use. Citing DefiLlama as the source is much appreciated. Find the API docs [here](https://defillama.com/docs/api) . #### [](https://docs.llama.fi/faqs#how-can-i-download-defillama-data) How can I download DefiLlama data? DefiLlama data is available to download in CSV format. You can find a “download” .csv button on various areas of the website: protocol page, chains page, overview and the bottom of the side menu bar. The amount of data retrieved depends on where the button is used, using it on the protocol page retrieves data for the specific protocol, using it on the chains page retrieves info by chain, the others retrieve all TVL data on the website. #### [](https://docs.llama.fi/faqs#why-dont-we-include-assets-in-other-custodian-under-a-cexs-assets) Why don't we include assets in other custodian under a CEX's assets? * Our users use our CEX asset metrics in order to see how much the market trusts a CEX with their capital, which is used as a proxy for how safe a CEX is to leave their money in. Deposits in a different custodian are completely independent from this and don't provide that safety market signal. * If we included custodians it'd open the door for our metric to be abused, for example by hypothetical CEX with 100m and 2bn in custodian vaults, displaying their assets as 2.1bn would give the signal that 2.1bn trust them with their money, when actually the opposite is true and 95% of their users trust them so little to keep the custody safe that theyre paying extra to have the custody segregated. If that CEX got hacked or had some issue and 95m was withdrawn, our metrics would show a 4.5% outflow, giving the signal that outflow is minimal and there's no danger of a run on the bank, when 95% have been withdrawn and actually the CEX is on the late stages of a bank run. * TLDR: by including custodian assets we'd end up giving the opposite signals for our users, and our goal is to provide data that helps in their decisions, not the opposite. #### [](https://docs.llama.fi/faqs#why-does-defillama-rank-protocols-by-premium-volume-instead-of-notional-volume) Why does DefiLlama rank protocols by premium volume instead of notional volume? There was a huge problem with washtrading options that had huge notional value but tiny premiums, which led to highly inflated notional volumes. That's why we switched to using premium volume because it reflected usage much better. [PreviousAdd a new RPC endpoint](https://docs.llama.fi/chainlist/add-a-new-rpc-endpoint) [NextCoin Prices API](https://docs.llama.fi/coin-prices-api) Last updated 5 months ago Was this helpful? ---