Skip to content

Commit

Permalink
refactor(zupass-gatekeeper): improved gatekeeper script to avoid doin…
Browse files Browse the repository at this point in the history
…g conversion on config
  • Loading branch information
Crisgarner committed Dec 3, 2024
1 parent c0b32e2 commit 028b203
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 85 deletions.
1 change: 1 addition & 0 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@openzeppelin/contracts": "^5.1.0",
"@openzeppelin/merkle-tree": "^1.0.7",
"@pcd/util": "^0.8.0",
"circomlibjs": "^0.1.7",
"ethers": "^6.13.4",
"hardhat": "^2.22.15",
Expand Down
11 changes: 7 additions & 4 deletions packages/contracts/tasks/deploy/maci/02-gatekeepers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { hexToBigInt, uuidToBigInt } from "@pcd/util";

import { HatsGatekeeperBase } from "../../../typechain-types";
import { EDeploySteps, ESupportedChains } from "../../helpers/constants";
import { ContractStorage } from "../../helpers/ContractStorage";
import { Deployment } from "../../helpers/Deployment";
import { uuidToBigInt } from "../../helpers/numericParser";
import { EContracts, IDeployParams } from "../../helpers/types";

const deployment = Deployment.getInstance();
Expand Down Expand Up @@ -140,8 +141,10 @@ deployment.deployTask(EDeploySteps.Gatekeepers, "Deploy gatekeepers").then((task
if (!skipDeployZupassGatekeeper) {
const eventId = deployment.getDeployConfigField<string>(EContracts.ZupassGatekeeper, "eventId", true);
const validEventId = uuidToBigInt(eventId);
const validSigner1 = deployment.getDeployConfigField<string>(EContracts.ZupassGatekeeper, "signer1", true);
const validSigner2 = deployment.getDeployConfigField<string>(EContracts.ZupassGatekeeper, "signer2", true);
const signer1 = deployment.getDeployConfigField<string>(EContracts.ZupassGatekeeper, "signer1", true);
const validSigner1 = hexToBigInt(signer1);
const signer2 = deployment.getDeployConfigField<string>(EContracts.ZupassGatekeeper, "signer2", true);
const validSigner2 = hexToBigInt(signer2);
let verifier = deployment.getDeployConfigField<string | undefined>(EContracts.ZupassGatekeeper, "zupassVerifier");

if (!verifier) {
Expand All @@ -165,7 +168,7 @@ deployment.deployTask(EDeploySteps.Gatekeepers, "Deploy gatekeepers").then((task
await storage.register({
id: EContracts.ZupassGatekeeper,
contract: ZupassGatekeeperContract,
args: [validEventId.toString(), validSigner1, validSigner2, verifier],
args: [validEventId.toString(), validSigner1.toString(), validSigner2.toString(), verifier],
network: hre.network.name,
});
}
Expand Down
10 changes: 0 additions & 10 deletions packages/contracts/tasks/helpers/numericParser.ts

This file was deleted.

112 changes: 41 additions & 71 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 028b203

Please sign in to comment.