Core Contracts

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

Redundant State Update Calls in `StabilityPool::deposit` Function Leading to Gas Inefficiency

Summary

The deposit function in the StabilityPool contract contains redundant state update calls through both _update() and _mintRAACRewards() functions, which perform the same operations, leading to unnecessary gas consumption.

Vulnerability Details

function deposit(uint256 amount) external nonReentrant whenNotPaused validAmount(amount) {
_update(); <==@found
rToken.safeTransferFrom(msg.sender, address(this), amount);
uint256 deCRVUSDAmount = calculateDeCRVUSDAmount(amount);
deToken.mint(msg.sender, deCRVUSDAmount);
userDeposits[msg.sender] += amount;
_mintRAACRewards(); <==@found
emit Deposit(msg.sender, amount, deCRVUSDAmount);
}

Impact

  • Unnecessary gas consumption

  • Reduced contract efficiency

Tools Used

  • Manual Review

Recommendations

Remove one of the redundant calls, preferably keep _mintRAACRewards() as it's more descriptive:

function deposit(uint256 amount) external nonReentrant whenNotPaused validAmount(amount) {
- _update();
rToken.safeTransferFrom(msg.sender, address(this), amount);
uint256 deCRVUSDAmount = calculateDeCRVUSDAmount(amount);
deToken.mint(msg.sender, deCRVUSDAmount);
userDeposits[msg.sender] += amount;
_mintRAACRewards();
emit Deposit(msg.sender, amount, deCRVUSDAmount);
}
Updates

Lead Judging Commences

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

Support

FAQs

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