Core Contracts

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

The addGauge function passes in the wrong `typeWeight` when updatng the Gauge struct

Summary

When the addGauge function is called by the gaugeAdmin in the function the Gauge struct is updated.

Vulnerability Details

When the addGauge function is called by the gaugeAdmin in the function the Gauge struct is updated with the required value and params. However in the typeWeight param always 0 is being passed in but the problem with that is that these weights are supposed to be evenly splitted between both the types i.e RWA and RAAC and this is also being done in the constructor this is initialized as 5000 for both types. if not that, the fact that this is also being updated by the gaugeAdmin in the setTypeWeight function. so either of these two should be passed for updating the Gauge instead of just 0 everytime.

Tools Used

Manual Review

Recommendations

Pass in 5000 instead of 0 when updating the Gauge struct or pass in this mapping instead o : typeWeights[gaugeType] = weight; because this being updated by the gaugeAdmin

Code Snippets

function addGauge(
address gauge,
GaugeType gaugeType,
uint256 initialWeight
) external onlyGaugeAdmin {
if (gauges[gauge].lastUpdateTime != 0) revert GaugeAlreadyExists();
if (gaugeType != GaugeType.RWA && gaugeType != GaugeType.RAAC) {
revert InvalidGaugeType();
}
// Use minimum weight (1) for period tracking if initialWeight is 0
uint256 periodWeight = initialWeight == 0 ? 1 : initialWeight;
uint256 duration = gaugeType == GaugeType.RWA ? 30 days : 7 days;
gauges[gauge] = Gauge({
weight: initialWeight,
-> typeWeight: 0, ////AUDIT - in the constructor this is initialized as 5000 for both types but here it passes 0? //typeWeights[gaugeType]
lastUpdateTime: block.timestamp,
gaugeType: gaugeType,
isActive: true,
lastRewardTime: block.timestamp
});```
``` function _initializeTypeWeights() private {
typeWeights[GaugeType.RWA] = 5000; // 50%
typeWeights[GaugeType.RAAC] = 5000; // 50%
}```
``` function setTypeWeight(
GaugeType gaugeType,
uint256 weight
) external onlyRole(GAUGE_ADMIN) {
if (weight > MAX_TYPE_WEIGHT) revert InvalidWeight();
uint256 oldWeight = typeWeights[gaugeType];
typeWeights[gaugeType] = weight;
```
Updates

Lead Judging Commences

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

Give us feedback!