|
| 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 | +/** |
| 8 | + * @title CoreContractsDeployer |
| 9 | + * @notice Provides reusable helpers for deploying individual core contract implementations. |
| 10 | + * Usage: |
| 11 | + * ```solidity |
| 12 | + * vm.startBroadcast(); |
| 13 | + * deployPermissionController(); |
| 14 | + * deployKeyRegistrar(); |
| 15 | + * vm.stopBroadcast(); |
| 16 | + * ``` |
| 17 | + */ |
| 18 | +abstract contract CoreContractsDeployer is EOADeployer { |
| 19 | + using Env for *; |
| 20 | + |
| 21 | + /** |
| 22 | + * permissions/ |
| 23 | + */ |
| 24 | + function deployPermissionController() internal onlyEOA returns (PermissionController deployed) { |
| 25 | + deployed = new PermissionController(); |
| 26 | + deployImpl({name: type(PermissionController).name, deployedTo: address(deployed)}); |
| 27 | + } |
| 28 | + |
| 29 | + function deployKeyRegistrar() internal onlyEOA returns (KeyRegistrar deployed) { |
| 30 | + deployed = new KeyRegistrar({ |
| 31 | + _permissionController: Env.proxy.permissionController(), |
| 32 | + _allocationManager: Env.proxy.allocationManager(), |
| 33 | + _version: Env.deployVersion() |
| 34 | + }); |
| 35 | + deployImpl({name: type(KeyRegistrar).name, deployedTo: address(deployed)}); |
| 36 | + } |
| 37 | + |
| 38 | + /** |
| 39 | + * core/ |
| 40 | + */ |
| 41 | + function deployAllocationManagerView() internal onlyEOA returns (AllocationManagerView deployed) { |
| 42 | + deployed = new AllocationManagerView({ |
| 43 | + _delegation: Env.proxy.delegationManager(), |
| 44 | + _eigenStrategy: Env.proxy.eigenStrategy(), |
| 45 | + _DEALLOCATION_DELAY: Env.MIN_WITHDRAWAL_DELAY(), |
| 46 | + _ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY() |
| 47 | + }); |
| 48 | + deployImpl({name: type(AllocationManagerView).name, deployedTo: address(deployed)}); |
| 49 | + } |
| 50 | + |
| 51 | + function deployAllocationManager() internal onlyEOA returns (AllocationManager deployed) { |
| 52 | + deployed = new AllocationManager({ |
| 53 | + _allocationManagerView: Env.impl.allocationManagerView(), |
| 54 | + _delegation: Env.proxy.delegationManager(), |
| 55 | + _eigenStrategy: Env.proxy.eigenStrategy(), |
| 56 | + _pauserRegistry: Env.impl.pauserRegistry(), |
| 57 | + _permissionController: Env.proxy.permissionController(), |
| 58 | + _DEALLOCATION_DELAY: Env.MIN_WITHDRAWAL_DELAY(), |
| 59 | + _ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY() |
| 60 | + }); |
| 61 | + deployImpl({name: type(AllocationManager).name, deployedTo: address(deployed)}); |
| 62 | + } |
| 63 | + |
| 64 | + function deployAVSDirectory() internal onlyEOA returns (AVSDirectory deployed) { |
| 65 | + deployed = new AVSDirectory({ |
| 66 | + _delegation: Env.proxy.delegationManager(), |
| 67 | + _pauserRegistry: Env.impl.pauserRegistry(), |
| 68 | + _version: Env.deployVersion() |
| 69 | + }); |
| 70 | + deployImpl({name: type(AVSDirectory).name, deployedTo: address(deployed)}); |
| 71 | + } |
| 72 | + |
| 73 | + function deployDelegationManager() internal onlyEOA returns (DelegationManager deployed) { |
| 74 | + deployed = new DelegationManager({ |
| 75 | + _strategyManager: Env.proxy.strategyManager(), |
| 76 | + _eigenPodManager: Env.proxy.eigenPodManager(), |
| 77 | + _allocationManager: Env.proxy.allocationManager(), |
| 78 | + _pauserRegistry: Env.impl.pauserRegistry(), |
| 79 | + _permissionController: Env.proxy.permissionController(), |
| 80 | + _MIN_WITHDRAWAL_DELAY: Env.MIN_WITHDRAWAL_DELAY(), |
| 81 | + _version: Env.deployVersion() |
| 82 | + }); |
| 83 | + deployImpl({name: type(DelegationManager).name, deployedTo: address(deployed)}); |
| 84 | + } |
| 85 | + |
| 86 | + function deployProtocolRegistry() internal onlyEOA returns (ProtocolRegistry deployed) { |
| 87 | + deployed = new ProtocolRegistry(); |
| 88 | + deployImpl({name: type(ProtocolRegistry).name, deployedTo: address(deployed)}); |
| 89 | + } |
| 90 | + |
| 91 | + function deployReleaseManager() internal onlyEOA returns (ReleaseManager deployed) { |
| 92 | + deployed = new ReleaseManager({_permissionController: Env.proxy.permissionController()}); |
| 93 | + deployImpl({name: type(ReleaseManager).name, deployedTo: address(deployed)}); |
| 94 | + } |
| 95 | + |
| 96 | + function deployRewardsCoordinator() internal onlyEOA returns (RewardsCoordinator deployed) { |
| 97 | + deployed = new RewardsCoordinator({ |
| 98 | + params: IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams({ |
| 99 | + delegationManager: Env.proxy.delegationManager(), |
| 100 | + strategyManager: Env.proxy.strategyManager(), |
| 101 | + allocationManager: Env.proxy.allocationManager(), |
| 102 | + pauserRegistry: Env.impl.pauserRegistry(), |
| 103 | + permissionController: Env.proxy.permissionController(), |
| 104 | + CALCULATION_INTERVAL_SECONDS: Env.CALCULATION_INTERVAL_SECONDS(), |
| 105 | + MAX_REWARDS_DURATION: Env.MAX_REWARDS_DURATION(), |
| 106 | + MAX_RETROACTIVE_LENGTH: Env.MAX_RETROACTIVE_LENGTH(), |
| 107 | + MAX_FUTURE_LENGTH: Env.MAX_FUTURE_LENGTH(), |
| 108 | + GENESIS_REWARDS_TIMESTAMP: Env.GENESIS_REWARDS_TIMESTAMP() |
| 109 | + }) |
| 110 | + }); |
| 111 | + deployImpl({name: type(RewardsCoordinator).name, deployedTo: address(deployed)}); |
| 112 | + } |
| 113 | + |
| 114 | + function deployStrategyManager() internal onlyEOA returns (StrategyManager deployed) { |
| 115 | + deployed = new StrategyManager({ |
| 116 | + _allocationManager: Env.proxy.allocationManager(), |
| 117 | + _delegation: Env.proxy.delegationManager(), |
| 118 | + _pauserRegistry: Env.impl.pauserRegistry(), |
| 119 | + _version: Env.deployVersion() |
| 120 | + }); |
| 121 | + deployImpl({name: type(StrategyManager).name, deployedTo: address(deployed)}); |
| 122 | + } |
| 123 | + |
| 124 | + /** |
| 125 | + * pods/ |
| 126 | + */ |
| 127 | + function deployEigenPodManager() internal onlyEOA returns (EigenPodManager deployed) { |
| 128 | + deployed = new EigenPodManager({ |
| 129 | + _ethPOS: Env.ethPOS(), |
| 130 | + _eigenPodBeacon: Env.beacon.eigenPod(), |
| 131 | + _delegationManager: Env.proxy.delegationManager(), |
| 132 | + _pauserRegistry: Env.impl.pauserRegistry() |
| 133 | + }); |
| 134 | + deployImpl({name: type(EigenPodManager).name, deployedTo: address(deployed)}); |
| 135 | + } |
| 136 | + |
| 137 | + function deployEigenPod() internal onlyEOA returns (EigenPod deployed) { |
| 138 | + deployed = new EigenPod({_ethPOS: Env.ethPOS(), _eigenPodManager: Env.proxy.eigenPodManager()}); |
| 139 | + deployImpl({name: type(EigenPod).name, deployedTo: address(deployed)}); |
| 140 | + } |
| 141 | + |
| 142 | + /** |
| 143 | + * strategies/ |
| 144 | + */ |
| 145 | + function deployEigenStrategy() internal onlyEOA returns (EigenStrategy deployed) { |
| 146 | + deployed = new EigenStrategy({ |
| 147 | + _strategyManager: Env.proxy.strategyManager(), |
| 148 | + _pauserRegistry: Env.impl.pauserRegistry() |
| 149 | + }); |
| 150 | + deployImpl({name: type(EigenStrategy).name, deployedTo: address(deployed)}); |
| 151 | + } |
| 152 | + |
| 153 | + function deployStrategyBase() internal onlyEOA returns (StrategyBase deployed) { |
| 154 | + deployed = new StrategyBase({ |
| 155 | + _strategyManager: Env.proxy.strategyManager(), |
| 156 | + _pauserRegistry: Env.impl.pauserRegistry() |
| 157 | + }); |
| 158 | + deployImpl({name: type(StrategyBase).name, deployedTo: address(deployed)}); |
| 159 | + } |
| 160 | + |
| 161 | + function deployStrategyBaseTVLLimits() internal onlyEOA returns (StrategyBaseTVLLimits deployed) { |
| 162 | + deployed = new StrategyBaseTVLLimits({ |
| 163 | + _strategyManager: Env.proxy.strategyManager(), |
| 164 | + _pauserRegistry: Env.impl.pauserRegistry() |
| 165 | + }); |
| 166 | + deployImpl({name: type(StrategyBaseTVLLimits).name, deployedTo: address(deployed)}); |
| 167 | + } |
| 168 | + |
| 169 | + function deployStrategyFactory() internal onlyEOA returns (StrategyFactory deployed) { |
| 170 | + deployed = new StrategyFactory({ |
| 171 | + _strategyManager: Env.proxy.strategyManager(), |
| 172 | + _pauserRegistry: Env.impl.pauserRegistry() |
| 173 | + }); |
| 174 | + deployImpl({name: type(StrategyFactory).name, deployedTo: address(deployed)}); |
| 175 | + } |
| 176 | + |
| 177 | + /** |
| 178 | + * multichain/ |
| 179 | + */ |
| 180 | + function deployBN254CertificateVerifier() internal onlyEOA returns (BN254CertificateVerifier deployed) { |
| 181 | + deployed = new BN254CertificateVerifier({_operatorTableUpdater: Env.proxy.operatorTableUpdater()}); |
| 182 | + deployImpl({name: type(BN254CertificateVerifier).name, deployedTo: address(deployed)}); |
| 183 | + } |
| 184 | + |
| 185 | + function deployCrossChainRegistry() internal onlyEOA returns (CrossChainRegistry deployed) { |
| 186 | + deployed = new CrossChainRegistry({ |
| 187 | + _allocationManager: Env.proxy.allocationManager(), |
| 188 | + _keyRegistrar: Env.proxy.keyRegistrar(), |
| 189 | + _permissionController: Env.proxy.permissionController(), |
| 190 | + _pauserRegistry: Env.impl.pauserRegistry() |
| 191 | + }); |
| 192 | + deployImpl({name: type(CrossChainRegistry).name, deployedTo: address(deployed)}); |
| 193 | + } |
| 194 | + |
| 195 | + function deployECDSACertificateVerifier() internal onlyEOA returns (ECDSACertificateVerifier deployed) { |
| 196 | + deployed = new ECDSACertificateVerifier({ |
| 197 | + _operatorTableUpdater: Env.proxy.operatorTableUpdater(), |
| 198 | + _version: Env.deployVersion() |
| 199 | + }); |
| 200 | + deployImpl({name: type(ECDSACertificateVerifier).name, deployedTo: address(deployed)}); |
| 201 | + } |
| 202 | + |
| 203 | + function deployOperatorTableUpdater() internal onlyEOA returns (OperatorTableUpdater deployed) { |
| 204 | + deployed = new OperatorTableUpdater({ |
| 205 | + _bn254CertificateVerifier: Env.proxy.bn254CertificateVerifier(), |
| 206 | + _ecdsaCertificateVerifier: Env.proxy.ecdsaCertificateVerifier(), |
| 207 | + _pauserRegistry: Env.impl.pauserRegistry() |
| 208 | + }); |
| 209 | + deployImpl({name: type(OperatorTableUpdater).name, deployedTo: address(deployed)}); |
| 210 | + } |
| 211 | + |
| 212 | + /** |
| 213 | + * avs/ |
| 214 | + */ |
| 215 | + function deployTaskMailbox() internal onlyEOA returns (TaskMailbox deployed) { |
| 216 | + deployed = new TaskMailbox({ |
| 217 | + _bn254CertificateVerifier: address(Env.proxy.bn254CertificateVerifier()), |
| 218 | + _ecdsaCertificateVerifier: address(Env.proxy.ecdsaCertificateVerifier()), |
| 219 | + _maxTaskSLA: Env.MAX_TASK_SLA() |
| 220 | + }); |
| 221 | + deployImpl({name: type(TaskMailbox).name, deployedTo: address(deployed)}); |
| 222 | + } |
| 223 | +} |
0 commit comments