-
Notifications
You must be signed in to change notification settings - Fork 0
Description
There are some pools within the Curve SPS that are returning insanely high numbers for TVL and volume.
I've narrowed the pricing issues down to the uniswap pricing substream that was built to enable curve to fetch prices from multiple source, and in particular this file which calculates price. https://github.com/Graph-BuildersDAO/uniswap-pricing-substream/blob/1e9541ce3967e43bff7dbd17147f1e7444a9c98a/src/modules/5_map_uniswap_prices.rs#L65
This works for most pairs with liquidity, and aligns with how prices are calculated for tokens in Uni v2. The issue comes where Uni v2 pairs contain near zero liquidity, and cannot be rebalanced by arbitrage. For example, this WETH/FXN pair https://etherscan.io/tokenholdings?a=0x9b03bfc09cd28eac9a920084dc6751a5c34457ea.
Using the calculation that calculates the token price normally would look something like this according to the token holdings in the pair:
(WETH reserves / FXN reserves) * WETH price = FXN price
(0.000004103640501247 / 0.000000000003227078) * 3,167.717455 = 4028156011.37
So ~ 4 trillion USD.. this value funnily enough, does not align with market prices outside of Uni V2.
We have bumped the pricing changes/improvements into the next iteration of this substream. As part of this work we should look at a more comprehensive pricing strategy. Here are some ideas/suggestions:
- Update uniswap v2 pricing substream to exclude prices for pairs that cannot be rebalanced and are giving values such as the one above.
- Implement some more lightweight pricing substreams for Uni v3, and other markets. This will hopefully give us full coverage of all assets within the Curve ecosystem. Currently we cannot identify prices for all assets.
- At a block number check against the pricing data received. If it is outdated pricing data, we should not be using it to calculate anything related to tvl/volume etc.
- Unify the pricing substreams into a monorepo, with shared protobuf outputs/types to enable seamless integration into other substreams.