Add call hash as parameters of multisig related event (#5499)

* Add call hash as parameters of multisig related event

* update docs
This commit is contained in:
HackFisher
2020-04-07 04:45:20 +08:00
committed by GitHub
parent 8bdf5da0b0
commit 64811e4df3
2 changed files with 18 additions and 17 deletions
+16 -15
View File
@@ -170,7 +170,8 @@ decl_event! {
/// Events type.
pub enum Event<T> where
AccountId = <T as system::Trait>::AccountId,
BlockNumber = <T as system::Trait>::BlockNumber
BlockNumber = <T as system::Trait>::BlockNumber,
CallHash = [u8; 32]
{
/// Batch of dispatches did not complete fully. Index of first failing dispatch given, as
/// well as the error.
@@ -178,17 +179,17 @@ decl_event! {
/// Batch of dispatches completed fully with no error.
BatchCompleted,
/// A new multisig operation has begun. First param is the account that is approving,
/// second is the multisig account.
NewMultisig(AccountId, AccountId),
/// second is the multisig account, third is hash of the call.
NewMultisig(AccountId, AccountId, CallHash),
/// A multisig operation has been approved by someone. First param is the account that is
/// approving, third is the multisig account.
MultisigApproval(AccountId, Timepoint<BlockNumber>, AccountId),
/// approving, third is the multisig account, fourth is hash of the call.
MultisigApproval(AccountId, Timepoint<BlockNumber>, AccountId, CallHash),
/// A multisig operation has been executed. First param is the account that is
/// approving, third is the multisig account.
MultisigExecuted(AccountId, Timepoint<BlockNumber>, AccountId, DispatchResult),
/// approving, third is the multisig account, fourth is hash of the call to be executed.
MultisigExecuted(AccountId, Timepoint<BlockNumber>, AccountId, CallHash, DispatchResult),
/// A multisig operation has been cancelled. First param is the account that is
/// cancelling, third is the multisig account.
MultisigCancelled(AccountId, Timepoint<BlockNumber>, AccountId),
/// cancelling, third is the multisig account, fourth is hash of the call.
MultisigCancelled(AccountId, Timepoint<BlockNumber>, AccountId, CallHash),
}
}
@@ -347,7 +348,7 @@ decl_module! {
if (m.approvals.len() as u16) < threshold - 1 {
m.approvals.insert(pos, who.clone());
<Multisigs<T>>::insert(&id, call_hash, m);
Self::deposit_event(RawEvent::MultisigApproval(who, timepoint, id));
Self::deposit_event(RawEvent::MultisigApproval(who, timepoint, id, call_hash));
return Ok(())
}
} else {
@@ -360,7 +361,7 @@ decl_module! {
let _ = T::Currency::unreserve(&m.depositor, m.deposit);
<Multisigs<T>>::remove(&id, call_hash);
Self::deposit_event(RawEvent::MultisigExecuted(
who, timepoint, id, result.map(|_| ()).map_err(|e| e.error)
who, timepoint, id, call_hash, result.map(|_| ()).map_err(|e| e.error)
));
} else {
ensure!(maybe_timepoint.is_none(), Error::<T>::UnexpectedTimepoint);
@@ -374,7 +375,7 @@ decl_module! {
depositor: who.clone(),
approvals: vec![who.clone()],
});
Self::deposit_event(RawEvent::NewMultisig(who, id));
Self::deposit_event(RawEvent::NewMultisig(who, id, call_hash));
} else {
return call.dispatch(frame_system::RawOrigin::Signed(id).into())
.map(|_| ()).map_err(|e| e.error)
@@ -444,7 +445,7 @@ decl_module! {
if let Err(pos) = m.approvals.binary_search(&who) {
m.approvals.insert(pos, who.clone());
<Multisigs<T>>::insert(&id, call_hash, m);
Self::deposit_event(RawEvent::MultisigApproval(who, timepoint, id));
Self::deposit_event(RawEvent::MultisigApproval(who, timepoint, id, call_hash));
} else {
Err(Error::<T>::AlreadyApproved)?
}
@@ -460,7 +461,7 @@ decl_module! {
depositor: who.clone(),
approvals: vec![who.clone()],
});
Self::deposit_event(RawEvent::NewMultisig(who, id));
Self::deposit_event(RawEvent::NewMultisig(who, id, call_hash));
} else {
Err(Error::<T>::NoApprovalsNeeded)?
}
@@ -520,7 +521,7 @@ decl_module! {
let _ = T::Currency::unreserve(&m.depositor, m.deposit);
<Multisigs<T>>::remove(&id, call_hash);
Self::deposit_event(RawEvent::MultisigCancelled(who, timepoint, id));
Self::deposit_event(RawEvent::MultisigCancelled(who, timepoint, id, call_hash));
Ok(())
}
}