Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: high
Invalid

Accrued Interest Is Lost When Minting Due to Missing balanceIncrease Adjustment in `RToken` contract

Summary

The _mint() function in RToken contract, does not account for balanceIncrease, causing accrued interest to be lost when updating _userState[onBehalfOf].index.

Vulnerability Details

In the mint() function, the accrued interest (balanceIncrease) is calculated as:

if (_userState[onBehalfOf].index != 0 && _userState[onBehalfOf].index < index) {
balanceIncrease = scaledBalance.rayMul(index) - scaledBalance.rayMul(_userState[onBehalfOf].index);
}

However, balanceIncrease is not added to amountToMint when calling _mint():

_mint(onBehalfOf, amountToMint.toUint128());

Since _userState[onBehalfOf].index is updated right after:

_userState[onBehalfOf].index = index.toUint128();

This means that any previously accrued interest (balanceIncrease) is effectively reset and lost, leading to incorrect interest calculations for users.

Impact

Users will lose the interest accrued before the current minting transaction, leading to an underestimation of their balance and overall yield loss.

Tools Used

Manual Review

Recommendations

Update _mint() to include balanceIncrease, ensuring users receive their full entitled interest before resetting _userState[onBehalfOf].index.

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

RToken::mint calculates balanceIncrease (interest accrued since last interaction) but never mints it, causing users to lose earned interest between deposits

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.

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

RToken::mint calculates balanceIncrease (interest accrued since last interaction) but never mints it, causing users to lose earned interest between deposits

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.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.