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

difftreelog

Merge pull request #212 from UniqueNetwork/feature/skip-zero-transfers

kozyrevdev2021-10-07parents: #25e7a6f #570dda6.patch.diff
in: master
Skip zero value transfers in transferFrom

2 files changed

modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -1354,6 +1354,10 @@
                 Self::check_white_list(&target_collection, &recipient)?;
             }
 
+            if value == 0 {
+                return Ok(())
+            }
+
             // Reduce approval by transferred amount or remove if remaining approval drops to 0
             if approval.saturating_sub(value) > 0 {
                 <Allowances<T>>::insert(collection_id, (item_id, &from, &sender), approval - value);
@@ -2882,4 +2886,4 @@
     }
 }
 
-// #endregion
\ No newline at end of file
+// #endregion
modifiedruntime/src/lib.rsdiffbeforeafterboth
151 spec_name: create_runtime_str!("nft"),151 spec_name: create_runtime_str!("nft"),
152 impl_name: create_runtime_str!("nft"),152 impl_name: create_runtime_str!("nft"),
153 authoring_version: 1,153 authoring_version: 1,
154 spec_version: 3,154 spec_version: 4,
155 impl_version: 1,155 impl_version: 1,
156 apis: RUNTIME_API_VERSIONS,156 apis: RUNTIME_API_VERSIONS,
157 transaction_version: 1,157 transaction_version: 1,