This repository has been archived by the owner on May 26, 2023. It is now read-only.
obront - LP tokens cannot be valued because ICHI cannot be priced by oracle, causing all new open positions to revert #152
Labels
Escalation Resolved
This issue's escalations have been approved/rejected
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Sponsor Disputed
The sponsor disputed this issue's validity
Won't Fix
The sponsor confirmed this issue will not be fixed
obront
high
LP tokens cannot be valued because ICHI cannot be priced by oracle, causing all new open positions to revert
Summary
In order to value ICHI LP tokens, the oracle uses the Fair LP Pricing technique, which uses the prices of both individual tokens, along with the quantities, to calculate the LP token value. However, this process requires the underlying token prices to be accessible by the oracle. Both Chainlink and Band do not support the ICHI token, so the function will fail, causing all new positions using the IchiVaultSpell to revert.
Vulnerability Detail
When a new Ichi position is opened, the ICHI LP tokens are posted as collateral. Their value is assessed using the
IchiLpOracle#getPrice()
function:This function uses the "Fair LP Pricing" formula, made famous by Alpha Homora. To simplify, this uses an oracle to get the prices of both underlying tokens, and then calculates the LP price based on these values and the reserves.
However, this process requires that we have a functioning oracle for the underlying tokens. However, Chainlink and Band both do not support the ICHI token (see the links for their comprehensive lists of data feeds). As a result, the call to
base.getPrice(token0)
will fail.All prices are calculated in the
isLiquidatable()
check at the end of theexecute()
function. As a result, any attempt to open a new ICHI position and post the LP tokens as collateral (which happens in bothopenPosition()
andopenPositionFarm()
) will revert.Impact
All new positions opened using the
IchiVaultSpell
will revert when they attempt to look up the LP token price, rendering the protocol useless.Code Snippet
https://github.com/sherlock-audit/2023-02-blueberry/blob/main/contracts/oracle/IchiLpOracle.sol#L19-L39
Tool used
Manual Review
Recommendation
There will need to be an alternate form of oracle that can price the ICHI token. The best way to accomplish this is likely to use a TWAP of the price on an AMM.
The text was updated successfully, but these errors were encountered: