mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 17:25:41 +00:00
Serialize/Deserialize trait implemented in no-std for XCM assets (#3057)
Continues the work of https://github.com/paritytech/polkadot/pull/7312. `MultiLocation` was modified to implement serialize in no-std in that PR, but not the assets types. This PR does the same for assets, and this also allows to inject them in pallets that require them in genesis.
This commit is contained in:
committed by
GitHub
parent
a9992dbb31
commit
de835f4cd9
@@ -51,9 +51,20 @@ use scale_info::TypeInfo;
|
||||
|
||||
/// A general identifier for an instance of a non-fungible asset class.
|
||||
#[derive(
|
||||
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen,
|
||||
Copy,
|
||||
Clone,
|
||||
Eq,
|
||||
PartialEq,
|
||||
Ord,
|
||||
PartialOrd,
|
||||
Encode,
|
||||
Decode,
|
||||
Debug,
|
||||
TypeInfo,
|
||||
MaxEncodedLen,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[cfg_attr(feature = "json-schema", derive(schemars::JsonSchema))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum AssetInstance {
|
||||
@@ -264,8 +275,19 @@ impl TryFrom<AssetInstance> for u128 {
|
||||
|
||||
/// Classification of whether an asset is fungible or not, along with a mandatory amount or
|
||||
/// instance.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[derive(
|
||||
Clone,
|
||||
Eq,
|
||||
PartialEq,
|
||||
Ord,
|
||||
PartialOrd,
|
||||
Debug,
|
||||
Encode,
|
||||
TypeInfo,
|
||||
MaxEncodedLen,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
)]
|
||||
#[cfg_attr(feature = "json-schema", derive(schemars::JsonSchema))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum Fungibility {
|
||||
@@ -345,9 +367,20 @@ impl TryFrom<NewFungibility> for Fungibility {
|
||||
|
||||
/// Classification of whether an asset is fungible or not.
|
||||
#[derive(
|
||||
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, Decode, TypeInfo, MaxEncodedLen,
|
||||
Copy,
|
||||
Clone,
|
||||
Eq,
|
||||
PartialEq,
|
||||
Ord,
|
||||
PartialOrd,
|
||||
Debug,
|
||||
Encode,
|
||||
Decode,
|
||||
TypeInfo,
|
||||
MaxEncodedLen,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[cfg_attr(feature = "json-schema", derive(schemars::JsonSchema))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum WildFungibility {
|
||||
@@ -381,9 +414,20 @@ impl TryFrom<NewWildFungibility> for WildFungibility {
|
||||
|
||||
/// Classification of an asset being concrete or abstract.
|
||||
#[derive(
|
||||
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, Decode, TypeInfo, MaxEncodedLen,
|
||||
Copy,
|
||||
Clone,
|
||||
Eq,
|
||||
PartialEq,
|
||||
Ord,
|
||||
PartialOrd,
|
||||
Debug,
|
||||
Encode,
|
||||
Decode,
|
||||
TypeInfo,
|
||||
MaxEncodedLen,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[cfg_attr(feature = "json-schema", derive(schemars::JsonSchema))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum AssetId {
|
||||
@@ -465,8 +509,18 @@ impl AssetId {
|
||||
}
|
||||
|
||||
/// Either an amount of a single fungible asset, or a single well-identified non-fungible asset.
|
||||
#[derive(Clone, Eq, PartialEq, Debug, Encode, Decode, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[derive(
|
||||
Clone,
|
||||
Eq,
|
||||
PartialEq,
|
||||
Debug,
|
||||
Encode,
|
||||
Decode,
|
||||
TypeInfo,
|
||||
MaxEncodedLen,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
)]
|
||||
#[cfg_attr(feature = "json-schema", derive(schemars::JsonSchema))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub struct MultiAsset {
|
||||
@@ -571,8 +625,19 @@ impl TryFrom<NewMultiAsset> for MultiAsset {
|
||||
/// - It may contain no items of duplicate asset class;
|
||||
/// - All items must be ordered;
|
||||
/// - The number of items should grow no larger than `MAX_ITEMS_IN_MULTIASSETS`.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, TypeInfo, Default)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[derive(
|
||||
Clone,
|
||||
Eq,
|
||||
PartialEq,
|
||||
Ord,
|
||||
PartialOrd,
|
||||
Debug,
|
||||
Encode,
|
||||
TypeInfo,
|
||||
Default,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
)]
|
||||
#[cfg_attr(feature = "json-schema", derive(schemars::JsonSchema))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub struct MultiAssets(Vec<MultiAsset>);
|
||||
@@ -784,8 +849,20 @@ impl MultiAssets {
|
||||
}
|
||||
|
||||
/// A wildcard representing a set of assets.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, Decode, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[derive(
|
||||
Clone,
|
||||
Eq,
|
||||
PartialEq,
|
||||
Ord,
|
||||
PartialOrd,
|
||||
Debug,
|
||||
Encode,
|
||||
Decode,
|
||||
TypeInfo,
|
||||
MaxEncodedLen,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
)]
|
||||
#[cfg_attr(feature = "json-schema", derive(schemars::JsonSchema))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum WildMultiAsset {
|
||||
@@ -912,8 +989,20 @@ impl<A: Into<AssetId>, B: Into<WildFungibility>> From<(A, B)> for WildMultiAsset
|
||||
}
|
||||
|
||||
/// `MultiAsset` collection, defined either by a number of `MultiAssets` or a single wildcard.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, Decode, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[derive(
|
||||
Clone,
|
||||
Eq,
|
||||
PartialEq,
|
||||
Ord,
|
||||
PartialOrd,
|
||||
Debug,
|
||||
Encode,
|
||||
Decode,
|
||||
TypeInfo,
|
||||
MaxEncodedLen,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
)]
|
||||
#[cfg_attr(feature = "json-schema", derive(schemars::JsonSchema))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum MultiAssetFilter {
|
||||
|
||||
Reference in New Issue
Block a user