/// @notice Returns start timestamp of current epoch
/// @return getEpochStartTimestamp start timestamp of the current epoch
function getEpochStartTimestamp() public view returns (uint256) {
//Eg. If EPOCH_LENGTH is 10min, then the epoch will change at 11:00, 11:10, 11:20 etc.
// NOTE: we intentianally divide first to truncate the insignificant digits.
//slither-disable-next-line divide-before-multiply
return (block.timestamp / EPOCH_LENGTH) * EPOCH_LENGTH;
// 100 / 7 * 7 = 14 * 7 = 98
// 100 * 7 / 7 = 700 / 7 = 100
// b.t < Epoch >> transaction revert!!
}
/// @notice Returns index of the current epoch based on block.timestamp
/// @dev Called by internal functions to get current epoch index
/// @return getCurrentEpochIndex the current epoch index
//slither-disable-next-line block-timestamp
function getCurrentEpochIndex() external view returns (uint256) {
return (getEpochStartTimestamp() - initialEpochStartTimestamp) / EPOCH_LENGTH;
}