In the DebtToken.sol contract, the mint function mints the actual amount (including interest) and also calculates interest again in the balanceOf function using the index, results in double counting of interest due. It results in debt value to be inflated and users may end up repaying more than the actual debt.
The mint function creates the debt token with the full amount (including interest) but does not normalize the debt using the appropriate scaling index.
The balanceOf function then further inflates the value by multiplying the actual debt by the index, leading to double-counting of the interest.
contracts/core/tokens/DebtToken.sol:#L160
contracts/core/tokens/DebtToken.sol:balanceOf#L225
User Debt Inflation: Users' debt is incorrectly inflated intermediately after deposit due to the double counting of interest.
Repayment Overestimation: Users may end up repaying more than the actual amount owed.
Reproduction Scenario
A user borrows 100 ETH with a current index of 1.1.
The mint function mints 100 ETH of DebtToken.
The balanceOf function calculates the user's debt as 110 ETH (100 * 1.1), which should have been 100 ETH.
User pay more Debt: 110 - 100 = 10 ETH
Manual Code Review
It is recommended to fix minting process. The mint function should mint the standardized amount (amountScaled) rather than the actual amount as shown below:
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.