Information on GAMM tokens in Osmosis
Several people have asked about how to check the amount of bonded GAMM tokens in the different bonding alternatives on Osmosis and the answer appears not widely known, so I figured I'd make a post explaining how to use the osmosisd CLI to extract this information.
First go to github.com/osmosis-labs/osmosis/releases and download the osmosisd for your system, at the time of writing the latest version is v6.1.0. Move the downloaded file to your Cosmos folder and rename it osmosisd (ie remove the system specifications), then take a look on the docs here: docs.osmosis.zone/developing/modules/spec-lockup.html#total-locked-of-denom
Now if we don't have a locally running node to query we can add the --node flag to connect to a validator that exposes their port, for example blockpane. So putting all this together open a terminal, navigate to your Cosmos folder and try the following command (on Linux a local executable is run with ./, if you are on a different OS you may need to modify):
./osmosisd query lockup total-locked-of-denom gamm/pool/610 --min-duration "1s" --node http://osmo-sync.blockpane.com:26657
Note that this command currently wont work for older pools, specifically it only works for pools created after v4 (released Sep 20, 2021) went live, the cutoff appears to be pool 602. If we try pool 1 we get that there are more tokens bonded for 14 days than the total amount of bonded tokens and in pool 2 we get a negative number of bonded tokens. The developers are working on a fix.
At the time of writing the command returns amount: "507906046520658117516", GAMM tokens have 18 decimal points to divide by 1e18 to get the proper amount. This is the number of GAMM tokens bonded over 1 second, by modifying the --min-duration flag we can calculate the amounts bonded in the various buckets, however there is one additional piece of information that is interesting which is the amount of unbonded GAMM tokens. Why would anyone supply liquidity and not bond you may wonder, well a project may supply liquidity without taking away from the rewards pool, Stargaze did this for example. Digging through the docs we find the following command:
./osmosisd query gamm total-share 610 --node http://osmo-sync.blockpane.com:26657
Which returns 508006221688860990525, so pretty much all liquidity in pool 610 is bonded.
Calculating the buckets manually quickly becomes tedious so I wrote this function for Julia (v1.4.1):
function gamminfo(pool) res=read(`./osmosisd query gamm total-share $pool --node http://osmo-sync.blockpane.com:26657`,String) all=parse(Float64,split(res,"\""))/1e18 println("All GAMM tokens: $all") res=read(`./osmosisd query lockup total-locked-of-denom gamm/pool/$pool --min-duration "1s" --node http://osmo-sync.blockpane.com:26657`,String) tot=parse(Float64,split(res,"\""))/1e18 println("Total bonded: $tot") res=read(`./osmosisd query lockup total-locked-of-denom gamm/pool/$pool --min-duration "604700s" --node http://osmo-sync.blockpane.com:26657`,String) bondedOver604700s=parse(Float64,split(res,"\""))/1e18 res=read(`./osmosisd query lockup total-locked-of-denom gamm/pool/$pool --min-duration "1209500s" --node http://osmo-sync.blockpane.com:26657`,String) bonded14d=parse(Float64,split(res,"\""))/1e18 bonded1d=tot-bondedOver604700s bonded7d=bondedOver604700s-bonded14d println("Bonded 1 day: $bonded1d\nBonded 7 days: $bonded7d\nBonded 14 days: $bonded14d") end
Start Julia in your Cosmos folder (or use the cd function in Julia) and paste the above function into the REPL, then try it on pool 606 for example: gamminfo(606)
All GAMM tokens: 3.0305868263222677e8 Total bonded: 3.0212659160480344e8 Bonded 1 day: 6.199677528089583e6 Bonded 7 days: 1.5217032301335335e7 Bonded 14 days: 2.807098817753785e8
So almost everyone in the ATOM/HUAHUA pool has bonded for 14 days. Lets check the STARS/OSMO pool:
julia> gamminfo(604) All GAMM tokens: 109.11923819814655 Total bonded: 58.30569640449847 Bonded 1 day: 3.1065956783850552 Bonded 7 days: 2.4763955987779056 Bonded 14 days: 52.72270512733551
Indeed the Stargaze project seems to have supplied about half of the liquidity without bonding it. This is not the case however for the ATOM/STARS pool where pretty much all liquidity is bonded, so even though there is more total liquidity in the STARS/OSMO pool one actually gets greater external rewards from there.
These bucket numbers aren't completely exact as it is technically possible to bond for arbitrary durations, there aren't currently any rewards for doing so however so the impact should be negligible. How unbonding tokens are categorized is unclear, there is evidence that they remain in the bucket they were bonded to after unbonding even though the official information says they immediately should jump to the bucket below.
If you found this information interesting feel free to follow me on twitter: JHLQ.