Skip to content

Commit

Permalink
all crates required by generic template compile post this commit
Browse files Browse the repository at this point in the history
  • Loading branch information
4meta5 committed Jan 12, 2025
1 parent b6ef606 commit 05d6141
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pallets/xcm-transactor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ pub mod pallet {
}
instructions.push(Transact {
origin_kind,
require_weight_at_most: dispatch_weight,
fallback_max_weight: Some(dispatch_weight),
call: call.into(),
});
Ok(Xcm(instructions))
Expand Down
8 changes: 4 additions & 4 deletions pallets/xcm-weight-trader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use frame_support::weights::WeightToFee;
use frame_system::pallet_prelude::*;
use sp_runtime::traits::{Convert, Zero};
use sp_std::vec::Vec;
use xcm::v4::{Asset, AssetId as XcmAssetId, Error as XcmError, Fungibility, Location, XcmContext};
use xcm::v5::{Asset, AssetId as XcmAssetId, Error as XcmError, Fungibility, Location, XcmContext};
use xcm::{IntoVersion, VersionedAssetId};
use xcm_executor::traits::{TransactAsset, WeightTrader};
use xcm_runtime_apis::fees::Error as XcmPaymentApiError;
Expand Down Expand Up @@ -269,13 +269,13 @@ pub mod pallet {
return Err(XcmPaymentApiError::UnhandledXcmVersion);
}

let v4_assets = [VersionedAssetId::V4(XcmAssetId::from(
let v4_assets = [VersionedAssetId::V5(XcmAssetId::from(
T::NativeLocation::get(),
))]
.into_iter()
.chain(
SupportedAssets::<T>::iter().filter_map(|(asset_location, (enabled, _))| {
enabled.then(|| VersionedAssetId::V4(XcmAssetId(asset_location)))
enabled.then(|| VersionedAssetId::V5(XcmAssetId(asset_location)))
}),
)
.collect::<Vec<_>>();
Expand All @@ -294,7 +294,7 @@ pub mod pallet {
weight: Weight,
asset: VersionedAssetId,
) -> Result<u128, XcmPaymentApiError> {
if let VersionedAssetId::V4(XcmAssetId(asset_location)) = asset
if let VersionedAssetId::V5(XcmAssetId(asset_location)) = asset
.into_version(4)
.map_err(|_| XcmPaymentApiError::VersionedConversionFailed)?
{
Expand Down
26 changes: 13 additions & 13 deletions primitives/xcm/src/asset_id_conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use sp_runtime::traits::MaybeEquivalence;
use sp_std::marker::PhantomData;
use xcm::v3::Location;
use xcm::v4::Location;
use xcm_executor::traits::ConvertLocation;

/// Converter struct implementing `AssetIdConversion` converting a numeric asset ID
Expand All @@ -41,22 +41,22 @@ where
AssetIdInfoGetter::get_asset_type(what.clone()).and_then(Into::into)
}
}
impl<AssetId, AssetType, AssetIdInfoGetter> MaybeEquivalence<xcm::v4::Location, AssetId>
impl<AssetId, AssetType, AssetIdInfoGetter> MaybeEquivalence<xcm::v5::Location, AssetId>
for AsAssetType<AssetId, AssetType, AssetIdInfoGetter>
where
AssetId: Clone,
AssetType: From<Location> + Into<Option<Location>> + Clone,
AssetIdInfoGetter: AssetTypeGetter<AssetId, AssetType>,
{
fn convert(id: &xcm::v4::Location) -> Option<AssetId> {
let v3_location =
xcm_builder::WithLatestLocationConverter::<xcm::v3::Location>::convert(id)?;
AssetIdInfoGetter::get_asset_id(v3_location.clone().into())
fn convert(id: &xcm::v5::Location) -> Option<AssetId> {
let v4_location =
xcm_builder::WithLatestLocationConverter::<xcm::v4::Location>::convert(id)?;
AssetIdInfoGetter::get_asset_id(v4_location.clone().into())
}
fn convert_back(what: &AssetId) -> Option<xcm::v4::Location> {
let v3_location: Location =
fn convert_back(what: &AssetId) -> Option<xcm::v5::Location> {
let v4_location: Location =
AssetIdInfoGetter::get_asset_type(what.clone()).and_then(Into::into)?;
xcm_builder::WithLatestLocationConverter::convert_back(&v3_location)
xcm_builder::WithLatestLocationConverter::convert_back(&v4_location)
}
}
impl<AssetId, AssetType, AssetIdInfoGetter> ConvertLocation<AssetId>
Expand All @@ -66,10 +66,10 @@ where
AssetType: From<Location> + Into<Option<Location>> + Clone,
AssetIdInfoGetter: AssetTypeGetter<AssetId, AssetType>,
{
fn convert_location(id: &xcm::v4::Location) -> Option<AssetId> {
let v3_location =
xcm_builder::WithLatestLocationConverter::<xcm::v3::Location>::convert(id)?;
AssetIdInfoGetter::get_asset_id(v3_location.clone().into())
fn convert_location(id: &xcm::v5::Location) -> Option<AssetId> {
let v4_location =
xcm_builder::WithLatestLocationConverter::<xcm::v4::Location>::convert(id)?;
AssetIdInfoGetter::get_asset_id(v4_location.clone().into())
}
}

Expand Down

0 comments on commit 05d6141

Please sign in to comment.