Core Contracts

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

The outputs of the `RToken::mint` function don't align with the variables in the `ReserveLibrary::deposit` function, leading to incorrect emit

Vulnerability Details

The RToken::mint function returns the values isFirstMint, amountToMint, totalSupply(), and amountScaled sequentially.

return (isFirstMint, amountToMint, totalSupply(), amountScaled);

However, in the ReserveLibrary::deposit function, which calls RToken::mint, the outputs are stored in variables named isFirstMint, amountScaled, newTotalSupply, and amountUnderlying.

(bool isFirstMint, uint256 amountScaled, uint256 newTotalSupply, uint256 amountUnderlying) IRToken(reserve.reserveRTokenAddress).mint(
address(this), // caller
depositor, // onBehalfOf
amount, // amount
reserve.liquidityIndex // index
);

As a result, the actual value of amountToMint is stored in the variable amountScaled, while the actual value of amountScaled is stored in amountUnderlying.

This discrepancy ultimately leads to incorrect emit here.

Impact

This can lead to user confusion.

Tools Used

Manual review

Recommendations

Sweep the amountScaled and amountUnderlying in the ReserveLibrary::deposit function.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

RToken::mint doesn't return data in the right order, making the protocol emit wrong events

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

RToken::mint doesn't return data in the right order, making the protocol emit wrong events

Support

FAQs

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

Give us feedback!