Core Contracts

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

Incorrect calculation of excessTokens will always revert mintRewards() function.

Summary

In RAACMinter.sol

function mintRewards(address to, uint256 amount) external nonReentrant whenNotPaused {
if (msg.sender != address(stabilityPool)) revert OnlyStabilityPool();
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);
emit RAACMinted(amount);
}
function tick() external nonReentrant whenNotPaused {
...
if (amountToMint > 0) {
excessTokens += amountToMint;
lastUpdateBlock = currentBlock;
raacToken.mint(address(stabilityPool), amountToMint);
emit RAACMinted(amountToMint);
}
...
}

In the tick() function, excessTokens is increased, but the minted RAAC tokens will be sent to the stabilityPool address, not to the contract's own address (address(this)).

In the mintRewards() function, excessTokens is treated as the balance of the RAAC token, and it is used to calculate how much to send to the specified address.

So in mintRewards() function will revert when call safeTransfer by insufficient balance.

Impact

After tick(), mintRewards() will always revert. So users can't receive rewards.

Tools Used

Manual

Recommendations

Need to remove "excessTokens += amountToMint;" in tick() function.

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

Lead Judging Commences

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

RAACMinter wrong excessTokens accounting in tick function

inallhonesty Lead Judge 4 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.