Skip to content

Commit

Permalink
fix: update the upgrade scripts to work with AAFactory (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
MexicanAce authored Dec 13, 2024
1 parent c0799c0 commit 28ce388
Showing 1 changed file with 9 additions and 2 deletions.
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

0 comments on commit 28ce388

Please sign in to comment.