Skip to content

Commit

Permalink
fix(moonbeam, moonriver): support evm native foreign assets in xcm ex…
Browse files Browse the repository at this point in the history
…ecutor
  • Loading branch information
RomarQ committed Mar 3, 2025
1 parent 650a3cd commit 4071d7f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
8 changes: 6 additions & 2 deletions runtime/moonbase/tests/xcm_mock/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,10 @@ impl pallet_xcm_transactor::Config for Runtime {
type SovereignAccountDispatcherOrigin = frame_system::EnsureRoot<AccountId>;
type CurrencyId = CurrencyId;
type AccountIdToLocation = xcm_primitives::AccountIdToLocation<AccountId>;
type CurrencyIdToLocation =
CurrencyIdToLocation<xcm_primitives::AsAssetType<AssetId, AssetType, AssetManager>>;
type CurrencyIdToLocation = moonbase_runtime::xcm_config::CurrencyIdToLocation<(
EvmForeignAssets,
AsAssetType<moonbeam_core_primitives::AssetId, AssetType, moonbase_runtime::AssetManager>,
)>;
type SelfLocation = SelfLocation;
type Weigher = xcm_builder::FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type UniversalLocation = UniversalLocation;
Expand Down Expand Up @@ -1086,7 +1088,9 @@ pub(crate) fn para_events() -> Vec<RuntimeEvent> {

use frame_support::traits::tokens::{PayFromAccount, UnityAssetBalanceConversion};
use frame_support::traits::{OnFinalize, OnInitialize, UncheckedOnRuntimeUpgrade};
use moonbase_runtime::EvmForeignAssets;
use pallet_evm::FrameSystemAccountProvider;
use xcm_primitives::AsAssetType;

pub(crate) fn on_runtime_upgrade() {
VersionUncheckedMigrateToV1::<Runtime>::on_runtime_upgrade();
Expand Down
5 changes: 4 additions & 1 deletion runtime/moonbeam/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,10 @@ impl pallet_xcm_transactor::Config for Runtime {
type SovereignAccountDispatcherOrigin = EnsureRoot<AccountId>;
type CurrencyId = CurrencyId;
type AccountIdToLocation = AccountIdToLocation<AccountId>;
type CurrencyIdToLocation = CurrencyIdToLocation<AsAssetType<AssetId, AssetType, AssetManager>>;
type CurrencyIdToLocation = CurrencyIdToLocation<(
EvmForeignAssets,
AsAssetType<AssetId, AssetType, AssetManager>,
)>;
type XcmSender = XcmRouter;
type SelfLocation = SelfLocation;
type Weigher = XcmWeigher;
Expand Down
8 changes: 6 additions & 2 deletions runtime/moonbeam/tests/xcm_mock/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,8 +763,10 @@ impl pallet_xcm_transactor::Config for Runtime {
type SovereignAccountDispatcherOrigin = frame_system::EnsureRoot<AccountId>;
type CurrencyId = CurrencyId;
type AccountIdToLocation = xcm_primitives::AccountIdToLocation<AccountId>;
type CurrencyIdToLocation =
CurrencyIdToLocation<xcm_primitives::AsAssetType<AssetId, AssetType, AssetManager>>;
type CurrencyIdToLocation = CurrencyIdToLocation<(
EvmForeignAssets,
AsAssetType<moonbeam_core_primitives::AssetId, AssetType, AssetManager>,
)>;
type SelfLocation = SelfLocation;
type Weigher = xcm_builder::FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type UniversalLocation = UniversalLocation;
Expand Down Expand Up @@ -1072,8 +1074,10 @@ pub(crate) fn para_events() -> Vec<RuntimeEvent> {

use frame_support::traits::tokens::{PayFromAccount, UnityAssetBalanceConversion};
use frame_support::traits::{OnFinalize, OnInitialize, UncheckedOnRuntimeUpgrade};
use moonbeam_runtime::EvmForeignAssets;
use pallet_evm::FrameSystemAccountProvider;
use sp_weights::constants::WEIGHT_REF_TIME_PER_SECOND;
use xcm_primitives::AsAssetType;

pub(crate) fn on_runtime_upgrade() {
VersionUncheckedMigrateToV1::<Runtime>::on_runtime_upgrade();
Expand Down
5 changes: 4 additions & 1 deletion runtime/moonriver/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,10 @@ impl pallet_xcm_transactor::Config for Runtime {
type SovereignAccountDispatcherOrigin = EnsureRoot<AccountId>;
type CurrencyId = CurrencyId;
type AccountIdToLocation = AccountIdToLocation<AccountId>;
type CurrencyIdToLocation = CurrencyIdToLocation<AsAssetType<AssetId, AssetType, AssetManager>>;
type CurrencyIdToLocation = CurrencyIdToLocation<(
EvmForeignAssets,
AsAssetType<AssetId, AssetType, AssetManager>,
)>;
type XcmSender = XcmRouter;
type SelfLocation = SelfLocation;
type Weigher = XcmWeigher;
Expand Down
8 changes: 6 additions & 2 deletions runtime/moonriver/tests/xcm_mock/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -768,8 +768,10 @@ impl pallet_xcm_transactor::Config for Runtime {
type SovereignAccountDispatcherOrigin = frame_system::EnsureRoot<AccountId>;
type CurrencyId = CurrencyId;
type AccountIdToLocation = xcm_primitives::AccountIdToLocation<AccountId>;
type CurrencyIdToLocation =
CurrencyIdToLocation<xcm_primitives::AsAssetType<AssetId, AssetType, AssetManager>>;
type CurrencyIdToLocation = CurrencyIdToLocation<(
EvmForeignAssets,
AsAssetType<moonbeam_core_primitives::AssetId, AssetType, AssetManager>,
)>;
type SelfLocation = SelfLocation;
type Weigher = xcm_builder::FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type UniversalLocation = UniversalLocation;
Expand Down Expand Up @@ -1078,7 +1080,9 @@ pub(crate) fn para_events() -> Vec<RuntimeEvent> {

use frame_support::traits::tokens::{PayFromAccount, UnityAssetBalanceConversion};
use frame_support::traits::{OnFinalize, OnInitialize, UncheckedOnRuntimeUpgrade};
use moonriver_runtime::EvmForeignAssets;
use pallet_evm::FrameSystemAccountProvider;
use xcm_primitives::AsAssetType;

pub(crate) fn on_runtime_upgrade() {
VersionUncheckedMigrateToV1::<Runtime>::on_runtime_upgrade();
Expand Down

0 comments on commit 4071d7f

Please sign in to comment.