Skip to content

Accumulators

EPOCH_LENGTH

Accumulators

getLatestAccumulated

function getLatestAccumulated(struct Accumulators.Accumulator acc) internal view returns (uint256)

getAccumulatedForEpoch

function getAccumulatedForEpoch(struct Accumulators.Accumulator acc, uint256 epoch) internal view returns (uint256)

getEpochTotalFromInitialRate

function getEpochTotalFromInitialRate(struct Accumulators.Accumulator acc, uint256 epoch) internal view returns (uint256)

isFirstEpoch

function isFirstEpoch(struct Accumulators.Accumulator acc, uint256 epoch) internal view returns (bool)

addRate

function addRate(struct Accumulators.Accumulator acc, uint256 rate) internal

subRate

function subRate(struct Accumulators.Accumulator acc, uint256 rate) internal

setRate

function setRate(struct Accumulators.Accumulator acc, uint256 rate) internal

latest

function latest(struct Accumulators.Accumulator acc) internal view returns (struct Accumulators.EpochCheckpoint)

checkPointLength

function checkPointLength(struct Accumulators.Accumulator acc) internal view returns (uint256)

getCheckpointAtEpoch

function getCheckpointAtEpoch(struct Accumulators.Accumulator acc, uint256 epochNumber) internal view returns (struct Accumulators.EpochCheckpoint)

Returns the most recent checkpoint during a given epoch. If a checkpoint is not available at that epoch, the closest one before it is returned, or a zero epoch checkpoint otherwise.

zeroEpoch

function zeroEpoch() private pure returns (struct Accumulators.EpochCheckpoint)

getEpochNumber

function getEpochNumber(uint256 timestamp) internal pure returns (uint32)

getCurrentEpochNumber

function getCurrentEpochNumber() internal view returns (uint32)

getEpochStartTimestamp

function getEpochStartTimestamp(uint256 epochNumber) internal pure returns (uint256)

getCurrentEpochStartTimestamp

function getCurrentEpochStartTimestamp() internal view returns (uint256)

getEpochEndTimestamp

function getEpochEndTimestamp(uint256 epochNumber) internal pure returns (uint256)

getCurrentEpochEndTimestamp

function getCurrentEpochEndTimestamp() internal view returns (uint256)

isCurrentEpoch

function isCurrentEpoch(uint256 timestamp) internal view returns (bool)