Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Make decl_event! more ergonomic #723

Merged
merged 3 commits into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions srml/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,11 @@ decl_module! {
}

decl_event!(
pub enum Event<T> with RawEvent<AccountId, AccountIndex, Balance>
where <T as system::Trait>::AccountId, <T as Trait>::AccountIndex, <T as Trait>::Balance {
pub enum Event<T> where
<T as system::Trait>::AccountId,
<T as Trait>::AccountIndex,
<T as Trait>::Balance
{
/// A new account was created.
NewAccount(AccountId, AccountIndex, NewAccountOutcome),
/// An account was reaped.
Expand Down
4 changes: 1 addition & 3 deletions srml/council/src/motions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ pub enum Origin {

/// Event for this module.
decl_event!(
pub enum Event<T> with RawEvent<Hash, AccountId>
where <T as system::Trait>::Hash, <T as system::Trait>::AccountId
{
pub enum Event<T> where <T as system::Trait>::Hash, <T as system::Trait>::AccountId {
/// A motion (given hash) has been proposed (by given account) with a threshold (given u32).
Proposed(AccountId, ProposalIndex, Hash, u32),
/// A motion (given hash) has been voted on by given account, leaving
Expand Down
4 changes: 1 addition & 3 deletions srml/council/src/seats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ decl_storage! {

decl_event!(
/// An event in this module.
pub enum Event<T> with RawEvent<AccountId>
where <T as system::Trait>::AccountId
{
pub enum Event<T> where <T as system::Trait>::AccountId {
/// reaped voter, reaper
VoterReaped(AccountId, AccountId),
/// slashed reaper
Expand Down
4 changes: 1 addition & 3 deletions srml/council/src/voting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ decl_storage! {

/// An event in this module.
decl_event!(
pub enum Event<T> with RawEvent<Hash>
where <T as system::Trait>::Hash
{
pub enum Event<T> where <T as system::Trait>::Hash {
/// A voting tally has happened for a referendum cancelation vote.
/// Last three are yes, no, abstain counts.
TallyCancelation(Hash, u32, u32, u32),
Expand Down
4 changes: 1 addition & 3 deletions srml/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ decl_storage! {

decl_event!(
/// An event in this module.
pub enum Event<T> with RawEvent<Balance, AccountId>
where <T as balances::Trait>::Balance, <T as system::Trait>::AccountId
{
pub enum Event<T> where <T as balances::Trait>::Balance, <T as system::Trait>::AccountId {
Tabled(PropIndex, Balance, Vec<AccountId>),
Started(ReferendumIndex, VoteThreshold),
Passed(ReferendumIndex),
Expand Down
4 changes: 1 addition & 3 deletions srml/example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ decl_module! {
/// circumstances that have happened that users, Dapps and/or chain explorers would find
/// interesting and otherwise difficult to detect.
decl_event!(
pub enum Event<T> with RawEvent<B>
where <T as balances::Trait>::Balance
{
pub enum Event<T> where B = <T as balances::Trait>::Balance {
// Just a normal `enum`, here's a dummy event to ensure it compiles.
/// Dummy event, just here so there's a generic type that's used.
Dummy(B),
Expand Down
4 changes: 1 addition & 3 deletions srml/session/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ decl_module! {

/// An event in this module.
decl_event!(
pub enum Event<T> with RawEvent<BlockNumber>
where <T as system::Trait>::BlockNumber
{
pub enum Event<T> where <T as system::Trait>::BlockNumber {
/// New session has happened. Note that the argument is the session index, not the block
/// number as the type might suggest.
NewSession(BlockNumber),
Expand Down
4 changes: 1 addition & 3 deletions srml/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ decl_module! {

/// An event in this module.
decl_event!(
pub enum Event<T> with RawEvent<Balance, AccountId>
where <T as balances::Trait>::Balance, <T as system::Trait>::AccountId
{
pub enum Event<T> where <T as balances::Trait>::Balance, <T as system::Trait>::AccountId {
/// All validators have been rewarded by the given balance.
Reward(Balance),
/// One validator (and their nominators) has been given a offline-warning (they're still
Expand Down
Loading