-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I am not really familiar with its usage on cumulus yet.
Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
…tech/substrate into apopiak/master-balance-conversion
I guess this needs an audit? |
Should the trait live in |
Probably yes, somewhere in here: https://github.com/paritytech/substrate/tree/master/frame/support/src/traits/tokens |
Code itself lgtm. But what is the use case and the justification for using min_balance of assets to establish a conversion rate? From what I understand, in order to faithfully use this conversion one must assume the min_balance between two assets is equivalent in relative "value" - is this the correct way to think about it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code is good to me,
but test needs to fixed, CI doesn't compile them
Yes I think this is the correct usecase, when min_balance hold a relatively same value. |
…/master-balance-conversion
bot merge |
Trying merge. |
This PR adds the
BalanceConversion
trait andBalanceToAssetBalance
type topallet_assets
to allow converting native balances to asset specific ones.This is a "low resolution" conversion based on the existential deposit (of the native currency) and the
min_balance
(of the asset).Note: The implementation actually expects a generic fungible, so the incoming balance could theoretically be an asset as well. (So the same implementation could work for chains that only have the assets pallet.)
PR also adds some derives for
Imbalance
that seemed useful but are unconnected to the conversion.needed for: paritytech/cumulus#488
supersedes #8776