The burn
function in RToken.sol
incorrectly calculates the scaled amount(amountScaled
) by multiplying, not dividing, by the interest rate index, causing users to burn more RToken than necessary and losing their interest earnings.
Core issue:
The current implementation incorrectly calculates the scaled amount using the formula amountScaled = amount * index
, instead of amountScaled = amountScaled = amount / index
.
This results in a larger number of RToken being burned than necessary, as the amount
is multiplied by the interest rate index.
contracts/core/tokens/RToken.sol:burn#L172
contracts/libraries/pools/ReserveLibrary.sol:withdraw#L377
User Impact: Users may lose out on their interest earnings as the system burns too many RToken to withdraw necessary underlying asset than intended.
Protocol Integrity: The incorrect burning of RToken impacts the protocol's economic model by breaking the 1:1 value peg between RToken and the underlying asset. This can result in an imbalance in the reserve pool and potentially affect the protocol's solvency.
Manual Code Review
It is recommended to correct the calculation of amountScaled and replace the multiplication with division in the burn
function to ensure that only the appropriate amount of RToken is burned based on the underlying asset value:
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.