Comment on page
Timed
A timer utility for keeping track of elapsed time within a window
Abstract contract for managing timed events that complete after a period
The contract has a duration d denominated in seconds. It has an effective timestamp t on the range [0,d]. After the period has ended, t stays fixed at d.
When it is initialized, it sets the current block timestamp to t=0. The remaining time is d-t and the completion condition is remaining = 0 (t=d).
DurationUpdate
TimerReset
Change in the duration of the timer
type | param | description |
uint256 | _duration | new duration |
A reset of the timer
type | param | description |
uint256 | _startTime | new timer start |
function isTimeEnded() external view returns (bool);
Returns true if elapsed time t is equal to the duration d.
function startTime() external view returns (uint256);
Returns the starting block timestamp of the window.
function duration() external view returns (uint256);
Returns the duration d of the window.
function timeSinceStart() external view returns (uint256);
Returns the elapsed time t since the startTime, with d as the maximum.
function remainingTime() external view returns (uint256);
Returns the time remaining in the window t - d.
timed.json
1KB
Code
Timed
Last modified 2yr ago