Unnecessary double scaling leads to potential amount errors.
In the _repay function, the code performs an unnecessary second scaling operation after calculating the actualRepayAmount. This happens because the debt amount (userScaledDebt) is already adjusted for the reserve.usageIndex, and applying another rayDiv(reserve.usageIndex) to actualRepayAmount leads to a double scaling issue.
The double scaling could result in incorrect repayment amounts, potentially causing underpayments or overpayments depending.
Manual review
Remove the redundant scaling step (scaledAmount = actualRepayAmount.rayDiv(reserve.usageIndex)) from the code.
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.