VelodromeTimeLibrary

Git Source

State Variables

WEEK

uint256 internal constant WEEK = 7 days;

Functions

epochStart

Calculate the start of the current epoch based on the timestamp provided

Epochs are aligned to weekly intervals, with each epoch starting at midnight UTC.

function epochStart(uint256 timestamp) internal pure returns (uint256);

Parameters

NameTypeDescription
timestampuint256The current timestamp to align

Returns

NameTypeDescription
<none>uint256The start timestamp of the epoch week

epochNext

Calculate the start of the next epoch or end of the current epoch

Returns the timestamp at the start of the next weekly epoch following the given timestamp.

function epochNext(uint256 timestamp) internal pure returns (uint256);

Parameters

NameTypeDescription
timestampuint256The current timestamp

Returns

NameTypeDescription
<none>uint256The start timestamp of the next epoch

epochVoteStart

Determine the start of the voting window for the current epoch

Voting windows start one hour into the weekly epoch.

function epochVoteStart(uint256 timestamp) internal pure returns (uint256);

Parameters

NameTypeDescription
timestampuint256The timestamp to calculate from

Returns

NameTypeDescription
<none>uint256The start timestamp of the voting window within the epoch

epochVoteEnd

Calculate the end of the voting window within the current epoch

Voting windows close one hour before the next epoch begins.

function epochVoteEnd(uint256 timestamp) internal pure returns (uint256);

Parameters

NameTypeDescription
timestampuint256The timestamp to calculate from

Returns

NameTypeDescription
<none>uint256The end timestamp of the voting window within the epoch