Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Granular NFT traits and new XCM NFT types #4300

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
e7003fd
feat(frame-support): add asset ops
mrshiposha Apr 25, 2024
6c6cf4b
feat(pallet-uniques): implement asset ops
mrshiposha Apr 25, 2024
a2099c0
feat(xcm): add unique instances adapters using asset ops
mrshiposha Apr 25, 2024
3f7c3a2
feat(rococo,westend): use xcm unique instances adapter
mrshiposha Apr 25, 2024
21323ff
Merge branch 'master' into feature/asset-ops-traits
mrshiposha Apr 26, 2024
2db1903
Merge branch 'master' into feature/asset-ops-traits
mrshiposha May 28, 2024
0016ec2
refactor: asset-ops related stuff, add Stash+Restore ops
mrshiposha Jun 11, 2024
17f54ab
refactor: unique instances XCM stuff
mrshiposha Jun 11, 2024
a725bbd
fix: add derives to NonFungibleAsset
mrshiposha Jun 11, 2024
b4893df
chore: remove unneeded
mrshiposha Jun 11, 2024
105ebfa
feat: add derives to id assignments
mrshiposha Jun 12, 2024
379d6cd
refactor(asset-ops): lifetimes in common strategies
mrshiposha Jun 13, 2024
d28ad75
refactor: xcm unique-instances derivatives traits
mrshiposha Jun 15, 2024
c45c7ca
refactor: id assignment
mrshiposha Jun 24, 2024
a5b1b1c
fix: remove unneeded imports
mrshiposha Jun 25, 2024
be99d8e
feat: add pallet-xnft
mrshiposha Jun 25, 2024
ae08d7e
Merge branch 'master' into feature/asset-ops-traits
mrshiposha Jun 27, 2024
6e06663
fix(xcm-builder): remove unneeded uses, add mod doc comment
mrshiposha Jun 27, 2024
aa2f827
fix(asset-ops): doc comment
mrshiposha Jun 27, 2024
79cae0a
fix: add pallet-xnft to workspace
mrshiposha Jun 27, 2024
4c7a0ca
fix: add Success type to all strategies
mrshiposha Jun 27, 2024
4585528
chore: cargo fmt
mrshiposha Jun 27, 2024
5324c5b
fix: impl StashStrategy,RestoreStrategy for WithOrigin
mrshiposha Jun 27, 2024
8f94c1d
fix: CI errors
mrshiposha Jul 3, 2024
23c36be
fix: remove unused imports
mrshiposha Jul 3, 2024
845149a
fix: clippy
mrshiposha Jul 3, 2024
f7e2c3e
fix: clippy
mrshiposha Jul 3, 2024
ce0b2e3
Merge branch 'master' into feature/asset-ops-traits
mrshiposha Jul 15, 2024
d30a218
Merge branch 'master' into feature/asset-ops-traits
mrshiposha Aug 5, 2024
d870d91
fix: cargo fmt, remove unneeded use
mrshiposha Aug 5, 2024
1a50904
fix: umbrella crate
mrshiposha Aug 5, 2024
cd24f76
refactor: replace pallet-xnft with pallet-derivatives
mrshiposha Sep 19, 2024
c1ff41e
refactor: simplify unique instances derivatives types
mrshiposha Sep 19, 2024
7bfb0fd
refactor: remove RegisterOnCreate/DeregisterOnDestroy
mrshiposha Sep 19, 2024
1b90a48
refactor: use result type in all registry's methods
mrshiposha Sep 19, 2024
15c0c53
feat: add AssetIdOf
mrshiposha Sep 19, 2024
a7e1809
refactor: use options to get original/derivative
mrshiposha Sep 20, 2024
a71ecad
feat: add IterDerivativesRegistry
mrshiposha Oct 11, 2024
df878fd
fix: remove unneeded imports
mrshiposha Oct 13, 2024
c45b442
refactor: remove AssetKind notion
mrshiposha Oct 24, 2024
44a2366
refactor: remove AssetKind notion from xcm adapters
mrshiposha Oct 24, 2024
1f050ea
fix: fmt uniques asset-ops
mrshiposha Oct 24, 2024
53c24d9
fix: fmt unique-instances xcm adapter
mrshiposha Oct 24, 2024
80385b9
refactor: derivatives traits and pallet
mrshiposha Oct 25, 2024
f47c741
fix: add derives for common create strategies
mrshiposha Oct 25, 2024
90c9fd9
refactor(pallet-derivatives): split derivative ops
mrshiposha Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ members = [
"polkadot/xcm/docs",
"polkadot/xcm/pallet-xcm",
"polkadot/xcm/pallet-xcm-benchmarks",
"polkadot/xcm/pallet-xnft",
"polkadot/xcm/procedural",
"polkadot/xcm/xcm-builder",
"polkadot/xcm/xcm-executor",
Expand Down Expand Up @@ -975,6 +976,7 @@ pallet-xcm = { path = "polkadot/xcm/pallet-xcm", default-features = false }
pallet-xcm-benchmarks = { path = "polkadot/xcm/pallet-xcm-benchmarks", default-features = false }
pallet-xcm-bridge-hub = { path = "bridges/modules/xcm-bridge-hub", default-features = false }
pallet-xcm-bridge-hub-router = { path = "bridges/modules/xcm-bridge-hub-router", default-features = false }
pallet-xnft = { path = "polkadot/xcm/pallet-xnft", default-features = false }
parachain-info = { path = "cumulus/parachains/pallets/parachain-info", default-features = false, package = "staging-parachain-info" }
parachain-template-runtime = { path = "templates/parachain/runtime" }
parachains-common = { path = "cumulus/parachains/common", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,18 @@ use testnet_parachains_constants::rococo::snowbridge::{
};
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowHrmpNotificationsFromRelayChain,
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
DenyReserveTransferToRelayChain, DenyThenTry, DescribeAllTerminal, DescribeFamily,
EnsureXcmOrigin, FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter,
GlobalConsensusParachainConvertsFor, HashedDescription, IsConcrete, LocalMint,
NetworkExportTableItem, NoChecking, NonFungiblesAdapter, ParentAsSuperuser, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignPaidRemoteExporter,
SovereignSignedViaLocation, StartsWith, StartsWithExplicitGlobalConsensus, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
XcmFeeManagerFromComponents, XcmFeeToAccount,
unique_instances::UniqueInstancesAdapter, AccountId32Aliases, AllowExplicitUnpaidExecutionFrom,
AllowHrmpNotificationsFromRelayChain, AllowKnownQueryResponses, AllowSubscriptionsFrom,
AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain, DenyThenTry,
DescribeAllTerminal, DescribeFamily, EnsureXcmOrigin, FrameTransactionalProcessor,
FungibleAdapter, FungiblesAdapter, GlobalConsensusParachainConvertsFor, HashedDescription,
IsConcrete, LocalMint, MatchInClassInstances, NetworkExportTableItem, NoChecking,
ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignPaidRemoteExporter, SovereignSignedViaLocation, StartsWith,
StartsWithExplicitGlobalConsensus, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
XcmFeeToAccount,
};
use xcm_executor::XcmExecutor;

Expand Down Expand Up @@ -149,19 +150,11 @@ pub type UniquesConvertedConcreteId =
assets_common::UniquesConvertedConcreteId<UniquesPalletLocation>;

/// Means for transacting unique assets.
pub type UniquesTransactor = NonFungiblesAdapter<
// Use this non-fungibles implementation:
Uniques,
// This adapter will handle any non-fungible asset from the uniques pallet.
UniquesConvertedConcreteId,
// Convert an XCM Location into a local account id:
LocationToAccountId,
// Our chain's account ID type (we can't get away without mentioning it explicitly):
pub type UniquesTransactor = UniqueInstancesAdapter<
AccountId,
// Does not check teleports.
NoChecking,
// The account to use for tracking teleports.
CheckingAccount,
LocationToAccountId,
MatchInClassInstances<UniquesConvertedConcreteId>,
Uniques,
>;

/// `AssetId`/`Balance` converter for `ForeignAssets`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ use polkadot_runtime_common::xcm_sender::ExponentialPrice;
use sp_runtime::traits::{AccountIdConversion, ConvertInto};
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowHrmpNotificationsFromRelayChain,
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
DenyReserveTransferToRelayChain, DenyThenTry, DescribeFamily, DescribePalletTerminal,
EnsureXcmOrigin, FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter,
GlobalConsensusParachainConvertsFor, HashedDescription, IsConcrete, LocalMint,
NetworkExportTableItem, NoChecking, NonFungiblesAdapter, ParentAsSuperuser, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
unique_instances::UniqueInstancesAdapter, AccountId32Aliases, AllowExplicitUnpaidExecutionFrom,
AllowHrmpNotificationsFromRelayChain, AllowKnownQueryResponses, AllowSubscriptionsFrom,
AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain, DenyThenTry, DescribeFamily,
DescribePalletTerminal, EnsureXcmOrigin, FrameTransactionalProcessor, FungibleAdapter,
FungiblesAdapter, GlobalConsensusParachainConvertsFor, HashedDescription, IsConcrete,
LocalMint, MatchInClassInstances, NetworkExportTableItem, NoChecking, ParentAsSuperuser,
ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, StartsWith,
StartsWithExplicitGlobalConsensus, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
Expand Down Expand Up @@ -142,19 +142,11 @@ pub type UniquesConvertedConcreteId =
assets_common::UniquesConvertedConcreteId<UniquesPalletLocation>;

/// Means for transacting unique assets.
pub type UniquesTransactor = NonFungiblesAdapter<
// Use this non-fungibles implementation:
Uniques,
// This adapter will handle any non-fungible asset from the uniques pallet.
UniquesConvertedConcreteId,
// Convert an XCM Location into a local account id:
LocationToAccountId,
// Our chain's account ID type (we can't get away without mentioning it explicitly):
pub type UniquesTransactor = UniqueInstancesAdapter<
AccountId,
// Does not check teleports.
NoChecking,
// The account to use for tracking teleports.
CheckingAccount,
LocationToAccountId,
MatchInClassInstances<UniquesConvertedConcreteId>,
Uniques,
>;

/// `AssetId`/`Balance` converter for `ForeignAssets`.
Expand Down
63 changes: 63 additions & 0 deletions polkadot/xcm/pallet-xnft/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[package]
name = "pallet-xnft"
version = "1.0.0"
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
homepage = "https://substrate.io"
repository.workspace = true
description = "FRAME XNFT pallet"
readme = "README.md"

[lints]
workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.12", default-features = false }
log = { workspace = true }
scale-info = { version = "2.11.1", default-features = false, features = ["derive"] }
frame-benchmarking = { optional = true, workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }

xcm = { workspace = true }
xcm-executor = { workspace = true }
xcm-builder = { workspace = true }

[features]
default = ["std"]
std = [
"codec/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime",
]
1 change: 1 addition & 0 deletions polkadot/xcm/pallet-xnft/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# xnft
Loading