The mint
function of the DebtToken contract incorrectly adds the balanceIncrease
to the amount
when minting new debt tokens. This is an error because the balanceIncrease
is already tracked by the index and does not need to be added each time a user borrows. This leads to over-issuance of debt tokens, resulting in inflated user balances and incorrect accounting.
Issue: Incorrect addition of balanceIncrease
to the amount
when minting debt tokens.
Code Location:
Expected Behavior:
The balanceIncrease
should not be added to the amount
when minting debt tokens because it is already accounted for by the index. The correct calculation should only mint the amountScaled
:
Actual Behavior:
The function adds the balanceIncrease
to the amount
, resulting in over-issuance of debt tokens.
Root Cause:
The logic for calculating the amountToMint
incorrectly includes the balanceIncrease
, which is already tracked by the index. This leads to double-counting of the balance increase and inflates the user's debt balance.
run in DebtToken.test.js
Over-Issuance of Debt Tokens:
Users receive more debt tokens than they should, leading to inflated balances and incorrect accounting.
Incorrect Debt Tracking:
The protocol's debt tracking becomes inaccurate, as the balanceIncrease
is double-counted (once by the index and once by the minting logic).
Financial Loss:
Over-issuance of debt tokens lead to financial losses for the user, as users may owe less than their actual debt and can easly be liquidated.
To fix this issue, the mint
function should be updated to exclude the balanceIncrease
from the amountToMint
.
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.