From 516ba26825256fcf16347f4870dbf04eaf67eb8b Mon Sep 17 00:00:00 2001 From: Anton Kovalchuk Date: Thu, 22 Aug 2024 10:57:01 +0200 Subject: [PATCH] use deployer as admin when deploy token rate oracle, improve deploy logs --- .../optimism/deploy-new-steth-contracts.ts | 5 +- scripts/optimism/deploy-scratch.ts | 41 ++++++++-------- utils/deployment.ts | 49 ++++++++++--------- 3 files changed, 50 insertions(+), 45 deletions(-) diff --git a/scripts/optimism/deploy-new-steth-contracts.ts b/scripts/optimism/deploy-new-steth-contracts.ts index 4814f162..a61224c8 100644 --- a/scripts/optimism/deploy-new-steth-contracts.ts +++ b/scripts/optimism/deploy-new-steth-contracts.ts @@ -46,7 +46,7 @@ async function main() { { tokenRateOracle: { proxyAdmin: deploymentConfig.optimism.tokenRateOracleProxyAdmin, - admin: deploymentConfig.optimism.tokenRateOracleAdmin, + admin: optDeployer.address, constructor: { tokenRateOutdatedDelay: deploymentConfig.optimism.tokenRateOutdatedDelay, maxAllowedL2ToL1ClockLag: deploymentConfig.optimism.maxAllowedL2ToL1ClockLag, @@ -84,7 +84,8 @@ async function main() { optDeployer, deploymentConfig, l1DeployScript, - l2DeployScript + l2DeployScript, + false ); await prompt.proceed(); diff --git a/scripts/optimism/deploy-scratch.ts b/scripts/optimism/deploy-scratch.ts index c38c2855..5e38d22b 100644 --- a/scripts/optimism/deploy-scratch.ts +++ b/scripts/optimism/deploy-scratch.ts @@ -30,39 +30,39 @@ async function main() { const [l1DeployScript, l2DeployScript] = await deploymentAll(networkName, { logger: console }) .deployAllScript( { - l1TokenNonRebasable: deploymentConfig.l1TokenNonRebasable, - l1TokenRebasable: deploymentConfig.l1RebasableToken, - accountingOracle: deploymentConfig.accountingOracle, - l2GasLimitForPushingTokenRate: deploymentConfig.l2GasLimitForPushingTokenRate, - lido: deploymentConfig.lido, + l1TokenNonRebasable: deploymentConfig.ethereum.l1TokenNonRebasable, + l1TokenRebasable: deploymentConfig.ethereum.l1RebasableToken, + accountingOracle: deploymentConfig.ethereum.accountingOracle, + l2GasLimitForPushingTokenRate: deploymentConfig.ethereum.l2GasLimitForPushingTokenRate, + lido: deploymentConfig.ethereum.lido, deployer: ethDeployer, admins: { - proxy: deploymentConfig.l1.proxyAdmin, + proxy: deploymentConfig.ethereum.bridgeProxyAdmin, bridge: ethDeployer.address }, deployOffset: 0, }, { tokenRateOracle: { - tokenRateOutdatedDelay: deploymentConfig.tokenRateOutdatedDelay, - maxAllowedL2ToL1ClockLag: deploymentConfig.maxAllowedL2ToL1ClockLag, - maxAllowedTokenRateDeviationPerDayBp: deploymentConfig.maxAllowedTokenRateDeviationPerDayBp, - oldestRateAllowedInPauseTimeSpan: deploymentConfig.oldestRateAllowedInPauseTimeSpan, - minTimeBetweenTokenRateUpdates: deploymentConfig.minTimeBetweenTokenRateUpdates, - tokenRate: deploymentConfig.initialTokenRateValue, - l1Timestamp: deploymentConfig.initialTokenRateL1Timestamp + tokenRateOutdatedDelay: deploymentConfig.optimism.tokenRateOutdatedDelay, + maxAllowedL2ToL1ClockLag: deploymentConfig.optimism.maxAllowedL2ToL1ClockLag, + maxAllowedTokenRateDeviationPerDayBp: deploymentConfig.optimism.maxAllowedTokenRateDeviationPerDayBp, + oldestRateAllowedInPauseTimeSpan: deploymentConfig.optimism.oldestRateAllowedInPauseTimeSpan, + minTimeBetweenTokenRateUpdates: deploymentConfig.optimism.minTimeBetweenTokenRateUpdates, + tokenRate: deploymentConfig.optimism.initialTokenRateValue, + l1Timestamp: deploymentConfig.optimism.initialTokenRateL1Timestamp }, l2TokenNonRebasable: { - version: deploymentConfig.l2TokenNonRebasableVersion + version: deploymentConfig.optimism.l2TokenNonRebasableDomainVersion }, l2TokenRebasable: { - version: deploymentConfig.l2TokenRebasableVersion + version: deploymentConfig.optimism.l2TokenRebasableDomainVersion }, deployer: optDeployer, admins: { - proxy: deploymentConfig.l2.proxyAdmin, + proxy: deploymentConfig.optimism.bridgeProxyAdmin, bridge: optDeployer.address, }, deployOffset: 0, @@ -75,7 +75,8 @@ async function main() { optDeployer, deploymentConfig, l1DeployScript, - l2DeployScript + l2DeployScript, + true ); await prompt.proceed(); @@ -92,7 +93,7 @@ async function main() { opStackTokenRatePusher: l1DeployScript.opStackTokenRatePusherImplAddress, ethDeployer: ethDeployer, ethProvider: ethProvider, - notifierOwner: deploymentConfig.tokenRateNotifierOwner + notifierOwner: deploymentConfig.ethereum.tokenRateNotifierOwner }); const l1BridgingManagement = new BridgingManagement( @@ -107,8 +108,8 @@ async function main() { { logger: console } ); - await l1BridgingManagement.setup(deploymentConfig.l1); - await l2BridgingManagement.setup(deploymentConfig.l2); + await l1BridgingManagement.setup(deploymentConfig.ethereum); + await l2BridgingManagement.setup(deploymentConfig.optimism); } main().catch((error) => { diff --git a/utils/deployment.ts b/utils/deployment.ts index 5e1702e9..187d3301 100644 --- a/utils/deployment.ts +++ b/utils/deployment.ts @@ -128,7 +128,8 @@ export async function printMultiChainDeploymentConfig( l2Deployer: Wallet, deploymentParams: MultiChainDeploymentConfig, l1DeployScript: DeployScript, - l2DeployScript: DeployScript + l2DeployScript: DeployScript, + scratchDeploy: boolean ) { const { ethereum, optimism } = deploymentParams; console.log(chalk.bold(`${title}\n`)); @@ -138,13 +139,13 @@ export async function printMultiChainDeploymentConfig( console.log(); console.log(chalk.bold(" · L1 Deployment Params:")); - await printEthereumDeploymentConfig(l1Deployer, ethereum, false); + await printEthereumDeploymentConfig(l1Deployer, ethereum, scratchDeploy); console.log(); console.log(chalk.bold(" · L1 Deployment Actions:")); l1DeployScript.print({ padding: 6 }); console.log(chalk.bold(" · L2 Deployment Params:")); - await printOptimismDeploymentConfig(l2Deployer, optimism, false); + await printOptimismDeploymentConfig(l2Deployer, optimism, scratchDeploy); console.log(); console.log(chalk.bold(" · L2 Deployment Actions:")); l2DeployScript.print({ padding: 6 }); @@ -154,7 +155,7 @@ export async function printMultiChainDeploymentConfig( async function printEthereumDeploymentConfig( deployer: Wallet, params: EthereumDeploymentConfig, - sctratchDeploy: boolean + scratchDeploy: boolean ) { const pad = " ".repeat(4); const chainId = await deployer.getChainId(); @@ -169,26 +170,27 @@ async function printEthereumDeploymentConfig( console.log(`${pad}· lido: ${chalk.underline(params.lido)}`); console.log(`${pad}· tokenRateNotifierOwner: ${chalk.underline(params.tokenRateNotifierOwner)}`); - if(sctratchDeploy) { - console.log(`${pad}· Proxy Admin: ${chalk.underline(params.bridgeProxyAdmin)}`); - console.log(`${pad}· Bridge Admin: ${chalk.underline(params.bridgeAdmin)}`); - console.log(`${pad}· Deposits Enabled: ${params.depositsEnabled}`); + if(scratchDeploy) { + console.log(`${pad}· Ethereum Bridge`); + console.log(`${pad}·· Proxy Admin: ${chalk.underline(params.bridgeProxyAdmin)}`); + console.log(`${pad}·· Bridge Admin: ${chalk.underline(params.bridgeAdmin)}`); + console.log(`${pad}·· Deposits Enabled: ${params.depositsEnabled}`); console.log( - `${pad}· Withdrawals Enabled: ${JSON.stringify(params.withdrawalsEnabled)}` + `${pad}·· Withdrawals Enabled: ${JSON.stringify(params.withdrawalsEnabled)}` ); console.log( - `${pad}· Deposits Enablers: ${JSON.stringify(params.depositsEnablers)}` + `${pad}·· Deposits Enablers: ${JSON.stringify(params.depositsEnablers)}` ); console.log( - `${pad}· Deposits Disablers: ${JSON.stringify(params.depositsDisablers)}` + `${pad}·· Deposits Disablers: ${JSON.stringify(params.depositsDisablers)}` ); console.log( - `${pad}· Withdrawals Enablers: ${JSON.stringify( + `${pad}·· Withdrawals Enablers: ${JSON.stringify( params.withdrawalsEnablers )}` ); console.log( - `${pad}· Withdrawals Disablers: ${JSON.stringify( + `${pad}·· Withdrawals Disablers: ${JSON.stringify( params.withdrawalsDisablers )}` ) @@ -198,7 +200,7 @@ async function printEthereumDeploymentConfig( async function printOptimismDeploymentConfig( deployer: Wallet, params: OptimismDeploymentConfig, - sctratchDeploy: boolean + scratchDeploy: boolean ) { const pad = " ".repeat(4); const chainId = await deployer.getChainId(); @@ -223,26 +225,27 @@ async function printOptimismDeploymentConfig( console.log(`${pad}· l2TokenRebasableDomainVersion: ${chalk.underline(params.l2TokenRebasableDomainVersion)}`); console.log(`${pad}· l2TokenBridge: ${chalk.underline(params.l2TokenBridge)}`); - if (sctratchDeploy) { - console.log(`${pad}· Proxy Admin: ${chalk.underline(params.bridgeProxyAdmin)}`); - console.log(`${pad}· Bridge Admin: ${chalk.underline(params.bridgeAdmin)}`); - console.log(`${pad}· Deposits Enabled: ${params.depositsEnabled}`); + if (scratchDeploy) { + console.log(`${pad}· Optimism Bridge`); + console.log(`${pad}·· Proxy Admin: ${chalk.underline(params.bridgeProxyAdmin)}`); + console.log(`${pad}·· Admin: ${chalk.underline(params.bridgeAdmin)}`); + console.log(`${pad}·· Deposits Enabled: ${params.depositsEnabled}`); console.log( - `${pad}· Withdrawals Enabled: ${JSON.stringify(params.withdrawalsEnabled)}` + `${pad}·· Withdrawals Enabled: ${JSON.stringify(params.withdrawalsEnabled)}` ); console.log( - `${pad}· Deposits Enablers: ${JSON.stringify(params.depositsEnablers)}` + `${pad}·· Deposits Enablers: ${JSON.stringify(params.depositsEnablers)}` ); console.log( - `${pad}· Deposits Disablers: ${JSON.stringify(params.depositsDisablers)}` + `${pad}·· Deposits Disablers: ${JSON.stringify(params.depositsDisablers)}` ); console.log( - `${pad}· Withdrawals Enablers: ${JSON.stringify( + `${pad}·· Withdrawals Enablers: ${JSON.stringify( params.withdrawalsEnablers )}` ); console.log( - `${pad}· Withdrawals Disablers: ${JSON.stringify( + `${pad}·· Withdrawals Disablers: ${JSON.stringify( params.withdrawalsDisablers )}` );