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

[feat] Fee Handler #161

Merged
merged 11 commits into from
Dec 22, 2021
Merged

[feat] Fee Handler #161

merged 11 commits into from
Dec 22, 2021

Conversation

stanly-johnson
Copy link
Member

@stanly-johnson stanly-johnson commented Dec 15, 2021

resolves #158

ToDo

  • Add more docs
  • Improve tests

@stanly-johnson
Copy link
Member Author

@olanod I created a simple version of the pallet to get started. The next stage would be converting
fn apply_fees(from: &Account, to: &Account, asset: Asset, amount: Amount) -> Vec<(Account, Amount)>;

And within the release function to loop through all the recipients. Is that correct?
Although I think this basic version is good enough for majority of cases where we will have only one recipient of fees. The drawback of the advanced approach is that the realease extrinsic ends up being expensive for the user, even though the actual recipient count might be low, since we use the worst case in benchmark to calculate the weights which means a user always pays the transaction fee equivalent to transfer to our MAX_RECIPIENTS always. Wdyt? Should we go ahead with the Vec<> approach? 🤔

@olanod
Copy link
Member

olanod commented Dec 15, 2021

About the worst case scenario, it's worth doing the extra work of calculating the weight dynamically or doing a weight correction https://docs.substrate.io/v3/runtime/weights-and-fees/#dynamic-weights

pallets/payment/src/types.rs Outdated Show resolved Hide resolved
pallets/payment/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Member

@olanod olanod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a small thing :)

pallets/payment/src/lib.rs Show resolved Hide resolved
pallets/payment/src/tests.rs Show resolved Hide resolved
@olanod olanod merged commit 9988e60 into virto-network:master Dec 22, 2021
@stanly-johnson stanly-johnson deleted the apply_fees branch March 15, 2022 08:50
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.

apply_fees extrinsic
2 participants