When users repay their debt, an equivalent of DebtToken
is burned. But the current implementation does not factor in the borrow rate which increases their debt over time, and simply erase it.
Every time the DebtToken::burn
function is called, the balance increase due to the borrow rate (represented by the index) is computed as balanceIncrease
. This value should be added to the user total debt, which is in fact the user balance of DebtToken
But this value balanceIncrease
is never used and registered in the user debt balance, neither in the DebtToken::burn
function or in the calling functions LendingPool::_repay
or LendingPool::finalizeLiquidation
If we check the burn function, wee see L196
that balanceIncrease
is computed from last user index and current index, then L200
the user index is updated to the current index.
But then, the burnt amount L210
is based solely on the amount
repaid, and does not factor in the new debt relative to the borrowing rate:
Same in the _repay
function which only registers the amount relative to the repaid debt.
Repaying a debt simply erase the debt increase due to the borrow rate, nullifying the borrow rate.
The increase in debt shouldn't be burned:
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.