Skip to main content
Version: v3.x

ITally

Tally interface

AddTallyResultsArgs

tally result args

struct AddTallyResultsArgs {
uint256[] voteOptionIndices;
uint256[] tallyResults;
uint256[][][] tallyResultProofs;
uint256 totalSpent;
uint256 totalSpentSalt;
uint256 tallyResultSalt;
uint256 newResultsCommitment;
uint256 spentVoiceCreditsHash;
uint256 perVOSpentVoiceCreditsHash;
}

verifyPerVOSpentVoiceCredits

function verifyPerVOSpentVoiceCredits(uint256 _voteOptionIndex, uint256 _spent, uint256[][] _spentProof, uint256 _spentSalt, uint8 _voteOptionTreeDepth, uint256 _spentVoiceCreditsHash, uint256 _resultCommitment) external view returns (bool)

Return Values

NameTypeDescription
[0]boolisValid Whether the provided proof is valid

verifySpentVoiceCredits

function verifySpentVoiceCredits(uint256 _totalSpent, uint256 _totalSpentSalt, uint256 _resultCommitment, uint256 _perVOSpentVoiceCreditsHash) external view returns (bool)

Verify the number of spent voice credits from the tally.json

Parameters

NameTypeDescription
_totalSpentuint256spent field retrieved in the totalSpentVoiceCredits object
_totalSpentSaltuint256the corresponding salt in the totalSpentVoiceCredit object
_resultCommitmentuint256hashLeftRight(merkle root of the results.tally, results.salt) in tally.json file
_perVOSpentVoiceCreditsHashuint256only for QV - hashLeftRight(merkle root of the no spent voice credits, salt)