Core Contracts

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

Wrong return parameters in the mint function.

Summary

The RToken::mint function incorrectly returns parameters, causing a mismatch in the variables when deconstructing the return values in ReserveLibrary::deposit.

Vulnerability Details

The execution flow follows:
LendingPool::deposit => ReserveLibrary::deposit => IRToken(reserve.reserveRTokenAddress).mint

The mint function of RToken returns the following values:

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

However, in the ReserveLibrary::deposit function, these returned values are deconstructed as:

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

The Issue

There is a mismatch between the expected and actual return values:

  • The 2nd and 4th variables are interchanged.

  • The amountScaled (expected as the 2nd return) is actually amountToMint, which is in asset tokens instead of scaled RTokens.

Impact

This discrepancy leads to:

  • Incorrect minted token amount shown to the user.

  • Events emitting incorrect minted amounts, leading to confusion and potential accounting errors.

Tools Used

Manual code review.

Recommendations

Ensure the correct order of returned values from the RToken::mint function to align with the deconstruction in ReserveLibrary::deposit. Specifically:

  • Swap the 2nd and 4th return values to match the expected order.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 month 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 about 1 month 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.