-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add update script attestation zk verifier
- Loading branch information
1 parent
118dffc
commit c3f2d47
Showing
1 changed file
with
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { ethers, upgrades, run } from "hardhat"; | ||
import * as fs from "fs"; | ||
|
||
import { | ||
AttestationVerifierZK__factory, | ||
Risc0_attestation_verifier_wrapper__factory, | ||
RiscZeroGroth16Verifier__factory, | ||
RiscZeroVerifierEmergencyStop__factory, | ||
} from "../typechain-types"; | ||
import { checkFileExists } from "../helpers"; | ||
import { AbiCoder } from "ethers"; | ||
import * as attestation from "../helpers/sample/risc0/attestation.json"; | ||
|
||
async function main(): Promise<string> { | ||
const chainId = (await ethers.provider.getNetwork()).chainId.toString(); | ||
console.log("deploying on chain id:", chainId); | ||
|
||
const signers = await ethers.getSigners(); | ||
console.log("available signers", signers.length); | ||
|
||
if (signers.length < 6) { | ||
throw new Error("Atleast 6 signers are required for deployment"); | ||
} | ||
|
||
const configPath = `./config/${chainId}.json`; | ||
const configurationExists = checkFileExists(configPath); | ||
|
||
if (!configurationExists) { | ||
throw new Error(`Config doesn't exists for chainId: ${chainId}`); | ||
} | ||
|
||
let admin = signers[0]; | ||
|
||
const path = `./addresses/${chainId}.json`; | ||
|
||
let addresses = JSON.parse(fs.readFileSync(path, "utf-8")); | ||
let attestation_zk_verifier = addresses.proxy.attestation_zk_verifier; | ||
|
||
const AttestationVerifierZK = await ethers.getContractFactory("AttestationVerifierZK"); | ||
|
||
await upgrades.upgradeProxy(attestation_zk_verifier, AttestationVerifierZK); | ||
|
||
return "Upgraded AttestationVerifierZK"; | ||
} | ||
|
||
main().then(console.log).catch(console.log); |