Total Value Locked calculation
Total Value Locked (TVL) - Total amount of locked tokens in Drop Protocol.
Steps to get current TVL:
- Go to celat.one page, search for the core contract of your instance
- Query config and go to puppeteer contract
- Query
extensionmessage to get all current delegations
Example of output:
{
"data": {
"delegations": {
"delegations": [
{
"delegator": "cosmos1nujy3vl3rww3cy8tf8pdru5jp3f9ppmkadws553ck3qryg2tjanqt39xnv",
"validator": "cosmosvaloper1rndyjagfg0nsedl2uy5n92vssn8aj5n67t0nfx",
"amount": {
"denom": "stake",
"amount": "78518979151"
}
},
{
"delegator": "cosmos1nujy3vl3rww3cy8tf8pdru5jp3f9ppmkadws553ck3qryg2tjanqt39xnv",
"validator": "cosmosvaloper1gh4vzw9wsfgl2h37qqnetet0m4wrzm7v7x3j9x",
"amount": {
"denom": "stake",
"amount": "78518979151"
}
}
]
},
"remote_height": 1021162,
"local_height": 17515817,
"timestamp": "1722427080795445398"
}
}
The sum of all delegations.delegations[i].amount.amount is current TVL
As you can see the result number is a sum of all current delegations. We could get an ICA address through ica query and then do the specific query to retrieve all current delegations, however, puppeteer contract do that bunch of operations instead of us using ICQ so we can trust this information.
We don't include in total TVL:
- Unprocessed unbond batches
- Unbonded funds that are currently held by ICA
- Pending tokens that should be bonded soon through staker ICA
Because it only makes insignificant difference and makes the logic of calculations complicated (and also because in any case these actions will affect on our current delegations, so it's a question of several hours that these information will be noted in delegation balances). In case if you want to get a precise TVL:
- Go to celat.one page, search for the core contract of your instance
- Query
exchange_rate - Query config and go to token contract
- Query config on that token contract, copy the
denomfield - Go to swagger and paste denom from previous step, execute it and you'll get a total supply of dTOKEN
exchange_rate* dTOKEN_total_supply = TVL