Skip to content

Commit

Permalink
Merge pull request #1829 from privacy-scaling-explorations/fix/merkle…
Browse files Browse the repository at this point in the history
…proof-deploy

fix(deploy-maci): sets the maci instance of any gatekeeper
  • Loading branch information
crisgarner authored Sep 18, 2024
2 parents 4deae8b + 4d5ae24 commit 28e5fc8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 43 deletions.
47 changes: 4 additions & 43 deletions packages/contracts/tasks/deploy/maci/08-maci.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import type {
EASGatekeeper,
GitcoinPassportGatekeeper,
ZupassGatekeeper,
MACI,
SemaphoreGatekeeper,
HatsGatekeeperBase,
} from "../../../typechain-types";
import type { SignUpGatekeeper, MACI } from "../../../typechain-types";

import { genEmptyBallotRoots } from "../../../ts/genEmptyBallotRoots";
import { EDeploySteps } from "../../helpers/constants";
Expand Down Expand Up @@ -80,43 +73,11 @@ deployment.deployTask(EDeploySteps.Maci, "Deploy MACI contract").then((task) =>
emptyBallotRoots,
);

if (gatekeeper === EContracts.EASGatekeeper) {
const gatekeeperContract = await deployment.getContract<EASGatekeeper>({
name: EContracts.EASGatekeeper,
if (gatekeeper !== EContracts.FreeForAllGatekeeper) {
const gatekeeperContract = await deployment.getContract<SignUpGatekeeper>({
name: EContracts.SignUpGatekeeper,
address: gatekeeperContractAddress,
});
const maciInstanceAddress = await maciContract.getAddress();

await gatekeeperContract.setMaciInstance(maciInstanceAddress).then((tx) => tx.wait());
} else if (gatekeeper === EContracts.GitcoinPassportGatekeeper) {
const gatekeeperContract = await deployment.getContract<GitcoinPassportGatekeeper>({
name: EContracts.GitcoinPassportGatekeeper,
address: gatekeeperContractAddress,
});
const maciInstanceAddress = await maciContract.getAddress();

await gatekeeperContract.setMaciInstance(maciInstanceAddress).then((tx) => tx.wait());
} else if (gatekeeper === EContracts.ZupassGatekeeper) {
const gatekeeperContract = await deployment.getContract<ZupassGatekeeper>({
name: EContracts.ZupassGatekeeper,
address: gatekeeperContractAddress,
});
const maciInstanceAddress = await maciContract.getAddress();
await gatekeeperContract.setMaciInstance(maciInstanceAddress).then((tx) => tx.wait());
} else if (gatekeeper === EContracts.SemaphoreGatekeeper) {
const gatekeeperContract = await deployment.getContract<SemaphoreGatekeeper>({
name: EContracts.SemaphoreGatekeeper,
address: gatekeeperContractAddress,
});

const maciInstanceAddress = await maciContract.getAddress();
await gatekeeperContract.setMaciInstance(maciInstanceAddress).then((tx) => tx.wait());
} else if (gatekeeper === EContracts.HatsGatekeeper) {
const gatekeeperContract = await deployment.getContract<HatsGatekeeperBase>({
name: EContracts.HatsGatekeeper,
address: gatekeeperContractAddress,
});

const maciInstanceAddress = await maciContract.getAddress();
await gatekeeperContract.setMaciInstance(maciInstanceAddress).then((tx) => tx.wait());
}
Expand Down
2 changes: 2 additions & 0 deletions packages/contracts/tasks/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ export enum EGatekeepers {
Zupass = "ZupassGatekeeper",
Semaphore = "SemaphoreGatekeeper",
MerkleProof = "MerkleProofGatekeeper",
SignUp = "SignUpGatekeeper",
}

/**
Expand All @@ -572,6 +573,7 @@ export enum EContracts {
ZupassGroth16Verifier = "ZupassGroth16Verifier",
SemaphoreGatekeeper = "SemaphoreGatekeeper",
MerkleProofGatekeeper = "MerkleProofGatekeeper",
SignUpGatekeeper = "SignUpGatekeeper",
Verifier = "Verifier",
MACI = "MACI",
StateAq = "StateAq",
Expand Down

0 comments on commit 28e5fc8

Please sign in to comment.