Summary
BaseGauge::constructor#L142 is setting wrong value for boostState.minBoost
.
Let's say minBoost
is 1x
, so it will be 10000
Vulnerability Details
BaseGauge::constructor#L142
constructor(
address _rewardToken,
address _stakingToken,
address _controller,
uint256 _maxEmission,
uint256 _periodDuration
) {
rewardToken = IERC20(_rewardToken);
stakingToken = IERC20(_stakingToken);
controller = _controller;
boostState.maxBoost = 25000;
142:: boostState.minBoost = 1e18; 👈👈
boostState.boostWindow = 7 days;
}
On BoostController#L42, we can see it is setting MIN_BOOST = 10000
(1x)
which is the correct one.
contract BoostController is IBoostController, ReentrancyGuard, AccessControl, Pausable {
using BoostCalculator for BoostCalculator.BoostState;
BoostCalculator.BoostState private boostState;
uint256 public constant MAX_BOOST = 25000;
42:: uint256 public constant MIN_BOOST = 10000; 👈👈
uint256 public constant MIN_DELEGATION_DURATION = 7 days;
}
Impact
The boostState.minBoost
should be 1x
which is actually 10000
.
Because boostState.minBoost
is used on lots of different functions, so the protocol will not work as expected.
1e18
is actually a large value like 1 * 10 ** 18
Tools Used
Manual review
Recommendations
constructor(
address _rewardToken,
address _stakingToken,
address _controller,
uint256 _maxEmission,
uint256 _periodDuration
) {
rewardToken = IERC20(_rewardToken);
stakingToken = IERC20(_stakingToken);
controller = _controller;
// ...OTHER_CODES...
// Initialize boost parameters
boostState.maxBoost = 25000; // 2.5x
- boostState.minBoost = 1e18;
+ boostState.minBoost = 10000; // actual 1x
boostState.boostWindow = 7 days;
// ...OTHER_CODES...
}