Skip to content
Unverified Commit 5878ea27 authored by Muharem Ismailov's avatar Muharem Ismailov Committed by GitHub
Browse files

Tx Payment: drop ED requirements for tx payments with exchangeable asset (#4488)

Drop the Existential Deposit (ED) requirement for the asset amount
exchangeable for the fee asset (eg. DOT/KSM) during transaction
payments.

This achieved by using `SwapCredit` implementation of swap, which works
with imbalances and does not require a temporary balance account within
the transaction payment.

### Problem
Currently, every swap during transaction payment, processed with asset
`A` for native asset, must be for an amount greater than the ED of a
native asset if the user lacks a native asset account. Since fees are
typically smaller, the current implementation necessitates additional
swaps to meet the ED during `pre_dispatch`, with refunds for excess ED
swap occurring during `post_dispatch`. Further details can be found
[here](https://github.com/paritytech/polkadot-sdk/blob/115c2477

/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/payment.rs#L115).

This setup presents an issue where a user is unable to transfer their
entire balance and close the account. Instead, the user must transfer
slightly less of asset `A` to ensure there is enough not only for the
fee payment but also some extra to meet the ED requirement for their
native account during `pre_dispatch`. In some cases during
`post_dispatch`, the user will have the excess ED swapped back to asset
`A`, while in other cases, it may not be sufficient to meet the ED
requirement for asset `A`, leading it being left in the user's
'temporary' native asset account.

---------

Co-authored-by: default avatarOliver Tale-Yazdi <[email protected]>
parent 71109c5f
Pipeline #486230 waiting for manual action with stages
in 51 minutes and 28 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment