-
Notifications
You must be signed in to change notification settings - Fork 300
Girazoki controlled fee specification #658
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
Girazoki controlled fee specification #658
Conversation
Interesting that you are willing to burn the extra fee rather than give it back to user but I guess I don't have a strong reason to stop you from doing that. |
Codecov Report
@@ Coverage Diff @@
## master #658 +/- ##
==========================================
+ Coverage 75.93% 76.46% +0.52%
==========================================
Files 78 78
Lines 6549 6772 +223
==========================================
+ Hits 4973 5178 +205
- Misses 1576 1594 +18
Continue to review full report at Codecov.
|
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.
It's worth noting that fee
would be burned instead of returned to users in docstring. I'm curious about the reason to burn them.
The reason for the fee to be burned (or trapped in the destination chain, whatever the destination chain decides to do with non-spent money in the holding register) is that the use case we are trying to cover is that in which:
We could make it such that we specify, with another argument, the receiver of the non-spent fees. But I think the users will try to adjust quite well the amount of fees they use for the operation so I dont think this would pay-off in the end |
But the code have to handle unexpected token anyway. You cannot prevent others to send some extra token to your account for whatever reason. |
That is actually very right. In that case then maybe we can return the non-used to the deposit account, and what the caller would have is a sense of "minimum balance" that the deposit account should have. Will modify the PR accordingly. Thanks @xlc! |
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 think it should error when fee is zero and test case for that.
And some comment indicate if fee is too low, then the asset will be trapped, and some test to check the asset is trapped if that's not too hard.
yeah no problem, I can do that |
Is there any reason the tests fail? they work locally for me |
I did shortcut also in do_transfer_with_fee for fee==0, before converting it into a fungible, since I think that was the origin of the tests panicking |
…_multiasset_with_Fee
Adds support for specifying the fee as a separate argument to the amount being transferred in xtokens. The fee amount will be used to pay for the buyExecution order in the destination chain. This is useful for cases in which users (or smart contracts) want to have a good control of the amount of tokens in a particular address. The existing extrinsics substract this fee from the amount being transferred, and thus its difficult to know how much tokens a given address has in a specific chain.
For the aforementioned motivation, non-spent fee amounts will get trapped in the destination chain with the new transfer_with_fee and transfer_multiasset_with_fee extrinsics.
For now I made it such that the fee needs to have the same asset id as the token you are transferring. I thought it might be good to test it like this, while we can relax this assumption in the future
Closes #655