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

fix(deploy-maci): sets the maci instance of any gatekeeper #1829

Merged
merged 1 commit into from
Sep 18, 2024
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
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
Loading