ResultComputation

Computes vote results.

The result is the mode of the added votes, if the mode’s frequency is >50%. Otherwise, the vote is unresolved.

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:

  • minVoteThreshold: Minimum 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.

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

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

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.

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.

© UMA Project 2018-2019