Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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).
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.
User Participation: Users can join open pools by staking their assets and optionally choose to roll over their stakes to a successor pool automatically.
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.
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.
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.
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.