Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Asset Hub - Stout NFT transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
Szegoo committed Jan 21, 2024
1 parent 625dc9f commit 70dfcdb
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 12 deletions.
7 changes: 5 additions & 2 deletions runtime/stout/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,13 @@ parameter_types! {
pub const ValueLimit: u32 = 64;
}

type StoutCollectionId = u32;
type StoutItemId = u32;

impl pallet_uniques::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type CollectionId = u32;
type ItemId = u32;
type CollectionId = StoutCollectionId;
type ItemId = StoutItemId;
type Currency = Balances;
type ForceOrigin = frame_system::EnsureRoot<AccountId>;
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
Expand Down
36 changes: 31 additions & 5 deletions runtime/stout/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ use cumulus_primitives_core::ParaId;

use super::{
AccountId, AssetRegistry, Assets, Balance, Balances, ParachainInfo, ParachainSystem,
PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, StoutCollectionId, StoutItemId,
Uniques, WeightToFee, XcmpQueue,
};
use frame_support::{
match_types, parameter_types,
Expand All @@ -46,9 +47,10 @@ use xcm_builder::{
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex,
ConvertedConcreteId, CurrencyAdapter, DenyReserveTransferToRelayChain, DenyThenTry,
EnsureXcmOrigin, FixedRateOfFungible, FixedWeightBounds, FungiblesAdapter, IsConcrete,
MintLocation, NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
MintLocation, NativeAsset, NoChecking, NonFungiblesAdapter, ParentAsSuperuser, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents,
};
use xcm_executor::XcmExecutor;

Expand Down Expand Up @@ -148,8 +150,30 @@ pub type ReservedFungiblesTransactor = FungiblesAdapter<
PlaceholderAccount,
>;

pub type NonFungiblesTransactor = NonFungiblesAdapter<
// Use this nonfungibles implementation:
Uniques,
// Type that attempts to convert the `MultiAsset` into a registered uniques item.
// Assets not found in AssetRegistry will not be used.
ConvertedConcreteId<
StoutCollectionId,
StoutItemId,
AsPrefixedGeneralIndex<StatemineUniquesPalletLocation, StoutCollectionId, JustTry>,
JustTry,
>,
// Convert an XCM MultiLocation into a local account id:
LocationToAccountId,
// This chain's account ID type (we can't get away without mentioning it explicitly):
AccountId,
// We don't track any teleports of `Assets`.
NoChecking,
// No teleports.
(),
>;

/// Means for transacting assets on this chain.
pub type AssetTransactors = (CurrencyTransactor, ReservedFungiblesTransactor, FungiblesTransactor);
pub type AssetTransactors =
(CurrencyTransactor, ReservedFungiblesTransactor, FungiblesTransactor, NonFungiblesTransactor);

/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
Expand Down Expand Up @@ -236,6 +260,8 @@ parameter_types! {
// Statemine's Assets pallet index
pub StatemineAssetsPalletLocation: MultiLocation =
MultiLocation::new(1, X2(Parachain(1000), PalletInstance(50)));
pub StatemineUniquesPalletLocation: MultiLocation =
MultiLocation::new(1, X2(Parachain(1000), PalletInstance(51)));
}

pub struct ReserveAssetsFrom<T>(PhantomData<T>);
Expand Down
10 changes: 5 additions & 5 deletions zombienet/stout_rococo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ default_command = "./bin/polkadot"
id = 1000
add_to_genesis = true
cumulus_based = true
chain = "statemine-local"
chain = "asset-hub-rococo-local"

[[parachains.collators]]
name = "statemine-collator01"
command = "./bin/polkadot-parachain"
ws_port = 9910
args = ["--log=xcm=trace,pallet-assets=trace"]
args = ["--log=xcm=trace,pallet-assets=trace,pallet-uniques=trace"]

[[parachains.collators]]
name = "statemine-collator02"
command = "./bin/polkadot-parachain"
ws_port = 9911
args = ["--log=xcm=trace,pallet-assets=trace"]
args = ["--log=xcm=trace,pallet-assets=trace,pallet-uniques=trace"]

[[parachains]]
id = 3000
Expand All @@ -54,13 +54,13 @@ chain = "stout-local"
name = "stout-collator01"
command = "./target/release/trappist-node"
ws_port = 9930
args = ["--log=xcm=trace,pallet-assets=trace"]
args = ["--log=xcm=trace,pallet-assets=trace,pallet-uniques=trace"]

[[parachains.collators]]
name = "stout-collator02"
command = "./target/release/trappist-node"
ws_port = 9931
args = ["--log=xcm=trace,pallet-assets=trace"]
args = ["--log=xcm=trace,pallet-assets=trace,pallet-uniques=trace"]

[types.Header]
number = "u64"
Expand Down

0 comments on commit 70dfcdb

Please sign in to comment.