Core Contracts

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

Missing update totalLocked in veRAACToken::withdraw

Summary

Missing update totalLocked in veRAAC token

Vulnerability Details

In veRAAC token, there is one variable state.totalLocked. This totalLocked aims to record the whole total locked RAAC token in this contract. We will make sure that the total locked amount should not exceed maxTotalLocked.

When we create or increase one lock, we will increase the state.totalLocked. The problem here is that in withdraw() function, we miss updating the totalLocked. This will cause that the record in state.totalLocked. When we use this state.totalLocked to check whether we exceed the maxTotalLocked, this check will be incorrect.

function createLock(
LockState storage state,
address user,
uint256 amount,
uint256 duration
) internal returns (uint256 end) {
state.totalLocked += amount;
return end;
}
function increaseLock(
LockState storage state,
address user,
uint256 additionalAmount
) internal {
state.totalLocked += additionalAmount;
}
function withdraw() external nonReentrant {
// Burn veTokens and transfer RAAC
_burn(msg.sender, currentPower);
raacToken.safeTransfer(msg.sender, amount);
}

Impact

Miss update state.totalLocked in withdraw function. The record state.totalLocked will be incorrect. When we use this state.totalLocked to check whether the total locked amount exceed the max lock cap, this check will be incorrect.

Tools Used

Manual

Recommendations

Update state.totalLocked in withdraw function.

Updates

Lead Judging Commences

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

veRAACToken::withdraw / emergencyWithdraw doesn't substract the `_lockState.totalLocked`

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

veRAACToken::withdraw / emergencyWithdraw doesn't substract the `_lockState.totalLocked`

Support

FAQs

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