-
Notifications
You must be signed in to change notification settings - Fork 740
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
[Asset Conversion] Incentives Extension #3149
Comments
https://github.com/open-web3-stack/open-runtime-module-library/tree/master/rewards this may or may not be helpful but we are using it for reward handling of the incentives for lp (and other use cases). |
I've outlined a possible approach below. Let me know how far off this is from what you had in mind @joepetrowski @muharem, and if you have any suggestions :). Tracking and claiming accumulated rewardsI suggest using the It's scalable (constant-time operations) and battle-tested (widely used throughout the Ethereum/EVM ecosystem). Determining reward tokens per-blockAs mentioned by Joe, this would be most easily handled via governance controlling the Unless there is some pressing reason to allow anyone to donate to the reward pool, then I suggest we start with governance in control and decide whether to extend the implementation to be permissionless in a future iteration. FRAME implementationCreate a new pallet
Once a pool is created, LP token holders can then "deposit" their tokens (putting a hold on them) by calling an extrinsic on the pallet and begin accumulating rewards. If we make this an opt-in process for LP token holders, I don't think the If we make this an automatic process for LP token holders, we can add optional hooks to the mint/redeem logic in |
I haven't looked deeply into I'm fine with configuring these rates/pools with governance, but we also will need to make sure the funds come from somewhere. Do you imagine that the pallet pays directly out of the Treasury, or that it gets one-off allocations to distribute?
Yes, in the runtime it actually just uses a fresh instance of |
I hadn't considered paying directly out of the Treasury. Are you thinking funds would be pulled directly from the Treasury Pot account? That would be preferable because it wouldn't require the periodic top-ups, we'd just need to be extra vigilant and add guard rails to prevent accidentally draining it if there is a bug 😄. |
Yeah exactly, it would be like the opposite of many of the But yes, it is risky. I think these allocations could be large, and something that would only need doing once a year or something. Long term I prefer less manual/governance involvement but it may be better to start with a system that requires explicit top-ups and then transition it to a simpler system that can just pull from the Treasury (within parameters/configuration, obviously). |
@liamaharon thank you for sharing the solution. I looked into the article you shared, and it look good to me. I think we should go for explicit top-ups solution, because otherwise it is risky, and does not look right to let such withdrawals directly from the treasury account. Also when we make it permissioned, to add a staking pool and liquidity for it, we will need this top-up model. I also would consider to have |
Thanks @joepetrowski and @muharem for your feedback, I agree explicit top-ups and segregated pool pots is the most sensible approach here. I've started scaffolding the
for a pallet here. Let me know if you have any feedback. If everything generally looks good I'll get started on the core logic and unit tests. |
shared some comments in DM |
Thanks @muharem! Let me respond here:
To confirm, you mean allow instantiating multiple instances of the pallet? I had designed it so a single instance of the pallet could support all use cases, but happy to allow multiple instances if there is benefit. What do you mean by 'less breaks later'?
Yeah I'm happy to do that for simplicity, I made it generic because it is also generic in the asset conversion pallet.
The issue with this is that staking would change from an O(1) operation to O(N). There's probably a way to avoid that, but it would introduce a lot of complexity for a feature we don't care for right now (initially we'll just have a single reward pool per asset).
I'm happy to do this, but curious what the use case is for customising how pool addresses are derived?
Seems like low hanging fruit to remove the need of a complex migration later, SGTM! I did try storing the Origin in the Pool but was having some issues. AccountId sounds better, let me try that. |
I will index the the topics in the order they appear.
For example StakeAssetId can be u32, RewardAssetId can be also (1) u32 or (2) Location. If we have only one registry,
|
This seems unnecessarily complicated to me, I'm probably not familiar with the limitations of the |
it can be, but it will result a complex |
I just realize, that in order to solve this issue, we will need to introduce a pallet extension for pallet-assets to implement |
Sounds good. I'll start with one, it'll be easiest to understand the trade-offs in practice. |
Hmm, this would require a seperate issue and PR. If we really wanted to rush we could still implement this but require users transfer their funds to the sovereign address of the pallet instead of |
Agree, it's better if we get Freezes implemented |
We should have an extension to Asset Conversion pallet to allow rewards for liquidity provision. This could take a number of forms, but the two main options I see are:
Option (2) is more flexible but can also imagine that it will have a lot of complexity. We may also need a proper implementation of
Freeze
for assets, which would be useful for other things like asset vesting/voting.Have discussed with @liamaharon so tagging him.
The text was updated successfully, but these errors were encountered: