TwoBorderTimeLockFacet
Enables the application of time-based lock configurations for staking campaigns and handles lock duration checks that should be performed during staking and restaking operations.
This implementation is designed to configure minimum and maximum lock durations for staked assets in positions within any campaign.
CampaignLockVariationsConfigured
Emitted at setCampaignLockVariations()
.
setCampaignLockVariations
Setter function for configuring time-based lock constraints for the specified staking campaign.
_Setter functions are executed during the creation process of campaigns (see CampaignCreationSkeleton.sol
).
This function allows for setting the minimum and maximum lock periods (in unix period format) that any position
within the campaign can support. All lock periods for positions in the campaign must fall within the
configured minAcceptedLockPeriod
and maxAcceptedLockPeriod
.
Emits a {CampaignLockVariationsConfigured}
event.
IMPORTANT:
maxAcceptedLockPeriod
must be greater than 0 (if no upper limit is required, usetype(uint256).max
).minAcceptedLockPeriod
must be less than or equal tomaxAcceptedLockPeriod
._
Parameters
Name | Type | Description |
---|---|---|
campaignId | uint256 | The unique identifier of the targeted staking campaign. |
campaignLockVariationsData | bytes | The ABI-encoded data containing the following: - minAcceptedLockPeriod : The minimum required time duration (uint256) in seconds, that staked assets must be locked when the positions are either created (stake) or increased (restake). - maxAcceptedLockPeriod : The maximum allowed time duration (uint256) in seconds, that staked assets can be locked when the positions are either created (stake) or increased (restake). |
checkTimeLock
Checks whether the specified lock period complies with the configured time-based lock constraints of the given campaign.
_Reverts if:
timeLockPeriod
is less than the campaign's configuredminAcceptedLockPeriod
(seesetCampaignLockVariations()
).timeLockPeriod
is greater than the campaign's configuredmaxAcceptedLockPeriod
(seesetCampaignLockVariations()
)._
Parameters
Name | Type | Description |
---|---|---|
campaignId | uint256 | The unique identifier of the targeted staking campaign. |
timeLockPeriod | uint256 | The lock period to check, in seconds (unix period format). |