Skip to content

Commit

Permalink
refactor: nonfungibles adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
chungquantin committed Dec 6, 2024
1 parent 46075b4 commit 05e552e
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 8 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions integration-tests/src/chains/pop_network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ decl_test_parachains! {
pallets = {
PolkadotXcm: runtime::PolkadotXcm,
Balances: runtime::Balances,
ForeignNfts: runtime::ForeignNfts,
}
},
}
Expand Down
13 changes: 12 additions & 1 deletion runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,11 +23,21 @@ 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" ]
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",
]
2 changes: 2 additions & 0 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Check warning on line 9 in runtime/common/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a module

warning: missing documentation for a module --> runtime/common/src/lib.rs:9:1 | 9 | pub mod xcm; | ^^^^^^^^^^^

/// Nonce for an account
pub type Nonce = u32;

Expand Down
1 change: 1 addition & 0 deletions runtime/common/src/xcm/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod nonfungibles_adapter;

Check warning on line 1 in runtime/common/src/xcm/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a module

warning: missing documentation for a module --> runtime/common/src/xcm/mod.rs:1:1 | 1 | pub mod nonfungibles_adapter; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
6 changes: 3 additions & 3 deletions runtime/devnet/src/config/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion runtime/devnet/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 3 additions & 1 deletion runtime/devnet/src/config/xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
};
Expand Down

0 comments on commit 05e552e

Please sign in to comment.