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

token0Price and token1Price inaccurate

Open nickollio28 opened this issue 3 years ago • 1 comments

I have noticed that many of the token0Price and token1Price returned from the pools query are inaccurate.

I am calling the following query: { pools (first:1000, orderBy:totalValueLockedETH, orderDirection:desc) { id liquidity totalValueLockedETH totalValueLockedToken0 totalValueLockedToken1 token0Price token0{ id symbol name decimals } token1Price token1{ id symbol name decimals } } }

One of the objects returned is: { "id": "0xc4002da5ceb8c65b3dd985f6c4a9bc961d932690", "liquidity": "14676598827104346561852", "totalValueLockedETH": "18.9421933297961722", "totalValueLockedToken0": "18434587.88001087528047385", "totalValueLockedToken1": "18.9421933297961722", "token0Price": "1232236.224236843549578921623944695", "token0": { "id": "0x5d858bcd53e085920620549214a8b27ce2f04670", "symbol": "POP", "name": "POP Network Token", "decimals": "18" }, "token1Price": "0.0000008115327080400727716542071865924594", "token1": { "id": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "symbol": "WETH", "name": "Wrapped Ether", "decimals": "18" } }

However, on the Uniswap app, it gives a token0Price of 2296, and a token1Price of 0.000435459

This POP token is inactive, and this may contribute to it, however I have experienced the same thing with active tokens.

In this example, it is off by a factor of 10^4, but in general I am getting inaccuracies all over the place, up to a factor of 10^26. And in other cases where the result is within a power of 10, it is still not accurate to what I get when looking it up on the Uniswap app.

nickollio28 avatar Mar 05 '22 23:03 nickollio28

The problem isn't with this individual pool, it is with many different pools. For example, returning ZRX/WETH @ 3.4*10^38.

nickollio28 avatar Mar 10 '22 01:03 nickollio28