Skip to content

Commit

Permalink
Merge pull request #26 from lidofinance/feature/improve_deploy_scripts2
Browse files Browse the repository at this point in the history
Improve deploy scripts
  • Loading branch information
kovalgek authored Aug 27, 2024
2 parents c14070f + 516ba26 commit 60b10d7
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 45 deletions.
5 changes: 3 additions & 2 deletions scripts/optimism/deploy-new-steth-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -84,7 +84,8 @@ async function main() {
optDeployer,
deploymentConfig,
l1DeployScript,
l2DeployScript
l2DeployScript,
false
);

await prompt.proceed();
Expand Down
41 changes: 21 additions & 20 deletions scripts/optimism/deploy-scratch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -75,7 +75,8 @@ async function main() {
optDeployer,
deploymentConfig,
l1DeployScript,
l2DeployScript
l2DeployScript,
true
);

await prompt.proceed();
Expand All @@ -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(
Expand All @@ -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) => {
Expand Down
49 changes: 26 additions & 23 deletions utils/deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`));
Expand All @@ -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 });
Expand All @@ -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();
Expand All @@ -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
)}`
)
Expand All @@ -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();
Expand All @@ -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
)}`
);
Expand Down

0 comments on commit 60b10d7

Please sign in to comment.