Skip to content

Commit

Permalink
update upgrade/deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
kovalgek committed Jun 11, 2024
1 parent a31049a commit baf9859
Show file tree
Hide file tree
Showing 16 changed files with 1,046 additions and 489 deletions.
20 changes: 9 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,19 @@
"compile": "hardhat compile",
"compile:force": "hardhat compile --force",
"coverage": "hardhat coverage --testfiles './test/**/*.unit.test.ts'",
"test:e2e": "hardhat test ./test/**/*.e2e.test.ts",
"test:unit": "hardhat test ./test/**/*.unit.test.ts",
"test:integration": "hardhat test ./test/**/*.integration.test.ts",
"fork:eth:mainnet": "hardhat node:fork eth_mainnet 8545",
"fork:eth:sepolia": "hardhat node:fork eth_sepolia 8545",
"fork:opt:sepolia": "hardhat node:fork opt_sepolia 9545",
"fork:opt:mainnet": "hardhat node:fork opt_mainnet 9545",
"optimism:deploy": "ts-node --files ./scripts/optimism/deploy-bridge.ts",
"optimism:finalize-message": "ts-node --files ./scripts/optimism/finalize-message.ts",
"optimism:test:e2e": "hardhat test ./test/optimism/*.e2e.test.ts",
"optimism:test:unit": "hardhat test ./test/optimism/*.unit.test.ts",
"optimism:test:integration": "hardhat test ./test/optimism/*.integration.test.ts",
"optimism:test:acceptance": "hardhat test ./test/optimism/*.acceptance.test.ts",
"optimism:test:executor": "hardhat test ./test/bridge-executor/optimism.integration.test.ts",
"optimism:test:launch": "REVERT=false hardhat test ./test/optimism/{_launch.test.ts,bridging.integration.test.ts}"
"deploy": "ts-node --files ./scripts/optimism/deploy-scratch.ts",
"upgrade": "ts-node --files ./scripts/optimism/upgrade.ts",
"finalize-message": "ts-node --files ./scripts/optimism/finalize-message.ts",
"test:e2e": "hardhat test ./test/optimism/*.e2e.test.ts",
"test:unit": "hardhat test ./test/optimism/*.unit.test.ts",
"test:integration": "hardhat test ./test/optimism/*.integration.test.ts",
"test:acceptance": "hardhat test ./test/optimism/*.acceptance.test.ts",
"test:executor": "hardhat test ./test/bridge-executor/optimism.integration.test.ts",
"test:launch": "REVERT=false hardhat test ./test/optimism/{_launch.test.ts,bridging.integration.test.ts}"
},
"keywords": [],
"author": "",
Expand Down
88 changes: 0 additions & 88 deletions scripts/optimism/deploy-new-impls.ts

This file was deleted.

85 changes: 0 additions & 85 deletions scripts/optimism/deploy-oracle.ts

This file was deleted.

98 changes: 98 additions & 0 deletions scripts/optimism/deploy-scratch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import env from "../../utils/env";
import prompt from "../../utils/prompt";
import network from "../../utils/network";
import deployment from "../../utils/deployment";
import { BridgingManagement } from "../../utils/bridging-management";
import deploymentAllFromScratch from "../../utils/optimism/deployment";

async function main() {
const networkName = env.network();
const ethOptNetwork = network.multichain(["eth", "opt"], networkName);

const [ethDeployer] = ethOptNetwork.getSigners(env.privateKey(), {
forking: env.forking(),
});
const [, optDeployer] = ethOptNetwork.getSigners(
env.string("OPT_DEPLOYER_PRIVATE_KEY"),
{
forking: env.forking(),
}
);

const deploymentConfig = deployment.loadMultiChainDeploymentConfig();

const [l1DeployScript, l2DeployScript] = await deploymentAllFromScratch (networkName, { logger: console })
.deployAllScript(
{
l1TokenNonRebasable: deploymentConfig.l1TokenNonRebasable,
l1TokenRebasable: deploymentConfig.l1RebasableToken,
accountingOracle: deploymentConfig.accountingOracle,
l2GasLimitForPushingTokenRate: deploymentConfig.l2GasLimitForPushingTokenRate,

deployer: ethDeployer,
admins: {
proxy: deploymentConfig.l1.proxyAdmin,
bridge: ethDeployer.address
},
contractsShift: 0,
},
{
tokenRateOracle: {
tokenRateOutdatedDelay: deploymentConfig.tokenRateOutdatedDelay,
maxAllowedL2ToL1ClockLag: deploymentConfig.maxAllowedL2ToL1ClockLag,
maxAllowedTokenRateDeviationPerDayBp: deploymentConfig.maxAllowedTokenRateDeviationPerDayBp,
oldestRateAllowedInPauseTimeSpan: deploymentConfig.oldestRateAllowedInPauseTimeSpan,
maxAllowedTimeBetweenTokenRateUpdates: deploymentConfig.maxAllowedTimeBetweenTokenRateUpdates,
tokenRate: deploymentConfig.tokenRateValue,
l1Timestamp: deploymentConfig.tokenRateL1Timestamp
},
l2TokenNonRebasable: {
version: "1"
},
l2TokenRebasable: {
version: "1"
},

deployer: optDeployer,
admins: {
proxy: deploymentConfig.l2.proxyAdmin,
bridge: optDeployer.address,
},
contractsShift: 0,
}
);

await deployment.printMultiChainDeploymentConfig(
"Deploy Optimism Bridge",
ethDeployer,
optDeployer,
deploymentConfig,
l1DeployScript,
l2DeployScript
);

await prompt.proceed();

await l1DeployScript.run();
await l2DeployScript.run();

const l1BridgingManagement = new BridgingManagement(
l1DeployScript.bridgeProxyAddress,
ethDeployer,
{ logger: console }
);

const l2BridgingManagement = new BridgingManagement(
l2DeployScript.tokenBridgeProxyAddress,
optDeployer,
{ logger: console }
);

await l1BridgingManagement.setup(deploymentConfig.l1);
await l2BridgingManagement.setup(deploymentConfig.l2);
}

main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
Loading

0 comments on commit baf9859

Please sign in to comment.