Conversation
kianenigma
left a comment
There was a problem hiding this comment.
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? |
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
BalanceConversiontrait andBalanceToAssetBalancetype topallet_assetsto 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
Imbalancethat seemed useful but are unconnected to the conversion.needed for: paritytech/cumulus#488
supersedes #8776