info icon indicating copy to clipboard operation
info copied to clipboard

Token price not being displayed or accounted

Open kroggen opened this issue 2 years ago • 3 comments

For many coins the Uniswap Pool and the Trade are not showing the price of the token, even being so easy to calculate the price using the current rate of exchange with the other token (eg WETH)

I guess there is no need for an external "oracle" for this purpose, but if there is one, after the oracle returns 0 or null as the price for the token on the pair, its price can then be calculated using the above simple method.

This is also happening when displaying the TVL (total value locked), it is showing the value of only ETH locked:

Screen Shot 2021-09-17 at 20 27 41 Screen Shot 2021-09-17 at 22 57 34

Also when adding liquidity, it only shows the value related to ETH or USDT, not the other token. Sometimes it appears as 0 (zero) total value added when adding only the other token on the pair:

Screen Shot 2021-09-17 at 20 22 27 Screen Shot 2021-09-17 at 20 23 23 Screen Shot 2021-09-17 at 22 57 49

Example:

https://info.uniswap.org/#/pools/0x8c2f778589b08dbd5857be26b604dc5c42861732

kroggen avatar Sep 17 '21 05:09 kroggen

Now I am suspecting that this bug is on TheGraph, as their results are used on these sites

kroggen avatar Sep 17 '21 05:09 kroggen

This issue was moved to info-v2 but it is happening on v3

And indeed, the values already come zeroed from the TheGraph API, from the uniswap-v3 module:

https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3

The token value is zeroed on poolDayDatas, transactions and many other requests...

Example:

When sending this request:

{
  "operationName": "tokens",
  "variables": {},
  "query": "query tokens {\n  tokens(\n    where: {id_in: [\"0x1559fa1b8f28238fd5d76d9f434ad86fd20d1559\"]}\n    block: {number: 13199668}\n    orderBy: totalValueLockedUSD\n    orderDirection: desc\n    subgraphError: allow\n  ) {\n    id\n    symbol\n    name\n    derivedETH\n    volumeUSD\n    volume\n    txCount\n    totalValueLocked\n    feesUSD\n    totalValueLockedUSD\n    __typename\n  }\n}\n"
}

The API returns:

{
  "data": {
    "tokens": [
      {
        "__typename": "Token",
        "derivedETH": "0",
        "feesUSD": "62056.63454676765890574577989388061",
        "id": "0x1559fa1b8f28238fd5d76d9f434ad86fd20d1559",
        "name": "Eden",
        "symbol": "EDEN",
        "totalValueLocked": "13179.623235071167538178",
        "totalValueLockedUSD": "0",      <-----------
        "txCount": "1863",
        "volume": "1255330.880892956011740054",
        "volumeUSD": "6235732.072187121969391931381996764"
      }
    ]
  }
}

With another coin:

{
  "data": {
    "tokens": [
      {
        "__typename": "Token",
        "derivedETH": "0",
        "feesUSD": "12491.15690999098388894178363751412",
        "id": "0x799ebfabe77a6e34311eeee9825190b9ece32824",
        "name": "BTRST",
        "symbol": "BTRST",
        "totalValueLocked": "248582.01862144848681035",
        "totalValueLockedUSD": "0",      <-----------
        "txCount": "459",
        "volume": "138138.64523260177497591",
        "volumeUSD": "1249115.690999098388894178363751412"
      }
    ]
  }
}

kroggen avatar Sep 17 '21 18:09 kroggen

Another effect of this is in the Liquidity graph:

When we hover the mouse to the right and left sides of the red line it always shows ETH locked, no the other token amount locked.

Check here:

https://info.uniswap.org/#/pools/0x2138a12520c9b45bb4b2c742923b514d5f662fec

With tokens that have normal price, the chart shows ETH locked in one side of the red line (current rate or position) and the amount of the other token locked on the other side (when hovering the mouse)

kroggen avatar Sep 17 '21 20:09 kroggen