Core Contracts

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

Incorrect Total Supply Check in lock Function

Summary

The lock function in the veRAACToken contract is designed to allow users to lock RAAC tokens and mint veRAAC tokens representing voting power. However, there is a critical issue in the total supply check:

  • The function checks if totalSupply() + amount > MAX_TOTAL_SUPPLY, where amount is the number of RAAC tokens being locked.

  • However, the actual amount minted as veRAAC tokens is the voting power, which is different from the token amount.

  • The check should be totalSupply() + newPower > MAX_TOTAL_SUPPLY.

Vulnerability Details

The voting power is calculated based on the lock duration and is often less than the locked token amount.

uint256 initialPower = (amount * duration) / MAX_LOCK_DURATION;

The issue arises because the total supply check compares the locked token amount (amount) + totalSupply() of veRAAC tokens. However, the actual amount minted as veRAAC tokens is the voting power. Since duration is often less than MAX_LOCK_DURATION, the voting power is usually less than the locked token amount. This discrepancy causes the total supply check to fail even when the total supply of veRAAC tokens is within the limit.

function lock(uint256 amount, uint256 duration) external nonReentrant whenNotPaused {
if (amount == 0) revert InvalidAmount();
if (amount > MAX_LOCK_AMOUNT) revert AmountExceedsLimit();
//@audit this should check totalSupply() + newPower
if (totalSupply() + amount > MAX_TOTAL_SUPPLY) revert TotalSupplyLimitExceeded();
//
//
uint256 newPower = uint256(uint128(bias));
_checkpointState.writeCheckpoint(msg.sender, newPower);
// Mint veTokens
_mint(msg.sender, newPower);
}

Impact

Incorrect check prevent users from locking tokens even when the total supply of veRAAC tokens is within the limit.

Tools Used

Manaul

Recommendations

Compare the total supply of veRAAC tokens with the minted voting power instead of the locked token amount.

if (totalSupply() + newPower > MAX_TOTAL_SUPPLY) revert TotalSupplyLimitExceeded();
Updates

Lead Judging Commences

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