You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
uniswap-v3: skip pools whose own price is 10x off coins prices (VOLLAR-USDT $46.4m at 9,907% apy) - #3282
/pools currently lists uniswap-v3 Polygon VOLLAR-USDT 1% (0x9039769396ad40d6e6a15b45269a5a229984604a) at $46.4m tvl and a 9,907% apy, with volumeUsd1d of $1.51b. On chain the pool holds:
token
balance
value at the pool's own price
USDT
5,526.63
$5,527
VOLLAR (8 dec)
211,027,858.9
~$526 (pool price $0.0000025)
coins.llama.fi priced VOLLAR at $0.24–0.29 through 11-21. The pool says $0.0000025, so the token crashed and its liquidity was dumped. On 11-23 utils.tvl valued the 211M VOLLAR at the stale ~$0.22. The pool's chart shows ~$0.92–0.98m of tvl every day up to 11-22, then the single 11-23 point at $46,387,898.
Nothing in the adapter compares the price a pool trades at with the prices its tvl is computed from, even though topLvl already reads slot0 for every pool.
Fix
Keep sqrtPriceX96 from the existing slot0 multicall, and drop a pool when its own token1/token0 price is more than 10x away from price0 / price1 from coins.llama.fi. Pools with only one priced side are unchanged, since those are already valued from the priced side alone. No extra RPC calls.
Impact on today's pools
I can't run the full adapter (the subgraphs need a Graph gateway key), so I measured the guard directly. For each uniswap-v3 pool in /pools on Ethereum, Polygon, Arbitrum, Optimism, Base and BSC above $100k, I took the factory getPool and slot0, compared it with coins.llama.fi prices, and got 534 pools with both sides priced:
deviation
pools
tvl
> 2x
4
$5m
> 5x
2
$4m
> 10x (dropped)
2
$4m
The two dropped pools both have zero active liquidity (liquidity() == 0), so their price sits outside every position and nothing trades against them. Both show 0% apy:
Ethereum WDOGE-WETH 1% 0x68082ecc5bbad8fe77c2cb9d0e3403d9a00ccbc2: price ratio 8.6e-35, $3.65m published
Ethereum WETH-XUSD 0.05% 0x3c385b0ce5b48958ffab12ffd8da14d433d7b885: price ratio 1.8e-30, $179k published
The two pools between 2x and 10x (DAI-HOPR at 0.21x, MET-WETH at 3.86x) are kept. VOLLAR-USDT is not in this table because VOLLAR has no coins price today. With the 11-23 price it is 88,000x off and would have been dropped.
Testing
node --check passes. I ran the guard against those pools with their on-chain sqrtPriceX96:
VOLLAR-USDT at the 11-23 price: dropped
WDOGE-WETH: dropped
healthy USDC-WETH and WBTC-WETH: kept
MET-WETH at 3.86x: kept
a one-side-priced pool: kept
Summary by CodeRabbit
Bug Fixes
Pool results now filter out pools whose price differs from the token-price ratio by more than a factor of 10. Pools are still shown when either token’s price is unavailable.
Pool price details are now included with the returned pool information.
No actionable comments were generated in the recent review.
Walkthrough
The Uniswap V3 adapter now attaches sqrtPriceX96 to each pool and filters pools whose derived price differs from the token price ratio by more than a factor of 10. Pools pass when either token price is missing. The existing LP fee-share calculation remains unchanged.
Changes: Uniswap V3 pool price filter
Layer / File(s)
Summary
Pool price validation src/adaptors/uniswap-v3/index.js
The adapter attaches sqrtPriceX96 to each pool and keeps pools with missing token prices. Otherwise, it compares the pool-derived price with the token price ratio and retains ratios from 1/10 through 10, inclusive. The LP fee-share calculation remains unchanged.
DefiLlama/yield-server#3119: The Uniswap V4 adapter applies a similar pool-price consistency filter with a 2x threshold.
Suggested reviewers:gomesalexandre, 0xkr3p
Merge Risk: Minimal · up to 9e35e
This change filters out Uniswap V3 pools whose on-chain price differs by more than 10x from the token prices used for TVL. No actionable merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: Uniswap V3 pools are skipped when their own price differs more than 10x from the coins prices. It also names a concrete example (VOLLAR-USDT). The raw summary and obje…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: Uniswap V3 pools are skipped when their own price differs more than 10x from the coins prices. It also names a concrete example (VOLLAR-USDT). The raw summary and objectives confirm the filter in src/adaptors/uniswap-v3/index.js matches this description. The title is specific and accurate.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 48b524f7-69f5-4e08-acce-514078ad50c7
Commits
Reviewing files that changed from the base of the PR and between ccd3bf6 and 9e35e91.
Files selected for processing: 1
src/adaptors/uniswap-v3/index.js
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.
CI's red here is environmental: every subgraph call hit payment required for subsequent requests for this API key, then the Monad PoolCreated getLogs in onchain.js failed on all RPCs ("block range too large", rate limits). Neither touches this change, which runs after the subgraph data loads.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
/poolscurrently lists uniswap-v3 Polygon VOLLAR-USDT 1% (0x9039769396ad40d6e6a15b45269a5a229984604a) at $46.4m tvl and a 9,907% apy, withvolumeUsd1dof $1.51b. On chain the pool holds:coins.llama.fi priced VOLLAR at $0.24–0.29 through 11-21. The pool says $0.0000025, so the token crashed and its liquidity was dumped. On 11-23
utils.tvlvalued the 211M VOLLAR at the stale ~$0.22. The pool's chart shows ~$0.92–0.98m of tvl every day up to 11-22, then the single 11-23 point at $46,387,898.Nothing in the adapter compares the price a pool trades at with the prices its tvl is computed from, even though
topLvlalready readsslot0for every pool.Fix
Keep
sqrtPriceX96from the existingslot0multicall, and drop a pool when its own token1/token0 price is more than 10x away fromprice0 / price1from coins.llama.fi. Pools with only one priced side are unchanged, since those are already valued from the priced side alone. No extra RPC calls.Impact on today's pools
I can't run the full adapter (the subgraphs need a Graph gateway key), so I measured the guard directly. For each uniswap-v3 pool in
/poolson Ethereum, Polygon, Arbitrum, Optimism, Base and BSC above $100k, I took the factorygetPoolandslot0, compared it with coins.llama.fi prices, and got 534 pools with both sides priced:The two dropped pools both have zero active liquidity (
liquidity() == 0), so their price sits outside every position and nothing trades against them. Both show 0% apy:0x68082ecc5bbad8fe77c2cb9d0e3403d9a00ccbc2: price ratio 8.6e-35, $3.65m published0x3c385b0ce5b48958ffab12ffd8da14d433d7b885: price ratio 1.8e-30, $179k publishedThe two pools between 2x and 10x (DAI-HOPR at 0.21x, MET-WETH at 3.86x) are kept. VOLLAR-USDT is not in this table because VOLLAR has no coins price today. With the 11-23 price it is 88,000x off and would have been dropped.
Testing
node --checkpasses. I ran the guard against those pools with their on-chainsqrtPriceX96:Summary by CodeRabbit