In the DebtToken contract, the mint function calculates the balanceIncrease by multiplying the index difference with the value returned by the balanceOf function, which already includes interest. This results in double-counting of interest, inflating debt balances and potentially causing users to overpay or disrupting the system's economic model.
The issue arises when the balanceIncrease is calculated using the balanceOf function, which already accounts for interest. This leads to an inflated balance when calculating the increase in debt, as the interest is counted twice—once in the balanceOf function and once during the balanceIncrease calculation.
contracts/core/tokens/DebtToken.sol:mint#L150-L156
contracts/core/tokens/DebtToken.sol:balanceOf#L225
Scenario:
The user initially borrows 100 ETH.
Old index = 1.0
New index = 1.1
Incorrect calculation:
balanceOf returns = 100 * 1.1 = 110 ETH
balanceIncrease = 110 * 1.1 - 110 * 1.0
= 121 - 110
= 11 ETH // ❌ Interest is inflated
Correct calculation should be:
balanceIncrease = 100 * 1.1 - 100 * 1.0
= 110 - 100
= 10 ETH
Interest Overinflation: Interest is incorrectly compounded by using an already interest-included balance.
Excessive User Debt: Users' debt balances are artificially inflated, leading to overpayments. Users may end up repaying more than their original debt due to the compounded interest error.
Economic Model Disruption: The system's debt calculations become inaccurate, impacting the economic security and balance of the system.
Manual code review
It is recommended to correct balanceIncrease calculation and use the unscaled balance (before interest) for balanceIncrease calculation.
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.