git.delta.rocks / unique-network / refs/commits / 59683d4fb2c6

difftreelog

feat add evm event `CollectionChanged` for sub events : `CollectionPropertySet`, `CollectionPropertyDeleted`, `PropertyPermissionSet`

Trubnikov Sergey2022-12-06parent: #6c3810b.patch.diff
in: master

7 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -58,6 +58,12 @@
 		#[indexed]
 		collection_id: address,
 	},
+	/// The collection has been changed.
+	CollectionChanged {
+		/// Collection ID.
+		#[indexed]
+		collection_id: address,
+	},
 }
 
 /// Does not always represent a full collection, for RFT it is either
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -1036,6 +1036,12 @@
 		.map_err(<Error<T>>::from)?;
 
 		Self::deposit_event(Event::CollectionPropertySet(collection.id, property.key));
+		<PalletEvm<T>>::deposit_log(
+			erc::CollectionHelpersEvents::CollectionChanged {
+				collection_id: eth::collection_id_to_address(collection.id),
+			}
+			.to_log(T::ContractAddress::get()),
+		);
 
 		Ok(())
 	}
@@ -1115,6 +1121,12 @@
 			collection.id,
 			property_key,
 		));
+		<PalletEvm<T>>::deposit_log(
+			erc::CollectionHelpersEvents::CollectionChanged {
+				collection_id: eth::collection_id_to_address(collection.id),
+			}
+			.to_log(T::ContractAddress::get()),
+		);
 
 		Ok(())
 	}
@@ -1209,6 +1221,12 @@
 			collection.id,
 			property_permission.key,
 		));
+		<PalletEvm<T>>::deposit_log(
+			erc::CollectionHelpersEvents::CollectionChanged {
+				collection_id: eth::collection_id_to_address(collection.id),
+			}
+			.to_log(T::ContractAddress::get()),
+		);
 
 		Ok(())
 	}
modifiedpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/unique/src/eth/stubs/CollectionHelpers.soldiffbeforeafterboth
--- a/pallets/unique/src/eth/stubs/CollectionHelpers.sol
+++ b/pallets/unique/src/eth/stubs/CollectionHelpers.sol
@@ -21,6 +21,7 @@
 contract CollectionHelpersEvents {
 	event CollectionCreated(address indexed owner, address indexed collectionId);
 	event CollectionDestroyed(address indexed collectionId);
+	event CollectionChanged(address indexed collectionId);
 }
 
 /// @title Contract, which allows users to operate with collections
modifiedtests/src/eth/abi/collectionHelpers.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/collectionHelpers.json
+++ b/tests/src/eth/abi/collectionHelpers.json
@@ -5,6 +5,19 @@
       {
         "indexed": true,
         "internalType": "address",
+        "name": "collectionId",
+        "type": "address"
+      }
+    ],
+    "name": "CollectionChanged",
+    "type": "event"
+  },
+  {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": true,
+        "internalType": "address",
         "name": "owner",
         "type": "address"
       },
modifiedtests/src/eth/api/CollectionHelpers.soldiffbeforeafterboth
--- a/tests/src/eth/api/CollectionHelpers.sol
+++ b/tests/src/eth/api/CollectionHelpers.sol
@@ -16,6 +16,7 @@
 interface CollectionHelpersEvents {
 	event CollectionCreated(address indexed owner, address indexed collectionId);
 	event CollectionDestroyed(address indexed collectionId);
+	event CollectionChanged(address indexed collectionId);
 }
 
 /// @title Contract, which allows users to operate with collections
addedtests/src/eth/events.test.tsdiffbeforeafterboth

no changes