Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verite on chain verify scripts #163

Merged
merged 3 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
@@ -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=
22 changes: 17 additions & 5 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
},
Expand Down
64 changes: 64 additions & 0 deletions scripts/verify-pool-admin.ts
Original file line number Diff line number Diff line change
@@ -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 TODO: this is mumbai
const tosAcceptanceRegistryAddress =
"0x15B0d52d980b58c48c90A479B37e3B93a9bBEd16";
// 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
// `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;
});