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 Oct 25, 2024
1 parent a0a1309 commit aab00a1
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
title: Solidity Docs
sidebar_label: Solidity Docs
---

This is a collection of the Solidity documentation for the MACI protocol. It is autogenerated with solidity-docs and should serve as a good starting point for understanding the codebase.
This is a collection of the Solidity documentation for the MACI protocol. It is autogenerated with solidity-docs and should serve as a good starting point for understanding the codebase.
1 change: 1 addition & 0 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@openzeppelin/contracts": "^5.0.2",
"@openzeppelin/merkle-tree": "^1.0.7",
"@pcd/util": "^0.8.0",
"circomlibjs": "^0.1.7",
"ethers": "^6.13.2",
"hardhat": "^2.22.13",
Expand Down
12 changes: 8 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 @@ -139,9 +140,12 @@ deployment.deployTask(EDeploySteps.Gatekeepers, "Deploy gatekeepers").then((task

if (!skipDeployZupassGatekeeper) {
const eventId = deployment.getDeployConfigField<string>(EContracts.ZupassGatekeeper, "eventId", true);
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
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 +169,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
Loading

0 comments on commit aab00a1

Please sign in to comment.