Crate pallet_rewards

source ·
Expand description

§Rewards Pallet

The Rewards pallet provides functionality for distributing rewards to different accounts with different currencies.

The user can stake an amount to claim a proportional reward. The staked amount is reserved/hold from the user account for that currency when is deposited and unreserved/release when is withdrawed.

§Overview

The Rewards pallet provides functions for:

  • Distribute (uniformly and with weights) a reward amount to several groups.
  • Deposit and withdraw stake associated to a currency.
  • Claim the reward given to a staked currency.
  • Associate currencies to groups and moving them from one group to another.

§Terminology

  • Currency ID: Identification of a token used to stake/unstake. This ID is associated to a group.
  • Reward: The amount given in native tokens to a proportional amount of currency staked.
  • Group: A shared resource where the reward is distributed. The accounts with a currency associated to a group can deposit/withdraw that currency to claim their proportional reward in the native token.
  • Stake account: The account related data used to hold the stake of certain currency.
  • Currency movement: The action on moving a currency from one group to another.

§Implementations

The Rewards pallet provides implementations for the Rewards trait.

§Assumptions

Each consuming reward system must have its unique instance of this pallet independent of the underlying reward mechanism. E.g., one instance for Block Rewards and another for Liquidity Rewards.

§Functionality

The exact reward functionality of this pallet is given by the mechanism used when it’s configured. Current mechanisms:

  • base mechanism. currency movement.
  • deferred mechanism. currency movement.
  • gap mechanism.

Re-exports§

Modules§