Acala
Acala copied to clipboard
support metadata operation on asset-registry
with existence of asset-registry module, we can not only register statemine/statemint inner assets, I think we can also register Token(TokenSymbol) asset (may be also including our own native asset). here is quick thought:
- a trait used to simulate all kinds of asset operation, and
asset-registrymodule can implement this trait. we could extend the metadata ofasset-registryto includeToken/CurrencyIdso that it will storecurrency_idtolocationand vice versa.
pub trait CurrencyMetadataOps {
// replace ExistentialDeposits
fn existential_deposit(currency_id: &CurrencyId) -> Balance;
// replace Convert<CurrencyId, Option<MultiLocation>>
fn currency_to_location(currency_id: CurrencyId) -> Option<MultiLocation>;
// replace Convert<MultiLocation, Option<CurrencyId>>
fn location_to_currency(location: MultiLocation) -> Option<CurrencyId>;
// replace Convert<MultiAsset, Option<CurrencyId>>
fn asset_to_currency(asset: MultiAsset) -> Option<CurrencyId> {
if let MultiAsset {
id: Concrete(location), ..
} = asset
{
Self::location_to_currency(location)
} else {
None
}
}
// Trader
fn units_per_second(currency_id: CurrencyId) -> Balance;
}
- refactor CurrencyId related mapping, such as
CurrencyIdConvert,Trader,ExistentialDeposits.
IMO this will simplify new foreign asset onboard on acala side. what do you think @xlc @shaunxw @zjb0807
This could be helpful to handle breaking changes of MultiLocation