-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
169806b
commit 84e10ed
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import "@nomiclabs/hardhat-web3"; | ||
import "@nomiclabs/hardhat-ethers"; | ||
import "@nomiclabs/hardhat-waffle"; | ||
|
||
import { task } from "hardhat/config"; | ||
import { ContractFactoryName } from "../src/types"; | ||
|
||
// yarn hardhat upgradeVerifier --rollupVersion 0 --startBatchIndex 0 --multipleVersionRollupVerifier 0x0165878a594ca255338adfa4d48449f69242eb8f --network l1 | ||
task("upgradeVerifier") | ||
.addParam("rollupVersion") | ||
.addParam("startBatchIndex") | ||
.addParam("multipleVersionRollupVerifier") | ||
.setAction(async (taskArgs, hre) => { | ||
const config = hre.deployConfig | ||
|
||
// deploy ZkEvmVerifierV1 | ||
const ZkEvmVerifierV1ContractFactoryName = ContractFactoryName.ZkEvmVerifierV1 | ||
const Factory = await hre.ethers.getContractFactory(ZkEvmVerifierV1ContractFactoryName) | ||
const contract = await Factory.deploy(config.programVkey) | ||
await contract.deployed() | ||
console.log("ZkEvmVerifierV1Contract: %s ; TX_HASH: %s", contract.address.toLocaleLowerCase(), contract.deployTransaction.hash); | ||
let blockNumber = await hre.ethers.provider.getBlockNumber() | ||
console.log("BLOCK_NUMBER: %s", blockNumber) | ||
|
||
// add verifier to MultipleVersionRollupVerifier | ||
const MultipleVersionRollupVerifierFactoryName = ContractFactoryName.MultipleVersionRollupVerifier | ||
const MultipleVersionRollupVerifierFactory = await hre.ethers.getContractFactory(MultipleVersionRollupVerifierFactoryName) | ||
const MultipleVersionRollupVerifier = MultipleVersionRollupVerifierFactory.attach(taskArgs.multipleVersionRollupVerifier) | ||
|
||
const res = await MultipleVersionRollupVerifier.updateVerifier(taskArgs.rollupVersion, taskArgs.startBatchIndex, contract.address.toLocaleLowerCase()) | ||
|
||
const receipt = await res.wait() | ||
console.log(`receipt status : ${receipt.status}`) | ||
console.log("upgrade verifier successfully, verifier: %s, rollupVersion: %s, startBatchIndex: %s", contract.address.toLocaleLowerCase(), taskArgs.rollupVersion, taskArgs.startBatchIndex) | ||
}); |