Core Contracts

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

Invalid total supply check for lock function in veRAACToken

Vulnerability Details

The lockallows users to lock RAAC tokens and get veRAAC tokens in exchange.

function lock(uint256 amount, uint256 duration) external nonReentrant whenNotPaused {
...
if (totalSupply() + amount > MAX_TOTAL_SUPPLY) revert TotalSupplyLimitExceeded();
...
// Calculate initial voting power
(int128 bias, int128 slope) = _votingState.calculateAndUpdatePower(
msg.sender,
amount,
unlockTime
);
// Update checkpoints
uint256 newPower = uint256(uint128(bias));
_checkpointState.writeCheckpoint(msg.sender, newPower);
// Mint veTokens
_mint(msg.sender, newPower);
emit LockCreated(msg.sender, amount, unlockTime);
...
}

The issue arises with the if (totalSupply() + amount > MAX_TOTAL_SUPPLY) revert TotalSupplyLimitExceeded();It's an invalid way of checking the MAX_TOTAL_SUPPLYthreshold because totalSupplyis the supply of veRAAC tokens while the amount argument is the amount of RAAC tokens to lock.

since newPoweris the actual amount of veRAAC tokens being minted then the correct check should be if (totalSupply() + newPower > MAX_TOTAL_SUPPLY) revert TotalSupplyLimitExceeded();.This should be done after newPowerhas been calculated. or check the new total supply after minting and compare with MAX_TOTAL_SUPPLY

Impact

Incorrect MAX_TOTAL_SUPPLY validation

Tools Used

Manual

Recommendations

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!