The LendingPool#repay() **** emits an incorrect repayment amount in the Repay event. Specifically:
actualRepayAmount is not correctly calculated due to an incorrect usage of userScaledDebt, which does not reflect the exact debt owed after interest accrual.
userScaledDebt is miscalculated and this value is the correct value at reserve.usageIndex = 1e27 and does not account for interest accruals correctly.
But reserve.usageIndex is increased now, so actualRepayAmount can be smaller than current amount value. Thus actualRepayAmount is miscalculated and user transfers amoutScaled to this contract, so amoutScaled is correct value to emit on event.
This causes incorrect event logging, which can mislead users and analytics tools.
manual
The correct value to emit is amountScaled, which accurately represents the repayment amount.
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.