The getPoolLPTokenValue function attempts to scale oracle prices to 18 decimals for culculations .However, the function incorrectly assumes the oracle prices lack decimal precision and blindly multiplies them by 1e18. Since oracle prices are already scaled to 1e18 from the getData functions ,this results in over-scaling. The inflated pool value impacts the calculated LP token valuation causing it to be significantly higher than it should be.
In getPoolLPTokenValue function this line attempts to scale _prices[i] to 18 decimals
Oracle prices are fetched using the getData function:
These prices typically have been scaled to 1e18 decimals.
as shown by the oracleWrapper and implemented in the oracle getData functions.
The over-scaled price is used in:
balancesLiveScaled18[i] already assumes 18-decimal precision for prices. Using an over-scaled price inflates the pool value (poolValueInUSD) by a factor of
1e18.
The function returns
With an inflated poolValueInUSD and poolTotalSupply in 18 decimals, the final LP token value is highly overestimated .In addition the functions loops through several tokens making the impact of the bug very huge.
Inflated pool values propagate to other parts of the system leading to incorrect calculations, liquidity mismanagement and Economic exploitation
Manual review.
The prices are already scaled by a factor of 1e18.No need to rescale again.
Order of magnitude: Price = 1e18 (already scaled and normalized by ChainlinkOracle). PriceScaled = 1e36 PoolValueInUSD = 1e36 (mulDown) PoolTotalSupply = 1e18 PoolValueInUSD / PoolTotalSupply = 1e18. Everything seems fine here.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.