From b3a3ee6c7b77ea0dc8cd10f2e6578b431f5bca6f Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Wed, 01 Sep 2021 07:38:22 +0000 Subject: [PATCH] fix: use new weights --- --- a/pallets/nft/src/lib.rs +++ b/pallets/nft/src/lib.rs @@ -242,6 +242,11 @@ .max(Self::create_item_fungible()) .max(Self::create_item_refungible(data)) } + fn create_multiple_items(amount: u32) -> Weight { + Self::create_multiple_items_nft(amount) + .max(Self::create_multiple_items_fungible(amount)) + .max(Self::create_multiple_items_refungible(amount)) + } fn burn_item() -> Weight { // TODO: refungible, fungible Self::burn_item_nft() @@ -887,9 +892,7 @@ /// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item]. /// /// * owner: Address, initial owner of the NFT. - #[weight = >::create_item(items_data.iter() - .map(|data| { data.data_size() as u32 }) - .sum())] + #[weight = >::create_multiple_items(items_data.len() as u32)] #[transactional] pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec) -> DispatchResult { @@ -915,7 +918,7 @@ /// * collection_id: ID of the collection. /// /// * value: New flag value. - #[weight = >::burn_item()] + #[weight = >::set_transfers_enabled_flag()] #[transactional] pub fn set_transfers_enabled_flag(origin, collection_id: CollectionId, value: bool) -> DispatchResult { -- gitstuff