The mint function in the debt token contract incorrectly inflates the user’s debt by unnecessarily minting additional debt tokens. This occurs due to the inclusion of balanceIncrease in the minting amount, which already accounts for accrued debt. As a result, users accumulate more debt tokens than they should, leading to an overestimation of their total debt balance.
Affected Function: mint
Code Snippet:
Issue Explanation:
The balanceIncrease variable represents the accrued debt since the last minting operation.
When a user holds debt tokens, the usageIndex increases over time, naturally increasing their total debt.
The function calculates the additional debt accrued since the last mint and adds this amount to the debt tokens being minted, leading to an overestimation of the user’s debt balance.
The user’s previous debt tokens already account for the increasing usageIndex, so minting additional tokens for this increase results in an unnecessary and inflated debt balance.
Incorrect Debt Calculation: Users accrue more debt than they actually should.
A user borrows an amount from the lending pool, minting debt tokens in return.
The usageIndex increases over time, naturally increasing their debt value.
The user borrows again, triggering the mint function.
The function calculates the accrued debt (balanceIncrease) and incorrectly adds it to the new mint amount.
The user’s debt tokens are over-minted, inflating their overall debt balance.
Modify the mint function to exclude balanceIncrease from the minting calculation, ensuring only new debt tokens corresponding to the borrowed amount are minted:
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.