From 2247c664b9db7e50f4e7aef9fa11ee7e2e188a05 Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Mon, 22 Jan 2024 13:41:57 +0100
Subject: [PATCH] refac(#173): harmonize InvitationSent

---
 docs/api/runtime-events.md                |   6 +++---
 pallets/smith-members/src/benchmarking.rs |   4 ++--
 pallets/smith-members/src/lib.rs          |   9 +++------
 pallets/smith-members/src/tests.rs        |   4 ++--
 resources/metadata.scale                  | Bin 128717 -> 128711 bytes
 5 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/docs/api/runtime-events.md b/docs/api/runtime-events.md
index 850b1f037..a3a532d8a 100644
--- a/docs/api/runtime-events.md
+++ b/docs/api/runtime-events.md
@@ -649,12 +649,12 @@ no args
 <li>
 <details>
 <summary>
-<code>InvitationSent(idty_index, invited_by)</code> - 0</summary>
+<code>InvitationSent(receiver, issuer)</code> - 0</summary>
 An identity is being inivited to become a smith.
 
 ```rust
-idty_index: T::IdtyIndex
-invited_by: T::IdtyIndex
+receiver: T::IdtyIndex
+issuer: T::IdtyIndex
 ```
 
 </details>
diff --git a/pallets/smith-members/src/benchmarking.rs b/pallets/smith-members/src/benchmarking.rs
index d5a9d0a27..62e0b8ddc 100644
--- a/pallets/smith-members/src/benchmarking.rs
+++ b/pallets/smith-members/src/benchmarking.rs
@@ -45,8 +45,8 @@ benchmarks! {
     }: _<T::RuntimeOrigin>(caller_origin, receiver)
     verify {
         assert_has_event::<T>(Event::<T>::InvitationSent{
-            idty_index: receiver,
-            invited_by: issuer,
+            receiver,
+            issuer,
         }.into());
     }
     accept_invitation {
diff --git a/pallets/smith-members/src/lib.rs b/pallets/smith-members/src/lib.rs
index 0c2c930f2..a20e0bd04 100644
--- a/pallets/smith-members/src/lib.rs
+++ b/pallets/smith-members/src/lib.rs
@@ -130,8 +130,8 @@ pub mod pallet {
     pub enum Event<T: Config> {
         /// An identity is being inivited to become a smith.
         InvitationSent {
-            idty_index: T::IdtyIndex,
-            invited_by: T::IdtyIndex,
+            receiver: T::IdtyIndex,
+            issuer: T::IdtyIndex,
         },
         /// The invitation has been accepted.
         InvitationAccepted { idty_index: T::IdtyIndex },
@@ -360,10 +360,7 @@ impl<T: Config> Pallet<T> {
         existing.received_certs = vec![];
         Smiths::<T>::insert(receiver, existing);
         ExpiresOn::<T>::append(new_expires_on, receiver);
-        Self::deposit_event(Event::<T>::InvitationSent {
-            idty_index: receiver,
-            invited_by: issuer,
-        });
+        Self::deposit_event(Event::<T>::InvitationSent { receiver, issuer });
     }
 
     fn check_accept_invitation(receiver: T::IdtyIndex) -> DispatchResultWithPostInfo {
diff --git a/pallets/smith-members/src/tests.rs b/pallets/smith-members/src/tests.rs
index ad3c83fbe..a6b9f0715 100644
--- a/pallets/smith-members/src/tests.rs
+++ b/pallets/smith-members/src/tests.rs
@@ -46,8 +46,8 @@ fn process_to_become_a_smith_and_lose_it() {
         // Try to invite
         assert_ok!(Pallet::<Runtime>::invite_smith(RuntimeOrigin::signed(1), 5));
         System::assert_has_event(RuntimeEvent::Smith(Event::<Runtime>::InvitationSent {
-            idty_index: 5,
-            invited_by: 1,
+            receiver: 5,
+            issuer: 1,
         }));
         // Accept invitation
         assert_ok!(Pallet::<Runtime>::accept_invitation(RuntimeOrigin::signed(
diff --git a/resources/metadata.scale b/resources/metadata.scale
index 78cad8eac5ff6bb55722910cf3791abfef75040a..ec4593b3867538d339e681f0f8c0013569459624 100644
GIT binary patch
delta 26
icmX^6mi_o!_6-ZvCJVSqP3}||Z@#X!{kj_CxAOp~w+u-D

delta 34
qcmX^9mi_Eo_6-ZvCOg^7aBF1dm1UNsro<;zHXl^meo&2(?E(M^`3_<L

-- 
GitLab