Core Contracts

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

The `RToken::mint` function returns an incorrect value.

Summary

The RToken::mint function return incorrect value when amountToMint == 0

Vulnerability Details

As stated in the comments above, the function's third return parameter should be:

"The new total supply after minting."

If no amount is minted, the total supply won't become zero as returned in the function; it will remain totalSupply().

* @return A tuple containing:
* - bool: True if this is the first mint for the recipient, false otherwise
* - uint256: The amount of scaled tokens minted
@> * - uint256: The new total supply after minting
* - uint256: The amount of underlying tokens minted
*/
function mint(
address caller,
address onBehalfOf,
uint256 amountToMint,
uint256 index
) external override onlyReservePool returns (bool, uint256, uint256, uint256) {
@>> if (amountToMint == 0) {
@>> return (false, 0, 0, 0);
`````
`````
`````
}

Impact

The return value used in any function will be inconsistent.

Recommendations

* @return A tuple containing:
* - bool: True if this is the first mint for the recipient, false otherwise
* - uint256: The amount of scaled tokens minted
* - uint256: The new total supply after minting
* - uint256: The amount of underlying tokens minted
*/
function mint(
address caller,
address onBehalfOf,
uint256 amountToMint,
uint256 index
) external override onlyReservePool returns (bool, uint256, uint256, uint256) {
if (amountToMint == 0) {
- return (false, 0, 0, 0);
+ return (false, 0, totalSupply(), 0);
`````
`````
`````
}
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!