1

While reviewing the substrate runtime code, I noticed that the pallet_asset_conversion Pallet references two distinct instances for the Assets Pallet within its Runtime Config:

impl pallet_asset_conversion::Config for Runtime {
    type RuntimeEvent = RuntimeEvent;
    type Currency = Balances;
    type AssetBalance = <Self as pallet_balances::Config>::Balance;
    type HigherPrecisionBalance = sp_core::U256;
    **type Assets = Assets;**
    type Balance = u128;
    **type PoolAssets = PoolAssets;**

Could you clarify the purpose of having two separate instances for the same pallet?

1 Answer 1

1

The purpose is very simple; using the same pallet multiple times in your runtime, but with a different configuration. Asset Hub is a good example. It uses two instances of pallet-assets:

  • instance1 is for the native assets (AssetId: u32) and e.g. the CreateOrigin is EnsureSigned. Meaning that everyone can send a native transaction (not XCM) and create an asset.
  • instance2 is for foreign assets (AssetId: MultiLocation) and e.g. the CreateOrigin needs to be a MultiLocation of a parachain or its relay chain.

Have a look yourself and you'll find that the configurations are very different.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.