diff --git a/polkadot/xcm/xcm-builder/src/location_conversion.rs b/polkadot/xcm/xcm-builder/src/location_conversion.rs index bafec5da4a30c133e0c0b02f1cc2f7a72a5ce7f3..a5e6b55824e8d5a962dc3eed53895f61aa1717a1 100644 --- a/polkadot/xcm/xcm-builder/src/location_conversion.rs +++ b/polkadot/xcm/xcm-builder/src/location_conversion.rs @@ -237,18 +237,11 @@ impl<Network: Get<Option<NetworkId>>, AccountId: From<[u8; 32]> + Into<[u8; 32]> /// network (provided by `Network`) and the `AccountId`'s `[u8; 32]` datum for the `id`. pub struct AliasesIntoAccountId32<Network, AccountId>(PhantomData<(Network, AccountId)>); impl<'a, Network: Get<Option<NetworkId>>, AccountId: Clone + Into<[u8; 32]> + Clone> - Convert<&'a AccountId, MultiLocation> for AliasesIntoAccountId32<Network, AccountId> + sp_runtime::traits::Convert<&'a AccountId, MultiLocation> + for AliasesIntoAccountId32<Network, AccountId> { - fn convert(who: &AccountId) -> Result<MultiLocation, &'a AccountId> { - Ok(AccountId32 { network: Network::get(), id: who.clone().into() }.into()) - } -} - -impl<Network: Get<Option<NetworkId>>, AccountId: Into<[u8; 32]> + Clone> - Convert<AccountId, MultiLocation> for AliasesIntoAccountId32<Network, AccountId> -{ - fn convert(who: AccountId) -> Result<MultiLocation, AccountId> { - Ok(AccountId32 { network: Network::get(), id: who.into() }.into()) + fn convert(who: &AccountId) -> MultiLocation { + AccountId32 { network: Network::get(), id: who.clone().into() }.into() } } @@ -313,7 +306,8 @@ impl<UniversalLocation: Get<InteriorMultiLocation>, AccountId: From<[u8; 32]> + } fn reverse_ref(_: impl Borrow<AccountId>) -> Result<MultiLocation, ()> { - // if this will be needed, we could implement some kind of guessing, if we have configuration for supported networkId+paraId + // if this is ever be needed, we could implement some kind of guessing, if we have + // configuration for supported networkId+paraId Err(()) } } diff --git a/polkadot/xcm/xcm-builder/src/pay.rs b/polkadot/xcm/xcm-builder/src/pay.rs index e8cd2b2bb287b0de6b5026128950c806d17460f7..504ec837751e6037f8355a814fb6882fa965901b 100644 --- a/polkadot/xcm/xcm-builder/src/pay.rs +++ b/polkadot/xcm/xcm-builder/src/pay.rs @@ -28,8 +28,11 @@ use xcm_executor::traits::{QueryHandler, QueryResponseStatus}; /// Implementation of the `frame_support::traits::tokens::Pay` trait, to allow /// for XCM-based payments of a given `Balance` of some asset ID existing on some chain under /// ownership of some `Interior` location of the local chain to a particular `Beneficiary`. The -/// `AssetKind` value can be converted into both the XCM `AssetId` (via and `Into` bound) and the -/// the destination chain's location, via the `AssetKindToLocatableAsset` type parameter. +/// `AssetKind` value is not itself bounded (to avoid the issue of needing to wrap some preexisting +/// datatype), however a converter type `AssetKindToLocatableAsset` must be provided in order to +/// translate it into a `LocatableAsset`, which comprises both an XCM `MultiLocation` describing +/// the XCM endpoint on which the asset to be paid resides and an XCM `AssetId` to identify the +/// specific asset at that endpoint. /// /// This relies on the XCM `TransferAsset` instruction. A trait `BeneficiaryRefToLocation` must be /// provided in order to convert the `Beneficiary` reference into a location usable by @@ -200,6 +203,3 @@ impl<Location: Get<MultiLocation>, AssetKind: Into<AssetId>> Convert<AssetKind, LocatableAssetId { asset_id: value.into(), location: Location::get() } } } - -#[test] -fn it_builds() {}