Skip to main content
Version: v3.x

IMACI

MACI interface

PollContracts

A struct holding the addresses of poll, mp and tally

struct PollContracts {
address poll;
address messageProcessor;
address tally;
}

DeployPollArgs

A struct holding the params for poll deployment

struct DeployPollArgs {
uint256 startDate;
uint256 endDate;
struct Params.TreeDepths treeDepths;
uint8 messageBatchSize;
struct DomainObjs.PubKey coordinatorPubKey;
address verifier;
address vkRegistry;
enum DomainObjs.Mode mode;
address policy;
address initialVoiceCreditProxy;
address[] relayers;
uint256 voteOptions;
}

stateTreeDepth

function stateTreeDepth() external view returns (uint8)

Get the depth of the state tree

Return Values

NameTypeDescription
[0]uint8The depth of the state tree

getStateTreeRoot

function getStateTreeRoot() external view returns (uint256)

Return the main root of the StateAq contract

Return Values

NameTypeDescription
[0]uint256The Merkle root

getStateIndex

function getStateIndex(uint256 _pubKeyHash) external view returns (uint256)

Get the index of a public key in the state tree

Parameters

NameTypeDescription
_pubKeyHashuint256The hash of the public key

Return Values

NameTypeDescription
[0]uint256index The index of the public key in the state tree

deployPoll

function deployPoll(struct IMACI.DeployPollArgs _pollArgs) external returns (struct IMACI.PollContracts)

Deploy a new Poll contract.

Parameters

NameTypeDescription
_pollArgsstruct IMACI.DeployPollArgsThe deploy poll args

signUp

function signUp(struct DomainObjs.PubKey _pubKey, bytes _signUpPolicyData) external

Allows any eligible user sign up. The sign-up policy should prevent double sign-ups or ineligible users from doing so. This function will only succeed if the sign-up deadline has not passed.

Parameters

NameTypeDescription
_pubKeystruct DomainObjs.PubKeyThe user's desired public key.
_signUpPolicyDatabytesData to pass to the sign-up policy register() function. For instance, the POAPPolicy or TokenPolicy requires this value to be the ABI-encoded token ID.

getStateRootOnIndexedSignUp

function getStateRootOnIndexedSignUp(uint256 _index) external view returns (uint256)

Return the state root when the '_index' user signed up

Parameters

NameTypeDescription
_indexuint256The serial number when the user signed up

Return Values

NameTypeDescription
[0]uint256The Merkle root

numSignUps

function numSignUps() external view returns (uint256)

Get the number of signups

Return Values

NameTypeDescription
[0]uint256numsignUps The number of signups

nextPollId

function nextPollId() external view returns (uint256)

Get the next poll ID

Return Values

NameTypeDescription
[0]uint256The next poll ID