Change fee payment token on account create, transfer or xcm transfer
Closed this issue ยท 5 comments
Description
If we are creating new account on the chain the fee payment asset could be set to the asset that was transferred to that account.
Why
The idea is that you don't need to do extra transaction when you transfer tokens to new account (disregarding bsx). This would greatly improve UX inside the chain because user doesn't need to do 2 transactions himself (If the account is new, including no system account (or has no fee payment balance) user would need to do second TX. I'm proposing to create a hook that will do this automagically after any transfer / lock. This can be tricky however.
Possible problems
- If the account is programatic (i.e. pool) we might not want to do this.
- If the account has been created before we also might not want to do this as it can cause confusion that different actions do or not do this for you.
- If somebody spams you with some useless asset it will be changed for you and it will be very confusing.
- ???
I would like to get some reasoning here why yes why not. My biggest concern is with spam. This is not as big of a problem since we're always checking your fee payment asset pre-tx signing and prompt you to change it on the UI if you don't have any / enough balance.
Spam should not be an issue if we only set the value in case it's not set already, i.e. on account creation.
We just need to be mindful that account creation and deletion will be costlier.
Based on discussion elsewhere we will want to implement this by adding a callback to ORML tokens (likely here) for newly created accounts that includes the asset id and would thus allow us to set it as the fee asset id.
Callback implementation here: open-web3-stack/open-runtime-module-library#754
Callback types for tx multi payment pallet here: galacticcouncil/warehouse#54