-
Notifications
You must be signed in to change notification settings - Fork 542
Use reducible_balance instead free_balance
#420
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
Use reducible_balance instead free_balance
#420
Conversation
At first I thought having the reducible balance not include the ED would be a great way to have the benefits of a non-zero ED and still keep eth compatibility. But now I think that's wrong because of a bad token transfer experience. Consider a chain with a ED = 1 token and the reducible balance does not include the ED. Imagine Alice has a total of 10 tokens, so from the EVM it looks like she has 9. Imagine Alice transfers 5 tokens to Bob. Because Bob also has a 1 token ED it appears that he only got 4 tokens. EDIT: This would only be true if bob's account is new. |
|
I'll do a final round of partial release for whatever crate is still possible. Then let's finally move Substrate to master and wait for paritytech/substrate#9140 |
|
This is now merge-able. Please pull master. |
|
Please fix tests and lints. |
* Use `tokens::fungible::Inspect::reducible_balance` * Integration test * cargo fmt * integration tests * recipient's balance is also subject to ed Co-authored-by: Joshy Orndorff <[email protected]> Co-authored-by: Joshy Orndorff <[email protected]>
Rel #291
Follow up on Add a usable_balance_for function to the Currency trait.
Once we update
frontierbranch we should be able of using https://crates.parity.io/frame_support/traits/tokens/fungible/trait.Inspect.html#tymethod.reducible_balance, that returns the balance thatis neither reserved nor locked/frozen.@sorpaas in the EVM context, usable balance should take into account
ExistentialDeposit? That is, should allow to go below it?