Core Contracts

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

Incorrect calculation of balance increase during RToken minting

Summary

The balance increase is just used to keep track of the interest accrued by the user, but does not have impact on the actual balance:

uint256 amountScaled = amountToMint.rayDiv(index);
if (amountScaled == 0) revert InvalidAmount();
//@audit this should retrieve the scaled balance use scaledBalance function
uint256 scaledBalance = balanceOf(onBehalfOf);
bool isFirstMint = scaledBalance == 0;
uint256 balanceIncrease = 0;
if (
_userState[onBehalfOf].index != 0 &&
_userState[onBehalfOf].index < index
) {
balanceIncrease =
scaledBalance.rayMul(index) -
scaledBalance.rayMul(_userState[onBehalfOf].index);
}

The current calculation fails to retrieve the actual scaled balance and instead is retrieving the updated unscaled balance using the balanceOf function. It should instead use the function from the inherited contract.

Vulnerability Details

Impact

This will just affect the monitoring systems.

Tools Used

Manual review.

Recommendations

Retrieve the actual scaled balance.

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

RToken::mint incorrectly uses balanceOf instead of super.balanceOf for calculating balanceIncrease, causing double-scaling and inflated interest values in events

Informational

Support

FAQs

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