Core Contracts

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

Rewards are independent from staked amount in BaseGauge contract which is incorrect.

Summary

BaseGauge contract allows to stake and withdraw tokens with the following functions:

function stake(uint256 amount) external nonReentrant updateReward(msg.sender) {
if (amount == 0) revert InvalidAmount();
_totalSupply += amount;
_balances[msg.sender] += amount;
stakingToken.safeTransferFrom(msg.sender, address(this), amount);
emit Staked(msg.sender, amount);
}
function withdraw(uint256 amount) external nonReentrant updateReward(msg.sender) {
if (amount == 0) revert InvalidAmount();
if (_balances[msg.sender] < amount) revert InsufficientBalance();
_totalSupply -= amount;
_balances[msg.sender] -= amount;
stakingToken.safeTransfer(msg.sender, amount);
emit Withdrawn(msg.sender, amount);
}

The problem arises because both of these functions use _balances mapping to store the amount staked by the user, and this mapping is never used in the contract to calculate the rewards.

Both functions have the updateReward(msg.sender)modifier, which will update the rewards due to the user. But this modifier never uses the staked amount and _balances mapping to compute rewards.

This means rewards are entirely independent from staking in the gauge which is not the expected behaviour.

Impact

The impact of this issue is high as it leads to incorrect computation of rewards for users.

Tools Used

Manual review.

Recommendations

Make sure to correctly implement gauge rewards mechanism.

Updates

Lead Judging Commences

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

BaseGauge::earned calculates rewards using getUserWeight instead of staked balances, potentially allowing users to claim rewards by gaining weight without proper reward checkpoint updates

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

BaseGauge::earned calculates rewards using getUserWeight instead of staked balances, potentially allowing users to claim rewards by gaining weight without proper reward checkpoint updates

Support

FAQs

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

Give us feedback!