Core Contracts

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

Excess tokens are not held for in the contract's balance

Summary

ExcessTokens are not held for in the contract's balance, thus mintRewards will revert in most cases.

Vulnerability Details

Link

During minting rewards in RAACMinter, if not enough excessTokens are held, then the function will mint additional tokens:

uint256 toMint = excessTokens >= amount ? 0 : amount - excessTokens;
excessTokens = excessTokens >= amount ? excessTokens - amount : 0;
if (toMint > 0) {
raacToken.mint(address(this), toMint);
}
raacToken.safeTransfer(to, amount);

The issue is excessTokens are not held for in the contract's balance. This variable represents amount of tokens minted in tick() function rather real tokens held for future reward distribution.
For example, excessTokens = 100e18, and reward amount is 1e18, but there is 0 tokens on contract's balance, because all tokens was minted to stability pool:

function tick() external nonReentrant whenNotPaused {
//...
if (amountToMint > 0) {
excessTokens += amountToMint;
lastUpdateBlock = currentBlock;
raacToken.mint(address(stabilityPool), amountToMint);
emit RAACMinted(amountToMint);
}
}
}

So mintRewards will revert because toMint will be 0 in most cases, and contract balanse is insufficient.

Impact

mintRewards will rewert in most cases.

Tools Used

Manual review.

Recommendations

Recommended to use contract's balance instead excessTokens to determine additional amount to be minted.

Updates

Lead Judging Commences

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

RAACMinter wrong excessTokens accounting in tick function

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

RAACMinter wrong excessTokens accounting in tick function

Support

FAQs

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

Give us feedback!