Platform: Code4rena
Start Date: 28/11/2022
Pot Size: $192,500 USDC
Total HM: 33
Participants: 106
Period: 11 days
Judge: LSDan
Total Solo HM: 15
Id: 186
League: ETH
Rank: 21/106
Findings: 1
Award: $1,219.66
π Selected for report: 0
π Solo Findings: 0
π Selected for report: Franfran
Also found by: __141345__, poirots
1219.6604 USDC - $1,219.66
The general idea of this snippet is to compute the square root of a price ratio:
The first case (decimals are equal) adds an adjustment which is meant to preserve the final value in wei
Note: we intentionaly skip here the 2**92
component, to keep the formulas here succint.
However, for the last case (oracleData.token1Decimal < oracleData.token0Decimal
), the given formula appears different from the one that would be reached in the process above:
It seems the square root was incorrectly ignored on the last branch, since the second component doesnβt match the code 1 / 10^(9 + d0 = d1)
(It both misses the square root, and transforms the 18 into a 9 incorrectly)
Manual analysis. Pen & paper. Excel
#0 - c4-judge
2022-12-20T16:38:31Z
dmvt marked the issue as duplicate of #237
#1 - c4-judge
2023-01-09T13:46:40Z
dmvt marked the issue as partial-50