Skip to content

Check existential deposit when creating an account during swap #692

@MOZGIII

Description

@MOZGIII

We have discovered an issue with account creation in both pallet_currency_swap and precompile_currency_swap in that they can both lead to the loss of funds when the amount swapped is smaller that the To currency existential deposit.

Currently, the account gets dusted before it is created.
We should change is the following ways:

  1. Use try_mutate_account if possible (maybe we can't though).
  2. Handle the case where the value swapped is less than the existential deposit of the currency, and fail the swap operation. In substrate this is done usually at the pallet call level, so we should do the same: add the check to the pallet_currency_swap and precompile_currency_swap calls.

Metadata

Metadata

Labels

bugSomething isn't workingevm

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions