From c3fe844519d243f62108a5ee4f924773fb0471e6 Mon Sep 17 00:00:00 2001 From: gorka Date: Tue, 20 Sep 2022 11:26:22 +0200 Subject: [PATCH] Add event to asset claim --- xcm/pallet-xcm/src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xcm/pallet-xcm/src/lib.rs b/xcm/pallet-xcm/src/lib.rs index 5d297e144df1..ba89115831c4 100644 --- a/xcm/pallet-xcm/src/lib.rs +++ b/xcm/pallet-xcm/src/lib.rs @@ -209,6 +209,10 @@ pub mod pallet { /// /// \[ location, query ID \] NotifyTargetMigrationFail(VersionedMultiLocation, QueryId), + /// Some assets have been claimed from an asset trap + /// + /// \[ hash, origin, assets \] + AssetsClaimed(H256, MultiLocation, VersionedMultiAssets), } #[pallet::origin] @@ -1303,12 +1307,13 @@ pub mod pallet { (0, Here) => (), _ => return false, }; - let hash = BlakeTwo256::hash_of(&(origin, versioned)); + let hash = BlakeTwo256::hash_of(&(origin, versioned.clone())); match AssetTraps::::get(hash) { 0 => return false, 1 => AssetTraps::::remove(hash), n => AssetTraps::::insert(hash, n - 1), } + Self::deposit_event(Event::AssetsClaimed(hash, origin.clone(), versioned)); return true } }