ICycleFacet
ICycleFacet is the interface for the CycleFacet contract.
This contract is responsible for managing the cycle state of the project.
Functions
Section titled “Functions”updateCycleState
Section titled “updateCycleState”Updates the state of the cycle. This function is called by various facets to update the cycle state when certain actions are performed.
This function is payable to allow delegatecalls to it while the caller is receiving ether.
function updateCycleState(uint256 cycleId) external payable;Parameters
| Name | Type | Description |
|---|---|---|
cycleId | uint256 | The cycle ID. |
cycleTimeRemaining
Section titled “cycleTimeRemaining”Returns the remaining time (in seconds) for the cycle to end.
function cycleTimeRemaining(uint256 cycleId) external view returns (uint256 remainingTime);Parameters
| Name | Type | Description |
|---|---|---|
cycleId | uint256 | The cycle ID. |
Returns
| Name | Type | Description |
|---|---|---|
remainingTime | uint256 | The time remaining (in seconds) for the cycle to end. |
lastTimeCycleApplicable
Section titled “lastTimeCycleApplicable”Returns the last time the cycle is applicable. This timestamp is a Math.min of the
cycle finish time and the current block.timestamp.
function lastTimeCycleApplicable(uint256 cycleId) external view returns (uint256 lastTimeApplicable);Parameters
| Name | Type | Description |
|---|---|---|
cycleId | uint256 | The cycle ID. |
Returns
| Name | Type | Description |
|---|---|---|
lastTimeApplicable | uint256 | The last time the cycle is applicable. |
startNewCycle
Section titled “startNewCycle”Starts a new cycle.
function startNewCycle(uint256 cycleDuration, bool issueCertificateIfNone) external;Parameters
| Name | Type | Description |
|---|---|---|
cycleDuration | uint256 | The duration of the cycle (in seconds). |
issueCertificateIfNone | bool | A flag to issue a certificate upon cycle start if none exists. |
extendCycleDuration
Section titled “extendCycleDuration”Extends the duration of the cycle.
The cycle duration cannot be less than 60 seconds.
The extension is only applicable if the manager owns 100% of the certificates.
Only the manager can call this function.
function extendCycleDuration(uint256 secondsToIncrease) external;Parameters
| Name | Type | Description |
|---|---|---|
secondsToIncrease | uint256 | The number of seconds to increase the cycle duration by. |