Skip to content

Humble docs contributions #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ At DefiLlama we consider the value of any tokens locked in the contracts of a pr
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 their tokens in a vesting contract we won't count these as TVL, since these tokens haven't been issued yet.
* 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:
Expand Down
4 changes: 2 additions & 2 deletions analysts/custom-columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The formula engine supports curated set of powerful operations, giving you flexi
* `category` (String, e.g., "DEX", "Lending")

{% hint style="info" %}
Not every fields 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
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
{% endhint %}

**Operators**
Expand Down Expand Up @@ -62,7 +62,7 @@ Create formulas that evaluate to `true` or `false`. Ideal for flagging protocols
### 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 has >15% gain in the last 7 days and recent 7d fees significantly above prior run rate.
* This will show you protocols that have >15% gain in the last 7 days and recent 7d fees significantly above prior run rate.

2. Revenue per TVL
* Formula: `revenue_30d / tvl`
Expand Down
4 changes: 2 additions & 2 deletions analysts/data-definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ USD Inflows is a metric that fixes that by representing the net asset inflows in

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 it's 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$.
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$.

### Staked

Value of governance coins that are staked in the protocol's staking system.

### Annual Operational Expenses

Operational costs for salaries, audits... througout 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.
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.

### Total Raised

Expand Down
8 changes: 4 additions & 4 deletions coin-prices-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ An adapter is just a javascript file that exports an async function that returns
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 tracability inside the database
adapter: 'aave', // unique adapters identifier, used for traceability inside the database
symbol: "USDT", // symbol of the token
condfidence: 0.7, // number 0-1 desribing the reliablility of the price data (more information below)
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
};
Expand All @@ -33,7 +33,7 @@ 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:
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'

Expand All @@ -60,6 +60,6 @@ getTokenPrices() uses a variety of functions and libraries to find token prices:
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 doesnt enter the database. Notice on lines 57 and 64 where unexpected data is excluded from the writes list by returning from the map function.
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!
6 changes: 3 additions & 3 deletions faqs/frequently-asked-questions.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Each project that is listed has an adapter/code that returns its TVL. Preference

#### 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.
Previously DefiLlama was funded by self-funding, donations and grants. Currently DefiLlama is mainly funded by kickbacks from aggregators used on LlamaSwap and subscriptions.

#### At what frequency is data updated on DefiLlama?

Expand Down Expand Up @@ -56,7 +56,7 @@ Doublecount is a toggle found on the DefiLlama website that gives users the opti
#### 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 wouldnt 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.
* 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.

#### How to list your protocol?

Expand All @@ -72,7 +72,7 @@ Yes. Our API is an open API and it free to use. Citing DefiLlama as the source i

#### 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.
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.

#### Why don't we include assets in other custodian under a CEX's assets?

Expand Down
4 changes: 2 additions & 2 deletions how-to-update-metadata.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
How to update metadata

Step 1. fork defillama-server
Step 1. Fork defillama-server

Step 2. Check data.ts or data2.ts to find your project listing

- find the part you would like to update(i.e. name, token address or symbol, description, twitter handle, etc..)
- find the part you would like to update (i.e. name, token address or symbol, description, twitter handle, etc..)
- commit your changes on your branch and submit a PR

Step 3. If you need to add an audit link
Expand Down
2 changes: 1 addition & 1 deletion list-your-project/emissions-dashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Just like for TVL adapters, if you'd like to add an emissions schedule to DefiLl
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 ](protocol-files.md)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 there a monitored regularly.
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.

![prayge](https://cdn.discordapp.com/emojis/1011049613186318376.webp?size=48\&quality=lossless)
4 changes: 2 additions & 2 deletions list-your-project/how-to-add-a-new-blockchain.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You need to add the name of the blockchain in the `projects/helper/chains.json`
]
```

You should use the field shortName from [https://chainlist.org/rpcs.json](https://chainlist.org/rpcs.json)
You should use the field shortName from [https://chainlist.org/rpcs.json](https://chainlist.org/rpcs.json)

***

Expand All @@ -52,7 +52,7 @@ This ensures tokens on the new blockchain (`zklink`) are properly recognized, in

#### 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
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**:

Expand Down
2 changes: 1 addition & 1 deletion list-your-project/how-to-add-new-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ LLAMA_RPC: "https://rpc1.llama.defi,https://rpc2.llama.defi"
```


**NOTE:** Adding new chain config doesnt automatically list it in Defillama, one would still need to add an adapter for defi app on given chain for it to show up
**NOTE:** Adding new chain config doesn't automatically list it in DefiLlama, one would still need to add an adapter for defi app on given chain for it to show up
4 changes: 2 additions & 2 deletions list-your-project/how-to-update-a-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ If you'd like to update the code used to calculate the TVL of a DeFi project alr
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 there a monitored regularly.
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.

### 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.
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.
Expand Down
12 changes: 6 additions & 6 deletions list-your-project/how-to-update-metadata.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
How to update metadata

Step 1. fork defillama-server
Step 1. Fork defillama-server

Step 2. Check data.ts or data2.ts to find your project listing

- find the part you would like to update(i.e. name, token address or symbol, description, twitter handle, etc..)
- find the part you would like to update (i.e. name, token address or symbol, description, twitter handle, etc..)
- commit your changes on your branch and submit a PR

Step 3. If you need to add an audit link
Expand All @@ -20,10 +20,10 @@ Step 3. If you need to add an audit link

Step 4. If you need to update the logo

- make sure that you have defillama-app repo also
- check the name for the logo on the listing(it should be the same as the protocol name)
- upload the new logo with the same name to defillama-server/defi/icons
- make sure that you also have defillama-app repo
- check the name for the logo on the listing (it should be the same as the protocol name)
- upload the new logo, with the same name, to defillama-server/defi/icons
- commit your changes and submit the pull request
- also upload a smaller logo 24x24 pixel & .jpg format to defillama-app/public/icons
- also upload a smaller logo (24x24 pixel, .jpg format) to defillama-app/public/icons
- commit your changes and submit the pull request

2 changes: 1 addition & 1 deletion list-your-project/how-to-write-an-sdk-adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ An adapter is just some code that takes in a UNIX timestamp and chain block heig

### Basic adapter

Below, you can see the one we use for Mint Club on Binance Smart Chain (BSC). Let's walk through it to get a better understanding of how it works.
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.

{% code title="projects/mint-club/index.js" %}
```javascript
Expand Down
2 changes: 1 addition & 1 deletion list-your-project/submit-a-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ If you'd like to list a DeFi project on DefiLlama:
2. Add a new folder with the same name as the project to projects/.
3. Write an [SDK adapter](how-to-write-an-sdk-adapter.md) 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 there a monitored regularly.
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).

Expand Down