UniswapHandler.maltMarketPrice
returns wrong decimals
#255
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
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
cmichel
Vulnerability details
The
UniswapHandler.maltMarketPrice
function returns a tuple of theprice
and thedecimals
of the price.However, the returned
decimals
do not match the computedprice
for theelse if (rewardDecimals < maltDecimals)
branch:Note that
rewardReserves
are in reward token decimals,maltReserves
is a malt balance amount (18 decimals).Then, the returned amount is in
rewardDecimals + diffDecimals + rewardDecimals - maltDecimals = maltDecimals + rewardDecimals - maltDecimals = rewardDecimals
.However
decimals = maltDecimals
is wrongly returned.Impact
Callers to this function will receive a price in unexpected decimals and might inflate or deflate the actual amount.
Luckily, the
AuctionEscapeHatch
decides to completely ignore the returneddecimals
and as all prices are effectively inrewardDecimals
, even if stated inmaltDecimals
, it currently does not seem to lead to an issue.Recommendation
Fix the function by returning
rewardDecimals
instead ofmaltDecimals
in therewardDecimals < maltDecimals
branch.The text was updated successfully, but these errors were encountered: