Skip to main content
Version: v1.2

IPoll

Poll interface

numSignUpsAndMessages

function numSignUpsAndMessages() external view returns (uint256 numSignups, uint256 numMsgs)

The number of messages which have been processed and the number of signups

Return Values

NameTypeDescription
numSignupsuint256The number of signups
numMsgsuint256The number of messages sent by voters

topup

function topup(uint256 stateIndex, uint256 amount) external

Allows to publish a Topup message

Parameters

NameTypeDescription
stateIndexuint256The index of user in the state queue
amountuint256The amount of credits to topup

publishMessage

function publishMessage(struct DomainObjs.Message _message, struct DomainObjs.PubKey _encPubKey) external

Allows anyone to publish a message (an encrypted command and signature). This function also enqueues the message.

Parameters

NameTypeDescription
_messagestruct DomainObjs.MessageThe message to publish
_encPubKeystruct DomainObjs.PubKeyAn ephemeral public key which can be combined with the coordinator's private key to generate an ECDH shared key with which to encrypt the message.

mergeMaciStateAqSubRoots

function mergeMaciStateAqSubRoots(uint256 _numSrQueueOps, uint256 _pollId) external

The first step of merging the MACI state AccQueue. This allows the ProcessMessages circuit to access the latest state tree and ballots via currentSbCommitment.

Parameters

NameTypeDescription
_numSrQueueOpsuint256Number of operations
_pollIduint256The ID of the active Poll

mergeMaciStateAq

function mergeMaciStateAq(uint256 _pollId) external

The second step of merging the MACI state AccQueue. This allows the ProcessMessages circuit to access the latest state tree and ballots via currentSbCommitment.

Parameters

NameTypeDescription
_pollIduint256The ID of the active Poll

mergeMessageAqSubRoots

function mergeMessageAqSubRoots(uint256 _numSrQueueOps) external

The first step in merging the message AccQueue so that the ProcessMessages circuit can access the message root.

Parameters

NameTypeDescription
_numSrQueueOpsuint256The number of subroot queue operations to perform

mergeMessageAq

function mergeMessageAq() external

The second step in merging the message AccQueue so that the ProcessMessages circuit can access the message root.

getDeployTimeAndDuration

function getDeployTimeAndDuration() external view returns (uint256 _deployTime, uint256 _duration)

Returns the Poll's deploy time and duration

Return Values

NameTypeDescription
_deployTimeuint256The deployment timestamp
_durationuint256The duration of the poll

stateAqMerged

function stateAqMerged() external view returns (bool)

Get the result of whether the MACI contract's stateAq has been merged by this contract

Return Values

NameTypeDescription
[0]boolWhether the MACI contract's stateAq has been merged by this contract

treeDepths

function treeDepths() external view returns (uint8 intStateTreeDepth, uint8 messageTreeSubDepth, uint8 messageTreeDepth, uint8 voteOptionTreeDepth)

Get the depths of the merkle trees

Return Values

NameTypeDescription
intStateTreeDepthuint8The depth of the state tree
messageTreeSubDepthuint8The subdepth of the message tree
messageTreeDepthuint8The depth of the message tree
voteOptionTreeDepthuint8The subdepth of the vote option tree

maxValues

function maxValues() external view returns (uint256 maxMessages, uint256 maxVoteOptions)

Get the max values for the poll

Return Values

NameTypeDescription
maxMessagesuint256The maximum number of messages
maxVoteOptionsuint256The maximum number of vote options

extContracts

function extContracts() external view returns (contract IMACI maci, contract AccQueue messageAq, contract TopupCredit topupCredit)

Get the external contracts

Return Values

NameTypeDescription
macicontract IMACIThe IMACI contract
messageAqcontract AccQueueThe AccQueue contract
topupCreditcontract TopupCreditThe TopupCredit contract

coordinatorPubKeyHash

function coordinatorPubKeyHash() external view returns (uint256 _coordinatorPubKeyHash)

Get the hash of coordinator's public key

Return Values

NameTypeDescription
_coordinatorPubKeyHashuint256the hash of coordinator's public key

currentSbCommitment

function currentSbCommitment() external view returns (uint256)

Get the commitment to the state leaves and the ballots. This is hash3(stateRoot, ballotRoot, salt). Its initial value should be hash(maciStateRootSnapshot, emptyBallotRoot, 0) Each successful invocation of processMessages() should use a different salt to update this value, so that an external observer cannot tell in the case that none of the messages are valid.

Return Values

NameTypeDescription
[0]uint256The commitment to the state leaves and the ballots