From b2829e2b9922248fe9d5acc96059a2502c87917b Mon Sep 17 00:00:00 2001 From: Brice Stacey Date: Wed, 14 Dec 2022 15:32:14 -0500 Subject: [PATCH 1/3] Add support for mumbai --- .env.example | 15 ++++++++++----- hardhat.config.ts | 22 +++++++++++++++++----- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/.env.example b/.env.example index 4601806f..591e56d3 100644 --- a/.env.example +++ b/.env.example @@ -1,10 +1,15 @@ +# Hardhat Accounts +ACCOUNT_ADMIN= +ACCOUNT_OPERATOR= +ACCOUNT_DEPLOYER= +ACCOUNT_PAUSER= +ACCOUNT_ACCOUNT= + # Goerli GOERLI_URL= -GOERLI_ADMIN= -GOERLI_OPERATOR= -GOERLI_DEPLOYER= -GOERLI_PAUSER= -GOERLI_ACCOUNT= + +# Mumbai +MUMBAI_URL= # Etherscan ETHERSCAN_API_KEY= diff --git a/hardhat.config.ts b/hardhat.config.ts index 868ee42f..3879685b 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -40,11 +40,23 @@ const config: HardhatUserConfig | ExtendedHardhatUserConfig = { url: process.env.GOERLI_URL ?? "", usdcAddress: "0x07865c6e87b9f70255377e024ace6630c1eaa37f", accounts: [ - process.env.GOERLI_ADMIN!, - process.env.GOERLI_OPERATOR!, - process.env.GOERLI_DEPLOYER!, - process.env.GOERLI_PAUSER!, - process.env.GOERLI_ACCOUNT! + process.env.ACCOUNT_ADMIN!, + process.env.ACCOUNT_OPERATOR!, + process.env.ACCOUNT_DEPLOYER!, + process.env.ACCOUNT_PAUSER!, + process.env.ACCOUNT_ACCOUNT! + ].filter((x) => x) + }, + mumbai: { + chainId: 80001, + url: process.env.MUMBAI_URL ?? "", + usdcAddress: "0xE097d6B3100777DC31B34dC2c58fB524C2e76921", + accounts: [ + process.env.ACCOUNT_ADMIN!, + process.env.ACCOUNT_OPERATOR!, + process.env.ACCOUNT_DEPLOYER!, + process.env.ACCOUNT_PAUSER!, + process.env.ACCOUNT_ACCOUNT! ].filter((x) => x) } }, From 0218db5bd15b26a4646d28567b31f206d10d0dc5 Mon Sep 17 00:00:00 2001 From: Brice Stacey Date: Wed, 14 Dec 2022 15:38:23 -0500 Subject: [PATCH 2/3] Add verify-pool-admin script --- scripts/verify-pool-admin.ts | 64 ++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 scripts/verify-pool-admin.ts diff --git a/scripts/verify-pool-admin.ts b/scripts/verify-pool-admin.ts new file mode 100644 index 00000000..77ca93a1 --- /dev/null +++ b/scripts/verify-pool-admin.ts @@ -0,0 +1,64 @@ +import { ethers, upgrades } from "hardhat"; +import hre from "hardhat"; + +type ExtendedHreNetworkConfig = typeof hre.network.config & { + usdcAddress: string | undefined; +}; + +async function main() { + // Address of the ToSAcceptanceRegistry contract + const tosAcceptanceRegistryAddress = + "0x15B0d52d980b58c48c90A479B37e3B93a9bBEd16"; + // Address of the PoolAdminAccessControl contract + const poolAdminAccessControlAddress = + "0x801a90094605123D55A8ea022dB623b6249c2b76"; + // The VerificationResult and signature from a Verite verifier. You can run the script + // `verite-verify` to get your own results + const verificationResult = { + schema: [ + "https://verite.id/definitions/processes/kycaml/0.0.1/generic--usa-legal_person" + ], + subject: "", + expiration: 1671133884, + verifier_verification_id: "" + }; + const signature = ""; + + const [admin, operator, deployer, pauser, other] = + await hre.ethers.getSigners(); + + let tx; + + // Accept TOS + const ToSAcceptanceRegistry = await ethers.getContractFactory( + "ToSAcceptanceRegistry" + ); + const tosAcceptanceRegistry = ToSAcceptanceRegistry.attach( + tosAcceptanceRegistryAddress + ).connect(other); + + tx = await tosAcceptanceRegistry.acceptTermsOfService(); + await tx.wait(); + console.log("Accepted TOS"); + + // Verify with Verite + const PoolAdminAccessControl = await ethers.getContractFactory( + "PoolAdminAccessControl" + ); + const poolAdminAccessControl = PoolAdminAccessControl.attach( + poolAdminAccessControlAddress + ); + + tx = await poolAdminAccessControl + .connect(other) + .verify(verificationResult, signature); + await tx.wait(); + console.log("Verified!"); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main().catch((error) => { + console.error(error); + process.exitCode = 1; +}); From 4b64ab230becfa8e88f01dcabc312d502452611d Mon Sep 17 00:00:00 2001 From: Brice Stacey Date: Wed, 14 Dec 2022 15:39:44 -0500 Subject: [PATCH 3/3] Add todo about addresses --- scripts/verify-pool-admin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/verify-pool-admin.ts b/scripts/verify-pool-admin.ts index 77ca93a1..d936ee98 100644 --- a/scripts/verify-pool-admin.ts +++ b/scripts/verify-pool-admin.ts @@ -6,10 +6,10 @@ type ExtendedHreNetworkConfig = typeof hre.network.config & { }; async function main() { - // Address of the ToSAcceptanceRegistry contract + // Address of the ToSAcceptanceRegistry contract TODO: this is mumbai const tosAcceptanceRegistryAddress = "0x15B0d52d980b58c48c90A479B37e3B93a9bBEd16"; - // Address of the PoolAdminAccessControl contract + // Address of the PoolAdminAccessControl contract TODO: this is mumbai const poolAdminAccessControlAddress = "0x801a90094605123D55A8ea022dB623b6249c2b76"; // The VerificationResult and signature from a Verite verifier. You can run the script