git.delta.rocks / unique-network / refs/commits / 2472fbfb0a20

difftreelog

fix benchmarks

Daniel Shiposha2022-10-03parent: #c1336b3.patch.diff
in: master

5 files changed

modifiedpallets/common/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/common/src/benchmarking.rs
+++ b/pallets/common/src/benchmarking.rs
@@ -116,7 +116,7 @@
 	create_collection_raw(
 		owner,
 		CollectionMode::NFT,
-		|owner, data| <Pallet<T>>::init_collection(owner, data, CollectionFlags::default()),
+		|owner: T::CrossAccountId, data| <Pallet<T>>::init_collection(owner.clone(), owner, data, CollectionFlags::default()),
 		|h| h,
 	)
 }
modifiedpallets/fungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/fungible/src/benchmarking.rs
+++ b/pallets/fungible/src/benchmarking.rs
@@ -31,7 +31,7 @@
 	create_collection_raw(
 		owner,
 		CollectionMode::Fungible(0),
-		<Pallet<T>>::init_collection,
+		|owner: T::CrossAccountId, data| <Pallet<T>>::init_collection(owner.clone(), owner, data),
 		FungibleHandle::cast,
 	)
 }
modifiedpallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -54,7 +54,7 @@
 	create_collection_raw(
 		owner,
 		CollectionMode::NFT,
-		|owner, data| <Pallet<T>>::init_collection(owner, data, true),
+		|owner: T::CrossAccountId, data| <Pallet<T>>::init_collection(owner.clone(), owner, data, true),
 		NonfungibleHandle::cast,
 	)
 }
modifiedpallets/refungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -62,7 +62,7 @@
 	create_collection_raw(
 		owner,
 		CollectionMode::ReFungible,
-		<Pallet<T>>::init_collection,
+		|owner: T::CrossAccountId, data| <Pallet<T>>::init_collection(owner.clone(), owner, data),
 		RefungibleHandle::cast,
 	)
 }
modifiedpallets/structure/src/benchmarking.rsdiffbeforeafterboth
before · pallets/structure/src/benchmarking.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use super::*;1819use frame_benchmarking::{benchmarks, account};20use frame_support::traits::{Currency, Get};21use up_data_structs::{22	CreateCollectionData, CollectionMode, CreateItemData, CreateNftData, budget::Unlimited,23};24use pallet_common::Config as CommonConfig;25use pallet_evm::account::CrossAccountId;2627const SEED: u32 = 1;2829benchmarks! {30	find_parent {31		let caller: T::AccountId = account("caller", 0, SEED);32		let caller_cross = T::CrossAccountId::from_sub(caller.clone());3334		<T as CommonConfig>::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());35		T::CollectionDispatch::create(caller_cross.clone(), CreateCollectionData {36			mode: CollectionMode::NFT,37			..Default::default()38		})?;39		let dispatch = T::CollectionDispatch::dispatch(CollectionHandle::try_get(CollectionId(1))?);40		let dispatch = dispatch.as_dyn();4142		dispatch.create_item(caller_cross.clone(), caller_cross.clone(), CreateItemData::NFT(CreateNftData::default()), &Unlimited)?;43	}: {44		let parent = <Pallet<T>>::find_parent(CollectionId(1), TokenId(1))?;45		assert!(matches!(parent, Parent::User(_)))46	}47}