-
Notifications
You must be signed in to change notification settings - Fork 17
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
Check existential deposit when creating an account during swap #692
Comments
Upd: we should not use |
Spent some time to investigate possible root causes. Looks like the behaviour is clear now. We have key data objects:
Current flow consists of the following:
We have an error in case swapped balance is less than ED of Let's check
So,
As we can see, in case I thinks in this case #694 makes sense as we need to estimate swapped balance before doing any tokens operations and make sure that the resulted amount is ge than ED. By the way, |
Well done outlining the situation! I think the better option would be to define our own trait on top of We should investigate whether the new This will the correct long-term solution. In the short term we could just add those extra checks temporarily and then we could remove them once we switch to the better low level building block - however this just seems like extra work when we can already add custom trait ext and solve it there. Overall, the currently proposed silution is way more of a hack than fixing the currency API to expose a better |
Yep, checked the So, maybe just switch to the new fungible traits? |
We have discovered an issue with account creation in both
pallet_currency_swap
andprecompile_currency_swap
in that they can both lead to the loss of funds when the amount swapped is smaller that theTo
currency existential deposit.Currently, the account gets dusted before it is created.
We should change is the following ways:
try_mutate_account
if possible (maybe we can't though).pallet_currency_swap
andprecompile_currency_swap
calls.The text was updated successfully, but these errors were encountered: