trn-seed icon indicating copy to clipboard operation
trn-seed copied to clipboard

added pallet for liquidity pool incentive program

Open leo-plugdefi opened this issue 1 year ago • 2 comments

Incentive Pallet

The Incentive pallet is a Substrate pallet that facilitates the creation and management of liquidity pools for various assets. It allows users to stake their assets in these pools and earn rewards in the form of native tokens (e.g., ROOT) based on the pool's performance and the user's stake.

Key Features:

  1. Pool Creation: Admins can create incentive pools for specific assets by specifying parameters such as the interest rate, maximum token limit, and the lock period (start and end blocks).

  2. Pool Succession: Admins can set up a succession relationship between pools, allowing users to automatically roll over their stakes from one pool to the next upon completion.

  3. User Participation: Users can join open pools by staking their assets and optionally choose to roll over their stakes to a successor pool automatically.

  4. Reward Calculation: The pallet calculates the rewards for users based on their staked amount, the pool's interest rate, and other factors like the asset's and native token's decimal places.

  5. Reward Distribution: Users can claim their rewards after a pool matures (reaches the lock end block). If a user has chosen to roll over, their stake is automatically transferred to the successor pool.

  6. Unsigned Transactions: An off-chain worker handles the rollover process via unsigned transactions, moving users' stakes from the predecessor pool to the successor pool automatically.

  7. Pool Management: Admins can close pools, and the pallet handles the distribution of remaining rewards and the transfer of locked assets back to the main vault account.

Extrinsic Descriptions:

  • create_pool: Allows an admin to create a new liquidity pool for a specific asset, setting parameters like interest rate, token limit, and lock period.
  • set_pool_succession: Allows an admin to link a predecessor pool to a successor pool for automatic rollover.
  • set_pool_rollover: Allows users to set their preference for rolling over their stake to a successor pool.
  • close_pool: Allows an admin to close an active pool, preventing new stakes.
  • enter_pool: Allows users to join an open pool by staking their assets.
  • exit_pool: Allows users to exit an open pool and withdraw their staked assets.
  • claim_reward: Allows users to claim their rewards from a matured pool, if no succession is set, the principle is returned as well.
  • rollover_unsigned: An unsigned transaction executed by the off-chain worker to handle the rollover process from a predecessor pool to a successor pool.

leo-plugdefi avatar Nov 28 '23 08:11 leo-plugdefi

he @leo-plugdefi noticed there are couple of commits that aimed to address the team comments, can you please mark which comments are resolved. We will do another round of review once all of the comments are resolved.

ken-futureverse avatar Jan 18 '24 21:01 ken-futureverse

@leo-plugdefi can we address the conflicts for another round of reviews.

zees-dev avatar Apr 30 '24 19:04 zees-dev

closed, replaced by PR #841

leo-plugdefi avatar May 15 '24 01:05 leo-plugdefi