v3-subgraph icon indicating copy to clipboard operation
v3-subgraph copied to clipboard

"Total tokens locked" in pools appear to have too high values

Open atiselsts opened this issue 4 years ago • 2 comments

It's not clear what exactly totalValueLockedToken0 and totalValueLockedToken1 are reflecting.

For instance, look at this UI screenshot: image

The price of 0.9988 DAI per GUSD, and the liquidity distribution in the pool is such that 0.9988 is the upper bound of the liquidity range. If I'm not mistaken, this effectively means that all liquidity in the pool should have been converted to GUSD. Yet the Total Tokens Locked field shows 415.99 DAI (rather than 0.00 DAI) locked, and a subgraph query of totalValueLockedToken1 confirms this.

The total USD value of the tokens (roughly the sames totalValueLockedToken0 + totalValueLockedToken1, as these are stablecoins) is also larger than the value obtained either by querying tick data or position data. This particular pool was selected because it is very small and simple to analyze, but the same thing happens in other pools. The Total Tokens Locked are more than obtained by summing the ticks or by summing the open positions.

Even if we include uncollected fees in the amount (which I think the subgraph code does not do), the total value is still far too large.

Is this expected? If so, how to interpret the Total Tokens Locked values?

atiselsts avatar Aug 27 '21 13:08 atiselsts

Is #55 expected to fix this?

atiselsts avatar Sep 21 '21 18:09 atiselsts

@atiselsts It was intended - but looks like the change resulted in incorrect data

will need to revisit the handleCollect event and see whats happening

ianlapham avatar Oct 14 '21 00:10 ianlapham