VaderReserve.reimburseImpermanentLoss improperly converts USDV to VADER #7
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 acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Handle
TomFrenchBlockchain
Vulnerability details
Impact
IL isn't properly converted from being in terms of USDV to VADER, resulting in reserve paying out incorrect amount.
Proof of Concept
VaderReserve.reimburseImpermanentLoss
receives anamount
in terms of USDV and converts this to an amount of VADER to send torecipient
.However as shown in the link if there is a previous price stored for USDV, the amount of VADER tokens to be sent to the
recipient
isamount / usdvPrice
.https://github.com/code-423n4/2021-12-vader/blob/fd2787013608438beae361ce1bb6d9ffba466c45/contracts/reserve/VaderReserve.sol#L84-L110
usdvPrice
is the total USD value of foreign assets divided by the total amount of USDV in a number of pairs. It's then some measure of the inverse of the price of USDV in USD, nothing to do with converting into VADER.The reserve will then improperly calculate the amount of VADER to pay out once there is a single reading of the USDV price.
Recommended Mitigation Steps
It looks like both branches of this if statement are supposed to be run, i.e. convert from USDV to USD and then to VADER but I can't be sure. Care should be taken so that the calculation being performed is the expected one.
The text was updated successfully, but these errors were encountered: