VoteTiming

Library to compute rounds and phases for an equal length commit-reveal voting cycle.

init(struct VoteTiming.Data data, uint256 phaseLength) internal

Initializes the data object. Sets the phase length based on the input.

computeCurrentRoundId(struct VoteTiming.Data data, uint256 currentTime) → uint256 internal

Computes the roundID based off the current time as floor(timestamp/roundLength).

The round ID depends on the global timestamp but not on the lifetime of the system. The consequence is that the initial round ID starts at an arbitrary number (that increments, as expected, for subsequent rounds) instead of zero or one.

Parameters:

  • data: input data object.

  • currentTime: input unix timestamp used to compute the current roundId.

computeRoundEndTime(struct VoteTiming.Data data, uint256 roundId) → uint256 internal

compute the round end time as a function of the round Id.

Parameters:

  • data: input data object.

  • roundId: uniquely identifies the current round.

computeCurrentPhase(struct VoteTiming.Data data, uint256 currentTime) → enum VotingAncillaryInterface.Phase internal

Computes the current phase based only on the current time.

Parameters:

  • data: input data object.

  • currentTime: input unix timestamp used to compute the current roundId.

© UMA Project 2018-2019