diff --git a/parachains/common/src/xcm_config.rs b/parachains/common/src/xcm_config.rs index 702065d05e..bcf7e3b118 100644 --- a/parachains/common/src/xcm_config.rs +++ b/parachains/common/src/xcm_config.rs @@ -76,34 +76,35 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { /// A `ChargeFeeInFungibles` implementation that converts the output of /// a given WeightToFee implementation an amount charged in /// a particular assetId from pallet-assets -pub struct AssetFeeAsExistentialDepositMultiplier( - PhantomData<(Runtime, WeightToFee, BalanceConverter)>, -); -impl +pub struct AssetFeeAsExistentialDepositMultiplier< + Runtime, + WeightToFee, + BalanceConverter, + AssetInstance: 'static, +>(PhantomData<(Runtime, WeightToFee, BalanceConverter, AssetInstance)>); +impl cumulus_primitives_utility::ChargeWeightInFungibles< AccountIdOf, - pallet_assets::Pallet, - > for AssetFeeAsExistentialDepositMultiplier + pallet_assets::Pallet, + > for AssetFeeAsExistentialDepositMultiplier where - Runtime: pallet_assets::Config, + Runtime: pallet_assets::Config, WeightToFee: WeightToFeePolynomial, BalanceConverter: BalanceConversion< CurrencyBalance, - >::AssetId, - >::Balance, + >::AssetId, + >::Balance, >, AccountIdOf: From + Into, { fn charge_weight_in_fungibles( - asset_id: as Inspect< + asset_id: as Inspect< AccountIdOf, >>::AssetId, weight: Weight, ) -> Result< - as Inspect< - AccountIdOf, - >>::Balance, + as Inspect>>::Balance, XcmError, > { let amount = WeightToFee::weight_to_fee(&weight); diff --git a/parachains/runtimes/assets/statemine/src/xcm_config.rs b/parachains/runtimes/assets/statemine/src/xcm_config.rs index 6ee9044d8f..e23808d717 100644 --- a/parachains/runtimes/assets/statemine/src/xcm_config.rs +++ b/parachains/runtimes/assets/statemine/src/xcm_config.rs @@ -189,6 +189,7 @@ impl xcm_executor::Config for XcmConfig { ConvertInto, TrustBackedAssetsInstance, >, + TrustBackedAssetsInstance, >, ConvertedConcreteId< AssetId, diff --git a/parachains/runtimes/assets/westmint/src/lib.rs b/parachains/runtimes/assets/westmint/src/lib.rs index 0b4c55f0ae..6aed43eb88 100644 --- a/parachains/runtimes/assets/westmint/src/lib.rs +++ b/parachains/runtimes/assets/westmint/src/lib.rs @@ -249,6 +249,19 @@ impl pallet_assets::Config for Runtime { type Helper = (); } +// This is frustrating... +// use pallet_assets::BenchmarkHelper; +// pub struct XcmBenchmarkHelper; +// #[cfg(feature = "runtime-benchmarks")] +// impl> BenchmarkHelper for XcmBenchmarkHelper { +// fn create_asset_id(id: u32) -> AssetId { +// match id { +// x => MultiLocationForAssetId { parents: 1, interior: X1(Parachain(x)) }, +// _ => MultiLocationForAssetId { parents: 0, interior: Here }, +// } +// } +// } + /// Assets managed by some foreign location. type ForeignAssetsInstance = pallet_assets::Instance2; impl pallet_assets::Config for Runtime { diff --git a/parachains/runtimes/assets/westmint/src/xcm_config.rs b/parachains/runtimes/assets/westmint/src/xcm_config.rs index 3c396c95e0..62a70c6535 100644 --- a/parachains/runtimes/assets/westmint/src/xcm_config.rs +++ b/parachains/runtimes/assets/westmint/src/xcm_config.rs @@ -189,6 +189,7 @@ impl xcm_executor::Config for XcmConfig { ConvertInto, TrustBackedAssetsInstance, >, + TrustBackedAssetsInstance, >, ConvertedConcreteId< AssetId, diff --git a/parachains/runtimes/testing/penpal/src/lib.rs b/parachains/runtimes/testing/penpal/src/lib.rs index 48d40c3008..067d2713e3 100644 --- a/parachains/runtimes/testing/penpal/src/lib.rs +++ b/parachains/runtimes/testing/penpal/src/lib.rs @@ -35,7 +35,7 @@ use frame_support::{ construct_runtime, dispatch::DispatchClass, parameter_types, - traits::Everything, + traits::{AsEnsureOriginWithArg, Everything}, weights::{ constants::WEIGHT_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, @@ -44,7 +44,7 @@ use frame_support::{ }; use frame_system::{ limits::{BlockLength, BlockWeights}, - EnsureRoot, + EnsureRoot, EnsureSigned, }; use smallvec::smallvec; use sp_api::impl_runtime_apis; @@ -398,6 +398,7 @@ impl pallet_assets::Config for Runtime { type Balance = Balance; type AssetId = AssetId; type Currency = Balances; + type CreateOrigin = AsEnsureOriginWithArg>; type ForceOrigin = EnsureRoot; type AssetDeposit = AssetDeposit; type MetadataDepositBase = MetadataDepositBase; diff --git a/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/parachains/runtimes/testing/rococo-parachain/src/lib.rs index c854c7b0a0..3f7642bbd6 100644 --- a/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -42,7 +42,7 @@ pub use frame_support::{ construct_runtime, dispatch::DispatchClass, match_types, parameter_types, - traits::{EitherOfDiverse, Everything, IsInVec, Randomness}, + traits::{AsEnsureOriginWithArg, EitherOfDiverse, Everything, IsInVec, Randomness}, weights::{ constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, ConstantMultiplier, IdentityFee, Weight, @@ -51,7 +51,7 @@ pub use frame_support::{ }; use frame_system::{ limits::{BlockLength, BlockWeights}, - EnsureRoot, + EnsureRoot, EnsureSigned, }; pub use pallet_balances::Call as BalancesCall; pub use pallet_timestamp::Call as TimestampCall; @@ -513,6 +513,7 @@ impl pallet_assets::Config for Runtime { type Balance = u64; type AssetId = AssetId; type Currency = Balances; + type CreateOrigin = AsEnsureOriginWithArg>; type ForceOrigin = AdminOrigin; type AssetDeposit = AssetDeposit; type MetadataDepositBase = MetadataDepositBase;