VotingInterface

commitVote(bytes32 identifier, uint256 time, bytes32 hash) external

Commit a vote for a price request for identifier at time.

identifier, time must correspond to a price request that’s currently in the commit phase. Commits can be changed.

Parameters:

  • identifier: uniquely identifies the committed vote. EG BTC/USD price pair.

  • time: unix timestamp of the price is being voted on.

  • hash: keccak256 hash of the price you want to vote for and a int salt.

batchCommit(struct VotingInterface.Commitment[] commits) external

Submit a batch of commits in a single transaction.

Using encryptedVote is optional. If included then commitment is stored on chain. Look at project-root/common/Constants.js for the tested maximum number of commitments that can fit in one transaction.

Parameters:

  • commits: struct to encapsulate an identifier, time, hash and optional encryptedVote.

revealVote(bytes32 identifier, uint256 time, int256 price, int256 salt) external

Reveal a previously committed vote for identifier at time.

The revealed price and salt must match the latest hash that commitVote() was called with. Only the committer can reveal their vote.

Parameters:

  • identifier: voted on in the commit phase. EG BTC/USD price pair.

  • time: specifies the unix timestamp of the price is being voted on.

  • price: voted on during the commit phase.

  • salt: value used to hide the commitment price during the commit phase.

batchReveal(struct VotingInterface.Reveal[] reveals) external

Reveal multiple votes in a single transaction. Look at project-root/common/Constants.js for the tested maximum number of reveals. that can fit in one transaction.

For more information on reveals, review the comment for revealVote.

Parameters:

  • reveals: array of the Reveal struct which contains an identifier, time, price and salt.

getPendingRequests() → struct VotingInterface.PendingRequest[] external

Gets the queries that are being voted on this round.

getVotePhase() → enum VotingInterface.Phase external

Returns the current voting phase, as a function of the current time.

getCurrentRoundId() → uint256 external

Returns the current round ID, as a function of the current time.

retrieveRewards(address voterAddress, uint256 roundId, struct VotingInterface.PendingRequest[] toRetrieve) → struct FixedPoint.Unsigned public

Retrieves rewards owed for a set of resolved price requests.

Can only retrieve rewards if calling for a valid round and if the call is done within the timeout threshold (not expired).

Parameters:

  • voterAddress: voter for which rewards will be retrieved. Does not have to be the caller.

  • roundId: the round from which voting rewards will be retrieved from.

  • toRetrieve: array of PendingRequests which rewards are retrieved from.

© UMA Project 2018-2019