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

query surroundingTicks return wrong liquidityNet/liquidityGross value

Open florije4ex opened this issue 2 years ago • 1 comments

The chart of liquidity of pool USDC / ETH(https://info.uniswap.org/#/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640) show some highly amount liquidity

WX20230915-130656

And we read the source code of info.uniswap.org(https://github.com/Uniswap/v3-info), and find the core code of query: https://github.com/Uniswap/v3-info/blob/03d02f17f74e1953d31f309c132edef9cec2fa2d/src/data/pools/tickData.ts#L69C38-L69C38 , and deal with data at: https://github.com/Uniswap/v3-info/blob/03d02f17f74e1953d31f309c132edef9cec2fa2d/src/data/pools/tickData.ts#L257

So we query subgraph api and get the same result as info.uniswap.org data:

WX20230915-131201

!!!!!BUT, when we query ticks from etherscan.io or from ethereum node rpc, we get tick data as follow: WX20230915-130728

liquidityGross is 7597427743119697 and liquidityNet is -7597427743119697. We think there should be something wrong with subgraph api, and it give wrong data on some tick. Can you explain why will some tick data is not correct, and will tick data be modified in future?

florije4ex avatar Sep 15 '23 05:09 florije4ex

There is some calculation required to have the liquidity from the tick data. You may refer to https://github.com/atiselsts/uniswap-v3-liquidity-math

stefanmsy avatar Jan 02 '24 08:01 stefanmsy