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
andamountStakedMultipliers
must be in strictly increasing order._
CampaignVirtualAmountMultipliersConfigured
Emitted at setCampaignVirtualAmountMultipliers()
.
VirtualAmountMultiplierApplied
Emitted at applyVirtualAmountMultiplier()
.
setCampaignVirtualAmountMultipliers
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
andamountStakedMultipliers
must be in strictly increasing order._
Parameters
Name | Type | Description |
---|---|---|
campaignId | uint256 | The unique identifier of the targeted staking campaign. |
campaignVirtualAmountMultipliersData | bytes | The 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
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
Name | Type | Description |
---|---|---|
campaignId | uint256 | The unique identifier of the targeted staking campaign. |
nftId | uint256 | The unique identifier of the NFT associated with the position. |
totalAmountStaked | uint256 | The actual raw balance (in staked input packets) of the position. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The calculated virtual balance of the position. |
getAmountMultiplier
Retrieves the amount multiplier applied to the specified staking position.
Amount multipliers are scaled by 1e18, allowing for 18 decimal precision.
Parameters
Name | Type | Description |
---|---|---|
nftId | uint256 | The unique identifier of the NFT associated with the position. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The amount multiplier value applied to the position. |