Skip to content

Commit

Permalink
refactor: cleanup contracts folder
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlc03 authored and 0xmad committed Dec 5, 2024
1 parent b230c7f commit 8c23149
Show file tree
Hide file tree
Showing 39 changed files with 61 additions and 467 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,5 @@ packages/cli/contractAddresses.old.json
packages/circuits/circom/test

**/ts/__benchmarks__/results/**

proofs
9 changes: 3 additions & 6 deletions packages/contracts/contracts/MACI.sol
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,14 @@ 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));
InternalLeanIMT._insert(leanIMTData, stateLeaf);
uint256 stateLeaf = hashStateLeaf(StateLeaf(_pubKey, voiceCreditBalance, block.timestamp));
uint256 stateRoot = InternalLeanIMT._insert(leanIMTData, stateLeaf);

// Store the current state tree root in the array
uint256 stateRoot = InternalLeanIMT._root(leanIMTData);
stateRootsOnSignUp.push(stateRoot);

emit SignUp(leanIMTData.size - 1, _pubKey.x, _pubKey.y, voiceCreditBalance, timestamp, stateLeaf);
emit SignUp(leanIMTData.size - 1, _pubKey.x, _pubKey.y, voiceCreditBalance, block.timestamp, stateLeaf);
}

/// @notice Deploy a new Poll contract.
Expand Down
6 changes: 1 addition & 5 deletions packages/contracts/contracts/Poll.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity ^0.8.20;

import { Params } from "./utilities/Params.sol";
import { EmptyBallotRoots } from "./trees/EmptyBallotRoots.sol";
import { SnarkCommon } from "./crypto/SnarkCommon.sol";
import { LazyIMTData, InternalLazyIMT } from "./trees/LazyIMT.sol";
import { IMACI } from "./interfaces/IMACI.sol";
Expand Down Expand Up @@ -252,10 +251,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();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/contracts/Tally.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/contracts/gatekeepers/EASGatekeeper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
30 changes: 0 additions & 30 deletions packages/contracts/contracts/trees/EmptyBallotRoots.sol

This file was deleted.

43 changes: 0 additions & 43 deletions packages/contracts/contracts/trees/zeros/MerkleBinary0.sol

This file was deleted.

43 changes: 0 additions & 43 deletions packages/contracts/contracts/trees/zeros/MerkleBinaryBlankSl.sol

This file was deleted.

43 changes: 0 additions & 43 deletions packages/contracts/contracts/trees/zeros/MerkleBinaryMaci.sol

This file was deleted.

Loading

0 comments on commit 8c23149

Please sign in to comment.