Uniswap / v3-subgraph

Subgraph for Uniswap V3
GNU General Public License v3.0
346 stars 477 forks source link

TVl Calculations Incorrect for pools #74

Open ianlapham opened 2 years ago

ianlapham commented 2 years ago

Conversion from here https://github.com/Uniswap/v3-info/issues/186

Steps to Reproduce (provided by @tcpzl)

  1. Go to the homepage of v3-info. We can find that the USDC/ETH and WBTC/ETH are the two most popular pools (highest TVL). Then click into the page of pool.
  2. Copy the contract address of the pool, then find it on etherscan. We can find the actual contracts: https://etherscan.io/address/0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8, and https://etherscan.io/address/0xcbcdf9626bc03e24f779434178a73a0b4bad62ed. However, the TVLs of ETH are not as the same as they are on etherscan. Unfortunately, there is a large gap

Current Production State

Possible cause for error

**Solution***

ianlapham commented 2 years ago

UPDATE:

This bug is fixed in this PR: https://github.com/Uniswap/v3-subgraph/pull/100/files Subgraph deployed and synced here: https://thegraph.com/hosted-service/subgraph/ianlapham/v3-minimal

Needed to wait aout 5 weeks for subgraph to sync, but once tested can merge this into main. NOTE: this involves several schema changes

chinchaun commented 2 years ago

Hey @ianlapham, is it safe to use the Subgraph (v3-minimal), or do I have to wait around 5 weeks to get it synced with your changes?

Thanks for fixing this!

shakibaei65 commented 2 years ago

ok aliya mr30

steegecs commented 2 years ago

I tried correcting for this in my Uniswap V3 subgraph, and when I include the subtraction of tokens from a pool on the Collect event, I get negative token values.

This happened on my subgraph, and from this branch -- > https://github.com/Uniswap/v3-subgraph/tree/mainnet-2.0

The only change I made on this branch was including the Collect handler in the subgraph.yaml.

togosh commented 1 year ago

Awesome work @ianlapham Are we just waiting for PR to be reviewed and merged in?