Skip to content

Commit b29522f

Browse files
authored
chore(entropy): deployment script for entropy upgrades (#2697)
1 parent adde071 commit b29522f

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
require("dotenv").config({ path: ".env" });
2+
import { utils, Wallet } from "zksync-web3";
3+
import { HardhatRuntimeEnvironment } from "hardhat/types";
4+
import { Deployer } from "@matterlabs/hardhat-zksync-deploy";
5+
import { assert } from "chai";
6+
import { writeFileSync } from "fs";
7+
import { ethers } from "ethers";
8+
9+
function envOrErr(name: string): string {
10+
const res = process.env[name];
11+
if (res === undefined) {
12+
throw new Error(`${name} environment variable is not set.`);
13+
}
14+
return res;
15+
}
16+
17+
export default async function (hre: HardhatRuntimeEnvironment) {
18+
// Initialize the wallet.
19+
const wallet = Wallet.fromMnemonic(envOrErr("MNEMONIC"));
20+
21+
// Create deployer object and load the artifact of the contract we want to deploy.
22+
const deployer = new Deployer(hre, wallet);
23+
24+
// Deposit some funds to L2 in order to be able to perform L2 transactions. Uncomment
25+
// this if the deployment account is unfunded.
26+
//
27+
// const depositAmount = ethers.utils.parseEther("0.005");
28+
// const depositHandle = await deployer.zkWallet.deposit({
29+
// to: deployer.zkWallet.address,
30+
// token: utils.ETH_ADDRESS,
31+
// amount: depositAmount,
32+
// });
33+
// // Wait until the deposit is processed on zkSync
34+
// await depositHandle.wait();
35+
36+
const entropyImplArtifact = await deployer.loadArtifact("EntropyUpgradable");
37+
const entropyImplContract = await deployer.deploy(entropyImplArtifact);
38+
39+
console.log(
40+
`Deployed Entropy implementation contract on ${entropyImplContract.address}`,
41+
);
42+
console.log(
43+
"Please use this address as the candidate new implementation in the deployment script.",
44+
);
45+
}

0 commit comments

Comments
 (0)