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

difftreelog

feat nft benchmarking

Yaroslav Bolyukin2021-08-30parent: #ececb8d.patch.diff
in: master

8 files changed

modifiedMakefilediffbeforeafterboth
--- a/Makefile
+++ b/Makefile
@@ -10,5 +10,9 @@
 bench-evm-migration:
 	make _bench PALLET=evm-migration
 
+.PHONY: bench-nft
+bench-nft:
+	make _bench PALLET=nft
+
 .PHONY: bench
-bench: bench-evm-migration
+bench: bench-evm-migration bench-nft
modifiedpallets/nft/src/benchmarking.rsdiffbeforeafterboth
1#![cfg(feature = "runtime-benchmarks")]1#![cfg(feature = "runtime-benchmarks")]
22
3use super::*;3use super::*;
4use crate::Module as Nft;4use crate::Pallet;
5
6use sp_std::prelude::*;
7use frame_system::RawOrigin;5use frame_system::RawOrigin;
8use frame_benchmarking::{benchmarks, account, whitelisted_caller}; // , TrackedStorageKey,6use frame_benchmarking::{benchmarks, account};
7use nft_data_structs::*;
8use core::convert::TryInto;
9use sp_runtime::DispatchError;
910
10const SEED: u32 = 1;11const SEED: u32 = 1;
11/*12
12fn default_nft_data() -> CreateItemData {13fn create_data(size: usize) -> Vec<u8> {
13 CreateItemData::NFT(CreateNftData { const_data: vec![1, 2, 3], variable_data: vec![3, 2, 1] })14 (0..size).map(|v| (v & 0xff) as u8).collect()
14}15}
1516fn create_u16_data(size: usize) -> Vec<u16> {
16fn default_fungible_data () -> CreateItemData {17 (0..size).map(|v| (v & 0xffff) as u16).collect()
17 CreateItemData::Fungible(CreateFungibleData { })18}
18}19
1920fn default_nft_data() -> CreateItemData {
20fn default_re_fungible_data () -> CreateItemData {21 CreateItemData::NFT(CreateNftData {
21 CreateItemData::ReFungible(CreateReFungibleData { const_data: vec![1, 2, 3], variable_data: vec![3, 2, 1] })22 const_data: create_data(CUSTOM_DATA_LIMIT as usize).try_into().unwrap(),
22}23 variable_data: create_data(CUSTOM_DATA_LIMIT as usize).try_into().unwrap(),
23*/24 })
25}
26
27fn default_fungible_data() -> CreateItemData {
28 CreateItemData::Fungible(CreateFungibleData { value: 1000 })
29}
30
31fn default_re_fungible_data() -> CreateItemData {
32 CreateItemData::ReFungible(CreateReFungibleData {
33 const_data: create_data(CUSTOM_DATA_LIMIT as usize).try_into().unwrap(),
34 variable_data: create_data(CUSTOM_DATA_LIMIT as usize).try_into().unwrap(),
35 pieces: 1000,
36 })
37}
38
39fn create_collection_helper<T: Config>(
40 owner: T::AccountId,
41 mode: CollectionMode,
42) -> Result<CollectionId, DispatchError> {
43 T::Currency::deposit_creating(&owner, T::CollectionCreationPrice::get());
44 let col_name = create_u16_data(MAX_COLLECTION_NAME_LENGTH)
45 .try_into()
46 .unwrap();
47 let col_desc = create_u16_data(MAX_COLLECTION_DESCRIPTION_LENGTH)
48 .try_into()
49 .unwrap();
50 let token_prefix = create_data(MAX_TOKEN_PREFIX_LENGTH).try_into().unwrap();
51 <Pallet<T>>::create_collection(
52 RawOrigin::Signed(owner).into(),
53 col_name,
54 col_desc,
55 token_prefix,
56 mode,
57 )?;
58 Ok(CreatedCollectionCount::get())
59}
60fn create_nft_collection<T: Config>(owner: T::AccountId) -> Result<CollectionId, DispatchError> {
61 create_collection_helper::<T>(owner, CollectionMode::NFT)
62}
63fn create_fungible_collection<T: Config>(
64 owner: T::AccountId,
65) -> Result<CollectionId, DispatchError> {
66 create_collection_helper::<T>(owner, CollectionMode::Fungible(0))
67}
68fn create_refungible_collection<T: Config>(
69 owner: T::AccountId,
70) -> Result<CollectionId, DispatchError> {
71 create_collection_helper::<T>(owner, CollectionMode::ReFungible)
72}
2473
25benchmarks! {74benchmarks! {
2675
27 create_collection {76 create_collection {
28 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();77 let col_name: Vec<u16> = create_u16_data(MAX_COLLECTION_NAME_LENGTH);
78 let col_desc: Vec<u16> = create_u16_data(MAX_COLLECTION_DESCRIPTION_LENGTH);
79 let token_prefix: Vec<u8> = create_data(MAX_TOKEN_PREFIX_LENGTH);
80 let mode: CollectionMode = CollectionMode::NFT;
81 let caller: T::AccountId = account("caller", 0, SEED);
82 T::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());
83 }: _(RawOrigin::Signed(caller.clone()), col_name.clone(), col_desc.clone(), token_prefix.clone(), mode)
84 verify {
85 assert_eq!(<Pallet<T>>::collection_id(2).unwrap().owner, caller);
86 }
87
88 destroy_collection {
89 let caller: T::AccountId = account("caller", 0, SEED);
90 let collection = create_nft_collection::<T>(caller.clone())?;
91 }: _(RawOrigin::Signed(caller.clone()), collection)
92
93 add_to_white_list {
94 let caller: T::AccountId = account("caller", 0, SEED);
95 let whitelist_account: T::AccountId = account("admin", 0, SEED);
96 let collection = create_nft_collection::<T>(caller.clone())?;
97 }: _(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(whitelist_account))
98
99 remove_from_white_list {
100 let caller: T::AccountId = account("caller", 0, SEED);
101 let whitelist_account: T::AccountId = account("admin", 0, SEED);
102 let collection = create_nft_collection::<T>(caller.clone())?;
103 <Pallet<T>>::add_to_white_list(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(whitelist_account.clone()))?;
104 }: _(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(whitelist_account))
105
106 set_public_access_mode {
29 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();107 let caller: T::AccountId = account("caller", 0, SEED);
108 let collection = create_nft_collection::<T>(caller.clone())?;
109 }: _(RawOrigin::Signed(caller.clone()), collection, AccessMode::WhiteList)
110
111 set_mint_permission {
112 let caller: T::AccountId = account("caller", 0, SEED);
113 let collection = create_nft_collection::<T>(caller.clone())?;
114 }: _(RawOrigin::Signed(caller.clone()), collection, true)
115
116 change_collection_owner {
117 let caller: T::AccountId = account("caller", 0, SEED);
118 let collection = create_nft_collection::<T>(caller.clone())?;
119 let new_owner: T::AccountId = account("admin", 0, SEED);
120 }: _(RawOrigin::Signed(caller.clone()), collection, new_owner)
121
122 add_collection_admin {
123 let caller: T::AccountId = account("caller", 0, SEED);
124 let collection = create_nft_collection::<T>(caller.clone())?;
125 let new_admin: T::AccountId = account("admin", 0, SEED);
126 }: _(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(new_admin))
127
128 remove_collection_admin {
129 let caller: T::AccountId = account("caller", 0, SEED);
130 let collection = create_nft_collection::<T>(caller.clone())?;
131 let new_admin: T::AccountId = account("admin", 0, SEED);
132 <Pallet<T>>::add_collection_admin(RawOrigin::Signed(caller.clone()).into(), 2, T::CrossAccountId::from_sub(new_admin.clone()))?;
133 }: _(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(new_admin))
134
135 set_collection_sponsor {
30 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();136 let caller: T::AccountId = account("caller", 0, SEED);
137 let collection = create_nft_collection::<T>(caller.clone())?;
138 }: _(RawOrigin::Signed(caller.clone()), collection, caller.clone())
139
140 confirm_sponsorship {
141 let caller: T::AccountId = account("caller", 0, SEED);
142 let collection = create_nft_collection::<T>(caller.clone())?;
143 <Pallet<T>>::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?;
144 }: _(RawOrigin::Signed(caller.clone()), collection)
145
146 remove_collection_sponsor {
31 let mode: CollectionMode = CollectionMode::NFT;147 let caller: T::AccountId = account("caller", 0, SEED);
148 let collection = create_nft_collection::<T>(caller.clone())?;
149 <Pallet<T>>::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?;
150 <Pallet<T>>::confirm_sponsorship(RawOrigin::Signed(caller.clone()).into(), 2)?;
151 }: _(RawOrigin::Signed(caller.clone()), collection)
152
153 // nft item
154 create_item_nft {
155 let b in 0..(CUSTOM_DATA_LIMIT * 2);
156
157 let caller: T::AccountId = account("caller", 0, SEED);
158 let collection = create_nft_collection::<T>(caller.clone())?;
159 let data = CreateItemData::NFT(CreateNftData {
160 const_data: create_data(b.min(CUSTOM_DATA_LIMIT) as usize).try_into().unwrap(),
161 variable_data: create_data(b.saturating_sub(CUSTOM_DATA_LIMIT) as usize).try_into().unwrap(),
162 });
163 }: create_item(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)
164
165 // fungible item
166 create_item_fungible {
32 let caller: T::AccountId = account("caller", 0, SEED);167 let caller: T::AccountId = account("caller", 0, SEED);
168 let collection = create_fungible_collection::<T>(caller.clone())?;
169 let data = CreateItemData::Fungible(CreateFungibleData {
170 value: 1000,
171 });
33 }: _(RawOrigin::Signed(caller.clone()), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode)172 }: create_item(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)
34/*173
35 verify {174 // refungible item
36 assert_eq!(Nft::<T>::collection_id(2).owner, caller);175 create_item_refungible {
37 }176 let b in 0..(CUSTOM_DATA_LIMIT * 2);
38 destroy_collection {177
39 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();178 let caller: T::AccountId = account("caller", 0, SEED);
40 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();179 let collection = create_refungible_collection::<T>(caller.clone())?;
41 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();180 let data = CreateItemData::ReFungible(CreateReFungibleData {
42 let mode: CollectionMode = CollectionMode::NFT;181 const_data: create_data(b.min(CUSTOM_DATA_LIMIT) as usize).try_into().unwrap(),
43 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());182 variable_data: create_data(b.saturating_sub(CUSTOM_DATA_LIMIT) as usize).try_into().unwrap(),
44 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;183 pieces: 1000,
45 }: _(RawOrigin::Signed(caller.clone()), 2)184 });
46185 }: create_item(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)
47 add_to_white_list {186
48 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();187 burn_item_nft {
49 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();188 let caller: T::AccountId = account("caller", 0, SEED);
50 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();189 let collection = create_nft_collection::<T>(caller.clone())?;
51 let mode: CollectionMode = CollectionMode::NFT;190 let data = default_nft_data();
52 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());191 <Pallet<T>>::create_item(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(caller.clone()), data)?;
53 let whitelist_account: T::AccountId = account("admin", 0, SEED);192 }: burn_item(RawOrigin::Signed(caller.clone()), collection, 1, 1)
54 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;193
55 }: add_to_white_list(RawOrigin::Signed(caller.clone()), 2, whitelist_account)194 transfer_nft {
56195 let caller: T::AccountId = account("caller", 0, SEED);
57 remove_from_white_list {196 let collection = create_nft_collection::<T>(caller.clone())?;
58 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();197 let recipient: T::AccountId = account("recipient", 0, SEED);
59 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();198 let data = default_nft_data();
60 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();199 <Pallet<T>>::create_item(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(caller.clone()), data)?;
61 let mode: CollectionMode = CollectionMode::NFT;200 }: transfer(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), collection, 1, 1)
62 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());201
63 let whitelist_account: T::AccountId = account("admin", 0, SEED);202 transfer_fungible {
64 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;203 let caller: T::AccountId = account("caller", 0, SEED);
65 Nft::<T>::add_to_white_list(RawOrigin::Signed(caller.clone()).into(), 2, whitelist_account.clone())?;204 let collection = create_fungible_collection::<T>(caller.clone())?;
66 }: remove_from_white_list(RawOrigin::Signed(caller.clone()), 2, whitelist_account)205 let recipient: T::AccountId = account("recipient", 0, SEED);
67206 let data = default_fungible_data();
68 set_public_access_mode {207 <Pallet<T>>::create_item(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(caller.clone()), data)?;
69 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();208 }: transfer(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), collection, 1, 1)
70 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();209
71 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();210 transfer_refungible {
72 let mode: CollectionMode = CollectionMode::NFT;211 let caller: T::AccountId = account("caller", 0, SEED);
73 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());212 let collection = create_refungible_collection::<T>(caller.clone())?;
74 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;213 let recipient: T::AccountId = account("recipient", 0, SEED);
75 }: set_public_access_mode(RawOrigin::Signed(caller.clone()), 2, AccessMode::WhiteList)214 let data = default_re_fungible_data();
76215 <Pallet<T>>::create_item(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(caller.clone()), data)?;
77 set_mint_permission {216 }: transfer(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), collection, 1, 1)
78 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();217
79 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();218 approve_nft {
80 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();219 let caller: T::AccountId = account("caller", 0, SEED);
81 let mode: CollectionMode = CollectionMode::NFT;220 let collection = create_nft_collection::<T>(caller.clone())?;
82 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());221 let recipient: T::AccountId = account("recipient", 0, SEED);
83 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;222 let data = default_nft_data();
84 }: set_mint_permission(RawOrigin::Signed(caller.clone()), 2, true)223 <Pallet<T>>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, T::CrossAccountId::from_sub(caller.clone()), data)?;
85224 }: approve(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), collection, 1, 1)
86 change_collection_owner {225
87 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();226 // Nft
88 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();227 transfer_from_nft {
89 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();228 let caller: T::AccountId = account("caller", 0, SEED);
90 let mode: CollectionMode = CollectionMode::NFT;229 let collection = create_nft_collection::<T>(caller.clone())?;
91 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());230 let recipient: T::AccountId = account("recipient", 0, SEED);
92 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;231 let data = default_nft_data();
93 let new_owner: T::AccountId = account("admin", 0, SEED);232 <Pallet<T>>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, T::CrossAccountId::from_sub(caller.clone()), data)?;
94 }: change_collection_owner(RawOrigin::Signed(caller.clone()), 2, new_owner)233 <Pallet<T>>::approve(RawOrigin::Signed(caller.clone()).into(), T::CrossAccountId::from_sub(recipient.clone()), 2, 1, 1)?;
95234 }: transfer_from(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), 2, 1, 1)
96 add_collection_admin {235
97 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();236 // Fungible
98 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();237 transfer_from_fungible {
99 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();238 let caller: T::AccountId = account("caller", 0, SEED);
100 let mode: CollectionMode = CollectionMode::NFT;239 let collection = create_fungible_collection::<T>(caller.clone())?;
101 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());240 let recipient: T::AccountId = account("recipient", 0, SEED);
102 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;241 let data = default_fungible_data();
103 let new_admin: T::AccountId = account("admin", 0, SEED);242 <Pallet<T>>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, T::CrossAccountId::from_sub(caller.clone()), data)?;
104 }: add_collection_admin(RawOrigin::Signed(caller.clone()), 2, new_admin)243 <Pallet<T>>::approve(RawOrigin::Signed(caller.clone()).into(), T::CrossAccountId::from_sub(recipient.clone()), 2, 1, 1)?;
105244 }: transfer_from(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), 2, 1, 1)
106 remove_collection_admin {245
107 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();246 // ReFungible
108 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();247 transfer_from_refungible {
109 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();248 let caller: T::AccountId = account("caller", 0, SEED);
110 let mode: CollectionMode = CollectionMode::NFT;249 let collection = create_refungible_collection::<T>(caller.clone())?;
111 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());250 let recipient: T::AccountId = account("recipient", 0, SEED);
112 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;251 let data = default_re_fungible_data();
113 let new_admin: T::AccountId = account("admin", 0, SEED);252 <Pallet<T>>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, T::CrossAccountId::from_sub(caller.clone()), data)?;
114 Nft::<T>::add_collection_admin(RawOrigin::Signed(caller.clone()).into(), 2, new_admin.clone())?;253 <Pallet<T>>::approve(RawOrigin::Signed(caller.clone()).into(), T::CrossAccountId::from_sub(recipient.clone()), 2, 1, 1)?;
115 }: remove_collection_admin(RawOrigin::Signed(caller.clone()), 2, new_admin)254 }: transfer_from(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), 2, 1, 1)
116255
117 set_collection_sponsor {256 set_offchain_schema {
118 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();257 let b in 0..OFFCHAIN_SCHEMA_LIMIT;
119 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();258
120 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();259 let caller: T::AccountId = account("caller", 0, SEED);
121 let mode: CollectionMode = CollectionMode::NFT;260 let collection = create_nft_collection::<T>(caller.clone())?;
122 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());261 let data = create_data(b as usize);
123 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;262 }: set_offchain_schema(RawOrigin::Signed(caller.clone()), collection, data)
124 }: set_collection_sponsor(RawOrigin::Signed(caller.clone()), 2, caller.clone())263
125264 set_const_on_chain_schema {
126 confirm_sponsorship {265 let b in 0..CONST_ON_CHAIN_SCHEMA_LIMIT;
127 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();266
128 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();267 let caller: T::AccountId = account("caller", 0, SEED);
129 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();268 let collection = create_nft_collection::<T>(caller.clone())?;
130 let mode: CollectionMode = CollectionMode::NFT;269 let data = create_data(b as usize);
131 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());270 }: set_const_on_chain_schema(RawOrigin::Signed(caller.clone()), collection, data)
132 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;271
133 Nft::<T>::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?;272 set_variable_on_chain_schema {
134 }: confirm_sponsorship(RawOrigin::Signed(caller.clone()), 2)273 let b in 0..VARIABLE_ON_CHAIN_SCHEMA_LIMIT;
135274
136 remove_collection_sponsor {275 let caller: T::AccountId = account("caller", 0, SEED);
137 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();276 let collection = create_nft_collection::<T>(caller.clone())?;
138 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();277 let data = create_data(b as usize);
139 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();278 }: set_variable_on_chain_schema(RawOrigin::Signed(caller.clone()), 2, data)
140 let mode: CollectionMode = CollectionMode::NFT;279
141 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());280 set_variable_meta_data_nft {
142 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;281 let b in 0..CUSTOM_DATA_LIMIT;
143 Nft::<T>::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?;282
144 Nft::<T>::confirm_sponsorship(RawOrigin::Signed(caller.clone()).into(), 2)?;283 let caller: T::AccountId = account("caller", 0, SEED);
145 }: remove_collection_sponsor(RawOrigin::Signed(caller.clone()), 2)284 let collection = create_nft_collection::<T>(caller.clone())?;
146285 let data = default_nft_data();
147 // nft item286 <Pallet<T>>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, T::CrossAccountId::from_sub(caller.clone()), data)?;
148 create_item_nft {287 let data = create_data(b as usize);
149 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();288 }: set_variable_meta_data(RawOrigin::Signed(caller.clone()), collection, 1, data)
150 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();289
151 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();290 set_schema_version {
152 let mode: CollectionMode = CollectionMode::NFT;291 let caller: T::AccountId = account("caller", 0, SEED);
153 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());292 let collection = create_nft_collection::<T>(caller.clone())?;
154 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;293 }: set_schema_version(RawOrigin::Signed(caller.clone()), 2, SchemaVersion::Unique)
155 let data = default_nft_data();294
156295 set_collection_limits{
157 }: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data)296 let caller: T::AccountId = account("caller", 0, SEED);
158297 let collection = create_nft_collection::<T>(caller.clone())?;
159 #[extra]298
160 create_item_nft_large {299 let cl = CollectionLimits {
161 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();300 account_token_ownership_limit: 0,
162 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();301 sponsored_data_size: 0,
163 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();302 token_limit: 1,
164 let mode: CollectionMode = CollectionMode::NFT;303 sponsor_transfer_timeout: 0,
165 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());304 owner_can_destroy: true,
166 let mut nft_data = CreateNftData {305 owner_can_transfer: true,
167 const_data: vec![],306 sponsored_data_rate_limit: None,
168 variable_data: vec![]307 };
169 };308 }: set_collection_limits(RawOrigin::Signed(caller.clone()), 2, cl)
170 for i in 0..1998 {
171 nft_data.const_data.push(10);
172 nft_data.variable_data.push(10);
173 }
174 let data = CreateItemData::NFT(nft_data);
175 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
176
177 }: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data)
178
179 // fungible item
180 create_item_fungible {
181 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
182 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
183 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
184 let mode: CollectionMode = CollectionMode::Fungible(3);
185 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
186 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
187 let data = default_fungible_data();
188
189 }: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data)
190
191 // refungible item
192 create_item_refungible {
193 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
194 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
195 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
196 let mode: CollectionMode = CollectionMode::ReFungible(3);
197 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
198 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
199 let data = default_re_fungible_data();
200
201 }: create_item(RawOrigin::Signed(caller.clone()), 2, caller.clone(), data)
202
203 burn_item {
204 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
205 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
206 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
207 let mode: CollectionMode = CollectionMode::NFT;
208 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
209 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
210 let data = default_nft_data();
211 Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
212
213 }: burn_item(RawOrigin::Signed(caller.clone()), 2, 1)
214
215 transfer_nft {
216 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
217 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
218 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
219 let mode: CollectionMode = CollectionMode::NFT;
220 let recipient: T::AccountId = account("recipient", 0, SEED);
221 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
222 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
223 let data = default_nft_data();
224 Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
225
226 }: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1)
227
228 transfer_fungible {
229 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
230 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
231 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
232 let mode: CollectionMode = CollectionMode::Fungible(3);
233 let recipient: T::AccountId = account("recipient", 0, SEED);
234 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
235 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
236 let data = default_fungible_data();
237 Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
238
239 }: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1)
240
241 transfer_refungible {
242 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
243 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
244 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
245 let mode: CollectionMode = CollectionMode::ReFungible(3);
246 let recipient: T::AccountId = account("recipient", 0, SEED);
247 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
248 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
249 let data = default_re_fungible_data();
250 Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
251
252 }: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1)
253
254 approve {
255 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
256 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
257 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
258 let mode: CollectionMode = CollectionMode::ReFungible(3);
259 let recipient: T::AccountId = account("recipient", 0, SEED);
260 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
261 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
262 let data = default_re_fungible_data();
263 Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
264
265 }: approve(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1)
266
267 // Nft
268 transfer_from_nft {
269 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
270 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
271 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
272 let mode: CollectionMode = CollectionMode::NFT;
273 let recipient: T::AccountId = account("recipient", 0, SEED);
274 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
275 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
276 let data = default_nft_data();
277 Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
278 Nft::<T>::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?;
279
280 }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)
281
282 // Fungible
283 transfer_from_fungible {
284 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
285 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
286 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
287 let mode: CollectionMode = CollectionMode::Fungible(3);
288 let recipient: T::AccountId = account("recipient", 0, SEED);
289 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
290 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
291 let data = default_fungible_data();
292 Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
293 Nft::<T>::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?;
294
295 }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)
296
297 // ReFungible
298 transfer_from_refungible {
299 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
300 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
301 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
302 let mode: CollectionMode = CollectionMode::ReFungible(3);
303 let recipient: T::AccountId = account("recipient", 0, SEED);
304 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
305 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
306 let data = default_re_fungible_data();
307 Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
308 Nft::<T>::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?;
309
310 }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)
311
312 enable_contract_sponsoring {
313 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
314
315 }: enable_contract_sponsoring(RawOrigin::Signed(caller.clone()), caller.clone(), true)
316
317 set_offchain_schema {
318 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
319 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
320 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
321 let mode: CollectionMode = CollectionMode::ReFungible(3);
322 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
323 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
324
325 }: set_offchain_schema(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec())
326
327 set_const_on_chain_schema {
328 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
329 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
330 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
331 let mode: CollectionMode = CollectionMode::ReFungible(3);
332 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
333 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
334 }: set_const_on_chain_schema(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec())
335
336 set_variable_on_chain_schema {
337 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
338 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
339 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
340 let mode: CollectionMode = CollectionMode::ReFungible(3);
341 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
342 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
343 }: set_variable_on_chain_schema(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec())
344
345 set_variable_meta_data {
346 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
347 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
348 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
349 let mode: CollectionMode = CollectionMode::NFT;
350 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
351 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
352 let data = default_nft_data();
353 Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone(), data)?;
354
355 }: set_variable_meta_data(RawOrigin::Signed(caller.clone()), 2, 1, [1, 2, 3].to_vec())
356
357 set_schema_version {
358 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
359 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
360 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
361 let mode: CollectionMode = CollectionMode::NFT;
362 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
363 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
364 }: set_schema_version(RawOrigin::Signed(caller.clone()), 2, SchemaVersion::Unique)
365
366 set_chain_limits {
367 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
368 let limits = ChainLimits {
369 collection_numbers_limit: 0,
370 account_token_ownership_limit: 0,
371 collections_admins_limit: 0,
372 custom_data_limit: 0,
373 nft_sponsor_transfer_timeout: 0,
374 fungible_sponsor_transfer_timeout: 0,
375 refungible_sponsor_transfer_timeout: 0
376 };
377 }: set_chain_limits(RawOrigin::Signed(caller.clone()), limits)
378
379 set_contract_sponsoring_rate_limit {
380 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
381 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
382 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
383 let mode: CollectionMode = CollectionMode::NFT;
384 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
385 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
386 let block_number: T::BlockNumber = 0.into();
387 }: set_contract_sponsoring_rate_limit(RawOrigin::Signed(caller.clone()), caller.clone(), block_number)
388
389 set_collection_limits{
390 let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
391 let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
392 let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
393 let mode: CollectionMode = CollectionMode::NFT;
394 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
395 Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;
396
397 let cl = CollectionLimits {
398 account_token_ownership_limit: 0,
399 sponsored_data_size: 0,
400 token_limit: 0,
401 sponsor_transfer_timeout: 0
402 };
403
404 }: set_collection_limits(RawOrigin::Signed(caller.clone()), 2, cl)
405
406 add_to_contract_white_list{
407 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
408 }: add_to_contract_white_list(RawOrigin::Signed(caller.clone()), caller.clone(), caller.clone())
409
410 remove_from_contract_white_list{
411 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
412 Nft::<T>::add_to_contract_white_list(RawOrigin::Signed(caller.clone()).into(), caller.clone(), caller.clone())?;
413 }: remove_from_contract_white_list(RawOrigin::Signed(caller.clone()), caller.clone(), caller.clone())
414
415 toggle_contract_white_list{
416 let caller: T::AccountId = T::AccountId::from(whitelisted_caller());
417 }: toggle_contract_white_list(RawOrigin::Signed(caller.clone()), caller.clone(), true)
418*/
419}309}
420310
deletedpallets/nft/src/default_weights.rsdiffbeforeafterboth
--- a/pallets/nft/src/default_weights.rs
+++ /dev/null
@@ -1,150 +0,0 @@
-use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};
-
-impl crate::WeightInfo for () {
-	fn create_collection() -> Weight {
-		70_000_000_u64
-			.saturating_add(DbWeight::get().reads(7_u64))
-			.saturating_add(DbWeight::get().writes(5_u64))
-	}
-	fn destroy_collection() -> Weight {
-		90_000_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(5_u64))
-	}
-	fn add_to_white_list() -> Weight {
-		30_000_000_u64
-			.saturating_add(DbWeight::get().reads(3_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn remove_from_white_list() -> Weight {
-		35_000_000_u64
-			.saturating_add(DbWeight::get().reads(3_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_public_access_mode() -> Weight {
-		27_000_000_u64
-			.saturating_add(DbWeight::get().reads(1_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_mint_permission() -> Weight {
-		27_000_000_u64
-			.saturating_add(DbWeight::get().reads(1_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn change_collection_owner() -> Weight {
-		27_000_000_u64
-			.saturating_add(DbWeight::get().reads(1_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn add_collection_admin() -> Weight {
-		32_000_000_u64
-			.saturating_add(DbWeight::get().reads(3_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn remove_collection_admin() -> Weight {
-		50_000_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_collection_sponsor() -> Weight {
-		32_000_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn confirm_sponsorship() -> Weight {
-		22_000_000_u64
-			.saturating_add(DbWeight::get().reads(1_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn remove_collection_sponsor() -> Weight {
-		24_000_000_u64
-			.saturating_add(DbWeight::get().reads(1_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn create_item(s: usize) -> Weight {
-		130_000_000_u64
-			.saturating_add(2135_u64.saturating_mul(s as Weight).saturating_mul(500_u64)) // 500 is temporary multiplier, fee for storage
-			.saturating_add(DbWeight::get().reads(10_u64))
-			.saturating_add(DbWeight::get().writes(8_u64))
-	}
-	fn burn_item() -> Weight {
-		170_000_000_u64
-			.saturating_add(DbWeight::get().reads(9_u64))
-			.saturating_add(DbWeight::get().writes(7_u64))
-	}
-	fn transfer() -> Weight {
-		125_000_000_u64
-			.saturating_add(DbWeight::get().reads(7_u64))
-			.saturating_add(DbWeight::get().writes(7_u64))
-	}
-	fn approve() -> Weight {
-		45_000_000_u64
-			.saturating_add(DbWeight::get().reads(3_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn transfer_from() -> Weight {
-		150_000_000_u64
-			.saturating_add(DbWeight::get().reads(9_u64))
-			.saturating_add(DbWeight::get().writes(8_u64))
-	}
-	fn set_offchain_schema() -> Weight {
-		33_000_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_const_on_chain_schema() -> Weight {
-		11_100_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_variable_on_chain_schema() -> Weight {
-		11_100_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_variable_meta_data() -> Weight {
-		17_500_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn enable_contract_sponsoring() -> Weight {
-		13_000_000_u64
-			.saturating_add(DbWeight::get().reads(1_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_schema_version() -> Weight {
-		8_500_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_contract_sponsoring_rate_limit() -> Weight {
-		3_500_000_u64
-			.saturating_add(DbWeight::get().reads(0_u64))
-			.saturating_add(DbWeight::get().writes(2_u64))
-	}
-	fn set_variable_meta_data_sponsoring_rate_limit() -> Weight {
-		3_500_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn toggle_contract_white_list() -> Weight {
-		3_000_000_u64
-			.saturating_add(DbWeight::get().reads(0_u64))
-			.saturating_add(DbWeight::get().writes(2_u64))
-	}
-	fn add_to_contract_white_list() -> Weight {
-		3_000_000_u64
-			.saturating_add(DbWeight::get().reads(0_u64))
-			.saturating_add(DbWeight::get().writes(2_u64))
-	}
-	fn remove_from_contract_white_list() -> Weight {
-		3_200_000_u64
-			.saturating_add(DbWeight::get().reads(0_u64))
-			.saturating_add(DbWeight::get().writes(2_u64))
-	}
-	fn set_collection_limits() -> Weight {
-		8_900_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-}
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -40,8 +40,9 @@
 	MAX_DECIMAL_POINTS, MAX_SPONSOR_TIMEOUT, MAX_TOKEN_OWNERSHIP, MAX_REFUNGIBLE_PIECES,
 	CUSTOM_DATA_LIMIT, COLLECTION_NUMBER_LIMIT, ACCOUNT_TOKEN_OWNERSHIP_LIMIT,
 	VARIABLE_ON_CHAIN_SCHEMA_LIMIT, CONST_ON_CHAIN_SCHEMA_LIMIT, COLLECTION_ADMINS_LIMIT,
-	OFFCHAIN_SCHEMA_LIMIT, AccessMode, Collection, CreateItemData, CollectionLimits, CollectionId,
-	CollectionMode, TokenId, SchemaVersion, SponsorshipState, Ownership, NftItemType,
+	OFFCHAIN_SCHEMA_LIMIT, MAX_TOKEN_PREFIX_LENGTH, MAX_COLLECTION_NAME_LENGTH,
+	MAX_COLLECTION_DESCRIPTION_LENGTH, AccessMode, Collection, CreateItemData, CollectionLimits,
+	CollectionId, CollectionMode, TokenId, SchemaVersion, SponsorshipState, Ownership, NftItemType,
 	FungibleItemType, ReFungibleItemType,
 };
 
@@ -51,7 +52,6 @@
 #[cfg(test)]
 mod tests;
 
-mod default_weights;
 mod eth;
 mod sponsorship;
 pub use sponsorship::NftSponsorshipHandler;
@@ -63,38 +63,8 @@
 
 #[cfg(feature = "runtime-benchmarks")]
 mod benchmarking;
-
-pub trait WeightInfo {
-	fn create_collection() -> Weight;
-	fn destroy_collection() -> Weight;
-	fn add_to_white_list() -> Weight;
-	fn remove_from_white_list() -> Weight;
-	fn set_public_access_mode() -> Weight;
-	fn set_mint_permission() -> Weight;
-	fn change_collection_owner() -> Weight;
-	fn add_collection_admin() -> Weight;
-	fn remove_collection_admin() -> Weight;
-	fn set_collection_sponsor() -> Weight;
-	fn confirm_sponsorship() -> Weight;
-	fn remove_collection_sponsor() -> Weight;
-	fn create_item(s: usize) -> Weight;
-	fn burn_item() -> Weight;
-	fn transfer() -> Weight;
-	fn approve() -> Weight;
-	fn transfer_from() -> Weight;
-	fn set_offchain_schema() -> Weight;
-	fn set_const_on_chain_schema() -> Weight;
-	fn set_variable_on_chain_schema() -> Weight;
-	fn set_variable_meta_data() -> Weight;
-	fn enable_contract_sponsoring() -> Weight;
-	fn set_schema_version() -> Weight;
-	fn set_contract_sponsoring_rate_limit() -> Weight;
-	fn set_variable_meta_data_sponsoring_rate_limit() -> Weight;
-	fn toggle_contract_white_list() -> Weight;
-	fn add_to_contract_white_list() -> Weight;
-	fn remove_from_contract_white_list() -> Weight;
-	fn set_collection_limits() -> Weight;
-}
+pub mod weights;
+use weights::WeightInfo;
 
 decl_error! {
 	/// Error for non-fungible-token module.
@@ -246,6 +216,39 @@
 	type TreasuryAccountId: Get<Self::AccountId>;
 }
 
+type SelfWeightOf<T> = <T as Config>::WeightInfo;
+
+trait WeightInfoHelpers: WeightInfo {
+	fn transfer() -> Weight {
+		Self::transfer_nft()
+			.max(Self::transfer_fungible())
+			.max(Self::transfer_refungible())
+	}
+	fn transfer_from() -> Weight {
+		Self::transfer_from_nft()
+			.max(Self::transfer_from_fungible())
+			.max(Self::transfer_from_refungible())
+	}
+	fn approve() -> Weight {
+		// TODO: refungible, fungible
+		Self::approve_nft()
+	}
+	fn set_variable_meta_data(data: u32) -> Weight {
+		// TODO: refungible
+		Self::set_variable_meta_data_nft(data)
+	}
+	fn create_item(data: u32) -> Weight {
+		Self::create_item_nft(data)
+			.max(Self::create_item_fungible())
+			.max(Self::create_item_refungible(data))
+	}
+	fn burn_item() -> Weight {
+		// TODO: refungible, fungible
+		Self::burn_item_nft()
+	}
+}
+impl<T: WeightInfo> WeightInfoHelpers for T {}
+
 // # Used definitions
 //
 // ## User control levels
@@ -455,7 +458,7 @@
 		///
 		/// * mode: [CollectionMode] collection type and type dependent data.
 		// returns collection ID
-		#[weight = <T as Config>::WeightInfo::create_collection()]
+		#[weight = <SelfWeightOf<T>>::create_collection()]
 		#[transactional]
 		pub fn create_collection(origin,
 								 collection_name: Vec<u16>,
@@ -492,9 +495,9 @@
 
 			// check params
 			ensure!(decimal_points <= MAX_DECIMAL_POINTS, Error::<T>::CollectionDecimalPointLimitExceeded);
-			ensure!(collection_name.len() <= 64, Error::<T>::CollectionNameLimitExceeded);
-			ensure!(collection_description.len() <= 256, Error::<T>::CollectionDescriptionLimitExceeded);
-			ensure!(token_prefix.len() <= 16, Error::<T>::CollectionTokenPrefixLimitExceeded);
+			ensure!(collection_name.len() <= MAX_COLLECTION_NAME_LENGTH, Error::<T>::CollectionNameLimitExceeded);
+			ensure!(collection_description.len() <= MAX_COLLECTION_DESCRIPTION_LENGTH, Error::<T>::CollectionDescriptionLimitExceeded);
+			ensure!(token_prefix.len() <= MAX_TOKEN_PREFIX_LENGTH, Error::<T>::CollectionTokenPrefixLimitExceeded);
 
 			// Generate next collection ID
 			let next_id = created_count
@@ -545,7 +548,7 @@
 		/// # Arguments
 		///
 		/// * collection_id: collection to destroy.
-		#[weight = <T as Config>::WeightInfo::destroy_collection()]
+		#[weight = <SelfWeightOf<T>>::destroy_collection()]
 		#[transactional]
 		pub fn destroy_collection(origin, collection_id: CollectionId) -> DispatchResult {
 
@@ -593,7 +596,7 @@
 		/// * collection_id.
 		///
 		/// * address.
-		#[weight = <T as Config>::WeightInfo::add_to_white_list()]
+		#[weight = <SelfWeightOf<T>>::add_to_white_list()]
 		#[transactional]
 		pub fn add_to_white_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
 
@@ -622,7 +625,7 @@
 		/// * collection_id.
 		///
 		/// * address.
-		#[weight = <T as Config>::WeightInfo::remove_from_white_list()]
+		#[weight = <SelfWeightOf<T>>::remove_from_white_list()]
 		#[transactional]
 		pub fn remove_from_white_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
 
@@ -650,7 +653,7 @@
 		/// * collection_id.
 		///
 		/// * mode: [AccessMode]
-		#[weight = <T as Config>::WeightInfo::set_public_access_mode()]
+		#[weight = <SelfWeightOf<T>>::set_public_access_mode()]
 		#[transactional]
 		pub fn set_public_access_mode(origin, collection_id: CollectionId, mode: AccessMode) -> DispatchResult
 		{
@@ -675,7 +678,7 @@
 		/// * collection_id.
 		///
 		/// * mint_permission: Boolean parameter. If True, allows minting to Anyone with conditions above.
-		#[weight = <T as Config>::WeightInfo::set_mint_permission()]
+		#[weight = <SelfWeightOf<T>>::set_mint_permission()]
 		#[transactional]
 		pub fn set_mint_permission(origin, collection_id: CollectionId, mint_permission: bool) -> DispatchResult
 		{
@@ -698,7 +701,7 @@
 		/// * collection_id.
 		///
 		/// * new_owner.
-		#[weight = <T as Config>::WeightInfo::change_collection_owner()]
+		#[weight = <SelfWeightOf<T>>::change_collection_owner()]
 		#[transactional]
 		pub fn change_collection_owner(origin, collection_id: CollectionId, new_owner: T::AccountId) -> DispatchResult {
 
@@ -722,7 +725,7 @@
 		/// * collection_id: ID of the Collection to add admin for.
 		///
 		/// * new_admin_id: Address of new admin to add.
-		#[weight = <T as Config>::WeightInfo::add_collection_admin()]
+		#[weight = <SelfWeightOf<T>>::add_collection_admin()]
 		#[transactional]
 		pub fn add_collection_admin(origin, collection_id: CollectionId, new_admin_id: T::CrossAccountId) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
@@ -753,7 +756,7 @@
 		/// * collection_id: ID of the Collection to remove admin for.
 		///
 		/// * account_id: Address of admin to remove.
-		#[weight = <T as Config>::WeightInfo::remove_collection_admin()]
+		#[weight = <SelfWeightOf<T>>::remove_collection_admin()]
 		#[transactional]
 		pub fn remove_collection_admin(origin, collection_id: CollectionId, account_id: T::CrossAccountId) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
@@ -777,7 +780,7 @@
 		/// * collection_id.
 		///
 		/// * new_sponsor.
-		#[weight = <T as Config>::WeightInfo::set_collection_sponsor()]
+		#[weight = <SelfWeightOf<T>>::set_collection_sponsor()]
 		#[transactional]
 		pub fn set_collection_sponsor(origin, collection_id: CollectionId, new_sponsor: T::AccountId) -> DispatchResult {
 			let sender = ensure_signed(origin)?;
@@ -795,7 +798,7 @@
 		/// # Arguments
 		///
 		/// * collection_id.
-		#[weight = <T as Config>::WeightInfo::confirm_sponsorship()]
+		#[weight = <SelfWeightOf<T>>::confirm_sponsorship()]
 		#[transactional]
 		pub fn confirm_sponsorship(origin, collection_id: CollectionId) -> DispatchResult {
 			let sender = ensure_signed(origin)?;
@@ -819,7 +822,7 @@
 		/// # Arguments
 		///
 		/// * collection_id.
-		#[weight = <T as Config>::WeightInfo::remove_collection_sponsor()]
+		#[weight = <SelfWeightOf<T>>::remove_collection_sponsor()]
 		#[transactional]
 		pub fn remove_collection_sponsor(origin, collection_id: CollectionId) -> DispatchResult {
 			let sender = ensure_signed(origin)?;
@@ -855,7 +858,7 @@
 		// .saturating_add(RocksDbWeight::get().reads(10 as Weight))
 		// .saturating_add(RocksDbWeight::get().writes(8 as Weight))]
 
-		#[weight = <T as Config>::WeightInfo::create_item(data.data_size())]
+		#[weight = <SelfWeightOf<T>>::create_item(data.data_size() as u32)]
 		#[transactional]
 		pub fn create_item(origin, collection_id: CollectionId, owner: T::CrossAccountId, data: CreateItemData) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
@@ -884,8 +887,8 @@
 		/// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].
 		///
 		/// * owner: Address, initial owner of the NFT.
-		#[weight = <T as Config>::WeightInfo::create_item(items_data.iter()
-							   .map(|data| { data.data_size() })
+		#[weight = <SelfWeightOf<T>>::create_item(items_data.iter()
+							   .map(|data| { data.data_size() as u32 })
 							   .sum())]
 		#[transactional]
 		pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResult {
@@ -912,7 +915,7 @@
 		/// * collection_id: ID of the collection.
 		///
 		/// * value: New flag value.
-		#[weight = <T as Config>::WeightInfo::burn_item()]
+		#[weight = <SelfWeightOf<T>>::burn_item()]
 		#[transactional]
 		pub fn set_transfers_enabled_flag(origin, collection_id: CollectionId, value: bool) -> DispatchResult {
 
@@ -938,7 +941,7 @@
 		/// * collection_id: ID of the collection.
 		///
 		/// * item_id: ID of NFT to burn.
-		#[weight = <T as Config>::WeightInfo::burn_item()]
+		#[weight = <SelfWeightOf<T>>::burn_item()]
 		#[transactional]
 		pub fn burn_item(origin, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResult {
 
@@ -973,7 +976,7 @@
 		///     * Non-Fungible Mode: Ignored
 		///     * Fungible Mode: Must specify transferred amount
 		///     * Re-Fungible Mode: Must specify transferred portion (between 0 and 1)
-		#[weight = <T as Config>::WeightInfo::transfer()]
+		#[weight = <SelfWeightOf<T>>::transfer()]
 		#[transactional]
 		pub fn transfer(origin, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
@@ -999,7 +1002,7 @@
 		/// * collection_id.
 		///
 		/// * item_id: ID of the item.
-		#[weight = <T as Config>::WeightInfo::approve()]
+		#[weight = <SelfWeightOf<T>>::approve()]
 		#[transactional]
 		pub fn approve(origin, spender: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, amount: u128) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
@@ -1029,7 +1032,7 @@
 		/// * item_id: ID of the item.
 		///
 		/// * value: Amount to transfer.
-		#[weight = <T as Config>::WeightInfo::transfer_from()]
+		#[weight = <SelfWeightOf<T>>::transfer_from()]
 		#[transactional]
 		pub fn transfer_from(origin, from: T::CrossAccountId, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128 ) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
@@ -1064,7 +1067,7 @@
 		/// * collection_id.
 		///
 		/// * schema: String representing the offchain data schema.
-		#[weight = <T as Config>::WeightInfo::set_variable_meta_data()]
+		#[weight = <SelfWeightOf<T>>::set_variable_meta_data(data.len() as u32)]
 		#[transactional]
 		pub fn set_variable_meta_data (
 			origin,
@@ -1095,7 +1098,7 @@
 		/// * collection_id.
 		///
 		/// * schema: SchemaVersion: enum
-		#[weight = <T as Config>::WeightInfo::set_schema_version()]
+		#[weight = <SelfWeightOf<T>>::set_schema_version()]
 		#[transactional]
 		pub fn set_schema_version(
 			origin,
@@ -1121,7 +1124,7 @@
 		/// * collection_id.
 		///
 		/// * schema: String representing the offchain data schema.
-		#[weight = <T as Config>::WeightInfo::set_offchain_schema()]
+		#[weight = <SelfWeightOf<T>>::set_offchain_schema(schema.len() as u32)]
 		#[transactional]
 		pub fn set_offchain_schema(
 			origin,
@@ -1151,7 +1154,7 @@
 		/// * collection_id.
 		///
 		/// * schema: String representing the const on-chain data schema.
-		#[weight = <T as Config>::WeightInfo::set_const_on_chain_schema()]
+		#[weight = <SelfWeightOf<T>>::set_const_on_chain_schema(schema.len() as u32)]
 		#[transactional]
 		pub fn set_const_on_chain_schema (
 			origin,
@@ -1181,7 +1184,7 @@
 		/// * collection_id.
 		///
 		/// * schema: String representing the variable on-chain data schema.
-		#[weight = <T as Config>::WeightInfo::set_const_on_chain_schema()]
+		#[weight = <SelfWeightOf<T>>::set_const_on_chain_schema(schema.len() as u32)]
 		#[transactional]
 		pub fn set_variable_on_chain_schema (
 			origin,
@@ -1199,7 +1202,7 @@
 			target_collection.save()
 		}
 
-		#[weight = <T as Config>::WeightInfo::set_collection_limits()]
+		#[weight = <SelfWeightOf<T>>::set_collection_limits()]
 		#[transactional]
 		pub fn set_collection_limits(
 			origin,
addedpallets/nft/src/weights.rsdiffbeforeafterboth
--- /dev/null
+++ b/pallets/nft/src/weights.rs
@@ -0,0 +1,362 @@
+// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs
+
+//! Autogenerated weights for pallet_nft
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
+//! DATE: 2021-08-30, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 128
+
+// Executed Command:
+// target/release/nft
+// benchmark
+// --pallet
+// pallet-nft
+// --wasm-execution
+// compiled
+// --extrinsic
+// *
+// --template
+// .maintain/frame-weight-template.hbs
+// --steps=50
+// --repeat=20
+// --output=./pallets/nft/src/weights.rs
+
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
+use sp_std::marker::PhantomData;
+
+/// Weight functions needed for pallet_nft.
+pub trait WeightInfo {
+	fn create_collection() -> Weight;
+	fn destroy_collection() -> Weight;
+	fn add_to_white_list() -> Weight;
+	fn remove_from_white_list() -> Weight;
+	fn set_public_access_mode() -> Weight;
+	fn set_mint_permission() -> Weight;
+	fn change_collection_owner() -> Weight;
+	fn add_collection_admin() -> Weight;
+	fn remove_collection_admin() -> Weight;
+	fn set_collection_sponsor() -> Weight;
+	fn confirm_sponsorship() -> Weight;
+	fn remove_collection_sponsor() -> Weight;
+	fn create_item_nft(b: u32, ) -> Weight;
+	fn create_item_fungible() -> Weight;
+	fn create_item_refungible(b: u32, ) -> Weight;
+	fn burn_item_nft() -> Weight;
+	fn transfer_nft() -> Weight;
+	fn transfer_fungible() -> Weight;
+	fn transfer_refungible() -> Weight;
+	fn approve_nft() -> Weight;
+	fn transfer_from_nft() -> Weight;
+	fn transfer_from_fungible() -> Weight;
+	fn transfer_from_refungible() -> Weight;
+	fn set_offchain_schema(b: u32, ) -> Weight;
+	fn set_const_on_chain_schema(b: u32, ) -> Weight;
+	fn set_variable_on_chain_schema(b: u32, ) -> Weight;
+	fn set_variable_meta_data_nft(b: u32, ) -> Weight;
+	fn set_schema_version() -> Weight;
+	fn set_collection_limits() -> Weight;
+}
+
+/// Weights for pallet_nft using the Substrate node and recommended hardware.
+pub struct SubstrateWeight<T>(PhantomData<T>);
+impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
+	fn create_collection() -> Weight {
+		(25_851_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(8 as Weight))
+			.saturating_add(T::DbWeight::get().writes(6 as Weight))
+	}
+	fn destroy_collection() -> Weight {
+		(28_737_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(2 as Weight))
+			.saturating_add(T::DbWeight::get().writes(4 as Weight))
+	}
+	fn add_to_white_list() -> Weight {
+		(6_237_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	fn remove_from_white_list() -> Weight {
+		(6_252_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	fn set_public_access_mode() -> Weight {
+		(6_691_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	fn set_mint_permission() -> Weight {
+		(6_630_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	fn change_collection_owner() -> Weight {
+		(6_521_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	fn add_collection_admin() -> Weight {
+		(8_057_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(2 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	fn remove_collection_admin() -> Weight {
+		(8_307_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(2 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	fn set_collection_sponsor() -> Weight {
+		(6_484_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	fn confirm_sponsorship() -> Weight {
+		(6_530_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	fn remove_collection_sponsor() -> Weight {
+		(6_733_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	fn create_item_nft(_b: u32, ) -> Weight {
+		(167_909_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(11 as Weight))
+			.saturating_add(T::DbWeight::get().writes(8 as Weight))
+	}
+	fn create_item_fungible() -> Weight {
+		(22_331_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(9 as Weight))
+			.saturating_add(T::DbWeight::get().writes(4 as Weight))
+	}
+	fn create_item_refungible(_b: u32, ) -> Weight {
+		(26_293_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(9 as Weight))
+			.saturating_add(T::DbWeight::get().writes(7 as Weight))
+	}
+	fn burn_item_nft() -> Weight {
+		(32_237_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(9 as Weight))
+			.saturating_add(T::DbWeight::get().writes(7 as Weight))
+	}
+	fn transfer_nft() -> Weight {
+		(192_578_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(14 as Weight))
+			.saturating_add(T::DbWeight::get().writes(10 as Weight))
+	}
+	fn transfer_fungible() -> Weight {
+		(170_749_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(11 as Weight))
+			.saturating_add(T::DbWeight::get().writes(7 as Weight))
+	}
+	fn transfer_refungible() -> Weight {
+		(35_949_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(10 as Weight))
+			.saturating_add(T::DbWeight::get().writes(7 as Weight))
+	}
+	fn approve_nft() -> Weight {
+		(169_825_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(9 as Weight))
+			.saturating_add(T::DbWeight::get().writes(4 as Weight))
+	}
+	fn transfer_from_nft() -> Weight {
+		(197_912_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(15 as Weight))
+			.saturating_add(T::DbWeight::get().writes(11 as Weight))
+	}
+	fn transfer_from_fungible() -> Weight {
+		(183_789_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(12 as Weight))
+			.saturating_add(T::DbWeight::get().writes(8 as Weight))
+	}
+	fn transfer_from_refungible() -> Weight {
+		(37_149_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(11 as Weight))
+			.saturating_add(T::DbWeight::get().writes(8 as Weight))
+	}
+	fn set_offchain_schema(_b: u32, ) -> Weight {
+		(6_435_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	fn set_const_on_chain_schema(_b: u32, ) -> Weight {
+		(6_646_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	fn set_variable_on_chain_schema(_b: u32, ) -> Weight {
+		(6_542_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	fn set_variable_meta_data_nft(_b: u32, ) -> Weight {
+		(14_697_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(2 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	fn set_schema_version() -> Weight {
+		(6_566_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+	fn set_collection_limits() -> Weight {
+		(6_349_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
+}
+
+// For backwards compatibility and tests
+impl WeightInfo for () {
+	fn create_collection() -> Weight {
+		(25_851_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(8 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(6 as Weight))
+	}
+	fn destroy_collection() -> Weight {
+		(28_737_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(4 as Weight))
+	}
+	fn add_to_white_list() -> Weight {
+		(6_237_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	fn remove_from_white_list() -> Weight {
+		(6_252_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	fn set_public_access_mode() -> Weight {
+		(6_691_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	fn set_mint_permission() -> Weight {
+		(6_630_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	fn change_collection_owner() -> Weight {
+		(6_521_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	fn add_collection_admin() -> Weight {
+		(8_057_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	fn remove_collection_admin() -> Weight {
+		(8_307_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	fn set_collection_sponsor() -> Weight {
+		(6_484_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	fn confirm_sponsorship() -> Weight {
+		(6_530_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	fn remove_collection_sponsor() -> Weight {
+		(6_733_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	fn create_item_nft(_b: u32, ) -> Weight {
+		(167_909_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(11 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(8 as Weight))
+	}
+	fn create_item_fungible() -> Weight {
+		(22_331_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(9 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(4 as Weight))
+	}
+	fn create_item_refungible(_b: u32, ) -> Weight {
+		(26_293_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(9 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(7 as Weight))
+	}
+	fn burn_item_nft() -> Weight {
+		(32_237_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(9 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(7 as Weight))
+	}
+	fn transfer_nft() -> Weight {
+		(192_578_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(14 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(10 as Weight))
+	}
+	fn transfer_fungible() -> Weight {
+		(170_749_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(11 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(7 as Weight))
+	}
+	fn transfer_refungible() -> Weight {
+		(35_949_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(10 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(7 as Weight))
+	}
+	fn approve_nft() -> Weight {
+		(169_825_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(9 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(4 as Weight))
+	}
+	fn transfer_from_nft() -> Weight {
+		(197_912_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(15 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(11 as Weight))
+	}
+	fn transfer_from_fungible() -> Weight {
+		(183_789_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(12 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(8 as Weight))
+	}
+	fn transfer_from_refungible() -> Weight {
+		(37_149_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(11 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(8 as Weight))
+	}
+	fn set_offchain_schema(_b: u32, ) -> Weight {
+		(6_435_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	fn set_const_on_chain_schema(_b: u32, ) -> Weight {
+		(6_646_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	fn set_variable_on_chain_schema(_b: u32, ) -> Weight {
+		(6_542_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	fn set_variable_meta_data_nft(_b: u32, ) -> Weight {
+		(14_697_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	fn set_schema_version() -> Weight {
+		(6_566_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+	fn set_collection_limits() -> Weight {
+		(6_349_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
+}
\ No newline at end of file
modifiedprimitives/nft/src/lib.rsdiffbeforeafterboth
--- a/primitives/nft/src/lib.rs
+++ b/primitives/nft/src/lib.rs
@@ -55,6 +55,10 @@
 pub const VARIABLE_ON_CHAIN_SCHEMA_LIMIT: u32 = 1024;
 pub const CONST_ON_CHAIN_SCHEMA_LIMIT: u32 = 1024;
 
+pub const MAX_COLLECTION_NAME_LENGTH: usize = 64;
+pub const MAX_COLLECTION_DESCRIPTION_LENGTH: usize = 256;
+pub const MAX_TOKEN_PREFIX_LENGTH: usize = 16;
+
 /// How much items can be created per single
 /// create_many call
 pub const MAX_ITEMS_PER_BATCH: u32 = 200;
modifiedruntime/src/lib.rsdiffbeforeafterboth
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -119,8 +119,6 @@
 /// Digest item type.
 pub type DigestItem = generic::DigestItem<Hash>;
 
-mod nft_weights;
-
 /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
 /// the specifics of the runtime. They can then be made to be agnostic over specific formats
 /// of data like extrinsics, allowing for them to continue syncing the network through upgrades
@@ -695,7 +693,7 @@
 /// Used for the pallet nft in `./nft.rs`
 impl pallet_nft::Config for Runtime {
 	type Event = Event;
-	type WeightInfo = nft_weights::WeightInfo;
+	type WeightInfo = pallet_nft::weights::SubstrateWeight<Self>;
 
 	type EvmBackwardsAddressMapping = pallet_nft::MapBackwardsAddressTruncated;
 	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;
deletedruntime/src/nft_weights.rsdiffbeforeafterboth
--- a/runtime/src/nft_weights.rs
+++ /dev/null
@@ -1,156 +0,0 @@
-//
-// This file is subject to the terms and conditions defined in
-// file 'LICENSE', which is part of this source code package.
-//
-
-use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};
-
-pub struct WeightInfo;
-impl pallet_nft::WeightInfo for WeightInfo {
-	fn create_collection() -> Weight {
-		70_000_000_u64
-			.saturating_add(DbWeight::get().reads(7_u64))
-			.saturating_add(DbWeight::get().writes(5_u64))
-	}
-	fn destroy_collection() -> Weight {
-		90_000_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(5_u64))
-	}
-	fn add_to_white_list() -> Weight {
-		30_000_000_u64
-			.saturating_add(DbWeight::get().reads(3_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn remove_from_white_list() -> Weight {
-		35_000_000_u64
-			.saturating_add(DbWeight::get().reads(3_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_public_access_mode() -> Weight {
-		27_000_000_u64
-			.saturating_add(DbWeight::get().reads(1_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_mint_permission() -> Weight {
-		27_000_000_u64
-			.saturating_add(DbWeight::get().reads(1_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn change_collection_owner() -> Weight {
-		27_000_000_u64
-			.saturating_add(DbWeight::get().reads(1_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn add_collection_admin() -> Weight {
-		32_000_000_u64
-			.saturating_add(DbWeight::get().reads(3_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn remove_collection_admin() -> Weight {
-		50_000_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_collection_sponsor() -> Weight {
-		32_000_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn confirm_sponsorship() -> Weight {
-		22_000_000_u64
-			.saturating_add(DbWeight::get().reads(1_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn remove_collection_sponsor() -> Weight {
-		24_000_000_u64
-			.saturating_add(DbWeight::get().reads(1_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn create_item(s: usize) -> Weight {
-		130_000_000_u64
-			.saturating_add(2135_u64.saturating_mul(s as Weight).saturating_mul(500_u64)) // 500 is temparary multiplier, fee for storage
-			.saturating_add(DbWeight::get().reads(10_u64))
-			.saturating_add(DbWeight::get().writes(8_u64))
-	}
-	fn burn_item() -> Weight {
-		170_000_000_u64
-			.saturating_add(DbWeight::get().reads(9_u64))
-			.saturating_add(DbWeight::get().writes(7_u64))
-	}
-	fn transfer() -> Weight {
-		125_000_000_u64
-			.saturating_add(DbWeight::get().reads(7_u64))
-			.saturating_add(DbWeight::get().writes(7_u64))
-	}
-	fn approve() -> Weight {
-		45_000_000_u64
-			.saturating_add(DbWeight::get().reads(3_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn transfer_from() -> Weight {
-		150_000_000_u64
-			.saturating_add(DbWeight::get().reads(9_u64))
-			.saturating_add(DbWeight::get().writes(8_u64))
-	}
-	fn set_offchain_schema() -> Weight {
-		33_000_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_const_on_chain_schema() -> Weight {
-		11_100_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_variable_on_chain_schema() -> Weight {
-		11_100_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_variable_meta_data() -> Weight {
-		17_500_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn enable_contract_sponsoring() -> Weight {
-		13_000_000_u64
-			.saturating_add(DbWeight::get().reads(1_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_schema_version() -> Weight {
-		8_500_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-	fn set_contract_sponsoring_rate_limit() -> Weight {
-		3_500_000_u64
-			.saturating_add(DbWeight::get().reads(0_u64))
-			.saturating_add(DbWeight::get().writes(2_u64))
-	}
-	fn set_variable_meta_data_sponsoring_rate_limit() -> Weight {
-		3_500_000_u64
-			.saturating_add(DbWeight::get().reads(1_u64))
-			.saturating_add(DbWeight::get().writes(2_u64))
-	}
-	fn toggle_contract_white_list() -> Weight {
-		3_000_000_u64
-			.saturating_add(DbWeight::get().reads(0_u64))
-			.saturating_add(DbWeight::get().writes(2_u64))
-	}
-	fn add_to_contract_white_list() -> Weight {
-		3_000_000_u64
-			.saturating_add(DbWeight::get().reads(0_u64))
-			.saturating_add(DbWeight::get().writes(2_u64))
-	}
-	fn remove_from_contract_white_list() -> Weight {
-		3_200_000_u64
-			.saturating_add(DbWeight::get().reads(0_u64))
-			.saturating_add(DbWeight::get().writes(2_u64))
-	}
-	fn set_collection_limits() -> Weight {
-		8_900_000_u64
-			.saturating_add(DbWeight::get().reads(2_u64))
-			.saturating_add(DbWeight::get().writes(1_u64))
-	}
-}