Skip to main content

LastFridayOfMonthCadence

Git Source - Generated with forge doc

Inherits: IRenewalCadence

Title: LastFridayOfMonthCadence

Cadence with boundaries at a fixed time of day on the last Friday of each month.

Periods span 28 or 35 days depending on the month.

Constants​

BOUNDARY_TIME_OF_DAY​

Time of day at which boundaries fall in seconds past 00:00:00 UTC.

uint256 public immutable BOUNDARY_TIME_OF_DAY

FIRST_BOUNDARY​

First returnable boundary (1970-01-30, the last Friday of January 1970, at BOUNDARY_TIME_OF_DAY); earlier inputs revert.

uint256 public immutable FIRST_BOUNDARY

Functions​

constructor​

constructor(uint256 boundaryTimeOfDay) ;

cadencePeriodStart​

Returns the start of the cadence period at or before a timestamp.

function cadencePeriodStart(uint256 timestamp) external view returns (uint256);

Parameters

NameTypeDescription
timestampuint256The reference timestamp.

Returns

NameTypeDescription
<none>uint256boundary The largest cadence point <= timestamp.

_fridayOnOrBefore​

Rolls epochDay (days since epoch) back to the Friday on or before it.

function _fridayOnOrBefore(uint256 epochDay) private pure returns (uint256);

_civilFromDays​

Returns year/month/day triple in civil calendar. Port of Hinnant's civil_from_days, standardized in C++20 std::chrono.

function _civilFromDays(uint256 epochDay) private pure returns (uint256 year, uint256 month, uint256 dayOfMonth);

Parameters

NameTypeDescription
epochDayuint256number of days since 1970-01-01

_daysInMonth​

Number of days in the given civil month.

function _daysInMonth(uint256 year, uint256 month) private pure returns (uint256);

Errors​

InvalidBoundaryTime​

error InvalidBoundaryTime();

TimestampBeforeFirstBoundary​

error TimestampBeforeFirstBoundary();