From 1893e990ecfb87a9d38bef1ccd9abdcce37c60ac Mon Sep 17 00:00:00 2001 From: Daniel Shiposha Date: Thu, 09 Jun 2022 15:27:07 +0000 Subject: [PATCH] feat: benchmark destroy_collection --- --- a/pallets/proxy-rmrk-core/src/benchmarking.rs +++ b/pallets/proxy-rmrk-core/src/benchmarking.rs @@ -7,7 +7,9 @@ BoundedVec, }; -use crate::{Config, Pallet, Call}; +use up_data_structs::*; + +use super::*; const SEED: u32 = 1; @@ -15,6 +17,18 @@ vec![0; S::get() as usize].try_into().expect("size == S") } +fn create_max_collection(owner: &T::AccountId) -> Result { + ::Currency::deposit_creating(owner, T::CollectionCreationPrice::get()); + + let metadata = create_data(); + let max = None; + let symbol = create_data(); + + >::create_collection(RawOrigin::Signed(owner.clone()).into(), metadata, max, symbol)?; + + Ok(>::get() - 1) +} + benchmarks! { create_collection { let caller = account("caller", 0, SEED); @@ -23,4 +37,9 @@ let max = None; let symbol = create_data(); }: _(RawOrigin::Signed(caller), metadata, max, symbol) + + destroy_collection { + let caller = account("caller", 0, SEED); + let collection_id = create_max_collection::(&caller)?; + }: _(RawOrigin::Signed(caller), collection_id) } -- gitstuff