Skip to content

Commit 3939c29

Browse files
authored
Merge pull request #8 from hadronlabs-org/feat/tvl-docs
Add TVL calculation page
2 parents ff6d54e + 9cd47c2 commit 3939c29

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

docs/integrations/tvl.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Total Value Locked calculation
2+
3+
Total Value Locked (TVL) - Total amount of locked tokens in Drop Protocol.
4+
5+
Steps to get current TVL:
6+
7+
- Go to [celat.one](https://neutron.celat.one/neutron-1/) page, search for the core contract of your instance
8+
- [Example](https://neutron.celat.one/neutron-1/contracts/neutron1mla0gsxwueanhqnq8hknagxcqujr3zjnhll9ut9dma7pvc3yl9mse254ql)
9+
- Query config and go to puppeteer contract
10+
- [Example](https://neutron.celat.one/neutron-1/interact-contract?selectedType=query&contract=neutron1mla0gsxwueanhqnq8hknagxcqujr3zjnhll9ut9dma7pvc3yl9mse254ql&msg=ewogICJjb25maWciOiB7fQp9)
11+
- Query `extension` message to get all current delegations
12+
- [Example](https://neutron.celat.one/neutron-1/interact-contract?selectedType=query&contract=neutron100pftltglp5xeffy5z6mawhhm5xp0f0je4jj4cxqrc3u4t6vhy3qqvd5y8&msg=eyJleHRlbnNpb24iOnsibXNnIjp7ImRlbGVnYXRpb25zIjp7fX19fQ==)
13+
14+
Example of output:
15+
16+
```json
17+
{
18+
"data": {
19+
"delegations": {
20+
"delegations": [
21+
{
22+
"delegator": "cosmos1nujy3vl3rww3cy8tf8pdru5jp3f9ppmkadws553ck3qryg2tjanqt39xnv",
23+
"validator": "cosmosvaloper1rndyjagfg0nsedl2uy5n92vssn8aj5n67t0nfx",
24+
"amount": {
25+
"denom": "stake",
26+
"amount": "78518979151"
27+
}
28+
},
29+
{
30+
"delegator": "cosmos1nujy3vl3rww3cy8tf8pdru5jp3f9ppmkadws553ck3qryg2tjanqt39xnv",
31+
"validator": "cosmosvaloper1gh4vzw9wsfgl2h37qqnetet0m4wrzm7v7x3j9x",
32+
"amount": {
33+
"denom": "stake",
34+
"amount": "78518979151"
35+
}
36+
}
37+
]
38+
},
39+
"remote_height": 1021162,
40+
"local_height": 17515817,
41+
"timestamp": "1722427080795445398"
42+
}
43+
}
44+
```
45+
46+
The sum of all `delegations.delegations[i].amount.amount` is current TVL
47+
48+
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.
49+
50+
We don't include in total TVL:
51+
52+
- Unprocessed unbond batches
53+
- Unbonded funds that are currently held by ICA
54+
- Pending tokens that should be bonded soon through staker ICA
55+
56+
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:
57+
58+
- Go to [celat.one](https://neutron.celat.one/pion-1/) page, search for the core contract of your instance
59+
- [Example](https://neutron.celat.one/pion-1/contracts/neutron1qqts44x06g4x430z3heszgczjhfpqf0jq6yxhnufy4w70cvklm7qswywwq)
60+
- Query `exchange_rate`
61+
- [Example](https://neutron.celat.one/pion-1/interact-contract?selectedType=query&contract=neutron1qqts44x06g4x430z3heszgczjhfpqf0jq6yxhnufy4w70cvklm7qswywwq&msg=ewogICJleGNoYW5nZV9yYXRlIjoge30KfQ%3D%3D)
62+
- Query config and go to token contract
63+
- [Example](https://neutron.celat.one/pion-1/interact-contract?selectedType=query&contract=neutron1qqts44x06g4x430z3heszgczjhfpqf0jq6yxhnufy4w70cvklm7qswywwq&msg=ewogICJjb25maWciOiB7fQp9)
64+
- Query config on that token contract, copy the `denom` field
65+
- [Example](https://neutron.celat.one/pion-1/interact-contract?selectedType=query&contract=neutron1nlmq2mzt932w2pnpr4gdxu0pex5gnqvyjgmrm3sv2gdwvw9n6evs4ja2gy&msg=ewogICJjb25maWciOiB7fQp9)
66+
- Go to [swagger](https://rest-falcron.pion-1.ntrn.tech/swagger/#/Query/SupplyOf) and paste denom from previous step, execute it and you'll get a total supply of dTOKEN
67+
- `exchange_rate` \* dTOKEN_total_supply = TVL

sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const sidebars = {
3131
"integrations/overview",
3232
"integrations/referral",
3333
"integrations/lsm_staking",
34+
"integrations/tvl",
3435
],
3536
},
3637
{

0 commit comments

Comments
 (0)