Staking ProtocollockVariationstwoBorderTimeLockFacet

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

event CampaignLockVariationsConfigured(uint256 campaignId, uint256 minAcceptedLockPeriod, uint256 maxAcceptedLockPeriod)

Emitted at setCampaignLockVariations().

setCampaignLockVariations

function setCampaignLockVariations(uint256 campaignId, bytes campaignLockVariationsData) external

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, use type(uint256).max).
  • minAcceptedLockPeriod must be less than or equal to maxAcceptedLockPeriod._

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted staking campaign.
campaignLockVariationsDatabytesThe 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

function checkTimeLock(uint256 campaignId, uint256 timeLockPeriod) external view

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 configured minAcceptedLockPeriod (see setCampaignLockVariations()).
  • timeLockPeriod is greater than the campaign's configured maxAcceptedLockPeriod (see setCampaignLockVariations())._

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted staking campaign.
timeLockPerioduint256The lock period to check, in seconds (unix period format).

On this page