Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/liquidity incentive #841

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

leo-plugdefi
Copy link
Collaborator

Liquidity Pool 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants