SwapUtils.sol
Wrong implementation
#252
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
WatchPug
Vulnerability details
Based on the context, the
tokenPrecisionMultipliers
used in price calculation should be calculated in realtime based oninitialTargetPrice
,futureTargetPrice
,futureTargetPriceTime
and current time, just likegetA()
andgetA2()
.However, in the current implementation,
tokenPrecisionMultipliers
used in price calculation is the stored value, it will only be changed when the owner calledrampTargetPrice()
andstopRampTargetPrice()
.As a result, the
targetPrice
set by the owner will not be effective until anothertargetPrice
is being set orstopRampTargetPrice()
is called.Recommendation
Consider adding
Swap.targetPrice
and changing the_xp()
at L661 from:https://github.com/code-423n4/2021-11-bootfinance/blob/f102ee73eb320532c5a7c1e833f225c479577e39/customswap/contracts/SwapUtils.sol#L661-L667
To:
The text was updated successfully, but these errors were encountered: