git.delta.rocks / unique-network / refs/commits / 2f8a220cd113

difftreelog

Weights added

str-mv2020-10-23parent: #2f98826.patch.diff
in: master

3 files changed

addedpallets/nft/src/benchmarking.rsdiffbeforeafterboth
after · pallets/nft/src/benchmarking.rs
1#[cfg(feature = "runtime-benchmarks")]2// mod benchmarking {3    use super::*;4    use sp_std::prelude::*;5    use frame_system::RawOrigin;6    // use frame_support::{ensure, traits::OnFinalize};7    use frame_benchmarking::{benchmarks, account, whitelisted_caller};  // , TrackedStorageKey, 8    use crate::Module as Nft;910    const SEED: u32 = 1;1112    benchmarks! {1314        _ {}1516        create_collection {17            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();18            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();19            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();20            let mode: CollectionMode = CollectionMode::NFT(2000);21            let caller: T::AccountId = account("caller", 0, SEED);22        }: create_collection(RawOrigin::Signed(caller.clone()), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode)23        verify {24			assert_eq!(Nft::<T>::collection(2).owner, caller);25        }2627        destroy_collection {28            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();29            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();30            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();31            let mode: CollectionMode = CollectionMode::NFT(2000);32            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());33            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;34        }: destroy_collection(RawOrigin::Signed(caller.clone()), 2)3536        add_to_white_list {37            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();38            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();39            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();40            let mode: CollectionMode = CollectionMode::NFT(2000);41            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());42            let whitelist_account: T::AccountId = account("admin", 0, SEED);43            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;44        }: add_to_white_list(RawOrigin::Signed(caller.clone()), 2, whitelist_account)4546        remove_from_white_list {47            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();48            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();49            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();50            let mode: CollectionMode = CollectionMode::NFT(2000);51            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());52            let whitelist_account: T::AccountId = account("admin", 0, SEED);53            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;54            Nft::<T>::add_to_white_list(RawOrigin::Signed(caller.clone()).into(), 2, whitelist_account.clone())?;55        }: remove_from_white_list(RawOrigin::Signed(caller.clone()), 2, whitelist_account)5657        set_public_access_mode {58            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();59            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();60            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();61            let mode: CollectionMode = CollectionMode::NFT(2000);62            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());63            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;64        }: set_public_access_mode(RawOrigin::Signed(caller.clone()), 2, AccessMode::WhiteList)6566        set_mint_permission {67            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();68            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();69            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();70            let mode: CollectionMode = CollectionMode::NFT(2000);71            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());72            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;73        }: set_mint_permission(RawOrigin::Signed(caller.clone()), 2, true)7475        change_collection_owner {76            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();77            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();78            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();79            let mode: CollectionMode = CollectionMode::NFT(2000);80            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());81            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;82            let new_owner: T::AccountId = account("admin", 0, SEED);83        }: change_collection_owner(RawOrigin::Signed(caller.clone()), 2, new_owner)8485        add_collection_admin {86            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();87            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();88            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();89            let mode: CollectionMode = CollectionMode::NFT(2000);90            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());91            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;92            let new_admin: T::AccountId = account("admin", 0, SEED);93        }: add_collection_admin(RawOrigin::Signed(caller.clone()), 2, new_admin)9495        remove_collection_admin {96            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();97            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();98            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();99            let mode: CollectionMode = CollectionMode::NFT(2000);100            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());101            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;102            let new_admin: T::AccountId = account("admin", 0, SEED);103            Nft::<T>::add_collection_admin(RawOrigin::Signed(caller.clone()).into(), 2, new_admin.clone())?;104        }: remove_collection_admin(RawOrigin::Signed(caller.clone()), 2, new_admin)105106        set_collection_sponsor {107            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();108            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();109            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();110            let mode: CollectionMode = CollectionMode::NFT(2000);111            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());112            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;113        }: set_collection_sponsor(RawOrigin::Signed(caller.clone()), 2, caller.clone())114115        confirm_sponsorship {116            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();117            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();118            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();119            let mode: CollectionMode = CollectionMode::NFT(2000);120            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());121            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;122            Nft::<T>::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?;123        }: confirm_sponsorship(RawOrigin::Signed(caller.clone()), 2)124125        remove_collection_sponsor {126            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();127            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();128            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();129            let mode: CollectionMode = CollectionMode::NFT(2000);130            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());131            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;132            Nft::<T>::set_collection_sponsor(RawOrigin::Signed(caller.clone()).into(), 2, caller.clone())?;133            Nft::<T>::confirm_sponsorship(RawOrigin::Signed(caller.clone()).into(), 2)?;134        }: remove_collection_sponsor(RawOrigin::Signed(caller.clone()), 2)135136        // nft item137        create_item_nft {138            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();139            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();140            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();141            let mode: CollectionMode = CollectionMode::NFT(2000);142            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());143            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;144145        }: create_item(RawOrigin::Signed(caller.clone()), 2, [1, 2, 3].to_vec(), caller.clone())146147        // fungible item148        create_item_fungible {149            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();150            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();151            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();152            let mode: CollectionMode = CollectionMode::Fungible(3);153            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());154            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;155156        }: create_item(RawOrigin::Signed(caller.clone()), 2, [].to_vec(), caller.clone())157158        // refungible item159        create_item_refungible {160            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();161            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();162            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();163            let mode: CollectionMode = CollectionMode::ReFungible(3, 3);164            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());165            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;166167        }: create_item(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec(), caller.clone())168169        burn_item {170            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();171            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();172            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();173            let mode: CollectionMode = CollectionMode::NFT(2000);174            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());175            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;176            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [1, 2, 3].to_vec(), caller.clone())?;177178        }: burn_item(RawOrigin::Signed(caller.clone()), 2, 1)179180        transfer_nft {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::NFT(2000);185            let recipient: T::AccountId = account("recipient", 0, SEED);186            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());187            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;188            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [1, 2, 3].to_vec(), caller.clone())?;189190        }: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1)191        192        transfer_fungible {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::Fungible(3);197            let recipient: T::AccountId = account("recipient", 0, SEED);198            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());199            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;200            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [].to_vec(), caller.clone())?;201202        }: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1)203204        transfer_refungible {205            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();206            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();207            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();208            let mode: CollectionMode = CollectionMode::ReFungible(3,3);209            let recipient: T::AccountId = account("recipient", 0, SEED);210            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());211            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;212            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [1,2,3].to_vec(), caller.clone())?;213214        }: transfer(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1, 1)215216        approve {217            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();218            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();219            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();220            let mode: CollectionMode = CollectionMode::ReFungible(3,3);221            let recipient: T::AccountId = account("recipient", 0, SEED);222            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());223            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;224            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [1,2,3].to_vec(), caller.clone())?;225226        }: approve(RawOrigin::Signed(caller.clone()), recipient.clone(), 2, 1)227228        // Nft229        transfer_from_nft {230            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();231            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();232            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();233            let mode: CollectionMode = CollectionMode::NFT(300);234            let recipient: T::AccountId = account("recipient", 0, SEED);235            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());236            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;237            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [1,2,3].to_vec(), caller.clone())?;238            Nft::<T>::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?;239240        }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)241242        // Fungible243        transfer_from_fungible {244            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();245            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();246            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();247            let mode: CollectionMode = CollectionMode::Fungible(3);248            let recipient: T::AccountId = account("recipient", 0, SEED);249            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());250            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;251            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [].to_vec(), caller.clone())?;252            Nft::<T>::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?;253254        }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)255256        // ReFungible257        transfer_from_refungible {258            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();259            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();260            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();261            let mode: CollectionMode = CollectionMode::ReFungible(3,3);262            let recipient: T::AccountId = account("recipient", 0, SEED);263            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());264            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;265            Nft::<T>::create_item(RawOrigin::Signed(caller.clone()).into(), 2, [1,2,3].to_vec(), caller.clone())?;266            Nft::<T>::approve(RawOrigin::Signed(caller.clone()).into(), recipient.clone(), 2, 1)?;267268        }: transfer_from(RawOrigin::Signed(caller.clone()), caller.clone(), recipient.clone(), 2, 1, 1)269270        set_offchain_schema {271            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();272            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();273            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();274            let mode: CollectionMode = CollectionMode::ReFungible(3,3);275            let caller: T::AccountId = T::AccountId::from(whitelisted_caller());276            Nft::<T>::create_collection(RawOrigin::Signed(caller.clone()).into(), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode.clone())?;277278        }: set_offchain_schema(RawOrigin::Signed(caller.clone()), 2, [1,2,3].to_vec())279    }
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -22,6 +22,7 @@
     },
     IsSubType, StorageValue,
 };
