Add field names to pallet Event variants (#9993)

* convert pallet-assets events to struct types

* updated events of a couple pallets

* updated pallet event field names

* update pallet event field names

* updated events in test files

* cargo fmt

* minorfixes

* fix assertion error

* minor fix

* formatting fix

* fmt
This commit is contained in:
David Salami
2021-11-16 02:56:00 +01:00
committed by GitHub
parent fb3c7326c2
commit 120894fdb7
48 changed files with 1181 additions and 681 deletions
+12 -9
View File
@@ -218,13 +218,12 @@ pub mod pallet {
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// Swap created. \[account, proof, swap\]
NewSwap(T::AccountId, HashedProof, PendingSwap<T>),
/// Swap created.
NewSwap { account: T::AccountId, proof: HashedProof, swap: PendingSwap<T> },
/// Swap claimed. The last parameter indicates whether the execution succeeds.
/// \[account, proof, success\]
SwapClaimed(T::AccountId, HashedProof, bool),
/// Swap cancelled. \[account, proof\]
SwapCancelled(T::AccountId, HashedProof),
SwapClaimed { account: T::AccountId, proof: HashedProof, success: bool },
/// Swap cancelled.
SwapCancelled { account: T::AccountId, proof: HashedProof },
}
/// Old name generated by `decl_event`.
@@ -268,7 +267,7 @@ pub mod pallet {
};
PendingSwaps::<T>::insert(target.clone(), hashed_proof.clone(), swap.clone());
Self::deposit_event(Event::NewSwap(target, hashed_proof, swap));
Self::deposit_event(Event::NewSwap { account: target, proof: hashed_proof, swap });
Ok(())
}
@@ -304,7 +303,11 @@ pub mod pallet {
PendingSwaps::<T>::remove(target.clone(), hashed_proof.clone());
Self::deposit_event(Event::SwapClaimed(target, hashed_proof, succeeded));
Self::deposit_event(Event::SwapClaimed {
account: target,
proof: hashed_proof,
success: succeeded,
});
Ok(())
}
@@ -333,7 +336,7 @@ pub mod pallet {
swap.action.cancel(&swap.source);
PendingSwaps::<T>::remove(&target, hashed_proof.clone());
Self::deposit_event(Event::SwapCancelled(target, hashed_proof));
Self::deposit_event(Event::SwapCancelled { account: target, proof: hashed_proof });
Ok(())
}