Private Voting Contract

Technical Documentation

Methods:

By default, these methods can only be called from an address granted the role CONSUMER_ROLE


requestCreateBallot(uint256 minimumVoters)

Requests the creation of a new ballot.

Successful execution results in the CreateBallotRequested event. minimumVoters must be greater than zero. Results in the CreateBallotFulfilled event after the ballot is created in space.


requestVote(bytes32 ballotId, 
            bytes memory encryptedVote)

Registers a vote for a particular ballot.

Successful execution results in the VoteRequested event. Results in the VoteFulfilled event after the vote is tabulated in space.


requestFinalizeBallot(bytes32 ballotId)

Requests the finalization (closure and tabulation) of the ballot identified by ballotId.

Successful execution results in the FinalizeBallotRequested event. Results in the FinalizeBallotFulfilled event after the ballot is finalized in space.

Events:

CreateBallotRequested(uint256 indexed requestId,
                      address indexed sender, 
                      uint256 minimumVoters)

Signals that a new ballot has been requested.


CreateBallotFulfilled(uint256 indexed requestId,
                      bytes32 indexed ballotId, 
                      bytes publicKey, 
                      uint256 indexed errorCode, 
                      bool callbackSuccess);

Signals that a new ballot has been created in space.


VoteRequested(uint256 indexed requestId,
              address indexed sender, 
              bytes32 indexed ballotId, 
              bytes encryptedVote)

Signals that an encrypted vote encryptedVote has been registered for the unique ballot identifier ballotId.


VoteFulfilled(uint256 indexed requestId,
              bytes32 indexed ballotId, 
              uint256 indexed errorCode,
              bool callbackSuccess)

Signals that a vote has been registered in space for the given ballotId.

FinalizeBallotRequested(uint256 indexed requestId,
                        address indexed sender, 
                        bytes32 indexed ballotId)

Signals that a request has been made to finalize the ballot identified by ballotId.

FinalizeBallotFulfilled(uint256 indexed requestId,
                        bytes32 indexed ballotId, 
                        string result, 
                        uint256 indexed errorCode, 
                        bool callbackSuccess)

Signals that the ballot identified by ballotId has been finalized in space. Ballot result is returned in the result parameter.

Last updated