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

feat(contracts): add deploySemaphoreGatekeeper() #1628

Merged
merged 1 commit into from
Jul 4, 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
4 changes: 2 additions & 2 deletions contracts/tests/SemaphoreGatekeeper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from "chai";
import { AbiCoder, Signer, ZeroAddress } from "ethers";
import { Keypair } from "maci-domainobjs";

import { deployContract } from "../ts/deploy";
import { deploySemaphoreGatekeeper, deployContract } from "../ts/deploy";
import { getDefaultSigner, getSigners } from "../ts/utils";
import { MACI, SemaphoreGatekeeper, MockSemaphore } from "../typechain-types";

Expand Down Expand Up @@ -65,7 +65,7 @@ describe("Semaphore Gatekeeper", () => {
mockSemaphore = await deployContract("MockSemaphore", signer, true, validGroupId);
const mockSemaphoreAddress = await mockSemaphore.getAddress();
signerAddress = await signer.getAddress();
semaphoreGatekeeper = await deployContract("SemaphoreGatekeeper", signer, true, mockSemaphoreAddress, validGroupId);
semaphoreGatekeeper = await deploySemaphoreGatekeeper(mockSemaphoreAddress, validGroupId, signer, true);
});

describe("Deployment", () => {
Expand Down
17 changes: 17 additions & 0 deletions contracts/ts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
MessageProcessorFactory__factory as MessageProcessorFactoryFactory,
TallyFactory__factory as TallyFactoryFactory,
GitcoinPassportGatekeeper,
SemaphoreGatekeeper,
} from "../typechain-types";

import { log } from "./utils";
Expand Down Expand Up @@ -167,6 +168,22 @@ export const deployGitcoinPassportGatekeeper = async (
minimumScore.toString(),
);

/**
* Deploy a SemaphoreGatekeeper contract
* @param semaphoreAddress - the address of the Semaphore contract
* @param groupId - The group id of the semaphore group
* @param signer - the signer to use to deploy the contract
* @param quiet - whether to suppress console output
* @returns the deployed SemaphoreGatekeeper contract
*/
export const deploySemaphoreGatekeeper = async (
semaphoreAddress: string,
groupId: bigint,
signer?: Signer,
quiet = false,
): Promise<SemaphoreGatekeeper> =>
deployContract<SemaphoreGatekeeper>("SemaphoreGatekeeper", signer, quiet, semaphoreAddress, groupId.toString());

/**
* Deploy Poseidon contracts
* @param signer - the signer to use to deploy the contracts
Expand Down
1 change: 1 addition & 0 deletions contracts/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export {
deployConstantInitialVoiceCreditProxy,
deployFreeForAllSignUpGatekeeper,
deployGitcoinPassportGatekeeper,
deploySemaphoreGatekeeper,
deployPollFactory,
createContractFactory,
deployPoseidonContracts,
Expand Down
Loading