Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 0 additions & 1 deletion node-template/runtime/src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ decl_module! {
}

decl_event!(
/// An event in this module.
pub enum Event<T> where AccountId = <T as system::Trait>::AccountId {
// Just a dummy event.
// Event `Something` is declared with a parameter of the type `u32` and `AccountId`
Expand Down
3 changes: 0 additions & 3 deletions srml/assets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ decl_module! {
}
}

/// An event in this module. Events are simple means of reporting specific conditions and
/// 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> where <T as system::Trait>::AccountId, <T as Trait>::Balance {
/// Some assets were issued.
Expand Down
1 change: 0 additions & 1 deletion srml/council/src/motions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ pub enum Origin {
Members(u32),
}

/// Event for this module.
decl_event!(
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).
Expand Down
1 change: 0 additions & 1 deletion srml/council/src/seats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ decl_storage! {
}

decl_event!(
/// An event in this module.
pub enum Event<T> where <T as system::Trait>::AccountId {
/// reaped voter, reaper
VoterReaped(AccountId, AccountId),
Expand Down
1 change: 0 additions & 1 deletion srml/council/src/voting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ decl_storage! {
}
}

/// An event in this module.
decl_event!(
pub enum Event<T> where <T as system::Trait>::Hash {
/// A voting tally has happened for a referendum cancellation vote.
Expand Down
1 change: 0 additions & 1 deletion srml/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ decl_storage! {
}

decl_event!(
/// An event in this module.
pub enum Event<T> where Balance = BalanceOf<T>, <T as system::Trait>::AccountId {
Proposed(PropIndex, Balance),
Tabled(PropIndex, Balance, Vec<AccountId>),
Expand Down
6 changes: 3 additions & 3 deletions srml/example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ decl_storage! {
}
}

/// An event in this module. Events are simple means of reporting specific conditions and
/// circumstances that have happened that users, Dapps and/or chain explorers would find
/// interesting and otherwise difficult to detect.
decl_event!(
/// Events are simple means of reporting specific conditions and
/// circumstances that have happened that users, Dapps and/or chain explorers would find
/// interesting and otherwise difficult to detect.
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.
Expand Down
1 change: 0 additions & 1 deletion srml/grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ impl<N: Decode, SessionKey: Decode> Decode for StoredPendingChange<N, SessionKey
}
}

/// GRANDPA events.
decl_event!(
pub enum Event<T> where <T as Trait>::SessionKey {
/// New authority set has been applied.
Expand Down
1 change: 0 additions & 1 deletion srml/session/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ decl_module! {
}
}

/// An event in this module.
decl_event!(
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
Expand Down
1 change: 0 additions & 1 deletion srml/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,6 @@ decl_module! {
}
}

/// An event in this module.
decl_event!(
pub enum Event<T> where Balance = BalanceOf<T>, <T as system::Trait>::AccountId {
/// All validators have been rewarded by the given balance.
Expand Down
1 change: 0 additions & 1 deletion srml/sudo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ decl_module! {
}
}

/// An event in this module.
decl_event!(
pub enum Event<T> where AccountId = <T as system::Trait>::AccountId {
/// A sudo just took place.
Expand Down
8 changes: 5 additions & 3 deletions srml/support/procedural/src/storage/transformation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ fn decl_storage_items(
}

impls.extend(quote! {
/// Instance trait implemented by all usable instance of the module.
pub trait #instantiable: 'static {
#const_impls
}
Expand All @@ -510,12 +511,12 @@ fn decl_storage_items(
.map(|i| {
let name = format!("Instance{}", i);
let ident = syn::Ident::new(&name, proc_macro2::Span::call_site());
(name, ident)
(name, ident, quote! {#[doc=r"Module instance"]})
})
.chain(default_instance.clone().map(|ident| (String::new(), ident)));
.chain(default_instance.clone().map(|ident| (String::new(), ident, quote! {#[doc=r"Default module instance"]})));

// Impl Instance trait for instances
for (prefix, ident) in instances {
for (prefix, ident, doc) in instances {
let mut const_impls = TokenStream2::new();

for (const_name, partial_const_value) in &const_names {
Expand All @@ -529,6 +530,7 @@ fn decl_storage_items(
// Those trait are derived because of wrong bounds for generics
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Clone, Eq, PartialEq, #scrate::codec::Encode, #scrate::codec::Decode)]
#doc
pub struct #ident;
impl #instantiable for #ident {
#const_impls
Expand Down
5 changes: 5 additions & 0 deletions srml/support/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ macro_rules! decl_event {
// Workaround for https://github.com/rust-lang/rust/issues/26925 . Remove when sorted.
#[derive(Clone, PartialEq, Eq, $crate::codec::Encode, $crate::codec::Decode)]
#[cfg_attr(feature = "std", derive(Debug))]
/// Events for this module.
///
$(#[$attr])*
pub enum Event {
$(
Expand Down Expand Up @@ -277,9 +279,12 @@ macro_rules! __decl_generic_event {
/// [`RawEvent`]: enum.RawEvent.html
/// [`Trait`]: trait.Trait.html
pub type Event<$event_generic_param $(, $instance $( = $event_default_instance)? )?> = RawEvent<$( $generic_type ),* $(, $instance)? >;

// Workaround for https://github.com/rust-lang/rust/issues/26925 . Remove when sorted.
#[derive(Clone, PartialEq, Eq, $crate::codec::Encode, $crate::codec::Decode)]
#[cfg_attr(feature = "std", derive(Debug))]
/// Events for this module.
///
$(#[$attr])*
pub enum RawEvent<$( $generic_param ),* $(, $instance)? > {
$(
Expand Down
1 change: 0 additions & 1 deletion srml/system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ pub struct EventRecord<E: Parameter + Member> {
pub event: E,
}

/// Event for the system module.
decl_event!(
pub enum Event {
/// An extrinsic completed successfully.
Expand Down
9 changes: 0 additions & 9 deletions srml/treasury/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ type BalanceOf<T> = <<T as Trait>::Currency as Currency<<T as system::Trait>::Ac
type PositiveImbalanceOf<T> = <<T as Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::PositiveImbalance;
type NegativeImbalanceOf<T> = <<T as Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::NegativeImbalance;

/// Our module's configuration trait. All our types and consts go in here. If the
/// module is dependent on specific other modules, then their configuration traits
/// should be added to our implied traits list.
///
/// `system::Trait` should always be included in our implied traits.
pub trait Trait: system::Trait {
/// The staking balance.
type Currency: Currency<Self::AccountId>;
Expand All @@ -58,10 +53,7 @@ pub trait Trait: system::Trait {

type ProposalIndex = u32;

// The module declaration. This states the entry points that we handle. The
// macro takes care of the marshalling of arguments and dispatch.
decl_module! {
// Simple declaration of the `Module` type. Lets the macro know what its working on.
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
fn deposit_event<T>() = default;
/// Put forward a suggestion for spending. A deposit proportional to the value
Expand Down Expand Up @@ -177,7 +169,6 @@ decl_storage! {
}
}

/// An event in this module.
decl_event!(
pub enum Event<T>
where
Expand Down