This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Trait Bounds for AssetId vs. MultiLocation #12738
Closed
Description
In order to support bridged/parachain assets on Statemint, we want to be able to use type AssetId = MultiLocation
. However, MultiLocation
does not meet the bounds of AssetId
.
From c290950:
type AssetId: Member
+ Parameter
+ Default
+ Copy
+ HasCompact
+ MaybeSerializeDeserialize
+ MaxEncodedLen
+ TypeInfo;
From gav-xcm-v3 (at aef0231):
#[derive(
Copy, Clone, Decode, Encode, Eq, PartialEq, Ord, PartialOrd, Debug, TypeInfo, MaxEncodedLen,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct MultiLocation {
/// The number of parent junctions at the beginning of this `MultiLocation`.
pub parents: u8,
/// The interior (i.e. non-parent) junctions that this `MultiLocation` contains.
pub interior: Junctions,
}
We should either implement HasCompact, MaybeSerializeDeserialize
for MultiLocation
, or relax the bounds on AssetId.
Steps to reproduce
Try to compile cumulus/joe-bridge-hub-westmint-assets
with this configuration:
type MultiLocationForAssetId = MultiLocation;
/// Assets managed by some foreign location.
type ForeignAssetsInstance = pallet_assets::Instance2;
impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
type AssetId = MultiLocationForAssetId; // <-- here
type Currency = Balances;
type CreateOrigin = ForeignCreators;
type ForceOrigin = AssetsForceOrigin;
type AssetDeposit = AssetDeposit;
type MetadataDepositBase = MetadataDepositBase;
type MetadataDepositPerByte = MetadataDepositPerByte;
type ApprovalDeposit = ApprovalDeposit;
type StringLimit = AssetsStringLimit;
type Freezer = ();
type Extra = ();
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>;
type AssetAccountDeposit = AssetAccountDeposit;
}