mint
function in DebtToken contract is defined as follows:
We can see that _mint
internal function will mint amountToMint
tokens. This is problematic because amountToMint
is computed like this:
This is incorrect to add the balance increase to the amount to mint. Only amountScaled
should be passed to _mint
(scaling to effective debt token by dividing by the usage index).
When looking at AAVE implementation of aToken (ScaledBalanceTokenBase contract), we clearly see that only the amount is minted, and balanceIncrease
, representing the increase of token balance between current index and last registered index for the user, is only used for event emission.
All this means the amount of debt tokens minted is way too high, given that amount
is not scaled down as it should (divided by index) and we add also balanceIncrease
.
The impact of this issue is high, as it leads to systematic minting of too many debt tokens for all users that borrow against their collateral.
Manual review.
Make sure to mint the right amount of debt token when users borrow through the lending pool:
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.