Core Contracts

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

[L-2] Lacking updation of `lastRewardTime` when distributing reward to a guage.

summary

In the GaugeController.sol distributeRewards() and _distributeToGauges() function, when the rewards are distributed to a guage, the guage's lastRewardTime is not updated.

Vulnerability Details

/**
* @notice Distributes rewards to a gauge
* @dev Calculates and transfers rewards based on gauge weight
* @param gauge Address of gauge to distribute rewards to
*/
function distributeRewards(address gauge) external override nonReentrant whenNotPaused {
if (!isGauge(gauge)) revert GaugeNotFound();
if (!gauges[gauge].isActive) revert GaugeNotActive();
uint256 reward = _calculateReward(gauge);
if (reward == 0) return;
//@audit lastRewardTime is not updated
IGauge(gauge).notifyRewardAmount(reward);
emit RewardDistributed(gauge, msg.sender, reward);
}

Impact

This will result in stale data when rewards are updated to a guage.

This mapping mapping(address => Gauge) public gauges will always return a stale lastRewardTime for all gauges, and every gauge will retain the same lastRewardTime set during addGauge, regardless of when rewards are actually distributed.

Tools Used

manual review

Recommendations

function distributeRewards(address gauge) external override nonReentrant whenNotPaused {
if (!isGauge(gauge)) revert GaugeNotFound();
if (!gauges[gauge].isActive) revert GaugeNotActive();
uint256 reward = _calculateReward(gauge);
if (reward == 0) return;
+ gauges[gauge].lastRewardTime = block.timestamp;
IGauge(gauge).notifyRewardAmount(reward);
emit RewardDistributed(gauge, msg.sender, reward);
}

in _distributeToGauges() function apply this change.

// Second pass: distribute rewards
for (uint256 i = 0; i < _gaugeList.length; i++) {
address gauge = _gaugeList[i];
if (gauges[gauge].isActive && gauges[gauge].gaugeType == gaugeType) {
uint256 gaugeShare = (amount * gaugeWeights[i]) / totalTypeWeight;
if (gaugeShare > 0) {
IGauge(gauge).notifyRewardAmount(gaugeShare);
+ gauges[gauge].lastRewardTime = block.timestamp;
}
}
}
Updates

Lead Judging Commences

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

Appeal created

aye__aye Submitter
3 months ago
inallhonesty Lead Judge
3 months ago
aye__aye Submitter
3 months ago
inallhonesty Lead Judge 3 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.