git.delta.rocks / unique-network / refs/commits / c12e121fed0b

difftreelog

refactor extract sponsorship primitives

Yaroslav Bolyukin2021-06-24parent: #73e89cc.patch.diff
in: master

6 files changed

deletedprimitives/Cargo.tomldiffbeforeafterboth
--- a/primitives/Cargo.toml
+++ /dev/null
@@ -1,30 +0,0 @@
-[package]
-name = "nft-data-structs"
-authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']
-description = "Nft data structs definitions"
-edition = "2018"
-license = 'GPL-3.0'
-homepage = "https://substrate.dev"
-repository = 'https://github.com/clover-network/clover'
-version = '0.9.0'
-
-[dependencies]
-codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ['derive'] }
-serde = { version = "1.0.119", features = ['derive'], default-features = false }
-frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-pallet-contracts = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-core = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-sp-runtime = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
-
-[features]
-default = ["std"]
-std = [
-  "serde/std",
-  "codec/std",
-  "frame-system/std",
-  "frame-support/std",
-  "sp-runtime/std",
-  "sp-core/std",
-  "pallet-contracts/std",
-]
\ No newline at end of file
addedprimitives/nft/Cargo.tomldiffbeforeafterboth
--- /dev/null
+++ b/primitives/nft/Cargo.toml
@@ -0,0 +1,30 @@
+[package]
+name = "nft-data-structs"
+authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']
+description = "Nft data structs definitions"
+edition = "2018"
+license = 'GPL-3.0'
+homepage = "https://substrate.dev"
+repository = 'https://github.com/clover-network/clover'
+version = '0.9.0'
+
+[dependencies]
+codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ['derive'] }
+serde = { version = "1.0.119", features = ['derive'], default-features = false }
+frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
+frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
+pallet-contracts = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
+sp-core = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
+sp-runtime = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }
+
+[features]
+default = ["std"]
+std = [
+  "serde/std",
+  "codec/std",
+  "frame-system/std",
+  "frame-support/std",
+  "sp-runtime/std",
+  "sp-core/std",
+  "pallet-contracts/std",
+]
\ No newline at end of file
addedprimitives/nft/src/lib.rsdiffbeforeafterboth
after · primitives/nft/src/lib.rs
12#![cfg_attr(not(feature = "std"), no_std)]34pub use serde::{Serialize, Deserialize};56use frame_system;7use sp_runtime::sp_std::prelude::Vec;8use codec::{Decode, Encode};9pub use frame_support::{10    construct_runtime, decl_event, decl_module, decl_storage, decl_error,11    dispatch::DispatchResult,12    ensure, fail, parameter_types,13    traits::{14        Currency, ExistenceRequirement, Get, Imbalance, KeyOwnerProofSystem, OnUnbalanced,15        Randomness, IsSubType, WithdrawReasons,16    },17    weights::{18        constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},19        DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,20        WeightToFeePolynomial, DispatchClass,21    },22    StorageValue,23    transactional,24};2526pub const MAX_DECIMAL_POINTS: DecimalPoints = 30;27pub const MAX_REFUNGIBLE_PIECES: u128 = 1_000_000_000_000_000_000_000;28pub const MAX_SPONSOR_TIMEOUT: u32 = 10_368_000;29pub const MAX_TOKEN_OWNERSHIP: u32 = 10_000_000;3031pub type CollectionId = u32;32pub type TokenId = u32;33pub type DecimalPoints = u8;3435#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]36#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]37pub enum CollectionMode {38    Invalid,39    NFT,40    // decimal points41    Fungible(DecimalPoints),42    ReFungible,43}4445impl Default for CollectionMode {46    fn default() -> Self {47        Self::Invalid48    }49}5051impl Into<u8> for CollectionMode {52    fn into(self) -> u8 {53        match self {54            CollectionMode::Invalid => 0,55            CollectionMode::NFT => 1,56            CollectionMode::Fungible(_) => 2,57            CollectionMode::ReFungible => 3,58        }59    }60}6162pub trait SponsoringResolve<AccountId, Call> {63    fn resolve(64        who: &AccountId,65		call: &Call) -> Option<AccountId>;66}6768#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]69#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]70pub enum AccessMode {71    Normal,72    WhiteList,73}74impl Default for AccessMode {75    fn default() -> Self {76        Self::Normal77    }78}7980#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]81#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]82pub enum SchemaVersion {83    ImageURL,84    Unique,85}86impl Default for SchemaVersion {87    fn default() -> Self {88        Self::ImageURL89    }90}9192#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]93#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]94pub struct Ownership<AccountId> {95    pub owner: AccountId,96    pub fraction: u128,97}9899#[derive(Encode, Decode, Debug, Clone, PartialEq)]100#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]101pub enum SponsorshipState<AccountId> {102    /// The fees are applied to the transaction sender103    Disabled,104    Unconfirmed(AccountId),105    /// Transactions are sponsored by specified account106    Confirmed(AccountId),107}108109impl<AccountId> SponsorshipState<AccountId> {110    pub fn sponsor(&self) -> Option<&AccountId> {111        match self {112            Self::Confirmed(sponsor) => Some(sponsor),113            _ => None,114        }115    }116117    pub fn pending_sponsor(&self) -> Option<&AccountId> {118        match self {119            Self::Unconfirmed(sponsor) | Self::Confirmed(sponsor) => Some(sponsor),120            _ => None,121        }122    }123124    pub fn confirmed(&self) -> bool {125        matches!(self, Self::Confirmed(_))126    }127}128129impl<T> Default for SponsorshipState<T> {130    fn default() -> Self {131        Self::Disabled132    }133}134135#[derive(Encode, Decode, Clone, PartialEq)]136#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]137pub struct Collection<T: frame_system::Config> {138    pub owner: T::AccountId,139    pub mode: CollectionMode,140    pub access: AccessMode,141    pub decimal_points: DecimalPoints,142    pub name: Vec<u16>,        // 64 include null escape char143    pub description: Vec<u16>, // 256 include null escape char144    pub token_prefix: Vec<u8>, // 16 include null escape char145    pub mint_mode: bool,146    pub offchain_schema: Vec<u8>,147    pub schema_version: SchemaVersion,148    pub sponsorship: SponsorshipState<T::AccountId>,149    pub limits: CollectionLimits<T::BlockNumber>, // Collection private restrictions 150    pub variable_on_chain_schema: Vec<u8>, //151    pub const_on_chain_schema: Vec<u8>, //152}153154#[derive(Encode, Decode, Debug, Clone, PartialEq)]155#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]156pub struct NftItemType<AccountId> {157    pub owner: AccountId,158    pub const_data: Vec<u8>,159    pub variable_data: Vec<u8>,160}161162#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]163#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]164pub struct FungibleItemType {165    pub value: u128,166}167168#[derive(Encode, Decode, Debug, Clone, PartialEq)]169#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]170pub struct ReFungibleItemType<AccountId> {171    pub owner: Vec<Ownership<AccountId>>,172    pub const_data: Vec<u8>,173    pub variable_data: Vec<u8>,174}175176177#[derive(Encode, Decode, Debug, Clone, PartialEq)]178#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]179pub struct CollectionLimits<BlockNumber: Encode + Decode> {180    pub account_token_ownership_limit: u32,181    pub sponsored_data_size: u32,182    /// None - setVariableMetadata is not sponsored183    /// Some(v) - setVariableMetadata is sponsored 184    ///           if there is v block between txs185    pub sponsored_data_rate_limit: Option<BlockNumber>,186    pub token_limit: u32,187188    // Timeouts for item types in passed blocks189    pub sponsor_transfer_timeout: u32,190    pub owner_can_transfer: bool,191    pub owner_can_destroy: bool,192}193194impl<BlockNumber: Encode + Decode> Default for CollectionLimits<BlockNumber> {195    fn default() -> Self {196        Self { 197            account_token_ownership_limit: 10_000_000, 198            token_limit: u32::max_value(),199            sponsored_data_size: u32::MAX, 200            sponsored_data_rate_limit: None,201            sponsor_transfer_timeout: 14400,202            owner_can_transfer: true,203            owner_can_destroy: true204        }205    }206}207208#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]209#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]210pub struct ChainLimits {211    pub collection_numbers_limit: u32,212    pub account_token_ownership_limit: u32,213    pub collections_admins_limit: u64,214    pub custom_data_limit: u32,215216    // Timeouts for item types in passed blocks217    pub nft_sponsor_transfer_timeout: u32,218    pub fungible_sponsor_transfer_timeout: u32,219    pub refungible_sponsor_transfer_timeout: u32,220221    // Schema limits222    pub offchain_schema_limit: u32,223    pub variable_on_chain_schema_limit: u32,224    pub const_on_chain_schema_limit: u32,225}226227228#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]229#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]230pub struct CreateNftData {231    pub const_data: Vec<u8>,232    pub variable_data: Vec<u8>,233}234235#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]236#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]237pub struct CreateFungibleData {238    pub value: u128,239}240241#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]242#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]243pub struct CreateReFungibleData {244    pub const_data: Vec<u8>,245    pub variable_data: Vec<u8>,246    pub pieces: u128,247}248249#[derive(Encode, Decode, Debug, Clone, PartialEq)]250#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]251pub enum CreateItemData {252    NFT(CreateNftData),253    Fungible(CreateFungibleData),254    ReFungible(CreateReFungibleData),255}256257impl CreateItemData {258    pub fn len(&self) -> usize {259        let len = match self {260            CreateItemData::NFT(data) => data.variable_data.len() + data.const_data.len(),261            CreateItemData::ReFungible(data) => data.variable_data.len() + data.const_data.len(),262            _ => 0263        };264        265        return len;266    }267}268269impl From<CreateNftData> for CreateItemData {270    fn from(item: CreateNftData) -> Self {271        CreateItemData::NFT(item)272    }273}274275impl From<CreateReFungibleData> for CreateItemData {276    fn from(item: CreateReFungibleData) -> Self {277        CreateItemData::ReFungible(item)278    }279}280281impl From<CreateFungibleData> for CreateItemData {282    fn from(item: CreateFungibleData) -> Self {283        CreateItemData::Fungible(item)284    }285}
addedprimitives/sponsorship/Cargo.tomldiffbeforeafterboth
--- /dev/null
+++ b/primitives/sponsorship/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "up-sponsorship"
+version = "0.1.0"
+edition = "2018"
+
+[dependencies]
+impl-trait-for-tuples = "0.2.1"
+
+[features]
+default = ["std"]
+std = []
\ No newline at end of file
addedprimitives/sponsorship/src/lib.rsdiffbeforeafterboth
--- /dev/null
+++ b/primitives/sponsorship/src/lib.rs
@@ -0,0 +1,42 @@
+#![no_std]
+
+pub trait SponsorshipHandler<AccountId, Call> {
+	fn get_sponsor(who: &AccountId, call: &Call) -> Option<AccountId>;
+}
+
+impl<A, C> SponsorshipHandler<A, C> for () {
+	fn get_sponsor(_who: &A, _call: &C) -> Option<A> {
+		None
+	}
+}
+
+macro_rules! impl_tuples {
+	($($ident:ident)+) => {
+		impl<AccountId, Call, $($ident),+> SponsorshipHandler<AccountId, Call> for ($($ident,)+)
+		where
+			$(
+				$ident: SponsorshipHandler<AccountId, Call>
+			),+
+		{
+			fn get_sponsor(who: &AccountId, call: &Call) -> Option<AccountId> {
+				$(
+					if let Some(account) = $ident::get_sponsor(who, call) {
+						return Some(account);
+					}
+				)+
+				None
+			}
+		}
+	}
+}
+
+impl_tuples! {A}
+impl_tuples! {A B}
+impl_tuples! {A B C}
+impl_tuples! {A B C D}
+impl_tuples! {A B C D E}
+impl_tuples! {A B C D E F}
+impl_tuples! {A B C D E F G}
+impl_tuples! {A B C D E F G H}
+impl_tuples! {A B C D E F G H I}
+impl_tuples! {A B C D E F G H I J}
deletedprimitives/src/lib.rsdiffbeforeafterboth
--- a/primitives/src/lib.rs
+++ /dev/null
@@ -1,285 +0,0 @@
-
-#![cfg_attr(not(feature = "std"), no_std)]
-
-pub use serde::{Serialize, Deserialize};
-
-use frame_system;
-use sp_runtime::sp_std::prelude::Vec;
-use codec::{Decode, Encode};
-pub use frame_support::{
-    construct_runtime, decl_event, decl_module, decl_storage, decl_error,
-    dispatch::DispatchResult,
-    ensure, fail, parameter_types,
-    traits::{
-        Currency, ExistenceRequirement, Get, Imbalance, KeyOwnerProofSystem, OnUnbalanced,
-        Randomness, IsSubType, WithdrawReasons,
-    },
-    weights::{
-        constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
-        DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,
-        WeightToFeePolynomial, DispatchClass,
-    },
-    StorageValue,
-    transactional,
-};
-
-pub const MAX_DECIMAL_POINTS: DecimalPoints = 30;
-pub const MAX_REFUNGIBLE_PIECES: u128 = 1_000_000_000_000_000_000_000;
-pub const MAX_SPONSOR_TIMEOUT: u32 = 10_368_000;
-pub const MAX_TOKEN_OWNERSHIP: u32 = 10_000_000;
-
-pub type CollectionId = u32;
-pub type TokenId = u32;
-pub type DecimalPoints = u8;
-
-#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub enum CollectionMode {
-    Invalid,
-    NFT,
-    // decimal points
-    Fungible(DecimalPoints),
-    ReFungible,
-}
-
-impl Default for CollectionMode {
-    fn default() -> Self {
-        Self::Invalid
-    }
-}
-
-impl Into<u8> for CollectionMode {
-    fn into(self) -> u8 {
-        match self {
-            CollectionMode::Invalid => 0,
-            CollectionMode::NFT => 1,
-            CollectionMode::Fungible(_) => 2,
-            CollectionMode::ReFungible => 3,
-        }
-    }
-}
-
-pub trait SponsoringResolve<AccountId, Call> {
-    fn resolve(
-        who: &AccountId,
-		call: &Call) -> Option<AccountId>;
-}
-
-#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub enum AccessMode {
-    Normal,
-    WhiteList,
-}
-impl Default for AccessMode {
-    fn default() -> Self {
-        Self::Normal
-    }
-}
-
-#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub enum SchemaVersion {
-    ImageURL,
-    Unique,
-}
-impl Default for SchemaVersion {
-    fn default() -> Self {
-        Self::ImageURL
-    }
-}
-
-#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub struct Ownership<AccountId> {
-    pub owner: AccountId,
-    pub fraction: u128,
-}
-
-#[derive(Encode, Decode, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub enum SponsorshipState<AccountId> {
-    /// The fees are applied to the transaction sender
-    Disabled,
-    Unconfirmed(AccountId),
-    /// Transactions are sponsored by specified account
-    Confirmed(AccountId),
-}
-
-impl<AccountId> SponsorshipState<AccountId> {
-    pub fn sponsor(&self) -> Option<&AccountId> {
-        match self {
-            Self::Confirmed(sponsor) => Some(sponsor),
-            _ => None,
-        }
-    }
-
-    pub fn pending_sponsor(&self) -> Option<&AccountId> {
-        match self {
-            Self::Unconfirmed(sponsor) | Self::Confirmed(sponsor) => Some(sponsor),
-            _ => None,
-        }
-    }
-
-    pub fn confirmed(&self) -> bool {
-        matches!(self, Self::Confirmed(_))
-    }
-}
-
-impl<T> Default for SponsorshipState<T> {
-    fn default() -> Self {
-        Self::Disabled
-    }
-}
-
-#[derive(Encode, Decode, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub struct Collection<T: frame_system::Config> {
-    pub owner: T::AccountId,
-    pub mode: CollectionMode,
-    pub access: AccessMode,
-    pub decimal_points: DecimalPoints,
-    pub name: Vec<u16>,        // 64 include null escape char
-    pub description: Vec<u16>, // 256 include null escape char
-    pub token_prefix: Vec<u8>, // 16 include null escape char
-    pub mint_mode: bool,
-    pub offchain_schema: Vec<u8>,
-    pub schema_version: SchemaVersion,
-    pub sponsorship: SponsorshipState<T::AccountId>,
-    pub limits: CollectionLimits<T::BlockNumber>, // Collection private restrictions 
-    pub variable_on_chain_schema: Vec<u8>, //
-    pub const_on_chain_schema: Vec<u8>, //
-}
-
-#[derive(Encode, Decode, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub struct NftItemType<AccountId> {
-    pub owner: AccountId,
-    pub const_data: Vec<u8>,
-    pub variable_data: Vec<u8>,
-}
-
-#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub struct FungibleItemType {
-    pub value: u128,
-}
-
-#[derive(Encode, Decode, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub struct ReFungibleItemType<AccountId> {
-    pub owner: Vec<Ownership<AccountId>>,
-    pub const_data: Vec<u8>,
-    pub variable_data: Vec<u8>,
-}
-
-
-#[derive(Encode, Decode, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub struct CollectionLimits<BlockNumber: Encode + Decode> {
-    pub account_token_ownership_limit: u32,
-    pub sponsored_data_size: u32,
-    /// None - setVariableMetadata is not sponsored
-    /// Some(v) - setVariableMetadata is sponsored 
-    ///           if there is v block between txs
-    pub sponsored_data_rate_limit: Option<BlockNumber>,
-    pub token_limit: u32,
-
-    // Timeouts for item types in passed blocks
-    pub sponsor_transfer_timeout: u32,
-    pub owner_can_transfer: bool,
-    pub owner_can_destroy: bool,
-}
-
-impl<BlockNumber: Encode + Decode> Default for CollectionLimits<BlockNumber> {
-    fn default() -> Self {
-        Self { 
-            account_token_ownership_limit: 10_000_000, 
-            token_limit: u32::max_value(),
-            sponsored_data_size: u32::MAX, 
-            sponsored_data_rate_limit: None,
-            sponsor_transfer_timeout: 14400,
-            owner_can_transfer: true,
-            owner_can_destroy: true
-        }
-    }
-}
-
-#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub struct ChainLimits {
-    pub collection_numbers_limit: u32,
-    pub account_token_ownership_limit: u32,
-    pub collections_admins_limit: u64,
-    pub custom_data_limit: u32,
-
-    // Timeouts for item types in passed blocks
-    pub nft_sponsor_transfer_timeout: u32,
-    pub fungible_sponsor_transfer_timeout: u32,
-    pub refungible_sponsor_transfer_timeout: u32,
-
-    // Schema limits
-    pub offchain_schema_limit: u32,
-    pub variable_on_chain_schema_limit: u32,
-    pub const_on_chain_schema_limit: u32,
-}
-
-
-#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub struct CreateNftData {
-    pub const_data: Vec<u8>,
-    pub variable_data: Vec<u8>,
-}
-
-#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub struct CreateFungibleData {
-    pub value: u128,
-}
-
-#[derive(Encode, Decode, Default, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub struct CreateReFungibleData {
-    pub const_data: Vec<u8>,
-    pub variable_data: Vec<u8>,
-    pub pieces: u128,
-}
-
-#[derive(Encode, Decode, Debug, Clone, PartialEq)]
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
-pub enum CreateItemData {
-    NFT(CreateNftData),
-    Fungible(CreateFungibleData),
-    ReFungible(CreateReFungibleData),
-}
-
-impl CreateItemData {
-    pub fn len(&self) -> usize {
-        let len = match self {
-            CreateItemData::NFT(data) => data.variable_data.len() + data.const_data.len(),
-            CreateItemData::ReFungible(data) => data.variable_data.len() + data.const_data.len(),
-            _ => 0
-        };
-        
-        return len;
-    }
-}
-
-impl From<CreateNftData> for CreateItemData {
-    fn from(item: CreateNftData) -> Self {
-        CreateItemData::NFT(item)
-    }
-}
-
-impl From<CreateReFungibleData> for CreateItemData {
-    fn from(item: CreateReFungibleData) -> Self {
-        CreateItemData::ReFungible(item)
-    }
-}
-
-impl From<CreateFungibleData> for CreateItemData {
-    fn from(item: CreateFungibleData) -> Self {
-        CreateItemData::Fungible(item)
-    }
-}
\ No newline at end of file