Core Contracts

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

Withdrawal will revert due to locking the exact raac amount without considering the tax

Summary

The last user who called the withdraw function couldn't complete the withdrawal.(tx reverted)

Vulnerability Details

The lock allow users to lock their set of raac tokens for a specific duration to mint veRAAC tokens that'll allow them to vote in the governance vote

function lock(uint256 amount, uint256 duration) external nonReentrant whenNotPaused {
if (amount == 0) revert InvalidAmount();
if (amount > MAX_LOCK_AMOUNT) revert AmountExceedsLimit();
if (totalSupply() + amount > MAX_TOTAL_SUPPLY) revert TotalSupplyLimitExceeded();
if (duration < MIN_LOCK_DURATION || duration > MAX_LOCK_DURATION)
revert InvalidLockDuration();
// Do the transfer first - this will revert with ERC20InsufficientBalance if user doesn't have enough tokens
raacToken.safeTransferFrom(msg.sender, address(this), amount);
// Calculate unlock time
uint256 unlockTime = block.timestamp + duration;
// Create lock position
_lockState.createLock(msg.sender, amount, duration);
_updateBoostState(msg.sender, amount);
// 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);
}

An issue with this implementation is that, when locking tokens, it does not take into account the fact that the raacToken is a fee-on-Transfer (FOT) token where a small portion of the transfer amount as charged as a tax, it locks the full deposited deposited amount without considering the tax.

During withdrawal, the last person to withdraw will have his tx revert due to insufficient funds

raacToken.safeTransfer(msg.sender, amount);

this is because the withdraw function attempts to transfer the exact provided amount during locking which did not take into account the tax.

Impact

Withdrawal will revert due to insufficient funds.

Tools Used

Manual review

Recommendations

Take into account the tax amount and store it as the lock amount.

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

[INVALID] FoT RAAC breaks veRAACToken

Support

FAQs

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