Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a proof of concept of taxing xcm transfers. It is not feature complete - see the todo list below for info on what is still left to be done. Although tests are failing, I have verified that taxing from and to the relay chain works.
This implements a wrapper around the the ExecuteXcm trait implementation, that modifies processed XCM messages prior to execution (inbound or outbound) such that 10% of all tokens being transferred are sent to the treasury. Again, this only serves as a proof of concept - as listed below, things like configurable taxing rates are still to be implemented.
Left to do before we can consider merging this:
Note: current logic still takes the normal fee for execution (a set fee per instruction) in addition to the tax.
It's also important to note that while most messages will continue to work as before, it is possible to construct messages that will fail with this new executor. The
DepositAsset
,DepositReserveAsset
,InitiateReserveWithdraw
typically use filters that transfers the entireholding
content to the target, but in theory it is also possible to have them send a set amount instead ofAll
. Such instructions could fail if theholding
register contains less than expected due to the tax. Another instruction that can fail isTransact
- if the extrinsic requires a specific balance.