Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Vstam1/nonfungibles adapter v2 #7344

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

vstam1
Copy link
Contributor

@vstam1 vstam1 commented Jun 9, 2023

This pr introduces the NonFungiblesV2Adapter as a new type for the XCM executor's AssetTransactor type, designed to work with the NFTs pallet. This Pr is a PoC to investigate how the NFTs pallet could work with XCM.

Introduces:

  • NonFungiblesV2Adapter
  • MultiLocationCollectionId: Wrapper for MultiLocation that implements the Incrementable trait. The trait implementation allow the NFT's pallet CollectionId type to be a wrapped MultiLocation.
  • Replaces the uniques pallet with the NFTs pallet in the xcm-simulator parachain runtime.

@vstam1 vstam1 marked this pull request as ready for review July 27, 2023 14:30
runtime/kusama/src/xcm_config.rs Outdated Show resolved Hide resolved
runtime/kusama/src/xcm_config.rs Outdated Show resolved Hide resolved
xcm/xcm-builder/src/nonfungibles_v2_adapter.rs Outdated Show resolved Hide resolved
xcm/xcm-builder/src/nonfungibles_v2_adapter.rs Outdated Show resolved Hide resolved
xcm/xcm-builder/src/nonfungibles_v2_adapter.rs Outdated Show resolved Hide resolved
xcm/xcm-builder/src/nonfungibles_v2_adapter.rs Outdated Show resolved Hide resolved
xcm/xcm-builder/src/nonfungibles_v2_adapter.rs Outdated Show resolved Hide resolved
xcm/xcm-builder/src/nonfungibles_v2_adapter.rs Outdated Show resolved Hide resolved
@vstam1 vstam1 added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit. T6-XCM This PR/Issue is related to XCM. labels Aug 7, 2023
Assets: nonfungibles_v2::Transfer<AccountId>,
Matcher: MatchesNonFungibles<Assets::CollectionId, Assets::ItemId>,
AccountIdConverter: ConvertLocation<AccountId>,
AccountId: Clone, // can't get away without it since Currency is generic over it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AccountId: Clone, // can't get away without it since Currency is generic over it.
AccountId: Clone, // can't get away without it since `nonfungibles_v2` is generic over it.

Assets: nonfungibles_v2::Mutate<AccountId, ItemConfig>,
Matcher: MatchesNonFungibles<Assets::CollectionId, Assets::ItemId>,
AccountIdConverter: ConvertLocation<AccountId>,
AccountId: Clone + Eq, // can't get away without it since Currency is generic over it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AccountId: Clone + Eq, // can't get away without it since Currency is generic over it.
AccountId: Clone + Eq, // can't get away without it since `nonfungibles_v2` is generic over it.

Assets: nonfungibles_v2::Mutate<AccountId, ItemConfig>,
Matcher: MatchesNonFungibles<Assets::CollectionId, Assets::ItemId>,
AccountIdConverter: ConvertLocation<AccountId>,
AccountId: Clone + Eq, // can't get away without it since Currency is generic over it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AccountId: Clone + Eq, // can't get away without it since Currency is generic over it.
AccountId: Clone + Eq, // can't get away without it since `nonfungibles_v2` is generic over it.

Assets: nonfungibles_v2::Mutate<AccountId, ItemConfig> + nonfungibles_v2::Transfer<AccountId>,
Matcher: MatchesNonFungibles<Assets::CollectionId, Assets::ItemId>,
AccountIdConverter: ConvertLocation<AccountId>,
AccountId: Clone + Eq, // can't get away without it since Currency is generic over it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AccountId: Clone + Eq, // can't get away without it since Currency is generic over it.
AccountId: Clone + Eq, // can't get away without it since `nonfungibles_v2` is generic over it.

Comment on lines +432 to +440
impl Incrementable for MultiLocationCollectionId {
fn increment(&self) -> Option<Self> {
None
}

fn initial_value() -> Option<Self> {
None
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to implement this? Aren't we going to be forcing the collection id of collections identified by MultiLocations?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit. T6-XCM This PR/Issue is related to XCM.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants