Closed viniabussafi closed 3 months ago
This is the way we calculate token balances right now on the liquidity spell:
cumulative_amount / POWER(10, COALESCE(t.decimals, p1.decimals))
.
Should we change it to cumulative_amount / POWER(10, COALESCE(t.decimals, p1.decimals, 18))
, as a gross estimative, in order to safeguard us from this sort of issue?
There are queries where we fallback to 18 decimals e.g. LBPs since every new token launched won't be available on prices.usd
or tokens.erc20
and 18 decimals is kind of the pattern. I'm not sure if in this case it wouldn't make it harder to debug though. it's important that we submit tokens to Dune so they also have symbols and pools labels work properly.
I suggest we make a query to get all missing tokens that are in Balancer pools and add them in a batch to tokens.erc20
so we're sure we don't have any problems at the moment, we can discuss more future-proof solutions on Thursday.
sDAI values are fixed and reflect the expected numbers
We are currently underestimating our TVL on Gnosis due to missing data on sDAi (https://gnosisscan.io/token/0xaf204776c7245bf4147c2612bf6e5972ee483701?a=0xBA12222222228d8Ba445958a75a0704d566BF2C8) in the
tokens.erc20
andprices.usd
tables, which causes us to not have it's decimals. I have submitted a PR to fix this.