|
| 1 | +// Deploy StakingRouter 1.5 to Sepolia |
| 2 | + |
| 3 | +import { assert } from "chai"; |
| 4 | +import { ethers, run } from "hardhat"; |
| 5 | + |
| 6 | +import { deployContract, deployImplementation, deployWithoutProxy, log, readNetworkState, Sk } from "lib"; |
| 7 | + |
| 8 | +function sleep(ms: number): Promise<void> { |
| 9 | + return new Promise((resolve) => setTimeout(resolve, ms)); |
| 10 | +} |
| 11 | + |
| 12 | +export async function main(): Promise<void> { |
| 13 | + const deployer = (await ethers.provider.getSigner()).address; |
| 14 | + assert.equal(process.env.DEPLOYER, deployer); |
| 15 | + |
| 16 | + const state = readNetworkState(); |
| 17 | + |
| 18 | + const DEPOSIT_CONTRACT_ADDRESS = state[Sk.chainSpec].depositContract; |
| 19 | + const APP_AGENT_ADDRESS = state[Sk.appAgent].proxy.address; |
| 20 | + const DEPOSIT_SECURITY_MODULE = state[Sk.deployer]; |
| 21 | + const SC_ADMIN = APP_AGENT_ADDRESS; |
| 22 | + const LIDO = state[Sk.appLido].proxy.address; |
| 23 | + const STAKING_ROUTER = state[Sk.stakingRouter].proxy.address; |
| 24 | + const LOCATOR = state[Sk.lidoLocator].proxy.address; |
| 25 | + const LEGACY_ORACLE = state[Sk.appOracle].proxy.address; |
| 26 | + const ACCOUNTING_ORACLE_PROXY = state[Sk.accountingOracle].proxy.address; |
| 27 | + const EL_REWARDS_VAULT = state[Sk.executionLayerRewardsVault].address; |
| 28 | + const BURNER = state[Sk.burner].address; |
| 29 | + const TREASURY_ADDRESS = APP_AGENT_ADDRESS; |
| 30 | + const VEBO = state[Sk.validatorsExitBusOracle].proxy.address; |
| 31 | + const WQ = state[Sk.withdrawalQueueERC721].proxy.address; |
| 32 | + const WITHDRAWAL_VAULT = state[Sk.withdrawalVault].proxy.address; |
| 33 | + const ORACLE_DAEMON_CONFIG = state[Sk.oracleDaemonConfig].address; |
| 34 | + |
| 35 | + // Deploy MinFirstAllocationStrategy |
| 36 | + const minFirstAllocationStrategyAddress = ( |
| 37 | + await deployWithoutProxy(Sk.minFirstAllocationStrategy, "MinFirstAllocationStrategy", deployer) |
| 38 | + ).address; |
| 39 | + |
| 40 | + log(`MinFirstAllocationStrategy address: ${minFirstAllocationStrategyAddress}`); |
| 41 | + const libraries = { |
| 42 | + MinFirstAllocationStrategy: minFirstAllocationStrategyAddress, |
| 43 | + }; |
| 44 | + |
| 45 | + log(`Deploying StakingRouter`, DEPOSIT_CONTRACT_ADDRESS); |
| 46 | + const stakingRouter = await deployContract("StakingRouter", [DEPOSIT_CONTRACT_ADDRESS], deployer, true, { |
| 47 | + libraries, |
| 48 | + }); |
| 49 | + |
| 50 | + console.log(`StakingRouter deployed to ${stakingRouter.address}`); |
| 51 | + |
| 52 | + const appNodeOperatorsRegistry = ( |
| 53 | + await deployImplementation(Sk.appNodeOperatorsRegistry, "NodeOperatorsRegistry", deployer, [], { libraries }) |
| 54 | + ).address; |
| 55 | + |
| 56 | + log(`NodeOperatorsRegistry address implementation: ${appNodeOperatorsRegistry}`); |
| 57 | + |
| 58 | + const SECONDS_PER_SLOT = 12; |
| 59 | + const GENESIS_TIME = 1655733600; |
| 60 | + |
| 61 | + const accountingOracleArgs = [LOCATOR, LIDO, LEGACY_ORACLE, SECONDS_PER_SLOT, GENESIS_TIME]; |
| 62 | + |
| 63 | + const accountingOracleAddress = ( |
| 64 | + await deployImplementation(Sk.accountingOracle, "AccountingOracle", deployer, accountingOracleArgs) |
| 65 | + ).address; |
| 66 | + |
| 67 | + log(`AO implementation address: ${accountingOracleAddress}`); |
| 68 | + |
| 69 | + const LIMITS = [1500, 0, 1000, 250, 2000, 100, 100, 128, 5000000, 1000, 101, 74]; |
| 70 | + |
| 71 | + const oracleReportSanityCheckerArgs = [LOCATOR, SC_ADMIN, LIMITS]; |
| 72 | + |
| 73 | + const oracleReportSanityCheckerAddress = ( |
| 74 | + await deployWithoutProxy( |
| 75 | + Sk.oracleReportSanityChecker, |
| 76 | + "OracleReportSanityChecker", |
| 77 | + deployer, |
| 78 | + oracleReportSanityCheckerArgs, |
| 79 | + ) |
| 80 | + ).address; |
| 81 | + |
| 82 | + log(`OracleReportSanityChecker new address ${oracleReportSanityCheckerAddress}`); |
| 83 | + |
| 84 | + const locatorConfig = [ |
| 85 | + [ |
| 86 | + ACCOUNTING_ORACLE_PROXY, |
| 87 | + DEPOSIT_SECURITY_MODULE, |
| 88 | + EL_REWARDS_VAULT, |
| 89 | + LEGACY_ORACLE, |
| 90 | + LIDO, |
| 91 | + oracleReportSanityCheckerAddress, |
| 92 | + LEGACY_ORACLE, |
| 93 | + BURNER, |
| 94 | + STAKING_ROUTER, |
| 95 | + TREASURY_ADDRESS, |
| 96 | + VEBO, |
| 97 | + WQ, |
| 98 | + WITHDRAWAL_VAULT, |
| 99 | + ORACLE_DAEMON_CONFIG, |
| 100 | + ], |
| 101 | + ]; |
| 102 | + |
| 103 | + const locatorAddress = (await deployImplementation(Sk.lidoLocator, "LidoLocator", deployer, locatorConfig)).address; |
| 104 | + |
| 105 | + log(`Locator implementation address ${locatorAddress}`); |
| 106 | + |
| 107 | + log("sleep before starting verification of contracts..."); |
| 108 | + await sleep(10_000); |
| 109 | + log("start verification of contracts..."); |
| 110 | + |
| 111 | + await run("verify:verify", { |
| 112 | + address: minFirstAllocationStrategyAddress, |
| 113 | + constructorArguments: [], |
| 114 | + contract: "contracts/common/lib/MinFirstAllocationStrategy.sol:MinFirstAllocationStrategy", |
| 115 | + }); |
| 116 | + |
| 117 | + await run("verify:verify", { |
| 118 | + address: stakingRouter.address, |
| 119 | + constructorArguments: [DEPOSIT_CONTRACT_ADDRESS], |
| 120 | + libraries: { |
| 121 | + MinFirstAllocationStrategy: minFirstAllocationStrategyAddress, |
| 122 | + }, |
| 123 | + contract: "contracts/0.8.9/StakingRouter.sol:StakingRouter", |
| 124 | + }); |
| 125 | + |
| 126 | + await run("verify:verify", { |
| 127 | + address: appNodeOperatorsRegistry, |
| 128 | + constructorArguments: [], |
| 129 | + libraries: { |
| 130 | + MinFirstAllocationStrategy: minFirstAllocationStrategyAddress, |
| 131 | + }, |
| 132 | + contract: "contracts/0.4.24/nos/NodeOperatorsRegistry.sol:NodeOperatorsRegistry", |
| 133 | + }); |
| 134 | + |
| 135 | + await run("verify:verify", { |
| 136 | + address: accountingOracleAddress, |
| 137 | + constructorArguments: accountingOracleArgs, |
| 138 | + contract: "contracts/0.8.9/oracle/AccountingOracle.sol:AccountingOracle", |
| 139 | + }); |
| 140 | + |
| 141 | + await run("verify:verify", { |
| 142 | + address: oracleReportSanityCheckerAddress, |
| 143 | + constructorArguments: oracleReportSanityCheckerArgs, |
| 144 | + contract: "contracts/0.8.9/sanity_checks/OracleReportSanityChecker.sol:OracleReportSanityChecker", |
| 145 | + }); |
| 146 | + |
| 147 | + await run("verify:verify", { |
| 148 | + address: locatorAddress, |
| 149 | + constructorArguments: locatorConfig, |
| 150 | + contract: "contracts/0.8.9/LidoLocator.sol:LidoLocator", |
| 151 | + }); |
| 152 | +} |
0 commit comments