In the mint function, the purpose of balanceIncrease is to calculate the user's balance increase due to changes in the liquidity index. This is because the balance of RToken increases over time as interest accumulates.
However, in RToken::mint, it is not used, so after the user mints RToken for the first time, they do not pay the interest balance when minting again, resulting in an incorrect total minted amount.
Note:
The DebtToken::burn function has a similar issue!
Suggested fix: Add uint256 amountToburn = amount + borrowIndex;, then _burn(from, amountToburn.toUint128());
Total Minted Amount Calculation: The original minted amount (amountToMint) should be added to the calculated balance increase (balanceIncrease) to determine the actual total amount to mint. Currently, since balanceIncrease is not used, users do not pay the interest balance (balanceIncrease) when minting RToken again after the first mint.
Interest IS applied through the balanceOf() mechanism. The separate balanceIncrease calculation is redundant/wrong. Users pay full debt including interest via userBalance capping.
The balanceIncrease is the interest that has already accrued on the user's existing scaledBalance since their last interaction. It's not something you mint as new tokens in the _mint function.
Interest IS applied through the balanceOf() mechanism. The separate balanceIncrease calculation is redundant/wrong. Users pay full debt including interest via userBalance capping.
The balanceIncrease is the interest that has already accrued on the user's existing scaledBalance since their last interaction. It's not something you mint as new tokens in the _mint function.
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.