|
| 1 | +// SPDX-License-Identifier: BUSL-1.1 |
| 2 | +pragma solidity ^0.8.12; |
| 3 | + |
| 4 | +import {EOADeployer} from "zeus-templates/templates/EOADeployer.sol"; |
| 5 | +import "../Env.sol"; |
| 6 | + |
| 7 | +import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; |
| 8 | +import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; |
| 9 | +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; |
| 10 | +import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; |
| 11 | +import "src/contracts/libraries/BeaconChainProofs.sol"; |
| 12 | + |
| 13 | +contract EmptyContract {} |
| 14 | + |
| 15 | +contract DeployFresh is EOADeployer { |
| 16 | + using Env for *; |
| 17 | + |
| 18 | + // helper fn |
| 19 | + function deployBlankProxy(string memory name) private returns (address) { |
| 20 | + return deployProxy({ |
| 21 | + name: name, |
| 22 | + deployedTo: address(new TransparentUpgradeableProxy( |
| 23 | + address(new EmptyContract()), |
| 24 | + Env.proxyAdmin(), |
| 25 | + "" |
| 26 | + )) |
| 27 | + }); |
| 28 | + } |
| 29 | + |
| 30 | + function _runAsEOA() internal override { |
| 31 | + vm.startBroadcast(); |
| 32 | + address[] memory pausers = new address[](3); |
| 33 | + pausers[0] = Env.pauserMultisig(); |
| 34 | + pausers[1] = Env.opsMultisig(); |
| 35 | + pausers[2] = Env.executorMultisig(); |
| 36 | + |
| 37 | + deployBlankProxy({ |
| 38 | + admin: |
| 39 | + }); |
| 40 | + |
| 41 | + deployBlankProxy({ |
| 42 | + name: type(PauserRegistry).name, |
| 43 | + implementation: address(new PauserRegistry({ |
| 44 | + _pausers: pausers, |
| 45 | + _unpauser: Env.executorMultisig() |
| 46 | + })), |
| 47 | + admin: Env.proxyAdmin(), |
| 48 | + data: "" |
| 49 | + }); |
| 50 | + |
| 51 | + deployProxyAndImpl({ |
| 52 | + name: type(PermissionController).name, |
| 53 | + implementation: address(new PermissionController()), |
| 54 | + admin: Env.proxyAdmin(), |
| 55 | + data: "" |
| 56 | + }); |
| 57 | + |
| 58 | + deployProxyAndImpl({ |
| 59 | + name: type(DelegationManager).name, |
| 60 | + implementation: address(new DelegationManager({ |
| 61 | + _strategyManager: Env.proxy.strategyManager(), |
| 62 | + _eigenPodManager: Env.proxy.eigenPodManager(), |
| 63 | + _allocationManager: Env.proxy.allocationManager(), |
| 64 | + _pauserRegistry: Env.impl.pauserRegistry(), |
| 65 | + _permissionController: Env.proxy.permissionController(), |
| 66 | + _MIN_WITHDRAWAL_DELAY: Env.MIN_WITHDRAWAL_DELAY() |
| 67 | + })), |
| 68 | + admin: Env.proxyAdmin(), |
| 69 | + data: "" |
| 70 | + }); |
| 71 | + |
| 72 | + deployProxyAndImpl({ |
| 73 | + name: type(StrategyManager).name, |
| 74 | + implementation: address(new StrategyManager({ |
| 75 | + _delegation: Env.proxy.delegationManager(), |
| 76 | + _pauserRegistry: Env.impl.pauserRegistry() |
| 77 | + })), |
| 78 | + admin: Env.proxyAdmin(), |
| 79 | + data: "" |
| 80 | + }); |
| 81 | + |
| 82 | + deployProxyAndImpl({ |
| 83 | + name: type(AVSDirectory).name, |
| 84 | + implementation: address(new AVSDirectory({ |
| 85 | + _delegation: Env.proxy.delegationManager(), |
| 86 | + _pauserRegistry: Env.impl.pauserRegistry() |
| 87 | + })), |
| 88 | + admin: Env.proxyAdmin(), |
| 89 | + data: "" |
| 90 | + }); |
| 91 | + |
| 92 | + /// core |
| 93 | + deployProxyAndImpl({ |
| 94 | + name: type(AllocationManager).name, |
| 95 | + implementation: address(new AllocationManager({ |
| 96 | + _delegation: Env.proxy.delegationManager(), |
| 97 | + _pauserRegistry: Env.impl.pauserRegistry(), |
| 98 | + _permissionController: Env.proxy.permissionController(), |
| 99 | + _DEALLOCATION_DELAY: Env.MIN_WITHDRAWAL_DELAY(), |
| 100 | + _ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY() |
| 101 | + })), |
| 102 | + admin: Env.proxyAdmin(), |
| 103 | + data: abi.encodeCall( |
| 104 | + AllocationManager.initialize, |
| 105 | + ( |
| 106 | + Env.executorMultisig(), // initialOwner |
| 107 | + 0 // initialPausedStatus |
| 108 | + ) |
| 109 | + ) |
| 110 | + }); |
| 111 | + |
| 112 | + |
| 113 | + deployProxyAndImpl({ |
| 114 | + name: type(RewardsCoordinator).name, |
| 115 | + implementation: address(new RewardsCoordinator({ |
| 116 | + _delegationManager: Env.proxy.delegationManager(), |
| 117 | + _strategyManager: Env.proxy.strategyManager(), |
| 118 | + _allocationManager: Env.proxy.allocationManager(), |
| 119 | + _pauserRegistry: Env.impl.pauserRegistry(), |
| 120 | + _permissionController: Env.proxy.permissionController(), |
| 121 | + _CALCULATION_INTERVAL_SECONDS: Env.CALCULATION_INTERVAL_SECONDS(), |
| 122 | + _MAX_REWARDS_DURATION: Env.MAX_REWARDS_DURATION(), |
| 123 | + _MAX_RETROACTIVE_LENGTH: Env.MAX_RETROACTIVE_LENGTH(), |
| 124 | + _MAX_FUTURE_LENGTH: Env.MAX_FUTURE_LENGTH(), |
| 125 | + _GENESIS_REWARDS_TIMESTAMP: Env.GENESIS_REWARDS_TIMESTAMP() |
| 126 | + })), |
| 127 | + admin: Env.proxyAdmin(), |
| 128 | + data: "" |
| 129 | + }); |
| 130 | + |
| 131 | + deployProxyAndImpl({ |
| 132 | + name: type(EigenPodManager).name, |
| 133 | + implementation: address(new EigenPodManager({ |
| 134 | + _ethPOS: Env.ethPOS(), |
| 135 | + _eigenPodBeacon: Env.beacon.eigenPod(), |
| 136 | + _delegationManager: Env.proxy.delegationManager(), |
| 137 | + _pauserRegistry: Env.impl.pauserRegistry() |
| 138 | + })), |
| 139 | + admin: Env.proxyAdmin(), |
| 140 | + data: "" |
| 141 | + }); |
| 142 | + |
| 143 | + deployProxyAndImpl({ |
| 144 | + name: type(EigenPod).name, |
| 145 | + implementation: address(new EigenPod({ |
| 146 | + _ethPOS: Env.ethPOS(), |
| 147 | + _eigenPodManager: Env.proxy.eigenPodManager(), |
| 148 | + _GENESIS_TIME: Env.EIGENPOD_GENESIS_TIME() |
| 149 | + })), |
| 150 | + admin: Env.proxyAdmin(), |
| 151 | + data: "" |
| 152 | + }); |
| 153 | + |
| 154 | + /// strategies/ |
| 155 | + deployImpl({ |
| 156 | + name: type(StrategyBaseTVLLimits).name, |
| 157 | + deployedTo: address(new StrategyBaseTVLLimits({ |
| 158 | + _strategyManager: Env.proxy.strategyManager(), |
| 159 | + _pauserRegistry: Env.impl.pauserRegistry() |
| 160 | + })) |
| 161 | + }); |
| 162 | + |
| 163 | + deployImpl({ |
| 164 | + name: type(EigenStrategy).name, |
| 165 | + deployedTo: address(new EigenStrategy({ |
| 166 | + _strategyManager: Env.proxy.strategyManager(), |
| 167 | + _pauserRegistry: Env.impl.pauserRegistry() |
| 168 | + })) |
| 169 | + }); |
| 170 | + |
| 171 | + deployImpl({ |
| 172 | + name: type(StrategyFactory).name, |
| 173 | + deployedTo: address(new StrategyFactory({ |
| 174 | + _strategyManager: Env.proxy.strategyManager(), |
| 175 | + _pauserRegistry: Env.impl.pauserRegistry() |
| 176 | + })) |
| 177 | + }); |
| 178 | + |
| 179 | + // for strategies deployed via factory |
| 180 | + deployImpl({ |
| 181 | + name: type(StrategyBase).name, |
| 182 | + deployedTo: address(new StrategyBase({ |
| 183 | + _strategyManager: Env.proxy.strategyManager(), |
| 184 | + _pauserRegistry: Env.impl.pauserRegistry() |
| 185 | + })) |
| 186 | + }); |
| 187 | + |
| 188 | + vm.stopBroadcast(); |
| 189 | + } |
| 190 | + |
| 191 | + function testScript() public virtual { |
| 192 | + _runAsEOA(); |
| 193 | + } |
| 194 | +} |
0 commit comments