RAACGauge and RWAGauge will revert on most functionalities because initial maxBoost is smaller than minBoost.
All gauges implement BaseGauge contract. In the BaseGauge constructor maxBoost is smaller than minBoost.
It can be easy reproduced in any gauge test file. Lets take for examp,e RAACGauge. We just have to remove the call that overrides the initial boost parameters:
import { time } from "@nomicfoundation/hardhat-network-helpers";
import { expect } from "chai";
import hre from "hardhat";
const { ethers } = hre;
describe("RAACGauge", () => {
let raacGauge;
let gaugeController;
let veRAACToken;
let rewardToken;
let owner;
let user1;
let user2;
let emergencyAdmin;
let snapshotId;
const WEEK = 7 * 24 * 3600;
const WEIGHT_PRECISION = 10000;
beforeEach(async () => {
snapshotId = await network.provider.send('evm_snapshot');
[owner, user1, user2, emergencyAdmin] = await ethers.getSigners();
// Deploy mock tokens first
const MockToken = await ethers.getContractFactory("MockToken");
rewardToken = await MockToken.deploy("Reward Token", "RWD", 18);
veRAACToken = await MockToken.deploy("veRAAC Token", "veRAAC", 18);
// Mint tokens to users for staking and voting
await rewardToken.mint(user1.address, ethers.parseEther("1000"));
await rewardToken.mint(user2.address, ethers.parseEther("1000"));
await veRAACToken.mint(user1.address, ethers.parseEther("1000"));
await veRAACToken.mint(user2.address, ethers.parseEther("500"));
// Deploy controller
const GaugeController = await ethers.getContractFactory("GaugeController");
gaugeController = await GaugeController.deploy(await veRAACToken.getAddress());
// Get current time and align to next week boundary with proper buffer
const currentTime = BigInt(await time.latest());
const nextWeekStart = ((currentTime / BigInt(WEEK)) + 3n) * BigInt(WEEK); // Add 3 weeks buffer
// Move to next week start
await time.setNextBlockTimestamp(Number(nextWeekStart));
await network.provider.send("evm_mine");
// Deploy RAACGauge
const RAACGauge = await ethers.getContractFactory("RAACGauge");
raacGauge = await RAACGauge.deploy(
await rewardToken.getAddress(),
await veRAACToken.getAddress(),
await gaugeController.getAddress()
);
// Setup roles and initial state
await raacGauge.grantRole(await raacGauge.CONTROLLER_ROLE(), owner.address);
// Approve tokens for staking
await rewardToken.connect(user1).approve(raacGauge.getAddress(), ethers.MaxUint256);
await rewardToken.connect(user2).approve(raacGauge.getAddress(), ethers.MaxUint256);
// Add gauge to controller and set initial weights
await gaugeController.grantRole(await gaugeController.GAUGE_ADMIN(), owner.address);
await gaugeController.addGauge(await raacGauge.getAddress(), 0, WEIGHT_PRECISION);
// Move time forward to ensure period is ready
await time.increase(WEEK);
// Set initial gauge weight through voting
await gaugeController.connect(user1).vote(await raacGauge.getAddress(), WEIGHT_PRECISION);
// Set initial weekly emission rate
await raacGauge.setWeeklyEmission(ethers.parseEther("10000"));
// Transfer reward tokens to gauge for distribution
await rewardToken.mint(raacGauge.getAddress(), ethers.parseEther("100000"));
// Initialize boost parameters before any staking operations
- await raacGauge.setBoostParameters(
- 25000, // 2.5x max boost
- 10000, // 1x min boost
- WEEK // 7 days boost window
- );
+ // // Initialize boost parameters before any staking operations
+ // await raacGauge.setBoostParameters(
+ // 25000, // 2.5x max boost
+ // 10000, // 1x min boost
+ // WEEK // 7 days boost window
+ // );
// Set initial weight after time alignment
await raacGauge.setInitialWeight(5000); // 50% weight
// Mine another block to ensure time progression
await network.provider.send("evm_mine");
});
Then run the test. You will see that huge % of test fail with 0x11 error.
Change initial min boost parameter to smaller value.