Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update the upgrade scripts to work with AAFactory #223

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions scripts/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { ethers } from "ethers";
// TODO: add support for constructor args
task("upgrade", "Upgrades ZKsync SSO contracts")
.addParam("proxy", "address of the proxy to upgrade")
.addParam("beaconAddress", "address of the beacon proxy for the upgrade")
.addPositionalParam("artifactName", "name of the artifact to upgrade to")
.setAction(async (cmd, hre) => {
const { LOCAL_RICH_WALLETS, getProvider, create2, ethersStaticSalt } = require("../test/utils");
const { LOCAL_RICH_WALLETS, getProvider, deployFactory, create2, ethersStaticSalt } = require("../test/utils");

let privateKey: string;
if (hre.network.name == "inMemoryNode" || hre.network.name == "dockerizedNode") {
Expand All @@ -20,9 +21,15 @@ task("upgrade", "Upgrades ZKsync SSO contracts")
}

const wallet = new Wallet(privateKey, getProvider());
let newImpl;

console.log("Deploying new implementation of", cmd.artifactName, "contract...");
const newImpl = await create2(cmd.artifactName, wallet, ethersStaticSalt, []);
if (cmd.artifactName == "AAFactory") {
if (!cmd.beaconAddress) throw "Deploying the AAFactory requires a Beacon Address '--beacon-address <value>'";
newImpl = await deployFactory(wallet, cmd.beaconAddress);
} else {
newImpl = await create2(cmd.artifactName, wallet, ethersStaticSalt, []);
}
console.log("New implementation deployed at:", await newImpl.getAddress());

console.log("Upgrading proxy at", cmd.proxy, "to new implementation...");
Expand Down
Loading