diff --git a/Cargo.lock b/Cargo.lock index d2bf2ace..96d8c4e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10807,12 +10807,16 @@ name = "pop-runtime-common" version = "0.0.0" dependencies = [ "frame-support", + "log", "parachains-common", "parity-scale-codec", "polkadot-primitives", "scale-info", "sp-runtime", "sp-std", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", ] [[package]] diff --git a/integration-tests/src/chains/pop_network/mod.rs b/integration-tests/src/chains/pop_network/mod.rs index 41daed27..f0a3496f 100644 --- a/integration-tests/src/chains/pop_network/mod.rs +++ b/integration-tests/src/chains/pop_network/mod.rs @@ -27,6 +27,7 @@ decl_test_parachains! { pallets = { PolkadotXcm: runtime::PolkadotXcm, Balances: runtime::Balances, + ForeignNfts: runtime::ForeignNfts, } }, } diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 395abd24..428356bf 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -13,6 +13,7 @@ targets = [ "x86_64-unknown-linux-gnu" ] [dependencies] codec = { workspace = true, default-features = false, features = [ "derive" ] } +log = { workspace = true, default-features = false } scale-info = { workspace = true, default-features = false, features = [ "derive" ] } # Substrate @@ -22,6 +23,9 @@ sp-std = { workspace = true, default-features = false } parachains-common = { workspace = true, default-features = false } polkadot-primitives = { workspace = true, default-features = false } +xcm = { workspace = true, default-features = false } +xcm-builder = { workspace = true, default-features = false } +xcm-executor = { workspace = true, default-features = false } [features] default = [ "std" ] @@ -29,4 +33,11 @@ runtime-benchmarks = [ "frame-support/runtime-benchmarks", "sp-runtime/runtime-benchmarks", ] -std = [ "frame-support/std", "sp-runtime/std" ] +std = [ + "frame-support/std", + "log/std", + "sp-runtime/std", + "xcm-builder/std", + "xcm-executor/std", + "xcm/std", +] diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index f20ea377..a26d13ae 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -6,6 +6,8 @@ pub use parachains_common::{AccountId, AuraId, Balance, Block, BlockNumber, Hash pub use polkadot_primitives::MAX_POV_SIZE; use sp_runtime::Perbill; +pub mod xcm; + /// Nonce for an account pub type Nonce = u32; diff --git a/runtime/common/src/xcm/mod.rs b/runtime/common/src/xcm/mod.rs new file mode 100644 index 00000000..af9f66c4 --- /dev/null +++ b/runtime/common/src/xcm/mod.rs @@ -0,0 +1 @@ +pub mod nonfungibles_adapter; diff --git a/runtime/devnet/src/config/nonfungibles.rs b/runtime/common/src/xcm/nonfungibles_adapter.rs similarity index 99% rename from runtime/devnet/src/config/nonfungibles.rs rename to runtime/common/src/xcm/nonfungibles_adapter.rs index 179cd413..293ca95e 100644 --- a/runtime/devnet/src/config/nonfungibles.rs +++ b/runtime/common/src/xcm/nonfungibles_adapter.rs @@ -23,12 +23,12 @@ pub struct MultiLocationCollectionId(pub MultiLocation); impl MultiLocationCollectionId { /// Consume `self` and return the inner MultiLocation. - pub(crate) fn into_inner(self) -> MultiLocation { + pub fn into_inner(self) -> MultiLocation { self.0 } /// Return a reference to the inner MultiLocation. - pub(crate) fn inner(&self) -> &MultiLocation { + pub fn inner(&self) -> &MultiLocation { &self.0 } } diff --git a/runtime/devnet/src/config/assets.rs b/runtime/devnet/src/config/assets.rs index 79e0d156..786b58ac 100644 --- a/runtime/devnet/src/config/assets.rs +++ b/runtime/devnet/src/config/assets.rs @@ -7,13 +7,13 @@ use frame_support::{ use frame_system::{EnsureRoot, EnsureSigned}; use pallet_nfts::PalletFeatures; use parachains_common::{AssetIdForTrustBackedAssets, CollectionId, ItemId, Signature}; +use pop_runtime_common::xcm::nonfungibles_adapter::MultiLocationCollectionId; use sp_runtime::traits::Verify; use xcm_executor::traits::ConvertLocation; use crate::{ - config::{nonfungibles::MultiLocationCollectionId, xcm::LocationToAccountId}, - deposit, AccountId, Assets, Balance, Balances, BlockNumber, Nfts, Runtime, RuntimeEvent, - RuntimeHoldReason, RuntimeOrigin, DAYS, EXISTENTIAL_DEPOSIT, UNIT, + config::xcm::LocationToAccountId, deposit, AccountId, Assets, Balance, Balances, BlockNumber, + Nfts, Runtime, RuntimeEvent, RuntimeHoldReason, RuntimeOrigin, DAYS, EXISTENTIAL_DEPOSIT, UNIT, }; /// We allow root to execute privileged asset operations. diff --git a/runtime/devnet/src/config/mod.rs b/runtime/devnet/src/config/mod.rs index 94594779..61ae0827 100644 --- a/runtime/devnet/src/config/mod.rs +++ b/runtime/devnet/src/config/mod.rs @@ -3,7 +3,6 @@ mod api; pub mod assets; mod contracts; mod ismp; -pub mod nonfungibles; mod proxy; // Public due to integration tests crate. pub mod xcm; diff --git a/runtime/devnet/src/config/xcm.rs b/runtime/devnet/src/config/xcm.rs index 202e303b..d7132ea4 100644 --- a/runtime/devnet/src/config/xcm.rs +++ b/runtime/devnet/src/config/xcm.rs @@ -10,6 +10,9 @@ use pallet_nfts::ItemConfig; use pallet_xcm::XcmPassthrough; use polkadot_parachain_primitives::primitives::Sibling; use polkadot_runtime_common::impls::ToAuthor; +use pop_runtime_common::xcm::nonfungibles_adapter::{ + MultiLocationCollectionId, NonFungiblesAdapterPop, +}; use xcm::{latest::prelude::*, opaque::v3::MultiLocation}; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, @@ -25,7 +28,6 @@ use xcm_executor::{ }; use crate::{ - config::nonfungibles::{MultiLocationCollectionId, NonFungiblesAdapterPop}, AccountId, AllPalletsWithSystem, Balances, ForeignNfts, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, };