Skip to main content

Epochs

Epochs​

EPOCH_SECONDS​

uint256 EPOCH_SECONDS

fromSeconds​

function fromSeconds(uint256 s) internal pure returns (uint256)

Get the epoch containing the timestamp s

Parameters​

NameTypeDescription
suint256the timestamp

Return Values​

NameTypeDescription
[0]uint256corresponding epoch

current​

function current() internal view returns (uint256)

Get the current epoch for the block.timestamp

Return Values​

NameTypeDescription
[0]uint256current epoch

currentEpochStartTimestamp​

function currentEpochStartTimestamp() internal view returns (uint256)

Get the start timestamp for the current epoch

Return Values​

NameTypeDescription
[0]uint256current epoch start timestamp

previous​

function previous() internal view returns (uint256)

Get the previous epoch given block.timestamp

Return Values​

NameTypeDescription
[0]uint256previous epoch

next​

function next() internal view returns (uint256)

Get the next epoch given block.timestamp

Return Values​

NameTypeDescription
[0]uint256next epoch

startOf​

function startOf(uint256 epoch) internal pure returns (uint256)

Get the Unix timestamp of the start of epoch

Parameters​

NameTypeDescription
epochuint256the epoch

Return Values​

NameTypeDescription
[0]uint256unix timestamp