LendingPool::repay calls _repay internally. This function will burn the debtTokensminted when the user opens a borrow position. The function receives the amount, and behalfOf parameters. After some checks the DebtToken::burn is called forwarding the amount.
The DebtToken::burnreturns four values:
amountBurned
newTotalSupply
amountScaled
balanceIncrease
While the LendingPool::_repay expect to receive the following order:
amountScaled
newTotalSupply
amountBurned
balanceIncrease
After receiving the wrong amount, the LendingPool::_repaywill try to transfer a bigger amount from the user. If he has given enough approval, it will succeed, if not the function will always revert.
Transferring more, the user will pay more than he should.
Reverting, the user will be blocked from repaying the borrowed amount.
Code Review
Adjust the returned value, so the transfers occur over the correct amount.
Interest IS applied through the balanceOf() mechanism. The separate balanceIncrease calculation is redundant/wrong. Users pay full debt including interest via userBalance capping.
Interest IS applied through the balanceOf() mechanism. The separate balanceIncrease calculation is redundant/wrong. Users pay full debt including interest via userBalance capping.
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.