+// use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};
 
 use frame_system::{self as system, ensure_signed, ensure_root};
 use sp_runtime::sp_std::prelude::Vec;
@@ -184,49 +185,9 @@
 pub trait Trait: system::Trait {
     type Event: From<Event<Self>> + Into<<Self as system::Trait>::Event>;
 }
-
 
 #[cfg(feature = "runtime-benchmarks")]
-mod benchmarking {
-    use super::*;
-    use sp_std::prelude::*;
-    use frame_system::RawOrigin;
-    // use frame_support::{ensure, traits::OnFinalize};
-    use frame_benchmarking::{benchmarks, account};  // , TrackedStorageKey, whitelisted_caller
-    use crate::Module as Nft;
-
-    const SEED: u32 = 1;
-
-    benchmarks! {
-
-        _ {}
-
-        create_collection {
-            let col_name1: Vec<u16> = "Test1".encode_utf16().collect::<Vec<u16>>();
-            let col_desc1: Vec<u16> = "TestDescription1".encode_utf16().collect::<Vec<u16>>();
-            let token_prefix1: Vec<u8> = b"token_prefix1".to_vec();
-            let mode: CollectionMode = CollectionMode::NFT(2000);
-            let caller: T::AccountId = account("caller", 0, SEED);
-        }: create_collection(RawOrigin::Signed(caller.clone()), col_name1.clone(), col_desc1.clone(), token_prefix1.clone(), mode)
-        verify {
-			assert_eq!(Nft::<T>::collection(2).owner, caller);
-		}
-    }
-
-    #[cfg(test)]
-    mod tests {
-        use super::*;
-        use crate::tests_composite::{ExtBuilder, Test};
-        use frame_support::assert_ok;
-
-        #[test]
-        fn create_collection() {
-            ExtBuilder::default().build().execute_with(|| {
-                assert_ok!(test_benchmark_create_collection::<Test>());
-            });
-        }
-    }
-}
+mod benchmarking;
 
 // #endregion
 
