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

difftreelog

Merge pull request #190 from UniqueNetwork/fix/nft-benchmarking

kozyrevdev2021-09-01parents: #7819c0f #b3a3ee6.patch.diff
in: master
Use newly added weights in pallet

1 file changed

modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
251 .max(Self::create_item_fungible())251 .max(Self::create_item_fungible())
252 .max(Self::create_item_refungible(data))252 .max(Self::create_item_refungible(data))
253 }253 }
254 fn create_multiple_items(amount: u32) -> Weight {
255 Self::create_multiple_items_nft(amount)
256 .max(Self::create_multiple_items_fungible(amount))
257 .max(Self::create_multiple_items_refungible(amount))
258 }
254 fn burn_item() -> Weight {259 fn burn_item() -> Weight {
255 // TODO: refungible, fungible260 // TODO: refungible, fungible
256 Self::burn_item_nft()261 Self::burn_item_nft()
896 /// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].901 /// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].
897 ///902 ///
898 /// * owner: Address, initial owner of the NFT.903 /// * owner: Address, initial owner of the NFT.
899 #[weight = <SelfWeightOf<T>>::create_item(items_data.iter()904 #[weight = <SelfWeightOf<T>>::create_multiple_items(items_data.len() as u32)]
900 .map(|data| { data.data_size() as u32 })
901 .sum())]
902 #[transactional]905 #[transactional]
903 pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResult {906 pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResult {
904907
924 /// * collection_id: ID of the collection.927 /// * collection_id: ID of the collection.
925 ///928 ///
926 /// * value: New flag value.929 /// * value: New flag value.
927 #[weight = <SelfWeightOf<T>>::burn_item()]930 #[weight = <SelfWeightOf<T>>::set_transfers_enabled_flag()]
928 #[transactional]931 #[transactional]
929 pub fn set_transfers_enabled_flag(origin, collection_id: CollectionId, value: bool) -> DispatchResult {932 pub fn set_transfers_enabled_flag(origin, collection_id: CollectionId, value: bool) -> DispatchResult {
930933