From bb6240c41f83b2a6df8dd8f6d53aa8f94460e255 Mon Sep 17 00:00:00 2001 From: MexicanAce Date: Fri, 13 Dec 2024 16:49:47 +0000 Subject: [PATCH] fix: update the upgrade scripts to work with AAFactory --- scripts/upgrade.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade.ts b/scripts/upgrade.ts index 7e8d7227..48b26e22 100644 --- a/scripts/upgrade.ts +++ b/scripts/upgrade.ts @@ -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") { @@ -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 '"; + 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...");