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

difftreelog

fix dont read storage during minting when not needed

Daniel Shiposha2023-09-25parent: #81bcea4.patch.diff
in: master

2 files changed

modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
620 Ok(is_owned)620 Ok(is_owned)
621 });621 });
622
623 let is_new_token = matches!(mode, SetPropertyMode::NewToken { .. });
622624
623 let mut is_token_exist =625 let mut is_token_exist = pallet_common::LazyValue::new(|| {
626 if is_new_token {
627 debug_assert!(Self::token_exists(collection, token_id));
628 true
629 } else {
624 pallet_common::LazyValue::new(|| Self::token_exists(collection, token_id));630 Self::token_exists(collection, token_id)
631 }
632 });
625633
626 let stored_properties = <TokenProperties<T>>::get((collection.id, token_id));634 let stored_properties = if is_new_token {
635 TokenPropertiesT::new()
636 } else {
637 <TokenProperties<T>>::get((collection.id, token_id))
638 };
627639
628 <PalletCommon<T>>::modify_token_properties(640 <PalletCommon<T>>::modify_token_properties(
629 collection,641 collection,
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
563 Ok(is_bundle_owner)563 Ok(is_bundle_owner)
564 });564 });
565
566 let is_new_token = matches!(mode, SetPropertyMode::NewToken { .. });
565567
566 let mut is_token_exist =568 let mut is_token_exist = pallet_common::LazyValue::new(|| {
569 if is_new_token {
570 debug_assert!(Self::token_exists(collection, token_id));
571 true
572 } else {
567 pallet_common::LazyValue::new(|| Self::token_exists(collection, token_id));573 Self::token_exists(collection, token_id)
574 }
575 });
568576
569 let stored_properties = <TokenProperties<T>>::get((collection.id, token_id));577 let stored_properties = if is_new_token {
578 TokenPropertiesT::new()
579 } else {
580 <TokenProperties<T>>::get((collection.id, token_id))
581 };
570582
571 <PalletCommon<T>>::modify_token_properties(583 <PalletCommon<T>>::modify_token_properties(
572 collection,584 collection,