burn() function in RToken contract calculates wrong amount to burn tokens. It was missed to calculate the interest and then the interest to be added to amount. Also the first param in the return - amount, should be in scaled units.
The function is expected to return:
- @return A tuple containing:\
- uint256: The amount of scaled tokens burned
- uint256: The new total supply after burning
- uint256: The amount of underlying asset transferred
It returns interest-free amount non scaled, total supply and interest-free amount.
The function withdraw in ReserveLibrary contract calls burn function from RToken contract.
burnedScaledAmount and amountUnderlying variables will be with not correct. They will be interest-free values and burnedScaledAmount will be not scaled.
To fix the issue first it should be added this part of code in burn() function in RToken after receiving the userBalance at row 164:
and then the return should looks like:
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.