Core Contracts

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

Incorrect MAX_TOTAL_SUPPLY validation in lock()

Summary

The current implementation checks the maximum total supply against the sum of the totalSupply() and the amount of RAAC tokens being locked, which is not the correct approach.

Vulnerability Details

totalSupply() represents the total veRAAC tokens in supply i.e already minted to users.

In lock() however, the MAX_TOTAL_SUPPLY check is done as follows:

if (totalSupply() + amount > MAX_TOTAL_SUPPLY) revert TotalSupplyLimitExceeded();

amount here is the number of raacTokens being supplied by the user for locking where as, newPower is the number of veRAAC tokens minted in return:

// Update checkpoints
>> uint256 newPower = uint256(uint128(bias));
---SNIP---
// @audit-info Mint veTokens (newPower)
>> _mint(msg.sender, newPower);

As such, when minting is done, the totalSupply() will be incremented by this newPower.

Therefore, it is imperative to perform the MAX_TOTAL_SUPPLY check right before this minting is done but as seen, the function does this inaccurately.

Impact

By checking against totalSupply() + amount, the contract could allow minting of veRAAC tokens that would push the total supply over the defined MAX_TOTAL_SUPPLY, leading to a violation of the contract's constraints.

Tools Used

Manual Review

Recommendations

Perform the MAX_TOTAL_SUPPLY check right before minting veRAAC tokens:

- if (totalSupply() + amount > MAX_TOTAL_SUPPLY) revert TotalSupplyLimitExceeded();
---SNIP---
uint256 newPower = uint256(uint128(bias));
---SNIP---
+ if (totalSupply() + newPower > MAX_TOTAL_SUPPLY) revert TotalSupplyLimitExceeded();
_mint(msg.sender, newPower);
Updates

Lead Judging Commences

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

Incorrect `MAX_TOTAL_SUPPLY` check in the `veRAACToken::lock/extend` function of `veRAACToken` could harm locking functionality

Support

FAQs

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

Give us feedback!