Tally Smart Contract
The Tally
contract is used by the coordinator to submit commitments to the tally results via the tallyVotes
function. This is done in batches and the final commitment can be used by the users to verify the validity of the results.
This contract should be deployed alongside a Poll
and ownership assigned to the coordinator.
The constructor accepts the following parameters:
constructor(
address _verifier,
address _vkRegistry,
address _poll,
address _mp,
address _tallyOwner,
Mode _mode
) payable Ownable(_tallyOwner) {
verifier = IVerifier(_verifier);
vkRegistry = IVkRegistry(_vkRegistry);
poll = IPoll(_poll);
messageProcessor = IMessageProcessor(_mp);
mode = _mode;
}
verifier
- The address of the verifier contractvkRegistry
- The address of the vkRegistry contractpoll
- The address of the poll contractmessageProcessor
- The address of the messageProcessor contractmode
- The mode of the tally contract - depending on this, the commitments will be processed differently, and it must equal the Poll mode (quadratic vs non quadratic voting)
Users can use the verification functions to verify the Tally results. These are as follows:
verifySpentVoiceCredits
- Verifies the spent voice creditsverifyPerVOSpentVoiceCredits
- Verifies the spent voice credits per vote optionverifyTallyResult
- Verifies the tally result