At the end of repay function there is an event informing how much tokens were repaid, but because of wrong calculations it returns incorrect amount.
The limit is userScaledDebt, which is wrong because the actual limit should be userDebt.
It will be easiest to show this with an example:
user borrows 1000 tokens at index 1, his userScaledDebt is equal to 1000
usageIndex goes up to 1.1, so he owns 1100 now
user repays, he enters 1100
line 7: balanceOf returns 1100 (because it multiplies 1000 by index which is 1.1 now)
line 8: 1100 / 1.1 = 1000
line 11: actualRepayAmount = 1000
lines 15: event emitts 1000, when user actually paid 1100
Event with inaccurate information is emitted.
Manual Review
The best would be to log amountScaled, because this is the actual amount of tokens send by the user to the protocol
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.