Campaign Creation

Campaign creation involves deploying dedicated asset managers (Vaults that can execute Txs) for handling the input and output of the campaign and configuring the campaign using required and optional setter functions. Each new campaign is assigned a unique ID, calculated by incrementing the totalCampaigns counter stored in the platform's general storage.

Workflow

  1. Deploy Asset Managers:

    • A dedicated CampaignAssetManager is deployed for managing the campaign’s input (staked underlying assets).
      It is referred to as InputAssetKeeper.
    • Another CampaignAssetManager is deployed for managing the campaign’s output (reward assets). It is referred to as RewardAssetHandler.
  2. Execute Setter Functions:

    • Required Setter Functions: Always executed during campaign creation in the order they were specified during the
      initialization of the CampaignCreationSkeleton.
    • Optional Setter Functions: Executed only if specified by the campaign creator using optional selectors.
  3. Assign Campaign ID:

    • The campaign is assigned a unique ID by incrementing the totalCampaigns counter.

Setter Function Registration

Registered via initCampaignCreation(): The required and optional setter functions are registered in the platform’s storage during the initialization process. These functions are identified by their function selectors.

Data Structure for dataToExecute

The dataToExecute input array of createCampaign() function, contains ABI-encoded input data for the setter functions. It is divided into two parts:

Part 1: Required Setter Function Data

  • Contains input data for required setter functions.
  • Order Matters: The order of data must match the order of the required selectors registered via initCampaignCreation().
    Example: If the required selectors are [selectorA, selectorB, selectorC], the corresponding dataToExecute must be [dataForFunctionA, dataForFunctionB, dataForFunctionC].
  • Mismatched Order: A mismatch in the order will result in misconfigurations or a transaction revert.

Part 2: Optional Setter Function Data

  • Contains input data for optional setter functions (if any).
  • This part is only included if the campaign creator specifies optional selectors to be executed.

Notes on Rates, Percentages, and Multipliers Configuration

This section outlines the proper configuration and scaling requirements for rates, percentages, and multipliers when creating a staking campaign in any staking platform.

Precision Scaling

All rates, percentages, and multipliers must be scaled by 1e18 at the API level to support 18 decimal precision in calculations. This ensures accurate computations, particularly in scenarios involving fractional multipliers or rewards.

Multiplier Configuration

There are two applicable multipliers:

  • VirtualAmountMultipliers: Adjust staking rewards based on the staked amount.

  • VirtualLockMultipliers: Adjust staking rewards based on the lock period duration.

Configuration Rules

  1. Array Lengths:

The lengths of the following arrays must match:

  • amountsStakedamountStakedMultipliers
  • lockPeriodslockPeriodsMultipliers
  1. Strictly Increasing Order:

The values in these arrays must be specified in strictly increasing order.

  • For amountsStaked and lockPeriods, this ensures logical progression in the staking parameters.
  • For amountStakedMultipliers and lockPeriodsMultipliers, this ensures that higher stakes or longer lock periods correspond to greater rewards.

Configuration Guidelines (Decimal Precision)

Tokens that are to be encapsulated into packets may have different decimal precisions, such as 18 decimals for ERC-20 tokens, 6 decimals for other ERC-20 tokens, or no decimals for ERC-1155 tokens. To maintain accuracy, the values in amountOfTokensPerPacket should be scaled according to each token's decimal precision (for example, using wei values for ERC-20 tokens). Additionally, packets should be specified in whole units at the API level.

Eligibility Criteria

Campaign creators must meet the eligibility requirements outlined in the relevant facets, such as the creatorEligibility and AccessControlStaking facets. Only users who are eligible can initiate the campaign creation process.

On this page