Skip to main content
Version: v2.0_alpha

SimplePayout

A simple payout contract that works with a SimpleRecipientRegistry and a MACI Tally contract

recipientRegistry

contract ISimpleRecipientRegistry recipientRegistry

the recipient registry

payoutToken

address payoutToken

the payout token

tally

contract ITally tally

the tally contract

paidUsers

mapping(uint256 => bool) paidUsers

keep track of which users have already been paid

totalAmount

uint256 totalAmount

the total amount of tokens available to be paid out

totalVoiceCreditsSpent

uint256 totalVoiceCreditsSpent

the total amount of voice credits spent

uint256 paid

keep track of how many users have been paid

InvalidSpentVoiceCredits

error InvalidSpentVoiceCredits()

Custom errors

ProjectAlreadyPaid

error ProjectAlreadyPaid()

InvalidProof

error InvalidProof()

NotAllProjectsPaid

error NotAllProjectsPaid()

constructor

constructor(address _recipientRegistry, address _token, address _tally, uint256 _totalAmount, uint256 _totalSpent, uint256 _totalSpentSalt, uint256 _resultCommitment, uint256 _perVOSpentVoiceCreditsHash) public payable

Create a new instance of the payout contract

Parameters

NameTypeDescription
_recipientRegistryaddressthe address of the recipient registry
_tokenaddressthe address of the payout token
_tallyaddressthe address of the tally contract
_totalAmountuint256the total amount of tokens available to be paid out
_totalSpentuint256the total amount of voice credits spent
_totalSpentSaltuint256the salt of the spent amount
_resultCommitmentuint256the commitment of the results
_perVOSpentVoiceCreditsHashuint256the hash of the spent voice credits

deposit

function deposit() external payable

Deposit the amount of tokens to the contract

This function is only callable by the owner

payout

function payout(uint256 _voteOptionIndex, uint256 _spent, uint256[][] _proof, uint256 _spentSalt, uint256 _resultsCommitment, uint256 _spentVoiceCreditsCommitment, uint8 _voteOptionTreeDepth) external

Payout the amount of tokens to the recipient

Parameters

NameTypeDescription
_voteOptionIndexuint256the index of the vote option
_spentuint256the amount of voice credits spent
_proofuint256[][]the proof of the spent amount
_spentSaltuint256the salt of the spent amount
_resultsCommitmentuint256the commitment of the results
_spentVoiceCreditsCommitmentuint256the commitment of the spent voice credits
_voteOptionTreeDepthuint8the depth of the vote option tree

collectDust

function collectDust() external

A function to collect the dust left from round downs can only be called once all projects have been paid