Skip to content

Commit 36e39d4

Browse files
committed
[CurvePB] Rename pools to poolBoosters to avoid confusion with AMM pools
1 parent 245b8e9 commit 36e39d4

File tree

2 files changed

+49
-41
lines changed

2 files changed

+49
-41
lines changed

contracts/contracts/automation/CurvePoolBoosterBribesModule.sol

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ contract CurvePoolBoosterBribesModule is AbstractSafeModule {
2525
////////////////////////////////////////////////////
2626

2727
/// @notice List of CurvePoolBooster addresses managed by this module
28-
address[] public pools;
28+
address[] public poolBoosters;
2929

3030
/// @notice ETH amount sent per pool booster to cover the L1 -> L2 bridge fee
3131
uint256 public bridgeFee;
@@ -48,19 +48,19 @@ contract CurvePoolBoosterBribesModule is AbstractSafeModule {
4848

4949
/// @param _safeContract Address of the Gnosis Safe this module is attached to
5050
/// @param _operator Address authorized to call operator-restricted functions
51-
/// @param _pools Initial list of CurvePoolBooster addresses to manage
51+
/// @param _poolBoosters Initial list of CurvePoolBooster addresses to manage
5252
/// @param _bridgeFee ETH amount to send per pool booster for bridge fees
5353
/// @param _additionalGasLimit Gas limit for cross-chain execution in manageCampaign
5454
constructor(
5555
address _safeContract,
5656
address _operator,
57-
address[] memory _pools,
57+
address[] memory _poolBoosters,
5858
uint256 _bridgeFee,
5959
uint256 _additionalGasLimit
6060
) AbstractSafeModule(_safeContract) {
6161
_grantRole(OPERATOR_ROLE, _operator);
62-
for (uint256 i = 0; i < _pools.length; i++) {
63-
_addPoolBoosterAddress(_pools[i]);
62+
for (uint256 i = 0; i < _poolBoosters.length; i++) {
63+
_addPoolBoosterAddress(_poolBoosters[i]);
6464
}
6565
_setBridgeFee(_bridgeFee);
6666
_setAdditionalGasLimit(_additionalGasLimit);
@@ -71,24 +71,24 @@ contract CurvePoolBoosterBribesModule is AbstractSafeModule {
7171
////////////////////////////////////////////////////
7272

7373
/// @notice Add new CurvePoolBooster addresses to the managed list
74-
/// @param _pools Addresses to add
75-
function addPoolBoosterAddress(address[] calldata _pools)
74+
/// @param _poolBoosters Addresses to add
75+
function addPoolBoosterAddress(address[] calldata _poolBoosters)
7676
external
7777
onlyOperator
7878
{
79-
for (uint256 i = 0; i < _pools.length; i++) {
80-
_addPoolBoosterAddress(_pools[i]);
79+
for (uint256 i = 0; i < _poolBoosters.length; i++) {
80+
_addPoolBoosterAddress(_poolBoosters[i]);
8181
}
8282
}
8383

8484
/// @notice Remove CurvePoolBooster addresses from the managed list
85-
/// @param _pools Addresses to remove
86-
function removePoolBoosterAddress(address[] calldata _pools)
85+
/// @param _poolBoosters Addresses to remove
86+
function removePoolBoosterAddress(address[] calldata _poolBoosters)
8787
external
8888
onlyOperator
8989
{
90-
for (uint256 i = 0; i < _pools.length; i++) {
91-
_removePoolBoosterAddress(_pools[i]);
90+
for (uint256 i = 0; i < _poolBoosters.length; i++) {
91+
_removePoolBoosterAddress(_poolBoosters[i]);
9292
}
9393
}
9494

@@ -110,12 +110,14 @@ contract CurvePoolBoosterBribesModule is AbstractSafeModule {
110110
/// - numberOfPeriods = 1 → extend by one period (week)
111111
/// - maxRewardPerVote = 0 → no update
112112
/// @dev Calls `manageCampaign` on each pool booster via the Safe. The Safe must hold
113-
/// enough ETH to cover `bridgeFee * pools.length`.
113+
/// enough ETH to cover `bridgeFee * poolBoosters.length`.
114114
function manageBribes() external onlyOperator {
115-
uint256[] memory totalRewardAmounts = new uint256[](pools.length);
116-
uint8[] memory extraDuration = new uint8[](pools.length);
117-
uint256[] memory rewardsPerVote = new uint256[](pools.length);
118-
for (uint256 i = 0; i < pools.length; i++) {
115+
uint256[] memory totalRewardAmounts = new uint256[](
116+
poolBoosters.length
117+
);
118+
uint8[] memory extraDuration = new uint8[](poolBoosters.length);
119+
uint256[] memory rewardsPerVote = new uint256[](poolBoosters.length);
120+
for (uint256 i = 0; i < poolBoosters.length; i++) {
119121
totalRewardAmounts[i] = type(uint256).max; // use all available rewards
120122
extraDuration[i] = 1; // extend by 1 period (week)
121123
rewardsPerVote[i] = 0; // no update to maxRewardPerVote
@@ -125,7 +127,7 @@ contract CurvePoolBoosterBribesModule is AbstractSafeModule {
125127

126128
/// @notice Fully configurable entry point to manage bribe campaigns. Allows setting
127129
/// reward amounts, durations, and reward rates individually for each pool.
128-
/// Each array must have the same length as the pools array.
130+
/// Each array must have the same length as the poolBoosters array.
129131
/// @param totalRewardAmounts Total reward amount per pool (0 = no update, type(uint256).max = use all available)
130132
/// @param extraDuration Number of periods to extend per pool (0 = no update, 1 = +1 week)
131133
/// @param rewardsPerVote Max reward per vote per pool (0 = no update)
@@ -134,9 +136,15 @@ contract CurvePoolBoosterBribesModule is AbstractSafeModule {
134136
uint8[] calldata extraDuration,
135137
uint256[] calldata rewardsPerVote
136138
) external onlyOperator {
137-
require(pools.length == totalRewardAmounts.length, "Length mismatch");
138-
require(pools.length == extraDuration.length, "Length mismatch");
139-
require(pools.length == rewardsPerVote.length, "Length mismatch");
139+
require(
140+
poolBoosters.length == totalRewardAmounts.length,
141+
"Length mismatch"
142+
);
143+
require(poolBoosters.length == extraDuration.length, "Length mismatch");
144+
require(
145+
poolBoosters.length == rewardsPerVote.length,
146+
"Length mismatch"
147+
);
140148
_manageBribes(totalRewardAmounts, extraDuration, rewardsPerVote);
141149
}
142150

@@ -146,35 +154,35 @@ contract CurvePoolBoosterBribesModule is AbstractSafeModule {
146154

147155
/// @notice Get the full list of managed CurvePoolBooster addresses
148156
/// @return Array of pool booster addresses
149-
function getPools() external view returns (address[] memory) {
150-
return pools;
157+
function getPoolBoosters() external view returns (address[] memory) {
158+
return poolBoosters;
151159
}
152160

153161
////////////////////////////////////////////////////
154162
/// --- Internal Functions
155163
////////////////////////////////////////////////////
156164

157165
/// @notice Internal logic to add a single pool booster address
158-
/// @dev Reverts if the address is already in the pools array
159-
/// @param _pool Address to append to the pools array
166+
/// @dev Reverts if the address is already in the poolBoosters array
167+
/// @param _pool Address to append to the poolBoosters array
160168
function _addPoolBoosterAddress(address _pool) internal {
161169
require(_pool != address(0), "Zero address");
162-
for (uint256 j = 0; j < pools.length; j++) {
163-
require(pools[j] != _pool, "Pool already added");
170+
for (uint256 j = 0; j < poolBoosters.length; j++) {
171+
require(poolBoosters[j] != _pool, "Pool already added");
164172
}
165-
pools.push(_pool);
173+
poolBoosters.push(_pool);
166174
emit PoolBoosterAddressAdded(_pool);
167175
}
168176

169177
/// @notice Internal logic to remove a pool booster address
170178
/// @dev Swaps the target with the last element and pops to avoid gaps
171-
/// @param pool Address to remove from the pools array
179+
/// @param pool Address to remove from the poolBoosters array
172180
function _removePoolBoosterAddress(address pool) internal {
173-
uint256 length = pools.length;
181+
uint256 length = poolBoosters.length;
174182
for (uint256 i = 0; i < length; i++) {
175-
if (pools[i] == pool) {
176-
pools[i] = pools[length - 1];
177-
pools.pop();
183+
if (poolBoosters[i] == pool) {
184+
poolBoosters[i] = poolBoosters[length - 1];
185+
poolBoosters.pop();
178186
emit PoolBoosterAddressRemoved(pool);
179187
return;
180188
}
@@ -209,13 +217,13 @@ contract CurvePoolBoosterBribesModule is AbstractSafeModule {
209217
uint8[] memory extraDuration,
210218
uint256[] memory rewardsPerVote
211219
) internal {
212-
uint256 pbCount = pools.length;
220+
uint256 pbCount = poolBoosters.length;
213221
require(
214222
address(safeContract).balance >= bridgeFee * pbCount,
215223
"Not enough ETH for bridge fees"
216224
);
217225
for (uint256 i = 0; i < pbCount; i++) {
218-
address poolBoosterAddress = pools[i];
226+
address poolBoosterAddress = poolBoosters[i];
219227
require(
220228
safeContract.execTransactionFromModule(
221229
poolBoosterAddress,

contracts/tasks/poolBooster.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const SECONDS_PER_WEEK = 60 * 60 * 24 * 7;
2323

2424
// Minimal ABIs
2525
const bribesModuleAbi = [
26-
"function getPools() external view returns (address[])",
26+
"function getPoolBoosters() external view returns (address[])",
2727
"function manageBribes() external",
2828
"function manageBribes(uint256[] totalRewardAmounts, uint8[] extraDuration, uint256[] rewardsPerVote) external",
2929
];
@@ -239,11 +239,11 @@ async function calculateRewardsPerVote(provider, options = {}) {
239239

240240
// Fetch pools from BribesModule
241241
const bribesModule = new Contract(BRIBES_MODULE, bribesModuleAbi, provider);
242-
const pools = await bribesModule.getPools();
243-
output(`Found ${pools.length} pools in BribesModule`);
242+
const pools = await bribesModule.getPoolBoosters();
243+
output(`Found ${pools.length} pool boosters in BribesModule`);
244244

245245
if (pools.length === 0) {
246-
output("No pools registered, nothing to calculate");
246+
output("No pool boosters registered, nothing to calculate");
247247
return { pools: [], rewardsPerVote: [] };
248248
}
249249

@@ -399,7 +399,7 @@ async function manageBribes({
399399
});
400400

401401
if (rewardsPerVote.length === 0) {
402-
log("No pools registered in BribesModule, nothing to do");
402+
log("No pool boosters registered in BribesModule, nothing to do");
403403
return;
404404
}
405405

0 commit comments

Comments
 (0)