Skip to content
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

support metadata operation on asset-registry #1773

Open
zqhxuyuan opened this issue Jan 12, 2022 · 1 comment
Open

support metadata operation on asset-registry #1773

zqhxuyuan opened this issue Jan 12, 2022 · 1 comment

Comments

@zqhxuyuan
Copy link
Contributor

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:

  1. a trait used to simulate all kinds of asset operation, and asset-registry module can implement this trait. we could extend the metadata of asset-registry to include Token/CurrencyId so that it will store currency_id to location and 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;
}
  1. 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

@xlc
Copy link
Member

xlc commented Jan 12, 2022

This could be helpful to handle breaking changes of MultiLocation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants