Staking Protocolinterfaces

IRewardsDistributionFacet

It defines the basic interface of RewardsDistribution facets.

initRewardsDistribution

function initRewardsDistribution(bytes initRewardsDistributionData) external

Initialization function.

The structure and content of initRewardsDistributionData are implementation specific.

Parameters

NameTypeDescription
initRewardsDistributionDatabytesThe ABI-encoded initialization data.

setCampaignRewardsDistribution

function setCampaignRewardsDistribution(uint256 campaignId, bytes campaignRewardsDistributionData) external

Sets the rewards distribution schedule for a specified campaign.

Setter functions are executed during the creation process of campaigns. The structure and content of campaignRewardsDistributionData are implementation specific.

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted staking campaign.
campaignRewardsDistributionDatabytesThe ABI-encoded rewards distribution configuration data.

applyStake

function applyStake(uint256 campaignId, uint256 nftId, uint256 virtualPacketsStaked, uint256 packetsStaked, address account) external

Applies implementation-specific logic when a staking position is created in the specified campaign.

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted staking campaign.
nftIduint256The unique identifier of the NFT associated with the position.
virtualPacketsStakeduint256The number of staked (input) packets adjusted by the applicable amount multiplier (if any).
packetsStakeduint256The raw number of staked packets, before applying any multipliers.
accountaddressThe address of the user creating and owning the position.

applyRestake

function applyRestake(uint256 campaignId, uint256 nftId) external returns (uint256 amountOfRewardPackets)

Applies implementation-specific logic when a staking position is increased in the specified campaign.

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted staking campaign.
nftIduint256The unique identifier of the NFT associated with the position.

Return Values

NameTypeDescription
amountOfRewardPacketsuint256The number of accrued claimable reward packets owed to the position prior to the restake operation.

applyUnstake

function applyUnstake(uint256 campaignId, uint256 nftId) external returns (uint256 amountOfRewardPackets)

Applies implementation-specific logic when a staking position is either closed or decreased.

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted staking campaign.
nftIduint256The unique identifier of the NFT associated with the position.

Return Values

NameTypeDescription
amountOfRewardPacketsuint256The number of accrued claimable reward packets owed to the position prior to the unstake operation.

getReward

function getReward(uint256 campaignId, uint256 nftId) external returns (uint256)

Returns the claimable rewards for a specific position.

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted staking campaign.
nftIduint256The unique identifier of the NFT associated with the position.

Return Values

NameTypeDescription
[0]uint256The number of accrued claimable reward packets owed to the position.

getRestakeReward

function getRestakeReward(uint256 campaignId, uint256 nftId) external returns (uint256)

Returns the accrued reward packets for a specified position, associated with either a gap lock period or an overlapping lock period.

_A gap period refers to the duration between the current position's unlock timestamp and the recalculated lock start timestamp for the increased position. An overlapping lock period refers to the duration between the current position's lock start timestamp and the recalculated lock start timestamp for the increased position.

NOTE:

  • If the restake occurs after the current position's unlock timestamp then a gap period is considered.
  • If the restake occurs before the current position's unlock timestamp then an overlapping period is considered._

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted staking campaign.
nftIduint256The unique identifier of the NFT associated with the position.

On this page