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
+29 -15
View File
@@ -327,7 +327,12 @@ pub mod pallet {
T::Currency::reserve(&who, deposit)?;
Proxies::<T>::insert(&anonymous, (bounded_proxies, deposit));
Self::deposit_event(Event::AnonymousCreated(anonymous, who, proxy_type, index));
Self::deposit_event(Event::AnonymousCreated {
anonymous,
who,
proxy_type,
disambiguation_index: index,
});
Ok(())
}
@@ -427,7 +432,7 @@ pub mod pallet {
})
.map(|d| *deposit = d)
})?;
Self::deposit_event(Event::Announced(real, who, call_hash));
Self::deposit_event(Event::Announced { real, proxy: who, call_hash });
Ok(())
}
@@ -547,16 +552,25 @@ pub mod pallet {
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// A proxy was executed correctly, with the given \[result\].
ProxyExecuted(DispatchResult),
/// A proxy was executed correctly, with the given.
ProxyExecuted { result: DispatchResult },
/// Anonymous account has been created by new proxy with given
/// disambiguation index and proxy type. \[anonymous, who, proxy_type,
/// disambiguation_index\]
AnonymousCreated(T::AccountId, T::AccountId, T::ProxyType, u16),
/// An announcement was placed to make a call in the future. \[real, proxy, call_hash\]
Announced(T::AccountId, T::AccountId, CallHashOf<T>),
/// A proxy was added. \[delegator, delegatee, proxy_type, delay\]
ProxyAdded(T::AccountId, T::AccountId, T::ProxyType, T::BlockNumber),
/// disambiguation index and proxy type.
AnonymousCreated {
anonymous: T::AccountId,
who: T::AccountId,
proxy_type: T::ProxyType,
disambiguation_index: u16,
},
/// An announcement was placed to make a call in the future.
Announced { real: T::AccountId, proxy: T::AccountId, call_hash: CallHashOf<T> },
/// A proxy was added.
ProxyAdded {
delegator: T::AccountId,
delegatee: T::AccountId,
proxy_type: T::ProxyType,
delay: T::BlockNumber,
},
}
/// Old name generated by `decl_event`.
@@ -672,12 +686,12 @@ impl<T: Config> Pallet<T> {
T::Currency::unreserve(delegator, *deposit - new_deposit);
}
*deposit = new_deposit;
Self::deposit_event(Event::<T>::ProxyAdded(
delegator.clone(),
Self::deposit_event(Event::<T>::ProxyAdded {
delegator: delegator.clone(),
delegatee,
proxy_type,
delay,
));
});
Ok(())
})
}
@@ -800,6 +814,6 @@ impl<T: Config> Pallet<T> {
}
});
let e = call.dispatch(origin);
Self::deposit_event(Event::ProxyExecuted(e.map(|_| ()).map_err(|e| e.error)));
Self::deposit_event(Event::ProxyExecuted { result: e.map(|_| ()).map_err(|e| e.error) });
}
}