The return values in DebtToken::burn
are in incorrect order compared to the natspec, causing LendingPool::_repay
& LendingPool::finalizeLiquidation
to transfer incorrect token amounts when users repay their debt.
Current implementation:
Documentation states order should be:
In LendingPool::finalizeLiquidation
, the values are destructured assuming the documented order:
In LendingPool::_repay, the values are destructured assuming the documented order:
This causes the protocol to transfer the unscaled amount when it should transfer the scaled amount, making users transfer more tokens than they should when repaying debt with accrued interest.
Example:
User debt of 100 tokens accrues to 200 tokens (index doubles)
User repays or gets liquidiated 50 tokens
Protocol transfers 50 tokens when it should transfer ~25 tokens (scaled by new index)
Users are forced to transfer more tokens than necessary when repaying debt or getting liquidated with accrued interest, as the protocol uses unscaled amounts instead of scaled amounts due to the return value ordering.
Foundry
Fix the return value order in DebtToken::burn
:
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.