The RToken contract's mint function incorrectly uses unscaled amounts (amountToMint) instead of scaled amounts (amountScaled) when minting tokens, breaking the fundamental ray-based scaling mechanism required for proper interest accrual. This deviation from the intended design causes incorrect token distribution and compromises the entire interest-bearing token system.
The token system is designed to operate with scaled balances. The amountScaled variable represents the normalized debt or deposit amount after applying the liquidity index.
By calling _mint(onBehalfOf, amountToMint.toUint128()) instead of using amountScaled, the contract effectively bypasses the scaling mechanism.
This misrepresentation will lead to incorrect interest accrual and improper accounting of user balances.
Over time, balances computed by balanceOf, which rely on the scaling system and this will not match the minted amounts, thereby breaking the protocol’s economic model.
Users will receive token amounts that do not properly reflect accrued interest. This discrepancy can lead to over- or under-representation of users' debt or deposit positions, impacting all economic operations such as lending, borrowing, and liquidation.
The interest accrual mechanism depends fundamentally on the correct use of scaled amounts; a failure here disrupts the balance calculations for all token holders and can cascade into broader protocol instability.
Investors could receive misleading token balances and interest rates, which could result in financial losses or misallocation of collateral.
Manual code review
Replace the use of amountToMint (the raw, unscaled amount) with amountScaled in the call to _mint. The corrected line should be:
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.