Using different UniV3 pools may lead to extra fees
Summary
Using different UniV3 pools may lead to extra fees paid
Vulnerability Detail
UniV3OracleImpl has variable $_pairOverrides to override pairs using while checking price
And it's expected that route Token0->Token1 uses the same pool as Token1->Token0 (with the same fee)
But in function UniV3OracleImpl._setPairOverride() you override fee only for Token0->Token1 route:
You override pair TEST->USDT by next params: {fee: 1%, period: HIGH_PERIOR}
While checking UniV3OracleImpl.getQuoteAmounts() for route TEST->USDT you get correct info from desired pool
But if someone requests UniV3OracleImpl.getQuoteAmounts() for route USDT->TEST, it will use another pool with default params: {fee: $defaultFee, period: $defaultPeriod}. And the result may be unpredictably wrong
Result: your users may pay extra fees or use too short interval to check price for super-high volatile token and loss their funds as a result
R2
medium
Using different UniV3 pools may lead to extra fees
Summary
Using different UniV3 pools may lead to extra fees paid
Vulnerability Detail
UniV3OracleImpl
has variable$_pairOverrides
to override pairs using while checking price And it's expected that routeToken0->Token1
uses the same pool asToken1->Token0
(with the same fee) But in functionUniV3OracleImpl._setPairOverride()
you override fee only forToken0->Token1
route:Impact
Let's consider the following situation:
Token
TEST
with high volatility{fee: 1%, period: HIGH_PERIOR}
UniV3OracleImpl.getQuoteAmounts()
for routeTEST->USDT
you get correct info from desired poolUniV3OracleImpl.getQuoteAmounts()
for routeUSDT->TEST
, it will use another pool with default params:{fee: $defaultFee, period: $defaultPeriod}
. And the result may be unpredictably wrongResult: your users may pay extra fees or use too short interval to check price for super-high volatile token and loss their funds as a result
Code Snippet
https://github.com/sherlock-audit/2023-04-splits/blob/7303cc26205f10ca9111be31f3574d2573df92b1/splits-oracle/src/UniV3OracleImpl.sol#L240
Tool used
Manual Review
Recommendation