VelodromeTimeLibrary
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
Name | Type | Description |
---|---|---|
timestamp | uint256 | The current timestamp to align |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The 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
Name | Type | Description |
---|---|---|
timestamp | uint256 | The current timestamp |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The 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
Name | Type | Description |
---|---|---|
timestamp | uint256 | The timestamp to calculate from |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The 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
Name | Type | Description |
---|---|---|
timestamp | uint256 | The timestamp to calculate from |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The end timestamp of the voting window within the epoch |