OnlyStartingTimestampCampaign
Enables the configuration of essential timestamps (e.g., starting timestamp) for staking campaigns and handles campaigns' time checks that should be performed during stake and restake operations.
This implementation is designed to configure only the starting timestamp of staking campaigns and checks solely that campaigns have already started during stake and restake operations.
IMPORTANT: This implementation is intended for use in staking campaigns where stake and restake operations, as well as rewards accrual, are perpetual. In such campaigns rewards begin accruing from the moment a user creates a position and continue indefinitely as long as the position remains active. Thus, stakes and restakes are instantly active._
CampaignNotOnCreationStateForSetting
Thrown when a targeted campaign is not "On Creation" state, which is required at configurations.
InvalidCampaignStartingTimestamp
Thrown when an attempt is made to set a campaign's starting timestamp in the past.
CannotStakeCampaignNotStarted
Thrown when an attempt is made to stake before the campaign's starting timestamp has been reached.
CampaignTimesConfigured
Emitted at setCampaignTimesData()
.
setCampaignTimesData
Setter function for configuring the starting timestamp for the specified staking campaign.
_Setter functions are executed during the creation process of campaigns (see CampaignCreationSkeleton.sol
).
Emits a {CampaignTimesConfigured}
event.
IMPORTANT:
startingTimestamp
must not be a past timestamp reference._
Parameters
Name | Type | Description |
---|---|---|
campaignId | uint256 | The unique identifier of the targeted staking campaign. |
campaignTimesData | bytes | The ABI-encoded data containing the following: - startingTimestamp : The Unix timestamp indicating when the campaign starts. |
checkCampaignTimesOnStake
Checks, during a stake or restake operation, whether the specified campaign has started.
_Reverts if:
block.timestamp
is less than the campaign's configured starting timestamp (seesetCampaignTimesData()
)._
Parameters
Name | Type | Description |
---|---|---|
campaignId | uint256 | The unique identifier of the targeted staking campaign. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The current block.timestamp , representing the timestamp of the stake or restake operation. This timestamp also serves as the lock starting point if a lock period is specified during the operation. |