|
| 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 {DeployFresh, ITransparentUpgradeableProxy} from "./1-deploy.s.sol"; |
| 6 | +import {MultisigBuilder} from "zeus-templates/templates/MultisigBuilder.sol"; |
| 7 | +import "../Env.sol"; |
| 8 | + |
| 9 | +import {Encode, MultisigCall} from "zeus-templates/utils/Encode.sol"; |
| 10 | +import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; |
| 11 | +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; |
| 12 | +import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; |
| 13 | +import "src/contracts/libraries/BeaconChainProofs.sol"; |
| 14 | +import "forge-std/console.sol"; |
| 15 | + |
| 16 | +/** |
| 17 | + * Purpose: update the implementation contracts on the previously deployed blank proxies. |
| 18 | + */ |
| 19 | +contract Queue is MultisigBuilder, DeployFresh { |
| 20 | + using Env for *; |
| 21 | + using Encode for *; |
| 22 | + |
| 23 | + function _getCalldataToExecutor() internal returns (bytes memory) { |
| 24 | + ProxyAdmin pa = ProxyAdmin(Env.proxyAdmin()); |
| 25 | + MultisigCall[] storage executorCalls = Encode.newMultisigCalls(); |
| 26 | + executorCalls.append({ |
| 27 | + to: Env.proxyAdmin(), |
| 28 | + data: abi.encodeCall( |
| 29 | + pa.upgradeAndCall, |
| 30 | + ( |
| 31 | + ITransparentUpgradeableProxy(payable(address(Env.proxy.delegationManager()))), |
| 32 | + address(Env.impl.delegationManager()), |
| 33 | + abi.encodeCall( |
| 34 | + DelegationManager.initialize, |
| 35 | + ( |
| 36 | + Env.executorMultisig(), |
| 37 | + Env.DELEGATION_INIT_PAUSED_STATUS() |
| 38 | + ) |
| 39 | + ) |
| 40 | + ) |
| 41 | + ) |
| 42 | + }); |
| 43 | + executorCalls.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 | + ) |
| 59 | + ) |
| 60 | + }); |
| 61 | + executorCalls.append({ |
| 62 | + to: Env.proxyAdmin(), |
| 63 | + data: abi.encodeCall( |
| 64 | + pa.upgradeAndCall, |
| 65 | + ( |
| 66 | + ITransparentUpgradeableProxy(payable(address(Env.proxy.avsDirectory()))), |
| 67 | + address(Env.impl.avsDirectory()), |
| 68 | + abi.encodeCall( |
| 69 | + AVSDirectory.initialize, |
| 70 | + ( |
| 71 | + Env.executorMultisig(), |
| 72 | + 0 |
| 73 | + ) |
| 74 | + ) |
| 75 | + ) |
| 76 | + ) |
| 77 | + }); |
| 78 | + executorCalls.append({ |
| 79 | + to: Env.proxyAdmin(), |
| 80 | + data: abi.encodeCall( |
| 81 | + pa.upgradeAndCall, |
| 82 | + ( |
| 83 | + ITransparentUpgradeableProxy(payable(address(Env.proxy.eigenPodManager()))), |
| 84 | + address(Env.impl.eigenPodManager()), |
| 85 | + abi.encodeCall( |
| 86 | + EigenPodManager.initialize, |
| 87 | + ( |
| 88 | + Env.executorMultisig(), |
| 89 | + Env.EIGENPOD_MANAGER_INIT_PAUSED_STATUS() |
| 90 | + ) |
| 91 | + ) |
| 92 | + ) |
| 93 | + ) |
| 94 | + }); |
| 95 | + executorCalls.append({ |
| 96 | + to: Env.proxyAdmin(), |
| 97 | + data: abi.encodeCall( |
| 98 | + pa.upgradeAndCall, |
| 99 | + ( |
| 100 | + ITransparentUpgradeableProxy(payable(address(Env.proxy.rewardsCoordinator()))), |
| 101 | + address(Env.impl.rewardsCoordinator()), |
| 102 | + abi.encodeCall( |
| 103 | + RewardsCoordinator.initialize, |
| 104 | + ( |
| 105 | + Env.executorMultisig(), |
| 106 | + Env.REWARDS_PAUSE_STATUS(), |
| 107 | + Env.REWARDS_UPDATER(), |
| 108 | + Env.ACTIVATION_DELAY(), |
| 109 | + Env.DEFAULT_SPLIT_BIPS() |
| 110 | + ) |
| 111 | + ) |
| 112 | + ) |
| 113 | + ) |
| 114 | + }); |
| 115 | + executorCalls.append({ |
| 116 | + to: Env.proxyAdmin(), |
| 117 | + data: abi.encodeCall( |
| 118 | + pa.upgradeAndCall, |
| 119 | + ( |
| 120 | + ITransparentUpgradeableProxy(payable(address(Env.proxy.allocationManager()))), |
| 121 | + address(Env.impl.allocationManager()), |
| 122 | + abi.encodeCall( |
| 123 | + AllocationManager.initialize, |
| 124 | + ( |
| 125 | + Env.executorMultisig(), |
| 126 | + Env.ALLOCATION_MANAGER_INIT_PAUSED_STATUS() |
| 127 | + ) |
| 128 | + ) |
| 129 | + ) |
| 130 | + ) |
| 131 | + }); |
| 132 | + executorCalls.append({ |
| 133 | + to: Env.proxyAdmin(), |
| 134 | + data: abi.encodeCall( |
| 135 | + pa.upgrade, |
| 136 | + ( |
| 137 | + ITransparentUpgradeableProxy(payable(address(Env.proxy.permissionController()))), |
| 138 | + address(Env.impl.permissionController()) |
| 139 | + ) |
| 140 | + ) |
| 141 | + }); |
| 142 | + |
| 143 | + return Encode.gnosisSafe.execTransaction({ |
| 144 | + from: address(Env.timelockController()), |
| 145 | + to: address(Env.multiSendCallOnly()), |
| 146 | + op: Encode.Operation.DelegateCall, |
| 147 | + data: Encode.multiSend(executorCalls) |
| 148 | + }); |
| 149 | + } |
| 150 | + |
| 151 | + function _runAsMultisig() prank(Env.protocolCouncilMultisig()) internal virtual override { |
| 152 | + bytes memory calldata_to_executor = _getCalldataToExecutor(); |
| 153 | + TimelockController timelock = Env.timelockController(); |
| 154 | + timelock.schedule({ |
| 155 | + target: Env.executorMultisig(), |
| 156 | + value: 0, |
| 157 | + data: calldata_to_executor, |
| 158 | + predecessor: 0, |
| 159 | + salt: 0, |
| 160 | + delay: timelock.getMinDelay() |
| 161 | + }); |
| 162 | + } |
| 163 | + |
| 164 | + function testDeploy() public override virtual {} // prevent duplicate test. |
| 165 | + |
| 166 | + function testScript() public virtual { |
| 167 | + _runAsEOA(); |
| 168 | + execute(); |
| 169 | + } |
| 170 | +} |
0 commit comments