custom-aa-tutorial/deploy/deploy-factory.ts
2024-06-10 16:34:56 +03:00

28 lines
979 B
TypeScript

import { utils, Wallet } from "zksync-web3";
import * as ethers from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { Deployer } from "@matterlabs/hardhat-zksync-deploy";
export default async function (hre: HardhatRuntimeEnvironment) {
// Private key of the account used to deploy
const wallet = new Wallet("<WALLET_PRIVATE_KEY>");
const deployer = new Deployer(hre, wallet);
const factoryArtifact = await deployer.loadArtifact("AAFactory");
const aaArtifact = await deployer.loadArtifact("TwoUserMultisig");
// Getting the bytecodeHash of the account
const bytecodeHash = utils.hashBytecode(aaArtifact.bytecode);
const factory = await deployer.deploy(
factoryArtifact,
[bytecodeHash],
undefined,
[
// Since the factory requires the code of the multisig to be available,
// we should pass it here as well.
aaArtifact.bytecode,
]
);
console.log(`AA factory address: ${factory.address}`);
}