22pragma solidity ^ 0.8.12 ;
33
44import {EOADeployer} from "zeus-templates/templates/EOADeployer.sol " ;
5- import {DeployFresh} from "./1-deploy-proxies-and-implementations.s.sol " ;
5+ import {DeployFresh, ITransparentUpgradeableProxy } from "./1-deploy-proxies-and-implementations.s.sol " ;
66import {MultisigBuilder} from "zeus-templates/templates/MultisigBuilder.sol " ;
77import "../Env.sol " ;
88
9- import " @openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy .sol " ;
10- import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol " ;
9+ import {Encode, MultisigCall} from " zeus-templates/utils/Encode .sol " ;
10+ import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol " ;
1111import "@openzeppelin/contracts/token/ERC20/IERC20.sol " ;
1212import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol " ;
1313import "src/contracts/libraries/BeaconChainProofs.sol " ;
@@ -18,92 +18,143 @@ import "forge-std/console.sol";
1818 */
1919contract UpgradeContracts is MultisigBuilder , DeployFresh {
2020 using Env for * ;
21+ using Encode for * ;
2122
22- function _runAsMultisig () prank (Env. protocolCouncilMultisig ()) internal virtual override {
23+ function _getCalldataToExecutor () internal returns ( bytes memory ) {
2324 ProxyAdmin pa = ProxyAdmin (Env.proxyAdmin ());
2425
25- pa.upgradeAndCall (
26- ITransparentUpgradeableProxy (payable (address (Env.proxy.delegationManager ()))),
27- address (Env.impl.delegationManager ()),
28- abi.encodeCall (
29- DelegationManager.initialize,
30- (
31- Env.executorMultisig (),
32- Env.DELEGATION_INIT_PAUSED_STATUS ()
26+ MultisigCall[] storage executorCalls = Encode.newMultisigCalls ()
27+ .append ({
28+ to: Env.proxyAdmin (),
29+ data: abi.encodeCall (
30+ pa.upgradeAndCall,
31+ (
32+ ITransparentUpgradeableProxy (payable (address (Env.proxy.delegationManager ()))),
33+ address (Env.impl.delegationManager ()),
34+ abi.encodeCall (
35+ DelegationManager.initialize,
36+ (
37+ Env.executorMultisig (),
38+ Env.DELEGATION_INIT_PAUSED_STATUS ()
39+ )
40+ )
41+ )
42+ )
43+ }).append ({
44+ to: Env.proxyAdmin (),
45+ data: abi.encodeCall (
46+ pa.upgradeAndCall,
47+ (
48+ ITransparentUpgradeableProxy (payable (address (Env.proxy.strategyManager ()))),
49+ address (Env.impl.strategyManager ()),
50+ abi.encodeCall (
51+ StrategyManager.initialize,
52+ (
53+ Env.executorMultisig (),
54+ Env.opsMultisig (),
55+ Env.STRATEGY_MANAGER_INIT_PAUSED_STATUS ()
56+ )
57+ )
58+ )
3359 )
34- )
35- );
36-
37- pa.upgradeAndCall (
38- ITransparentUpgradeableProxy (payable (address (Env.proxy.strategyManager ()))),
39- address (Env.impl.strategyManager ()),
40- abi.encodeCall (
41- StrategyManager.initialize,
42- (
43- Env.executorMultisig (),
44- Env.opsMultisig (),
45- Env.STRATEGY_MANAGER_INIT_PAUSED_STATUS ()
60+ }).append ({
61+ to: Env.proxyAdmin (),
62+ data: abi.encodeCall (
63+ pa.upgradeAndCall,
64+ (
65+ ITransparentUpgradeableProxy (payable (address (Env.proxy.avsDirectory ()))),
66+ address (Env.impl.avsDirectory ()),
67+ abi.encodeCall (
68+ AVSDirectory.initialize,
69+ (
70+ Env.executorMultisig (),
71+ 0
72+ )
73+ )
74+ )
4675 )
47- )
48- );
49-
50- pa.upgradeAndCall (
51- ITransparentUpgradeableProxy (payable (address (Env.proxy.avsDirectory ()))),
52- address (Env.impl.avsDirectory ()),
53- abi.encodeCall (
54- AVSDirectory.initialize,
55- (
56- Env.executorMultisig (),
57- 0
76+ }).append ({
77+ to: Env.proxyAdmin (),
78+ data: abi.encodeCall (
79+ pa.upgradeAndCall,
80+ (
81+ ITransparentUpgradeableProxy (payable (address (Env.proxy.eigenPodManager ()))),
82+ address (Env.impl.eigenPodManager ()),
83+ abi.encodeCall (
84+ EigenPodManager.initialize,
85+ (
86+ Env.executorMultisig (),
87+ Env.EIGENPOD_MANAGER_INIT_PAUSED_STATUS ()
88+ )
89+ )
90+ )
5891 )
59- )
60- );
61-
62- pa.upgradeAndCall (
63- ITransparentUpgradeableProxy (payable (address (Env.proxy.eigenPodManager ()))),
64- address (Env.impl.eigenPodManager ()),
65- abi.encodeCall (
66- EigenPodManager.initialize,
67- (
68- Env.executorMultisig (),
69- Env.EIGENPOD_MANAGER_INIT_PAUSED_STATUS ()
92+ }).append ({
93+ to: Env.proxyAdmin (),
94+ data: abi.encodeCall (
95+ pa.upgradeAndCall,
96+ (
97+ ITransparentUpgradeableProxy (payable (address (Env.proxy.rewardsCoordinator ()))),
98+ address (Env.impl.rewardsCoordinator ()),
99+ abi.encodeCall (
100+ RewardsCoordinator.initialize,
101+ (
102+ Env.executorMultisig (),
103+ Env.REWARDS_PAUSE_STATUS (),
104+ Env.REWARDS_UPDATER (),
105+ Env.ACTIVATION_DELAY (),
106+ Env.DEFAULT_SPLIT_BIPS ()
107+ )
108+ )
109+ )
70110 )
71- )
72- );
73-
74- pa.upgradeAndCall (
75- ITransparentUpgradeableProxy (payable (address (Env.proxy.rewardsCoordinator ()))),
76- address (Env.impl.rewardsCoordinator ()),
77- abi.encodeCall (
78- RewardsCoordinator.initialize,
79- (
80- Env.executorMultisig (),
81- Env.REWARDS_PAUSE_STATUS (),
82- Env.REWARDS_UPDATER (),
83- Env.ACTIVATION_DELAY (),
84- Env.DEFAULT_SPLIT_BIPS ()
111+ }).append ({
112+ to: Env.proxyAdmin (),
113+ data: abi.encodeCall (
114+ pa.upgradeAndCall,
115+ (
116+ ITransparentUpgradeableProxy (payable (address (Env.proxy.allocationManager ()))),
117+ address (Env.impl.allocationManager ()),
118+ abi.encodeCall (
119+ AllocationManager.initialize,
120+ (
121+ Env.executorMultisig (),
122+ Env.ALLOCATION_MANAGER_INIT_PAUSED_STATUS ()
123+ )
124+ )
125+ )
85126 )
86- )
87- );
88-
89- pa.upgradeAndCall (
90- ITransparentUpgradeableProxy (payable (address (Env.proxy.allocationManager ()))),
91- address (Env.impl.allocationManager ()),
92- abi.encodeCall (
93- AllocationManager.initialize,
94- (
95- Env.executorMultisig (),
96- Env.ALLOCATION_MANAGER_INIT_PAUSED_STATUS ()
127+ }).append ({
128+ to: Env.proxyAdmin (),
129+ data: abi.encodeCall (
130+ pa.upgrade,
131+ (
132+ ITransparentUpgradeableProxy (payable (address (Env.proxy.permissionController ()))),
133+ address (Env.impl.permissionController ())
134+ )
97135 )
98- )
99- );
100-
101- pa.upgrade (
102- ITransparentUpgradeableProxy (payable (address (Env.proxy.permissionController ()))),
103- address (Env.impl.permissionController ())
104- );
136+ });
137+
138+ return Encode.gnosisSafe.execTransaction ({
139+ from: address (Env.timelockController ()),
140+ to: address (Env.multiSendCallOnly ()),
141+ op: Encode.Operation.DelegateCall,
142+ data: Encode.multiSend (executorCalls)
143+ });
105144 }
106145
146+ function _runAsMultisig () prank (Env.protocolCouncilMultisig ()) internal virtual override {
147+ bytes memory calldata_to_executor = _getCalldataToExecutor ();
148+ TimelockController timelock = Env.timelockController ();
149+ timelock.schedule ({
150+ target: Env.executorMultisig (),
151+ value: 0 ,
152+ data: calldata_to_executor,
153+ predecessor: 0 ,
154+ salt: 0 ,
155+ delay: timelock.getMinDelay ()
156+ });
157+ }
107158
108159 function testDeploy () public override virtual {} // prevent duplicate test.
109160
0 commit comments