ResultComputation

Computes vote results.

The result is the mode of the added votes. Otherwise, the vote is unresolved.

addVote(struct ResultComputation.Data data, int256 votePrice, struct FixedPoint.Unsigned numberTokens) internal

Adds a new vote to be used when computing the result.

Parameters:

  • data: contains information to which the vote is applied.

  • votePrice: value specified in the vote for the given numberTokens.

  • numberTokens: number of tokens that voted on the votePrice.

getResolvedPrice(struct ResultComputation.Data data, struct FixedPoint.Unsigned minVoteThreshold) → bool isResolved, int256 price internal

Returns whether the result is resolved, and if so, what value it resolved to.

price should be ignored if isResolved is false.

Parameters:

  • data: contains information against which the minVoteThreshold is applied.

  • minVoteThreshold: min number of tokens that must have been voted for the result to be valid. Can be used to enforce a minimum voter participation rate, regardless of how the votes are distributed.

wasVoteCorrect(struct ResultComputation.Data data, bytes32 voteHash) → bool internal

Checks whether a voteHash is considered correct.

Should only be called after a vote is resolved, i.e., via getResolvedPrice.

Parameters:

  • data: contains information against which the voteHash is checked.

  • voteHash: committed hash submitted by the voter.

getTotalCorrectlyVotedTokens(struct ResultComputation.Data data) → struct FixedPoint.Unsigned internal

Gets the total number of tokens whose votes are considered correct.

Should only be called after a vote is resolved, i.e., via getResolvedPrice.

Parameters:

  • data: contains all votes against which the correctly voted tokens are counted.

© UMA Project 2018-2019