@@ -365,7 +326,10 @@
         /// 
         /// * mode: [CollectionMode] collection type and type dependent data.
         // returns collection ID
-        #[weight = 0]
+        #[weight =
+        (70_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(7 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(5 as Weight))]
         pub fn create_collection(origin,
                                  collection_name: Vec<u16>,
                                  collection_description: Vec<u16>,
@@ -461,7 +425,10 @@
         /// # Arguments
         /// 
         /// * collection_id: collection to destroy.
-        #[weight = 0]
+        #[weight =
+        (90_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(2 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(5 as Weight))]
         pub fn destroy_collection(origin, collection_id: u64) -> DispatchResult {
 
             let sender = ensure_signed(origin)?;
@@ -508,7 +475,10 @@
         /// * collection_id.
         /// 
         /// * address.
-        #[weight = 0]
+        #[weight =
+        (30_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(3 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(1 as Weight))]
         pub fn add_to_white_list(origin, collection_id: u64, address: T::AccountId) -> DispatchResult{
 
             let sender = ensure_signed(origin)?;
@@ -543,7 +513,10 @@
         /// * collection_id.
         /// 
         /// * address.
-        #[weight = 0]
+        #[weight =
+        (35_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(3 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(1 as Weight))]
         pub fn remove_from_white_list(origin, collection_id: u64, address: T::AccountId) -> DispatchResult{
 
             let sender = ensure_signed(origin)?;
@@ -572,7 +545,10 @@
         /// * collection_id.
         /// 
         /// * mode: [AccessMode]
-        #[weight = 0]
+        #[weight =
+        (27_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(1 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(1 as Weight))]
         pub fn set_public_access_mode(origin, collection_id: u64, mode: AccessMode) -> DispatchResult
         {
             let sender = ensure_signed(origin)?;
@@ -598,7 +574,10 @@
         /// * collection_id.
         /// 
         /// * mint_permission: Boolean parameter. If True, allows minting to Anyone with conditions above.
-        #[weight = 0]
+        #[weight =
+        (27_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(1 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(1 as Weight))]
         pub fn set_mint_permission(origin, collection_id: u64, mint_permission: bool) -> DispatchResult
         {
             let sender = ensure_signed(origin)?;
@@ -622,7 +601,10 @@
         /// * collection_id.
         /// 
         /// * new_owner.
-        #[weight = 0]
+        #[weight =
+        (27_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(1 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(1 as Weight))]
         pub fn change_collection_owner(origin, collection_id: u64, new_owner: T::AccountId) -> DispatchResult {
 
             let sender = ensure_signed(origin)?;
@@ -647,7 +629,10 @@
         /// * collection_id: ID of the Collection to add admin for.
         /// 
         /// * new_admin_id: Address of new admin to add.
-        #[weight = 0]
+        #[weight =
+        (32_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(3 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(1 as Weight))]
         pub fn add_collection_admin(origin, collection_id: u64, new_admin_id: T::AccountId) -> DispatchResult {
 
             let sender = ensure_signed(origin)?;
@@ -681,7 +666,10 @@
         /// * collection_id: ID of the Collection to remove admin for.
         /// 
         /// * account_id: Address of admin to remove.
-        #[weight = 0]
+        #[weight =
+        (50_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(2 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(1 as Weight))]
         pub fn remove_collection_admin(origin, collection_id: u64, account_id: T::AccountId) -> DispatchResult {
 
             let sender = ensure_signed(origin)?;
@@ -706,7 +694,10 @@
         /// * collection_id.
         /// 
         /// * new_sponsor.
-        #[weight = 0]
+        #[weight =
+        (32_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(2 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(1 as Weight))]
         pub fn set_collection_sponsor(origin, collection_id: u64, new_sponsor: T::AccountId) -> DispatchResult {
 
             let sender = ensure_signed(origin)?;
@@ -728,7 +719,10 @@
         /// # Arguments
         /// 
         /// * collection_id.
-        #[weight = 0]
+        #[weight =
+        (22_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(1 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(1 as Weight))]
         pub fn confirm_sponsorship(origin, collection_id: u64) -> DispatchResult {
 
             let sender = ensure_signed(origin)?;
@@ -753,7 +747,10 @@
         /// # Arguments
         /// 
         /// * collection_id.
-        #[weight = 0]
+        #[weight =
+        (24_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(1 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(1 as Weight))]
         pub fn remove_collection_sponsor(origin, collection_id: u64) -> DispatchResult {
 
             let sender = ensure_signed(origin)?;
@@ -786,7 +783,10 @@
         /// * properties: Array of bytes that contains NFT properties. Since NFT Module is agnostic of properties meaning, it is treated purely as an array of bytes.
         /// 
         /// * owner: Address, initial owner of the NFT.
-        #[weight = 0]
+        #[weight =
+        (130_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(10 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(8 as Weight))]
         pub fn create_item(origin, collection_id: u64, properties: Vec<u8>, owner: T::AccountId) -> DispatchResult {
 
             let sender = ensure_signed(origin)?;
@@ -869,7 +869,10 @@
         /// * collection_id: ID of the collection.
         /// 
         /// * item_id: ID of NFT to burn.
-        #[weight = 0]
+        #[weight =
+        (170_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(9 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(7 as Weight))]
         pub fn burn_item(origin, collection_id: u64, item_id: u64) -> DispatchResult {
 
             let sender = ensure_signed(origin)?;
@@ -922,7 +925,10 @@
         ///     * Non-Fungible Mode: Ignored
         ///     * Fungible Mode: Must specify transferred amount
         ///     * Re-Fungible Mode: Must specify transferred portion (between 0 and 1)
-        #[weight = 0]
+        #[weight =
+        (125_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(7 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(7 as Weight))]
         pub fn transfer(origin, recipient: T::AccountId, collection_id: u64, item_id: u64, value: u64) -> DispatchResult {
 
             let sender = ensure_signed(origin)?;
@@ -964,7 +970,10 @@
         /// * collection_id.
         /// 
         /// * item_id: ID of the item.
-        #[weight = 0]
+        #[weight =
+        (45_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(3 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(1 as Weight))]
         pub fn approve(origin, approved: T::AccountId, collection_id: u64, item_id: u64) -> DispatchResult {
 
             let sender = ensure_signed(origin)?;
@@ -1022,7 +1031,10 @@
         /// * item_id: ID of the item.
         /// 
         /// * value: Amount to transfer.
-        #[weight = 0]
+        #[weight =
+        (150_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(9 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(8 as Weight))]
         pub fn transfer_from(origin, from: T::AccountId, recipient: T::AccountId, collection_id: u64, item_id: u64, value: u64 ) -> DispatchResult {
 
             let sender = ensure_signed(origin)?;
@@ -1032,8 +1044,11 @@
             if <ApprovedList<T>>::contains_key(collection_id, (item_id, from.clone())) {
                 let list_itm = <ApprovedList<T>>::get(collection_id, (item_id, from.clone()));
                 let opt_item = list_itm.iter().find(|i| i.approved == sender.clone());
-                appoved_transfer = opt_item.is_some();
-                ensure!(opt_item.unwrap().amount >= value, "Requested value more than approved");
+                if opt_item.is_some()
+                {
+                    appoved_transfer = true;
+                    ensure!(opt_item.unwrap().amount >= value, "Requested value more than approved");
+                }
             }
 
             // Transfer permissions check
@@ -1091,7 +1106,10 @@
         /// * collection_id.
         /// 
         /// * schema: String representing the offchain data schema.
-        #[weight = 0]
+        #[weight =
+        (33_000_000 as Weight)
+        .saturating_add(RocksDbWeight::get().reads(2 as Weight))
+        .saturating_add(RocksDbWeight::get().writes(1 as Weight))]
         pub fn set_offchain_schema(
             origin,
             collection_id: u64,
modifiedruntime/src/lib.rsdiffbeforeafterboth
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -528,16 +528,16 @@
 			use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
 
 			let whitelist: Vec<TrackedStorageKey> = vec![
-				// Block Number
-				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
-				// Total Issuance
-				hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),
-				// Execution Phase
-				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
-				// Event Count
-				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
-				// System Events
-				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
+				// Alice account
+				hex_literal::hex!("d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d").to_vec().into(),
+				// // Total Issuance
+				// hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),
+				// // Execution Phase
+				// hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
+				// // Event Count
+				// hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
+				// // System Events
+				// hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
             ];
 
 			let mut batches = Vec::<BenchmarkBatch>::new();