Uniswap / v2-subgraph

Uniswap V2 subgraph 📊
https://thegraph.com/explorer/subgraph/uniswap/uniswap-v2
GNU General Public License v3.0
408 stars 739 forks source link

totalsupply not working #149

Open simple-marvin opened 8 months ago

simple-marvin commented 8 months ago

https://thegraph.com/explorer/subgraphs/A3Np3RQbaBA6oKJgiwDJeo5T3zrYfGHPWFYayMwtNDum?v=1&view=Playground&chain=arbitrum-one

or

https://thegraph.com/hosted-service/subgraph/ianlapham/uniswap-v2-dev

when i use one of the above links and the below query, it also shows me weird numbers

query: { tokens(first: 5, orderBy:tradeVolumeUSD orderDirection:desc) { id symbol name decimals totalSupply } }

result: { "data": { "tokens": [ { "id": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "symbol": "WETH", "name": "Wrapped Ether", "decimals": "18", "totalSupply": "15640" }, { "id": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "symbol": "USDC", "name": "USD//C", "decimals": "6", "totalSupply": "14864" }, { "id": "0xdac17f958d2ee523a2206206994597c13d831ec7", "symbol": "USDT", "name": "Tether USD", "decimals": "6", "totalSupply": "14448" }, { "id": "0xa47c8bf37f92abed4a126bda807a7b7498661acd", "symbol": "UST", "name": "Wrapped UST Token", "decimals": "18", "totalSupply": "14448" }, { "id": "0xc8d674114bac90148d11d3c1d33c61835a0f9dcd", "symbol": "mNFLX", "name": "Wrapped Mirror NFLX Token", "decimals": "18", "totalSupply": "14448" } ] }

token with correct totalSupply from etherscan: weth - 15640 - 3276063798496846980898561 usdc - 14864 - 23398309739224635 usdt - 14448 - 44005847706828943 ust - 14448 - 295788247260048794239793908 mNFLX- 14448 - 3083201876426681305152

V3 shows the right totalSupply

https://thegraph.com/explorer/subgraphs/HUZDsRpEVP2AvzDCyzDHtdc64dyDxx8FQjzsmqSg4H3B?view=Playground&chain=arbitrum-one

simple-marvin commented 8 months ago

Hey anyone working on it?

itsjerryokolo commented 8 months ago

@simple-marvin The team wrote

The token.totalSupply is not a great field to try to utilize in this subgraph. When a token has a hard cap upon launch it should be fine, but we're making an eth call when the token is first recognized by the subgraph to get the totalSupply, then we don't update it afterwards. Think about what the totalSupply of WETH was when the first WETH pool was created, since then more eth has been wrapped so the totalSupply has changed.

If they really want totalSupply for USDC, WETH, WSDT etc., this would probably need to be a different subgraph that can properly track this, or they can use RPC.

simple-marvin commented 8 months ago

@itsjerryokolo Thanks for the reponse.

All totalSupplys are wrong, i know that weth, usdc, usdt,... have changing totalSupply, it just was an example (a bad example). I am not really interested in those tokens (weth, usdc, usdt,...) more like in the below one. RPC and other stuff are too slow, Graph is the perfect solution for my Project.

The totalSupply field seems to return a random number or is wrong or i dont know how to read it.

The ERC20 tokens from below have a completely wrong totalSupply and it's not just them, so far I haven't found a token that has a correct totalSupply.

0xb8a87405d9a4f2f866319b77004e88dff66c0d92 0xaaee1a9723aadb7afa2810263653a34ba2c21c7a 0xe70e1d6a2e971ff6debc21dd2540064c25c9bc0d

Query: { Spider: token(id:"0xe70e1d6a2e971ff6debc21dd2540064c25c9bc0d") { symbol totalSupply } Sora: token(id:"0xb8a87405d9a4f2f866319b77004e88dff66c0d92") { symbol totalSupply } Mog: token(id:"0xaaee1a9723aadb7afa2810263653a34ba2c21c7a") { symbol totalSupply } }

Result: { "data": { "Spider": { "symbol": "Spider", "totalSupply": "26240" //actual totalSupply: 420690000000000000000000000000000 }, "Sora": { "symbol": "SORA", "totalSupply": "42920" //actual totalSupply: 1000000000000000000000000000 }, "Mog": { "symbol": "Mog", "totalSupply": "42624" //actual totalSupply: 390570159911439123354797210149241 } } }

https://etherscan.io/token/0xaaeE1A9723aaDB7afA2810263653A34bA2C21C7a#readContract https://etherscan.io/token/0xb8a87405d9a4F2F866319B77004e88dfF66c0d92#readContract https://etherscan.io/token/0xe70E1D6A2E971ff6DEBc21DD2540064c25C9Bc0D#readContract