Tornado Cash subgraph: update price oracle & deploy to other chains

The current subgraph for tracking Tornado Cash relayer fees (https://github.com/dmihal/tornado-cash-subgraph/) uses the MakerDAO V2 oracle to get the ETH/USD price.

Unfortunately, this oracle has been deprecated and is no longer being upgraded (price is frozen at around $2000). And unfortunately, the new MakerDAO oracle (0x64de91f5a373cd4c28de3600cb34c7c6ce410c85) only allows whitelisted addresses to read its prices (and it doesn’t appear that the Graph Protocol allows setting a from address for calls.

My suggestion would be to use the Uniswap V2 ETH/USDC pool as the oracle. While the V3 pool would be more accurate, the V2 pool is much simpler to implement as a price oracle (simply divide the two reserves).

However, I’d love to know if anyone has other suggestions for price oracles.

Hi there!
Was having a look at open posts for adapters. Why not simply use coingecko API to get the assets price at any point in time? It seems that this is how it’s done in most adapters now.

Using CoinGecko is definitely easier, which is why most adapters use it

However, there’s some nice advantages of building the price oracle directly into the subgraph:

For one, it’s more accurate. When an adapter queries CoinGecko, it gets the price of the asset on the day of the event, while building it into the subgraph lets us get the price on the exact time of the event (depending on how quickly the oracle updates).

This also allows us to do date-range queries, since the subgraph has the USD fees directly.

1 Like

Tornado Cash is also deployed to the following chains:

  • Binance Smart Chain
  • xDai/Gnosis Chain
  • Polygon
  • Optimism
  • Arbitrum
  • Avalanche

The subgraph should be updated to support these additional chains (adding the respective pools and updating the price oracle) and deployed, so other Tornado instances can be shown.