Skip to content

Commit 2a226d6

Browse files
fix: deploy contracts only once in script!
this script was deploying the contracts twice since `run()` called `cheats.broadcast` and was used inside `setUp` this commit fixes the behavior by splitting up functions more appropriately
1 parent 9fd2aae commit 2a226d6

File tree

1 file changed

+34
-20
lines changed

1 file changed

+34
-20
lines changed

script/Deploy_ProgrammaticIncentives_PreProd.s.sol

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,22 @@ contract Deploy_ProgrammaticIncentives_PreProd is Script, ProgrammaticIncentives
5757
proxyAdmin.upgrade(TransparentUpgradeableProxy(payable(address(beigen))), address(beigenImpl));
5858
cheats.stopPrank();
5959

60-
run();
60+
// set up strategy arrays and amounts array
61+
_amounts[0] = 1e24;
62+
_amounts[1] = 2e26;
63+
_strategiesAndMultipliers[0].push(IRewardsCoordinator.StrategyAndMultiplier({
64+
strategy: eigenStrategy,
65+
multiplier: 1e18
66+
}));
67+
for (uint256 i = 0; i < deployedStrategyArray.length; ++i) {
68+
_strategiesAndMultipliers[1].push(IRewardsCoordinator.StrategyAndMultiplier({
69+
strategy: deployedStrategyArray[i],
70+
// TODO: correct multipliers!
71+
multiplier: 1e18
72+
}));
73+
}
74+
75+
deployContracts();
6176

6277
// give tokenHopper bEIGEN minting permission and disable transfer restrictions
6378
cheats.startPrank(Ownable(address(beigen)).owner());
@@ -77,23 +92,13 @@ contract Deploy_ProgrammaticIncentives_PreProd is Script, ProgrammaticIncentives
7792
}
7893

7994
function run() public {
80-
// deploy ActionGenerator & Hopper
81-
// TODO: correct amounts
82-
_amounts[0] = 1e24;
83-
_amounts[1] = 2e26;
84-
_strategiesAndMultipliers[0].push(IRewardsCoordinator.StrategyAndMultiplier({
85-
strategy: eigenStrategy,
86-
multiplier: 1e18
87-
}));
88-
for (uint256 i = 0; i < deployedStrategyArray.length; ++i) {
89-
_strategiesAndMultipliers[1].push(IRewardsCoordinator.StrategyAndMultiplier({
90-
strategy: deployedStrategyArray[i],
91-
// TODO: correct multipliers!
92-
multiplier: 1e18
93-
}));
94-
}
95-
9695
cheats.startBroadcast();
96+
deployContracts();
97+
cheats.stopBroadcast();
98+
}
99+
100+
function deployContracts() public {
101+
// deploy ActionGenerator & Hopper
97102
actionGenerator = new RewardAllStakersActionGenerator({
98103
_rewardsCoordinator: rewardsCoordinator,
99104
_firstSubmissionStartTimestamp: config_firstSubmissionStartTimestamp,
@@ -104,7 +109,6 @@ contract Deploy_ProgrammaticIncentives_PreProd is Script, ProgrammaticIncentives
104109
_EIGEN: eigen
105110
});
106111

107-
// TODO: correct config
108112
ITokenHopper.HopperConfiguration memory hopperConfiguration = ITokenHopper.HopperConfiguration({
109113
token: address(eigen),
110114
startTime: config_startTime,
@@ -117,7 +121,6 @@ contract Deploy_ProgrammaticIncentives_PreProd is Script, ProgrammaticIncentives
117121
config: hopperConfiguration,
118122
initialOwner: initialOwner
119123
});
120-
cheats.stopBroadcast();
121124
}
122125

123126
function test_ProgrammaticIncentives_Deployment() public {
@@ -156,8 +159,19 @@ contract Deploy_ProgrammaticIncentives_PreProd is Script, ProgrammaticIncentives
156159
// deployedStrategyArray.push(StrategyBase(strategyAddress));
157160
// }
158161
// TODO: above is broken because array in config is empty -- this is the WETH Strategy address and "BeaconChainETH Strategy"
159-
deployedStrategyArray.push(StrategyBase(address(0xD523267698C81a372191136e477fdebFa33D9FB4)));
160162
deployedStrategyArray.push(StrategyBase(address(0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0)));
163+
deployedStrategyArray.push(StrategyBase(address(0xD523267698C81a372191136e477fdebFa33D9FB4)));
164+
165+
// check for ordering
166+
address currAddress = address(0);
167+
for (uint256 i = 0; i < deployedStrategyArray.length; ++i) {
168+
IStrategy strategy = deployedStrategyArray[i];
169+
require(
170+
currAddress < address(strategy),
171+
"strategies must be in ascending order for submission"
172+
);
173+
currAddress = address(strategy);
174+
}
161175

162176
// token
163177
proxyAdmin = ProxyAdmin(stdJson.readAddress(existingDeploymentData, ".addresses.token.tokenProxyAdmin"));

0 commit comments

Comments
 (0)