-
Notifications
You must be signed in to change notification settings - Fork 7
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
404 add pooled reward pallet #415
Conversation
… with different types
… new configuration to necessary mock runtimes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest implementation looks good to me overall. I mainly added nit-picking comments.
It's probably not obvious but doc comments on specific pallet items are super useful because they will be extracted into the metadata and tools like polkadot.js use them to show some extra info when eg calling extrinsics.
For some reason, the checks are disabled for this PR. I don't see an option to turn them back on nor do I see a reason why they don't run. Maybe it's because the PR has conflicts with the base branch that must be resolved? @gianfra-t can you resolve these conflicts so we see if this prevents the CI actions from running? |
Hey @ebma, does this error:
mean we need to regenerate the metadata? |
Yes exactly, regenerating the metadata should do the trick 👍 |
I just merged with the latest changes in main, but the tests are passing. As soon as they pass again should we merge this? Or do you want to have another look @TorstenStueber? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now. Thanks for your great efforts with all of this @gianfra-t! 👍
Let's still wait for the review of @TorstenStueber before merging though
Co-authored-by: Marcel Ebert <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked thoroughly at the code again and everything looks good.
Great job!
@gianfra-t feel free to push the squash and merge button then. |
Issue #404 and #406, part of this pendulum task.
Adds the
pooled-rewards
pallet, that will allow to distribute the static native currency rewards for the nominators/operators of vaults, as well as the fee distribution in arbitrary currency.This pallet is taken from interlay .
This will also replace the current
rewards
pallet that is used to distribute fees currently.At any point the stake of each
vault_id
on thepooled-rewards
pallet for it's corresponding collateral currency pool is maintained to be equal to thatvault_id
'stotal_staking
amount from the staking pallet. See for example here.This update is performed whenever the stake for the
vault_id
changes, and is managed by thepool_staking_manager
interface:This PR will also merge changes for #406, where reward percentage per collateral pool is calculated (see here), and exposes a function used for fee pallet to distribute arbitrary rewards.
Additions to reward-distribution pallet.
on_initialize
hook, that calculates the block specific reward, and updates it if required.distrubute_reward
function that calculates the percentages in USD of the total stake, and distributes to each collateral pool a proportional amount. This function will be used both from external pallets (eg Fee) and to distribute the per-block rewards in native token.vault_id
,account_id
pair.The collect_reward extrinsic replaces the extrinsic previously located in the fee pallet which only allowed to withdraw the reward for the wrapped currency and native( see here)