TwoBorderTimeLockFacetStorage
This library manages the storage and logic for applying 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.
CampaignNotOnCreationStateForSetting
Thrown when a targeted campaign is not "On Creation" state, which is required at configurations.
InvalidZeroMaxLockPeriod
Thrown at setter when the maximum lock period is attempted to be set to zero for a campaign.
MaxLockPeriodLessThanMin
Thrown when the specified maximum lock period is less than the minimum for a campaign.
InvalidTimeLockPeriod
Thrown when a specified time lock period is not within the accepted range for a campaign.
STORAGE_SLOT
Unique identifier for the storage slot where the Layout struct is stored.
Layout
Struct for managing time-based lock configurations for staking campaigns.
CampaignLockPeriods
Struct containing the time-based lock configuration for a staking campaign.
layout
Retrieves a reference to the Layout struct stored at the slot specified by STORAGE_SLOT
unique identifier.
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
.
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 |
---|---|---|
l | struct TwoBorderTimeLockFacetStorage.Layout | A reference to the Layout struct in storage. |
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 in seconds, that staked assets must be locked when the positions are either created (stake) or increased (restake). - maxAcceptedLockPeriod : The maximum allowed time duration 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 |
---|---|---|
l | struct TwoBorderTimeLockFacetStorage.Layout | A reference to the Layout struct in storage. |
campaignId | uint256 | The unique identifier of the targeted staking campaign. |
timeLockPeriod | uint256 | The lock period to check, in seconds (unix period format). |