From 922217c698c1fe17977ae37dffc47e9aeca85af9 Mon Sep 17 00:00:00 2001 From: ctrlc03 <93448202+ctrlc03@users.noreply.github.com> Date: Fri, 29 Nov 2024 11:51:58 +0000 Subject: [PATCH] refactor: cleanup contracts folder --- .gitignore | 2 ++ packages/contracts/contracts/MACI.sol | 6 ++---- packages/contracts/contracts/Poll.sol | 5 +---- packages/contracts/contracts/Tally.sol | 2 +- .../gatekeepers/AnonAadhaarGatekeeper.sol | 3 ++- .../contracts/gatekeepers/EASGatekeeper.sol | 2 +- .../gatekeepers/GitcoinPassportGatekeeper.sol | 2 +- .../contracts/gatekeepers/HatsGatekeeperBase.sol | 2 +- .../gatekeepers/SemaphoreGatekeeper.sol | 2 +- .../interfaces/IAnonAadhaar.sol | 0 .../{ => gatekeepers}/interfaces/IEAS.sol | 0 .../interfaces/IGitcoinPassportDecoder.sol | 0 .../{ => gatekeepers}/interfaces/IHats.sol | 0 .../{ => gatekeepers}/interfaces/ISemaphore.sol | 0 .../{ => gatekeepers}/mocks/MockAnonAadhaar.sol | 0 .../{ => gatekeepers}/mocks/MockEAS.sol | 0 .../mocks/MockGitcoinPassportDecoder.sol | 0 .../{ => gatekeepers}/mocks/MockHatsProtocol.sol | 0 .../{ => gatekeepers}/mocks/MockSemaphore.sol | 0 .../mocks}/SignUpToken.sol | 0 .../contracts/{crypto => mocks}/MockVerifier.sol | 4 ++-- packages/contracts/package.json | 16 +++++++--------- .../AnonAadhaarGatekeeper.test.ts | 11 +++++------ .../{ => gatekeepers}/EASGatekeeper.test.ts | 11 +++++------ .../GitcoinPassportGatekeeper.test.ts | 9 ++++----- .../{ => gatekeepers}/HatsGatekeeper.test.ts | 11 +++++------ .../MerkleProofGatekeeper.test.ts | 11 +++++------ .../SemaphoreGatekeeper.test.ts | 11 +++++------ .../{ => gatekeepers}/SignUpGatekeeper.test.ts | 11 +++++------ .../{ => gatekeepers}/ZupassGatekeeper.test.ts | 11 +++++------ 30 files changed, 60 insertions(+), 72 deletions(-) rename packages/contracts/contracts/{ => gatekeepers}/interfaces/IAnonAadhaar.sol (100%) rename packages/contracts/contracts/{ => gatekeepers}/interfaces/IEAS.sol (100%) rename packages/contracts/contracts/{ => gatekeepers}/interfaces/IGitcoinPassportDecoder.sol (100%) rename packages/contracts/contracts/{ => gatekeepers}/interfaces/IHats.sol (100%) rename packages/contracts/contracts/{ => gatekeepers}/interfaces/ISemaphore.sol (100%) rename packages/contracts/contracts/{ => gatekeepers}/mocks/MockAnonAadhaar.sol (100%) rename packages/contracts/contracts/{ => gatekeepers}/mocks/MockEAS.sol (100%) rename packages/contracts/contracts/{ => gatekeepers}/mocks/MockGitcoinPassportDecoder.sol (100%) rename packages/contracts/contracts/{ => gatekeepers}/mocks/MockHatsProtocol.sol (100%) rename packages/contracts/contracts/{ => gatekeepers}/mocks/MockSemaphore.sol (100%) rename packages/contracts/contracts/{utilities => gatekeepers/mocks}/SignUpToken.sol (100%) rename packages/contracts/contracts/{crypto => mocks}/MockVerifier.sol (82%) rename packages/contracts/tests/{ => gatekeepers}/AnonAadhaarGatekeeper.test.ts (96%) rename packages/contracts/tests/{ => gatekeepers}/EASGatekeeper.test.ts (94%) rename packages/contracts/tests/{ => gatekeepers}/GitcoinPassportGatekeeper.test.ts (96%) rename packages/contracts/tests/{ => gatekeepers}/HatsGatekeeper.test.ts (97%) rename packages/contracts/tests/{ => gatekeepers}/MerkleProofGatekeeper.test.ts (94%) rename packages/contracts/tests/{ => gatekeepers}/SemaphoreGatekeeper.test.ts (93%) rename packages/contracts/tests/{ => gatekeepers}/SignUpGatekeeper.test.ts (92%) rename packages/contracts/tests/{ => gatekeepers}/ZupassGatekeeper.test.ts (97%) diff --git a/.gitignore b/.gitignore index 2c07d300e8..29ad2c9303 100644 --- a/.gitignore +++ b/.gitignore @@ -154,3 +154,5 @@ packages/cli/contractAddresses.old.json packages/circuits/circom/test **/ts/__benchmarks__/results/** + +proofs diff --git a/packages/contracts/contracts/MACI.sol b/packages/contracts/contracts/MACI.sol index b0cbcec39f..5dd8a644e3 100644 --- a/packages/contracts/contracts/MACI.sol +++ b/packages/contracts/contracts/MACI.sol @@ -156,13 +156,11 @@ contract MACI is IMACI, DomainObjs, Params, Utilities { // Get the user's voice credit balance. uint256 voiceCreditBalance = initialVoiceCreditProxy.getVoiceCredits(msg.sender, _initialVoiceCreditProxyData); - uint256 timestamp = block.timestamp; - // Create a state leaf and insert it into the tree. - uint256 stateLeaf = hashStateLeaf(StateLeaf(_pubKey, voiceCreditBalance, timestamp)); + uint256 stateLeaf = hashStateLeaf(StateLeaf(_pubKey, voiceCreditBalance, block.timestamp)); InternalLazyIMT._insert(lazyIMTData, stateLeaf); - emit SignUp(lazyIMTData.numberOfLeaves - 1, _pubKey.x, _pubKey.y, voiceCreditBalance, timestamp); + emit SignUp(lazyIMTData.numberOfLeaves - 1, _pubKey.x, _pubKey.y, voiceCreditBalance, block.timestamp); } /// @notice Deploy a new Poll contract. diff --git a/packages/contracts/contracts/Poll.sol b/packages/contracts/contracts/Poll.sol index ba276915a0..8bb00d9f8d 100644 --- a/packages/contracts/contracts/Poll.sol +++ b/packages/contracts/contracts/Poll.sol @@ -182,10 +182,7 @@ contract Poll is Params, Utilities, SnarkCommon, IPoll { /// @dev Can only be submitted before the voting deadline /// @param _messages the messages /// @param _encPubKeys the encrypted public keys - function publishMessageBatch( - Message[] calldata _messages, - PubKey[] calldata _encPubKeys - ) public virtual isWithinVotingDeadline { + function publishMessageBatch(Message[] calldata _messages, PubKey[] calldata _encPubKeys) public virtual { if (_messages.length != _encPubKeys.length) { revert InvalidBatchLength(); } diff --git a/packages/contracts/contracts/Tally.sol b/packages/contracts/contracts/Tally.sol index e92ce42973..8d7d26f124 100644 --- a/packages/contracts/contracts/Tally.sol +++ b/packages/contracts/contracts/Tally.sol @@ -442,10 +442,10 @@ contract Tally is Ownable, SnarkCommon, CommonUtilities, Hasher, DomainObjs, ITa TallyResult storage previous = tallyResults[_voteOptionIndex]; if (!previous.flag) { + previous.flag = true; totalTallyResults++; } - previous.flag = true; previous.value = _tallyResult; } } diff --git a/packages/contracts/contracts/gatekeepers/AnonAadhaarGatekeeper.sol b/packages/contracts/contracts/gatekeepers/AnonAadhaarGatekeeper.sol index b675ddbd30..446f3a7fc0 100644 --- a/packages/contracts/contracts/gatekeepers/AnonAadhaarGatekeeper.sol +++ b/packages/contracts/contracts/gatekeepers/AnonAadhaarGatekeeper.sol @@ -2,8 +2,9 @@ pragma solidity ^0.8.20; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; + import { SignUpGatekeeper } from "./SignUpGatekeeper.sol"; -import { IAnonAadhaar } from "../interfaces/IAnonAadhaar.sol"; +import { IAnonAadhaar } from "./interfaces/IAnonAadhaar.sol"; /// @title AnonAadhaarGatekeeper /// @notice A gatekeeper contract which allows users to sign up to MACI diff --git a/packages/contracts/contracts/gatekeepers/EASGatekeeper.sol b/packages/contracts/contracts/gatekeepers/EASGatekeeper.sol index 94f0977f17..0b79b6ec46 100644 --- a/packages/contracts/contracts/gatekeepers/EASGatekeeper.sol +++ b/packages/contracts/contracts/gatekeepers/EASGatekeeper.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.20; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { SignUpGatekeeper } from "./SignUpGatekeeper.sol"; -import { IEAS } from "../interfaces/IEAS.sol"; +import { IEAS } from "./interfaces/IEAS.sol"; /// @title EASGatekeeper /// @notice A gatekeeper contract which allows users to sign up to MACI diff --git a/packages/contracts/contracts/gatekeepers/GitcoinPassportGatekeeper.sol b/packages/contracts/contracts/gatekeepers/GitcoinPassportGatekeeper.sol index a683dbff59..60217d7881 100644 --- a/packages/contracts/contracts/gatekeepers/GitcoinPassportGatekeeper.sol +++ b/packages/contracts/contracts/gatekeepers/GitcoinPassportGatekeeper.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.20; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { SignUpGatekeeper } from "./SignUpGatekeeper.sol"; -import { IGitcoinPassportDecoder } from "../interfaces/IGitcoinPassportDecoder.sol"; +import { IGitcoinPassportDecoder } from "./interfaces/IGitcoinPassportDecoder.sol"; /// @title GitcoinPassportGatekeeper /// @notice A gatekeeper contract which allows users to sign up to MACI diff --git a/packages/contracts/contracts/gatekeepers/HatsGatekeeperBase.sol b/packages/contracts/contracts/gatekeepers/HatsGatekeeperBase.sol index 3ffb56ceb6..80764ad6bf 100644 --- a/packages/contracts/contracts/gatekeepers/HatsGatekeeperBase.sol +++ b/packages/contracts/contracts/gatekeepers/HatsGatekeeperBase.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.10; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; -import { IHats } from "../interfaces/IHats.sol"; +import { IHats } from "./interfaces/IHats.sol"; import { SignUpGatekeeper } from "./SignUpGatekeeper.sol"; /// @title HatsGatekeeperBase diff --git a/packages/contracts/contracts/gatekeepers/SemaphoreGatekeeper.sol b/packages/contracts/contracts/gatekeepers/SemaphoreGatekeeper.sol index 0b6ed88efd..ea448857a2 100644 --- a/packages/contracts/contracts/gatekeepers/SemaphoreGatekeeper.sol +++ b/packages/contracts/contracts/gatekeepers/SemaphoreGatekeeper.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.20; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { SignUpGatekeeper } from "./SignUpGatekeeper.sol"; -import { ISemaphore } from "../interfaces/ISemaphore.sol"; +import { ISemaphore } from "./interfaces/ISemaphore.sol"; /// @title SemaphoreGatekeeper /// @notice A gatekeeper contract which allows users to sign up to MACI diff --git a/packages/contracts/contracts/interfaces/IAnonAadhaar.sol b/packages/contracts/contracts/gatekeepers/interfaces/IAnonAadhaar.sol similarity index 100% rename from packages/contracts/contracts/interfaces/IAnonAadhaar.sol rename to packages/contracts/contracts/gatekeepers/interfaces/IAnonAadhaar.sol diff --git a/packages/contracts/contracts/interfaces/IEAS.sol b/packages/contracts/contracts/gatekeepers/interfaces/IEAS.sol similarity index 100% rename from packages/contracts/contracts/interfaces/IEAS.sol rename to packages/contracts/contracts/gatekeepers/interfaces/IEAS.sol diff --git a/packages/contracts/contracts/interfaces/IGitcoinPassportDecoder.sol b/packages/contracts/contracts/gatekeepers/interfaces/IGitcoinPassportDecoder.sol similarity index 100% rename from packages/contracts/contracts/interfaces/IGitcoinPassportDecoder.sol rename to packages/contracts/contracts/gatekeepers/interfaces/IGitcoinPassportDecoder.sol diff --git a/packages/contracts/contracts/interfaces/IHats.sol b/packages/contracts/contracts/gatekeepers/interfaces/IHats.sol similarity index 100% rename from packages/contracts/contracts/interfaces/IHats.sol rename to packages/contracts/contracts/gatekeepers/interfaces/IHats.sol diff --git a/packages/contracts/contracts/interfaces/ISemaphore.sol b/packages/contracts/contracts/gatekeepers/interfaces/ISemaphore.sol similarity index 100% rename from packages/contracts/contracts/interfaces/ISemaphore.sol rename to packages/contracts/contracts/gatekeepers/interfaces/ISemaphore.sol diff --git a/packages/contracts/contracts/mocks/MockAnonAadhaar.sol b/packages/contracts/contracts/gatekeepers/mocks/MockAnonAadhaar.sol similarity index 100% rename from packages/contracts/contracts/mocks/MockAnonAadhaar.sol rename to packages/contracts/contracts/gatekeepers/mocks/MockAnonAadhaar.sol diff --git a/packages/contracts/contracts/mocks/MockEAS.sol b/packages/contracts/contracts/gatekeepers/mocks/MockEAS.sol similarity index 100% rename from packages/contracts/contracts/mocks/MockEAS.sol rename to packages/contracts/contracts/gatekeepers/mocks/MockEAS.sol diff --git a/packages/contracts/contracts/mocks/MockGitcoinPassportDecoder.sol b/packages/contracts/contracts/gatekeepers/mocks/MockGitcoinPassportDecoder.sol similarity index 100% rename from packages/contracts/contracts/mocks/MockGitcoinPassportDecoder.sol rename to packages/contracts/contracts/gatekeepers/mocks/MockGitcoinPassportDecoder.sol diff --git a/packages/contracts/contracts/mocks/MockHatsProtocol.sol b/packages/contracts/contracts/gatekeepers/mocks/MockHatsProtocol.sol similarity index 100% rename from packages/contracts/contracts/mocks/MockHatsProtocol.sol rename to packages/contracts/contracts/gatekeepers/mocks/MockHatsProtocol.sol diff --git a/packages/contracts/contracts/mocks/MockSemaphore.sol b/packages/contracts/contracts/gatekeepers/mocks/MockSemaphore.sol similarity index 100% rename from packages/contracts/contracts/mocks/MockSemaphore.sol rename to packages/contracts/contracts/gatekeepers/mocks/MockSemaphore.sol diff --git a/packages/contracts/contracts/utilities/SignUpToken.sol b/packages/contracts/contracts/gatekeepers/mocks/SignUpToken.sol similarity index 100% rename from packages/contracts/contracts/utilities/SignUpToken.sol rename to packages/contracts/contracts/gatekeepers/mocks/SignUpToken.sol diff --git a/packages/contracts/contracts/crypto/MockVerifier.sol b/packages/contracts/contracts/mocks/MockVerifier.sol similarity index 82% rename from packages/contracts/contracts/crypto/MockVerifier.sol rename to packages/contracts/contracts/mocks/MockVerifier.sol index 004739b332..56c001130c 100644 --- a/packages/contracts/contracts/crypto/MockVerifier.sol +++ b/packages/contracts/contracts/mocks/MockVerifier.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; -import { SnarkConstants } from "./SnarkConstants.sol"; -import { SnarkCommon } from "./SnarkCommon.sol"; +import { SnarkConstants } from "../crypto/SnarkConstants.sol"; +import { SnarkCommon } from "../crypto/SnarkCommon.sol"; import { IVerifier } from "../interfaces/IVerifier.sol"; /// @title MockVerifier diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 827dbc3694..4bd1ab8454 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -47,21 +47,19 @@ "test:tallyNonQv": "pnpm run test ./tests/TallyNonQv.test.ts", "test:hasher": "pnpm run test ./tests/Hasher.test.ts", "test:utilities": "pnpm run test ./tests/Utilities.test.ts", - "test:signupGatekeeper": "pnpm run test ./tests/SignUpGatekeeper.test.ts", + "test:signupGatekeeper": "pnpm run test ./tests/gatekeepers/SignUpGatekeeper.test.ts", "test:verifier": "pnpm run test ./tests/Verifier.test.ts", "test:accQueue": "pnpm run test ./tests/AccQueue.test.ts", "test:accQueueBenchmark": "pnpm run test ./tests/AccQueueBenchmark.test.ts", "test:hasherBenchmarks": "pnpm run test ./tests/HasherBenchmarks.test.ts", "test:vkRegistry": "pnpm run test ./tests/VkRegistry.test.ts", "test:pollFactory": "pnpm run test ./tests/PollFactory.test.ts", - "test:eas_gatekeeper": "pnpm run test ./tests/EASGatekeeper.test.ts", - "test:hats_gatekeeper": "pnpm run test ./tests/HatsGatekeeper.test.ts", - "test:gitcoin_gatekeeper": "pnpm run test ./tests/GitcoinPassportGatekeeper.test.ts", - "test:zupass_gatekeeper": "pnpm run test ./tests/ZupassGatekeeper.test.ts", - "test:semaphore_gatekeeper": "pnpm run test ./tests/SemaphoreGatekeeper.test.ts", - "test:anon_aadhaar_gatekeeper": "pnpm run test ./tests/AnonAadhaarGatekeeper.test.ts", - "test:simpleProjectRegistry": "pnpm run test ./tests/extensions/SimpleProjectRegistry.test.ts", - "test:simplePayout": "pnpm run test ./tests/extensions/SimplePayout.test.ts", + "test:eas_gatekeeper": "pnpm run test ./tests/gatekeepers/EASGatekeeper.test.ts", + "test:hats_gatekeeper": "pnpm run test ./tests/gatekeepers/HatsGatekeeper.test.ts", + "test:gitcoin_gatekeeper": "pnpm run test ./tests/gatekeepers/GitcoinPassportGatekeeper.test.ts", + "test:zupass_gatekeeper": "pnpm run test ./tests/gatekeepers/ZupassGatekeeper.test.ts", + "test:semaphore_gatekeeper": "pnpm run test ./tests/gatekeepers/SemaphoreGatekeeper.test.ts", + "test:anon_aadhaar_gatekeeper": "pnpm run test ./tests/gatekeepers/AnonAadhaarGatekeeper.test.ts", "deploy": "hardhat deploy-full", "deploy-poll": "hardhat deploy-poll", "verify": "hardhat verify-full", diff --git a/packages/contracts/tests/AnonAadhaarGatekeeper.test.ts b/packages/contracts/tests/gatekeepers/AnonAadhaarGatekeeper.test.ts similarity index 96% rename from packages/contracts/tests/AnonAadhaarGatekeeper.test.ts rename to packages/contracts/tests/gatekeepers/AnonAadhaarGatekeeper.test.ts index aee68ec283..815ba7d0aa 100644 --- a/packages/contracts/tests/AnonAadhaarGatekeeper.test.ts +++ b/packages/contracts/tests/gatekeepers/AnonAadhaarGatekeeper.test.ts @@ -2,12 +2,11 @@ import { expect } from "chai"; import { AbiCoder, Signer, ZeroAddress } from "ethers"; import { Keypair } from "maci-domainobjs"; -import { deployAnonAadhaarGatekeeper, deployContract } from "../ts/deploy"; -import { getDefaultSigner, getSigners } from "../ts/utils"; -import { MACI, AnonAadhaarGatekeeper, MockAnonAadhaar } from "../typechain-types"; - -import { STATE_TREE_DEPTH, initialVoiceCreditBalance } from "./constants"; -import { deployTestContracts } from "./utils"; +import { deployAnonAadhaarGatekeeper, deployContract } from "../../ts/deploy"; +import { getDefaultSigner, getSigners } from "../../ts/utils"; +import { MACI, AnonAadhaarGatekeeper, MockAnonAadhaar } from "../../typechain-types"; +import { STATE_TREE_DEPTH, initialVoiceCreditBalance } from "../constants"; +import { deployTestContracts } from "../utils"; describe("AnonAadhaar Gatekeeper", () => { let anonAadhaarGatekeeper: AnonAadhaarGatekeeper; diff --git a/packages/contracts/tests/EASGatekeeper.test.ts b/packages/contracts/tests/gatekeepers/EASGatekeeper.test.ts similarity index 94% rename from packages/contracts/tests/EASGatekeeper.test.ts rename to packages/contracts/tests/gatekeepers/EASGatekeeper.test.ts index e78504a1b5..eddd1cff0a 100644 --- a/packages/contracts/tests/EASGatekeeper.test.ts +++ b/packages/contracts/tests/gatekeepers/EASGatekeeper.test.ts @@ -2,12 +2,11 @@ import { expect } from "chai"; import { AbiCoder, Signer, ZeroAddress, toBeArray } from "ethers"; import { Keypair } from "maci-domainobjs"; -import { deployContract } from "../ts/deploy"; -import { getDefaultSigner, getSigners } from "../ts/utils"; -import { EASGatekeeper, MACI } from "../typechain-types"; - -import { STATE_TREE_DEPTH, initialVoiceCreditBalance } from "./constants"; -import { deployTestContracts } from "./utils"; +import { deployContract } from "../../ts/deploy"; +import { getDefaultSigner, getSigners } from "../../ts/utils"; +import { EASGatekeeper, MACI } from "../../typechain-types"; +import { STATE_TREE_DEPTH, initialVoiceCreditBalance } from "../constants"; +import { deployTestContracts } from "../utils"; describe("EAS Gatekeeper", () => { let easGatekeeper: EASGatekeeper; diff --git a/packages/contracts/tests/GitcoinPassportGatekeeper.test.ts b/packages/contracts/tests/gatekeepers/GitcoinPassportGatekeeper.test.ts similarity index 96% rename from packages/contracts/tests/GitcoinPassportGatekeeper.test.ts rename to packages/contracts/tests/gatekeepers/GitcoinPassportGatekeeper.test.ts index 77b58c201a..797e8c26c0 100644 --- a/packages/contracts/tests/GitcoinPassportGatekeeper.test.ts +++ b/packages/contracts/tests/gatekeepers/GitcoinPassportGatekeeper.test.ts @@ -2,11 +2,10 @@ import { expect } from "chai"; import { AbiCoder, Signer, ZeroAddress } from "ethers"; import { Keypair } from "maci-domainobjs"; -import { deployContract, getDefaultSigner, getSigners } from "../ts"; -import { GitcoinPassportGatekeeper, MACI, MockGitcoinPassportDecoder } from "../typechain-types"; - -import { initialVoiceCreditBalance, STATE_TREE_DEPTH } from "./constants"; -import { deployTestContracts } from "./utils"; +import { deployContract, getDefaultSigner, getSigners } from "../../ts"; +import { GitcoinPassportGatekeeper, MACI, MockGitcoinPassportDecoder } from "../../typechain-types"; +import { initialVoiceCreditBalance, STATE_TREE_DEPTH } from "../constants"; +import { deployTestContracts } from "../utils"; describe("GitcoinPassport Gatekeeper", () => { let gitcoinGatekeeper: GitcoinPassportGatekeeper; diff --git a/packages/contracts/tests/HatsGatekeeper.test.ts b/packages/contracts/tests/gatekeepers/HatsGatekeeper.test.ts similarity index 97% rename from packages/contracts/tests/HatsGatekeeper.test.ts rename to packages/contracts/tests/gatekeepers/HatsGatekeeper.test.ts index 5e43e574af..02a03020d9 100644 --- a/packages/contracts/tests/HatsGatekeeper.test.ts +++ b/packages/contracts/tests/gatekeepers/HatsGatekeeper.test.ts @@ -2,12 +2,11 @@ import { expect } from "chai"; import { AbiCoder, Signer, ZeroAddress } from "ethers"; import { Keypair } from "maci-domainobjs"; -import { deployContract } from "../ts/deploy"; -import { getSigners } from "../ts/utils"; -import { HatsGatekeeperMultiple, HatsGatekeeperSingle, MACI, MockHatsProtocol } from "../typechain-types"; - -import { STATE_TREE_DEPTH, initialVoiceCreditBalance } from "./constants"; -import { deployTestContracts } from "./utils"; +import { deployContract } from "../../ts/deploy"; +import { getSigners } from "../../ts/utils"; +import { HatsGatekeeperMultiple, HatsGatekeeperSingle, MACI, MockHatsProtocol } from "../../typechain-types"; +import { STATE_TREE_DEPTH, initialVoiceCreditBalance } from "../constants"; +import { deployTestContracts } from "../utils"; describe("HatsProtocol Gatekeeper", () => { let maciContract: MACI; diff --git a/packages/contracts/tests/MerkleProofGatekeeper.test.ts b/packages/contracts/tests/gatekeepers/MerkleProofGatekeeper.test.ts similarity index 94% rename from packages/contracts/tests/MerkleProofGatekeeper.test.ts rename to packages/contracts/tests/gatekeepers/MerkleProofGatekeeper.test.ts index 6f86b98290..bf3200b830 100644 --- a/packages/contracts/tests/MerkleProofGatekeeper.test.ts +++ b/packages/contracts/tests/gatekeepers/MerkleProofGatekeeper.test.ts @@ -3,12 +3,11 @@ import { expect } from "chai"; import { AbiCoder, Signer, ZeroAddress, encodeBytes32String } from "ethers"; import { Keypair } from "maci-domainobjs"; -import { deployContract } from "../ts/deploy"; -import { getDefaultSigner, getSigners, generateMerkleTree } from "../ts/utils"; -import { MerkleProofGatekeeper, MACI } from "../typechain-types"; - -import { STATE_TREE_DEPTH, initialVoiceCreditBalance } from "./constants"; -import { deployTestContracts } from "./utils"; +import { deployContract } from "../../ts/deploy"; +import { getDefaultSigner, getSigners, generateMerkleTree } from "../../ts/utils"; +import { MerkleProofGatekeeper, MACI } from "../../typechain-types"; +import { STATE_TREE_DEPTH, initialVoiceCreditBalance } from "../constants"; +import { deployTestContracts } from "../utils"; describe("MerkleProof Gatekeeper", () => { let merkleProofGatekeeper: MerkleProofGatekeeper; diff --git a/packages/contracts/tests/SemaphoreGatekeeper.test.ts b/packages/contracts/tests/gatekeepers/SemaphoreGatekeeper.test.ts similarity index 93% rename from packages/contracts/tests/SemaphoreGatekeeper.test.ts rename to packages/contracts/tests/gatekeepers/SemaphoreGatekeeper.test.ts index 0d9f0b7e28..05d8a7fc4f 100644 --- a/packages/contracts/tests/SemaphoreGatekeeper.test.ts +++ b/packages/contracts/tests/gatekeepers/SemaphoreGatekeeper.test.ts @@ -2,12 +2,11 @@ import { expect } from "chai"; import { AbiCoder, Signer, ZeroAddress } from "ethers"; import { Keypair } from "maci-domainobjs"; -import { deploySemaphoreGatekeeper, deployContract } from "../ts/deploy"; -import { getDefaultSigner, getSigners } from "../ts/utils"; -import { MACI, SemaphoreGatekeeper, MockSemaphore } from "../typechain-types"; - -import { STATE_TREE_DEPTH, initialVoiceCreditBalance } from "./constants"; -import { deployTestContracts } from "./utils"; +import { deploySemaphoreGatekeeper, deployContract } from "../../ts/deploy"; +import { getDefaultSigner, getSigners } from "../../ts/utils"; +import { MACI, SemaphoreGatekeeper, MockSemaphore } from "../../typechain-types"; +import { STATE_TREE_DEPTH, initialVoiceCreditBalance } from "../constants"; +import { deployTestContracts } from "../utils"; describe("Semaphore Gatekeeper", () => { let semaphoreGatekeeper: SemaphoreGatekeeper; diff --git a/packages/contracts/tests/SignUpGatekeeper.test.ts b/packages/contracts/tests/gatekeepers/SignUpGatekeeper.test.ts similarity index 92% rename from packages/contracts/tests/SignUpGatekeeper.test.ts rename to packages/contracts/tests/gatekeepers/SignUpGatekeeper.test.ts index cdf4937025..8b69986c20 100644 --- a/packages/contracts/tests/SignUpGatekeeper.test.ts +++ b/packages/contracts/tests/gatekeepers/SignUpGatekeeper.test.ts @@ -2,12 +2,11 @@ import { expect } from "chai"; import { AbiCoder, ZeroAddress, Signer } from "ethers"; import { Keypair } from "maci-domainobjs"; -import { deploySignupToken, deploySignupTokenGatekeeper, deployFreeForAllSignUpGatekeeper } from "../ts/deploy"; -import { getDefaultSigner } from "../ts/utils"; -import { FreeForAllGatekeeper, MACI, SignUpToken, SignUpTokenGatekeeper } from "../typechain-types"; - -import { STATE_TREE_DEPTH, initialVoiceCreditBalance } from "./constants"; -import { deployTestContracts } from "./utils"; +import { deploySignupToken, deploySignupTokenGatekeeper, deployFreeForAllSignUpGatekeeper } from "../../ts/deploy"; +import { getDefaultSigner } from "../../ts/utils"; +import { FreeForAllGatekeeper, MACI, SignUpToken, SignUpTokenGatekeeper } from "../../typechain-types"; +import { STATE_TREE_DEPTH, initialVoiceCreditBalance } from "../constants"; +import { deployTestContracts } from "../utils"; describe("SignUpGatekeeper", () => { let signUpToken: SignUpToken; diff --git a/packages/contracts/tests/ZupassGatekeeper.test.ts b/packages/contracts/tests/gatekeepers/ZupassGatekeeper.test.ts similarity index 97% rename from packages/contracts/tests/ZupassGatekeeper.test.ts rename to packages/contracts/tests/gatekeepers/ZupassGatekeeper.test.ts index 077590b759..6d766a973a 100644 --- a/packages/contracts/tests/ZupassGatekeeper.test.ts +++ b/packages/contracts/tests/gatekeepers/ZupassGatekeeper.test.ts @@ -2,12 +2,11 @@ import { expect } from "chai"; import { AbiCoder, Signer, ZeroAddress } from "ethers"; import { Keypair } from "maci-domainobjs"; -import { deployContract } from "../ts/deploy"; -import { getDefaultSigner, getSigners } from "../ts/utils"; -import { MACI, ZupassGatekeeper } from "../typechain-types"; - -import { STATE_TREE_DEPTH, initialVoiceCreditBalance } from "./constants"; -import { deployTestContracts } from "./utils"; +import { deployContract } from "../../ts/deploy"; +import { getDefaultSigner, getSigners } from "../../ts/utils"; +import { MACI, ZupassGatekeeper } from "../../typechain-types"; +import { STATE_TREE_DEPTH, initialVoiceCreditBalance } from "../constants"; +import { deployTestContracts } from "../utils"; describe("Zupass Gatekeeper", () => { let zupassGatekeeper: ZupassGatekeeper;