Core Contracts

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

`MAX_TOTAL_LOCKED_AMOUNT` can be exceeded in `lock()`

Summary

In the lock() function, there is a check to ensure that the amount being locked by an individual user does not exceed MAX_LOCK_AMOUNT, but there is no check to ensure that the total amount locked by all users does not exceed MAX_TOTAL_LOCKED_AMOUNT.

Vulnerability Details

The protocol defines MAX_LOCK_AMOUNT and MAX_TOTAL_LOCKED_AMOUNT which are the Maximum amount of tokens that can be locked in a single position and Maximum total amount of tokens that can be locked globally respectively.

// @notice Maximum amount that can be locked in a single position
uint256 private constant MAX_LOCK_AMOUNT = 10_000_000e18; // 10M
// @notice Maximum total amount that can be locked globally
uint256 public constant MAX_TOTAL_LOCKED_AMOUNT = 1_000_000_000e18; // 1B

Now, lock() function only ensures that the amount is not greater than MAX_LOCK_AMOUNT:

if (amount > MAX_LOCK_AMOUNT) revert AmountExceedsLimit();

However, it does not check if the total amount locked by all users plus the amount the user is bringing in exceeds MAX_TOTAL_LOCKED_AMOUNT.

Impact

This oversight means that if multiple users lock tokens, the total locked amount could exceed the defined limit of MAX_TOTAL_LOCKED_AMOUNT. This could disrupt the intended functionality of the token locking mechanism.

Tools Used

Manual Review

Recommendations

Add a check to ensure that the total amount locked by all users does not exceed MAX_TOTAL_LOCKED_AMOUNT:

if (amount > MAX_LOCK_AMOUNT) revert AmountExceedsLimit();
+ require(_lockState.totalLocked + amount <= MAX_TOTAL_LOCKED_AMOUNT);
Updates

Lead Judging Commences

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

`veRAACToken::lock` function doesn't check MAX_TOTAL_LOCKED_AMOUNT

Support

FAQs

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

Give us feedback!