Staking ProtocolvirtualAmountMultipliercontinuousVirtualAmountMultiplier

ContinuousVirtualAmountMultiplierFacet

Enables the application of amount multipliers (used for scaling rewards) within staking campaigns according to a continuous-based schema.

_Example of a continuous-based schema configuration: If amountsStaked = [100, 300] and amountStakedMultipliers = [2, 4]:

  • A position with less than 100 staked packets will receive an amount multiplier of 1 (no multiplier).

  • A position with staked packets X, where X is between 100 (inclusive) and 300 (exclusive), will receive an amount multiplier calculated as follows: amountMultiplierForX = 2 + ((X - 100) / (300 - 100)) * (4 - 2)

  • A position with 300 or more staked packets will receive an amount multiplier of 4.

In addition to amount-wise scaling of rewards, staking campaigns may also scale rewards based on the lock period (i.e., lock multipliers). This implementation focuses solely on staked amount scaling, ensuring that positions receive rewards according to the continuous-based amount multiplier schema defined by the associated campaign.

IMPORTANT:

  • Multipliers should be scaled by 1e18, allowing for calculations with up to 18 decimal precision. -amountsStaked and amountStakedMultipliers must be in strictly increasing order._

CampaignVirtualAmountMultipliersConfigured

event CampaignVirtualAmountMultipliersConfigured(uint256 campaignId, uint256[] amountsStaked, uint256[] amountStakedMultipliers)

Emitted at setCampaignVirtualAmountMultipliers().

VirtualAmountMultiplierApplied

event VirtualAmountMultiplierApplied(uint256 nftId, uint256 virtualAmountMultiplier)

Emitted at applyVirtualAmountMultiplier().

setCampaignVirtualAmountMultipliers

function setCampaignVirtualAmountMultipliers(uint256 campaignId, bytes campaignVirtualAmountMultipliersData) external

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

_Setter functions are executed during the creation process of campaigns (see CampaignCreationSkeleton.sol). This function allows for the configuration of thresholds and their respective base multipliers for staked amounts.

The lengths of the amountsStaked and amountStakedMultipliers arrays must be equal. Each threshold defined in amountsStaked should correspond to a base multiplier in amountStakedMultipliers.

Emits a {CampaignVirtualAmountMultipliersConfigured} event.

IMPORTANT:

  • Values in amountStakedMultipliers should be scaled by 1e18 at the API level, allowing for 18 decimal precision. -amountsStaked and amountStakedMultipliers must be in strictly increasing order._

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted staking campaign.
campaignVirtualAmountMultipliersDatabytesThe ABI-encoded data containing the following: - amountsStaked: A uint256 array of input packet amounts defining amount thresholds for amount-based multipliers. - amountStakedMultipliers: A uint256 array of respective base multiplier values for each threshold (scaled by 1e18).

applyVirtualAmountMultiplier

function applyVirtualAmountMultiplier(uint256 campaignId, uint256 nftId, uint256 totalAmountStaked) external returns (uint256)

Applies the respective amount multiplier to the specified position based on the campaign's configuration and the position's total staked amount of input packets.

_This function returns the virtual balance of the specified position, calculated as the position's actual raw balance multiplied by the applicable amount multiplier.

Emits a {VirtualAmountMultiplierApplied} event._

Parameters

NameTypeDescription
campaignIduint256The unique identifier of the targeted staking campaign.
nftIduint256The unique identifier of the NFT associated with the position.
totalAmountStakeduint256The actual raw balance (in staked input packets) of the position.

Return Values

NameTypeDescription
[0]uint256The calculated virtual balance of the position.

getAmountMultiplier

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

Retrieves the amount multiplier applied to the specified staking position.

Amount 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 amount multiplier value applied to the position.

On this page