This standard specifies how the Unique Assets must be identified in the Polkadot ecosystem throughout the parachains.
For its motivation, see the Polkadot Unique Asset Standards document.
The Unique Assets can be represented as NFTs. The Polkadot ecosystem already has an established way of identifying them, yet just for the limited scope: cross-chain transfers.
This document proposes to use the XCM identification of NFTs as the ecosystem-wise standard of identifying Unique Assets.
struct UniqueAsset {
/// The overall asset identity.
pub id: XcmAssetId,
/// The *instance ID*, the secondary asset identifier.
/// E.g., an NFT within the collection identified by the `id` above.
pub instance: XcmAssetInstance,
}
The UniqueAsset
struct should be versioned in the same manner as XCM. The version of the UniqueAsset
struct must correspond to the version of XCM types inside it:
struct UniqueAssetV3 {
pub id: XcmV3AssetId,
pub instance: XcmV3AssetInstance,
}
The corresponding VersionedUniqueAsset
enum is also defined for clients to use:
pub enum VersionedUniqueAsset {
V3(UniqueAssetV3),
V4(UniqueAssetV4),
// and so on, following the XCM versions
}
The VersionedUniqueAsset
should always be used in the API facing the client, not the concrete version of the UniqueAsset
struct.
The reason is the same as for XCM: if a chain upgrades to a newer version, it shouldn't break the existing clients that haven't yet upgraded themselves.
Since Unique Assets can be represented by individual assets like NFTs and their groups like NFT collections, we need to distinguish them.
This document follows the approach described in the Fellowship RFC 125 "XCM Asset Metadata".
A Unique Asset that represents a group of assets (such as an NFT collection) can be identified as follows:
UniqueAsset {
id: COLLECTION_ID, // `COLLECTION_ID` is a placeholder for a value.
instance: XcmAssetInstance::Undefined,
}
A Unique Asset that is a part of a group (such as an NFT within a collection) is identified as follows:
UniqueAsset {
id: COLLECTION_ID, // `COLLECTION_ID` is a placeholder for a value.
instance: NFT_ID, // `NFT_ID` is a placeholder for a value.
}