Core Contracts

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

Incorrect Supply Check in `veRAACToken.lock()` Leads to Unnecessary Rejections and Supply Cap Violations

Summary

The lock() function in veRAACToken.sol incorrectly assumes a 1:1 relationship between locked RAAC tokens (_lockState.totalLocked) and veTokens (totalSupply()). This could block RAAC locking too early when totalSupply() is nearing MAX_TOTAL_SUPPLY.

Vulnerability Details

The current condition:

veRAACToken.sol#L568

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

🚨 Incorrectly assumes that:

  • Locking 1 RAAC always mints 1 veToken

  • Total veTokens (totalSupply()) are equal to _lockState.totalLocked

As a matter of fact, veTokens are minted using this formula:

VotingPowerLib.sol#L89-L92

uint256 duration = unlockTime - block.timestamp;
uint256 initialPower = (amount * duration) / MAX_LOCK_DURATION; // Normalize by max duration
bias = int128(int256(initialPower));

veRAACToken.sol#L216-L217

if (duration < MIN_LOCK_DURATION || duration > MAX_LOCK_DURATION)
revert InvalidLockDuration();
  • totalSupply() is 0.25× to 1× _lockState.totalLocked

Impact

Users cannot lock RAAC even when veToken supply after calling lock() is below MAX_TOTAL_SUPPLY, reducing participation. Hence, less veTokens than expected could be minted, never reaching MAX_TOTAL_SUPPLY.

Tools Used

Manual

Recommendations

Modify the condition in lock() to ensure it correctly accounts for veToken generation based on duration:

veRAACToken.sol#L568

- if (totalSupply() + amount > MAX_TOTAL_SUPPLY) revert TotalSupplyLimitExceeded();
+ if (totalSupply() + (amount / duration) > MAX_TOTAL_SUPPLY) revert TotalSupplyLimitExceeded();
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!