Staking Protocolinterfaces

IVirtualLockMultiplierFacet

It defines the basic interface of VirtualLockMultiplier facets.

initVirtualLockMultiplierFacet

function initVirtualLockMultiplierFacet(bytes initVirtualLockMultipliersData) external

Initialization function.

The structure and content of initVirtualLockMultipliersData are implementation specific.

Parameters

NameTypeDescription
initVirtualLockMultipliersDatabytesThe ABI-encoded initialization data.

setCampaignVirtualLockMultipliers

function setCampaignVirtualLockMultipliers(uint256 campaignId, bytes campaignVirtualLockMultipliersData) external

Setter function for configuring lock multipliers for the specified staking campaign.

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

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted staking campaign.
campaignVirtualLockMultipliersDatabytesThe ABI-encoded data containing the lock multipliers configuration.

applyVirtualLockMultiplier

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

Applies the respective lock multiplier to the specified position based on the campaign's configuration and the position's lock period.

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 value of the applied lock multiplier.

combineVirtualLockMultipliers

function combineVirtualLockMultipliers(uint256 nftId, uint256 currentLockMultiplier, uint256 newLockMultiplier, uint256 packetsStaked, uint256 packetsRestaked) external returns (uint256)

Applies to the specified position the calculated combined lock multiplier.

combinedLockMultiplier = (((packetsStaked * currentLockMultiplier) + (packetsRestaked * newLockMultiplier)) / (packetsStaked + packetsRestaked))

Parameters

NameTypeDescription
nftIduint256The unique identifier of the NFT associated with the position.
currentLockMultiplieruint256The value of the lock multiplier currently applied to the position.
newLockMultiplieruint256The lock multiplier applicable for the restake's lock period.
packetsStakeduint256The total amount of staked input packets in the current position.
packetsRestakeduint256The amount of input packets to be allocated during the restake operation.

Return Values

NameTypeDescription
[0]uint256The calculated combined lock multiplier value.

getCurrentLockMultiplier

function getCurrentLockMultiplier(uint256 nftId) external view returns (uint256)

Retrieves the lock multiplier currently applied to the specified position.

Lock multipliers are scaled by 1e18, allowing for 18 decimal precision.

Parameters

NameTypeDescription
nftIduint256The unique identifier of the NFT associated with the position.

Return Values

NameTypeDescription
[0]uint256The lock multiplier value currently applied to the specified position.

getVirtualBalance

function getVirtualBalance(uint256 nftId) external view returns (uint256)

Calculates and retrieves the virtual balance of the specified position. The virtual balance is calculated as the position's actual raw balance (staked input packets) multiplied by the applicable amount and lock multiplier.

Parameters

NameTypeDescription
nftIduint256The unique identifier of the NFT associated with the position.

Return Values

NameTypeDescription
[0]uint256The virtual balance of the position accounting for both any applicable amount and lock multipliers.

getVirtualBalanceForAmount

function getVirtualBalanceForAmount(uint256 nftId, uint256 amountOfPackets) external view returns (uint256)

Retrieves the virtual amount of packets based on the specified amount of packets and the position's applicable lock multiplier (virtualAmount = amountOfPackets * lockMultiplierApplied).

This function only accounts for any applicable lock multiplier.

Parameters

NameTypeDescription
nftIduint256The unique identifier of the NFT associated with the position.
amountOfPacketsuint256The virtual balance of the specified packets accounting only for any applicable lock multiplier.