Expand description

The pallet module in each FRAME pallet hosts the most important items needed to construct this pallet.

The main components of this pallet are:

  • Pallet, which implements all of the dispatchable extrinsics of the pallet, among other public functions.
    • The subset of the functions that are dispatchable can be identified either in the dispatchables module or in the Call enum.
  • storage_types, which contains the list of all types that are representing a storage item. Otherwise, all storage items are listed among Type Definitions.
  • Config, which contains the configuration trait of this pallet.
  • Event and Error, which are listed among the Enums.

Modules

  • Auto-generated docs-only module listing all defined dispatchables for this pallet.
  • Auto-generated docs-only module listing all (public and private) defined storage types for this pallet.

Structs

  • The Pallet struct, the main type that implements traits and standalone functions within the pallet.
  • Information about single token rewards

Enums

  • Contains a variant per dispatchable extrinsic that this pallet has.
  • Errors
  • The Event enum of this pallet

Traits

Type Definitions

  • Tracks how much liquidity user activated for particular (liq token, reward token) pair StorageNMap was used because it only require single read to know if user deactivated all liquidity associated with particular liquidity_token that is rewarded. If so part of the liquididty tokens can be unlocked.
  • Tracks how much of the liquidity was activated for schedule rewards and not yet liquidity mining rewards. That information is essential to properly handle token unlcocks when liquidity is deactivated.
  • Tracks how much of the liquidity was activated for schedule rewards and not yet liquidity mining rewards. That information is essential to properly handle token unlcocks when liquidity is deactivated.
  • ModuleDeprecated
    Type alias to Pallet, to be used by construct_runtime.
  • Stores information about pool weight and accumulated rewards. The accumulated rewards amount is the number of rewards that can be claimed per liquidity token. Here is tracked the number of rewards per liquidity token relationship. Expect larger values when the number of liquidity tokens are smaller.
  • Maps liquidity token to list of tokens that it ever was rewarded with
  • Storage type is StorageDoubleMap with key1 type AccountIdOf < T >, key2 type CurrencyIdOf < T > and value type RewardInfo < BalanceOf < T > >.
  • Stores information about pool weight and accumulated rewards
  • List of activated schedules sorted by expiry date
  • Storage type is StorageMap with key type ScheduleId and value type (Schedule < T >, Option < ScheduleId >).
  • Storage type is StorageMap with key type (CurrencyIdOf < T >, CurrencyIdOf < T >) and value type (U256, u64).
  • How much scheduled rewards per single liquidty_token should be distribute_rewards the value is multiplied by u128::MAX to avoid floating point arithmetic
  • Storage type is StorageValue with value type SchedulesList.
  • Storage type is StorageMap with key type CurrencyIdOf < T > and value type BalanceOf < T >.
  • Tracks number of activated liquidity per schedule. It is used for calculation of “cumulative rewrds amount” per 1 liquidity token. Therefore activation/deactivation needs to be deffered same way as schedule rewards are delayed.