Skip to content

Commit 11e1d8c

Browse files
committed
[CurvePB] Make manageBribes fully configurable per pool
Add totalRewardAmounts and extraDuration parameters to the parameterized manageBribes overload, allowing per-pool control over reward amounts and campaign duration. The no-arg version retains the previous defaults. Remove redundant onlyOperator modifier from internal _manageBribes. Update NatSpec.
1 parent 5477540 commit 11e1d8c

File tree

1 file changed

+42
-21
lines changed

1 file changed

+42
-21
lines changed

contracts/contracts/automation/CurvePoolBoosterBribesModule.sol

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ interface ICurvePoolBooster {
1616
/// @author Origin Protocol
1717
/// @notice Gnosis Safe module that automates the management of VotemarketV2 bribe campaigns
1818
/// across multiple CurvePoolBooster contracts. It instructs the Safe to call `manageCampaign`
19-
/// on each registered pool booster, extending campaigns by one period and forwarding ETH
20-
/// from the Safe's balance to cover bridge fees.
19+
/// on each registered pool booster, forwarding ETH from the Safe's balance to cover
20+
/// bridge fees. Campaign parameters (reward amount, duration, reward rate) can be
21+
/// configured per pool or left to sensible defaults.
2122
contract CurvePoolBoosterBribesModule is AbstractSafeModule {
2223
////////////////////////////////////////////////////
2324
/// --- Storage
@@ -86,23 +87,40 @@ contract CurvePoolBoosterBribesModule is AbstractSafeModule {
8687
_setBridgeFee(newFee);
8788
}
8889

89-
/// @notice Manage bribe campaigns for all registered pool boosters with no maxRewardPerVote update.
90-
/// @dev Calls `manageCampaign` on each pool booster via the Safe, extending by 1 period
91-
/// and using all available reward tokens. The Safe must hold enough ETH to cover
92-
/// `bridgeFee * POOLS.length`.
90+
/// @notice Default entry point to manage bribe campaigns for all registered pool boosters.
91+
/// Applies the same behavior to every pool:
92+
/// - totalRewardAmount = type(uint256).max → use all available reward tokens
93+
/// - numberOfPeriods = 1 → extend by one period (week)
94+
/// - maxRewardPerVote = 0 → no update
95+
/// @dev Calls `manageCampaign` on each pool booster via the Safe. The Safe must hold
96+
/// enough ETH to cover `bridgeFee * POOLS.length`.
9397
function manageBribes() external onlyOperator {
98+
uint256[] memory totalRewardAmounts = new uint256[](POOLS.length);
99+
uint8[] memory extraDuration = new uint8[](POOLS.length);
94100
uint256[] memory rewardsPerVote = new uint256[](POOLS.length);
95-
_manageBribes(rewardsPerVote);
101+
for (uint256 i = 0; i < POOLS.length; i++) {
102+
totalRewardAmounts[i] = type(uint256).max; // use all available rewards
103+
extraDuration[i] = 1; // extend by 1 period (week)
104+
rewardsPerVote[i] = 0; // no update to maxRewardPerVote
105+
}
106+
_manageBribes(totalRewardAmounts, extraDuration, rewardsPerVote);
96107
}
97108

98-
/// @notice Manage bribe campaigns with per-pool maxRewardPerVote values
99-
/// @param rewardsPerVote Array of maxRewardPerVote values, one per pool (0 = no update)
100-
function manageBribes(uint256[] memory rewardsPerVote)
101-
external
102-
onlyOperator
103-
{
109+
/// @notice Fully configurable entry point to manage bribe campaigns. Allows setting
110+
/// reward amounts, durations, and reward rates individually for each pool.
111+
/// Each array must have the same length as the POOLS array.
112+
/// @param totalRewardAmounts Total reward amount per pool (0 = no update, type(uint256).max = use all available)
113+
/// @param extraDuration Number of periods to extend per pool (0 = no update, 1 = +1 week)
114+
/// @param rewardsPerVote Max reward per vote per pool (0 = no update)
115+
function manageBribes(
116+
uint256[] memory totalRewardAmounts,
117+
uint8[] memory extraDuration,
118+
uint256[] memory rewardsPerVote
119+
) external onlyOperator {
120+
require(POOLS.length == totalRewardAmounts.length, "Length mismatch");
121+
require(POOLS.length == extraDuration.length, "Length mismatch");
104122
require(POOLS.length == rewardsPerVote.length, "Length mismatch");
105-
_manageBribes(rewardsPerVote);
123+
_manageBribes(totalRewardAmounts, extraDuration, rewardsPerVote);
106124
}
107125

108126
////////////////////////////////////////////////////
@@ -153,11 +171,14 @@ contract CurvePoolBoosterBribesModule is AbstractSafeModule {
153171
/// @notice Internal logic to manage bribe campaigns for all registered pool boosters
154172
/// @dev Iterates over all pool boosters and instructs the Safe to call `manageCampaign`
155173
/// on each one, sending `bridgeFee` ETH from the Safe's balance per call.
156-
/// @param rewardsPerVote Array of maxRewardPerVote values, one per pool (0 = no update)
157-
function _manageBribes(uint256[] memory rewardsPerVote)
158-
internal
159-
onlyOperator
160-
{
174+
/// @param totalRewardAmounts Total reward amount per pool (0 = no update, type(uint256).max = use all available)
175+
/// @param extraDuration Number of periods to extend per pool (0 = no update)
176+
/// @param rewardsPerVote Max reward per vote per pool (0 = no update)
177+
function _manageBribes(
178+
uint256[] memory totalRewardAmounts,
179+
uint8[] memory extraDuration,
180+
uint256[] memory rewardsPerVote
181+
) internal {
161182
uint256 length = POOLS.length;
162183
require(
163184
address(safeContract).balance >= bridgeFee * length,
@@ -171,8 +192,8 @@ contract CurvePoolBoosterBribesModule is AbstractSafeModule {
171192
bridgeFee, // ETH value to cover bridge fee
172193
abi.encodeWithSelector(
173194
ICurvePoolBooster.manageCampaign.selector,
174-
type(uint256).max, // totalRewardAmount, 0 = no update
175-
1, // numberOfPeriods, 0 = no update, 1 = +1 period (week)
195+
totalRewardAmounts[i], // totalRewardAmount, 0 = no update, type(uint256).max = use all available rewards
196+
extraDuration[i], // numberOfPeriods, 0 = no update, 1 = +1 period (week)
176197
rewardsPerVote[i], // maxRewardPerVote, 0 = no update
177198
1000000 // additionalGasLimit
178199
),

0 commit comments

Comments
 (0)