-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support multiple fee recipients #10
Comments
Since we are using the bounded vec already I think this is something we can tackle now, I'm thinking the bound of the recipient limit can even be hardcoded(e.g. |
Throwing more ideas to the pot, fees don't have to be just a list of accounts that will receive money from the payer it can also include accounts that will "give money" money to the payer, in other words discounts. To give an example, imagine 🧑🌾 Bob selling milk in a marketplace and 👩🏽Alice buying a bottle for 100 MLK, 🐮 milkyplace takes a 3% fee for each bottle that Bob sells, there's also a tax for diary products in their local community of 0.1%, Alice might be the holder of a NFT coupon that gives her a 5% discount and on top of that the Virto nation wants their people to have strong bones so it gives people 50MLK for each bottle. Alice still pays 100MLK(bottle) + 3MLK(fee) + 0.1MLK(tax) + 5MLK(example release incentive) = 108.1MLK, but the since the list now part of the payment detail also includes discounts, those are reserved from the accounts returned from the handler(i.e. 5MLK taken from the coupon issuer and 50MLK from Virto) so when Alice releases the funds it gets back 60MLK🥛!. |
Currently the fee_handler function can handle only one fee recipient
fn apply_fees(from: &Account, to: &Account) -> (Account, Percent);
We can improve this function by returning a list of fee recipients
fn apply_fees(from: &Account, to: &Account) -> Vec<(Account, Percent)>;
In the
release
extrinsic, the fee amount should be transferred to all recipients returned byapply_fees
provided the count is less thanMAX_FEE_RECIPIENTS
. It is also important to implement dynamic weights for this extrinsic to account for too many recipients.The text was updated successfully, but these errors were encountered: