balancer / dune-spellbook

SQL views for Dune Analytics
Other
7 stars 11 forks source link

fix ggAVAX and yyAVAX liquidity #66

Closed mendesfabio closed 7 months ago

mendesfabio commented 7 months ago

Avalanche TVL is quite underestimated (17M on Dune vs. 24M Subgraph) because of these two Composable pools - ggAVAX and yyAVAX. It's probably related to missing decimals and/or prices for these tokens since WAVAX does have price.

image image

viniabussafi commented 7 months ago

Both tokens are missing on coinpaprika and, therefore, can't be added to prices.usd -- will try decreasing the dex.prices treshold on the liquidity spell while implementing a filter for outliers. Will update once tests run

mendesfabio commented 7 months ago

did you verify the decimals? if we fix pricing but the token hasn't been added to Dune we'll have to do it -- probably another good thing to automate. also, would double-check what are the current thresholds for sample_size both on our side and on dex.prices itself

viniabussafi commented 7 months ago

Created a PR to add both tokens to the tokens.erc20 spell

viniabussafi commented 7 months ago

Adding ggAVAX to the tokens.erc20 spell increased avalanche liquidity, since it had some data on dex.prices

viniabussafi commented 7 months ago

Now trying to create a broader solution using the rate providers to determine LST and LRT token prices. Working initially on this query

viniabussafi commented 7 months ago

Currently, querying both the traces table and all stable pool factories for their rate providers appears to be quite resource-intensive. I'll continue working on optimizing this process to make it more efficient. In the meantime, I've developed an alternative solution to reduce the sample size used in dex.prices. This alternative involves implementing a filter against outliers to discard occurrences where there is a 10000x increase in the price of a token between successive occurrences. You can find the details of this alternative approach in this query. image image

viniabussafi commented 7 months ago

Created a PR to run this solution and results look good on all chains

viniabussafi commented 7 months ago

PR was merged and issue was fixed.