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

Commit 9156ea3

Browse files
bkchrgavofyork
authored andcommitted
Make deposit_event work with none generic events (#1309)
* Make `deposit_event` work with none generic events `fn deposit_event() = default` will now be used for none generic events `fn deposit_event<T>() = default` is now for generic events. * Update wasm files * Fixes some spelling mistakes * Update wasm and fix new module
1 parent 6a0b684 commit 9156ea3

File tree

17 files changed

+39
-19
lines changed

17 files changed

+39
-19
lines changed
Binary file not shown.
Binary file not shown.

srml/assets/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ type AssetId = u32;
6262
decl_module! {
6363
// Simple declaration of the `Module` type. Lets the macro know what its working on.
6464
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
65-
fn deposit_event() = default;
65+
fn deposit_event<T>() = default;
6666
/// Issue a new class of fungible assets. There are, and will only ever be, `total`
6767
/// such assets and they'll all belong to the `origin` initially. It will have an
6868
/// identifier `AssetId` instance: this will be specified in the `Issued` event.

srml/balances/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ pub trait Trait: system::Trait {
136136

137137
decl_module! {
138138
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
139-
fn deposit_event() = default;
139+
fn deposit_event<T>() = default;
140140

141141
/// Transfer some liquid free balance to another staker.
142142
pub fn transfer(

srml/contract/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ where
147147
decl_module! {
148148
/// Contracts module.
149149
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
150-
fn deposit_event() = default;
150+
fn deposit_event<T>() = default;
151151
// TODO: Change AccountId to staking::Address
152152
/// Make a call to a specified account, optionally transferring some balance.
153153
/// Make a call to a specified account, optionally transferring some balance.

srml/council/src/motions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ decl_event!(
6767

6868
decl_module! {
6969
pub struct Module<T: Trait> for enum Call where origin: <T as system::Trait>::Origin {
70-
fn deposit_event() = default;
70+
fn deposit_event<T>() = default;
7171
fn propose(origin, threshold: Compact<u32>, proposal: Box<<T as Trait>::Proposal>) {
7272
let who = ensure_signed(origin)?;
7373
let threshold = threshold.into();

srml/council/src/seats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub trait Trait: democracy::Trait {
8787

8888
decl_module! {
8989
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
90-
fn deposit_event() = default;
90+
fn deposit_event<T>() = default;
9191

9292
/// Set candidate approvals. Approval slots stay valid as long as candidates in those slots
9393
/// are registered.

srml/council/src/voting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub trait Trait: CouncilTrait {
3333

3434
decl_module! {
3535
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
36-
fn deposit_event() = default;
36+
fn deposit_event<T>() = default;
3737

3838
fn propose(origin, proposal: Box<T::Proposal>) {
3939
let who = ensure_signed(origin)?;

srml/democracy/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub trait Trait: balances::Trait + Sized {
8787

8888
decl_module! {
8989
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
90-
fn deposit_event() = default;
90+
fn deposit_event<T>() = default;
9191

9292
/// Propose a sensitive action to be taken.
9393
fn propose(
@@ -376,7 +376,7 @@ impl<T: Trait> Module<T> {
376376
.map(|a| (a.clone(), Self::vote_of((index, a))))
377377
// ^^^ defensive only: all items come from `voters`; for an item to be in `voters` there must be a vote registered; qed
378378
.filter(|&(_, vote)| vote.is_aye() == approved) // Just the winning coins
379-
{
379+
{
380380
// now plus: the base lock period multiplied by the number of periods this voter offered to
381381
// lock should they win...
382382
let locked_until = now + lock_period * T::BlockNumber::sa((vote.multiplier()) as u64);

srml/example/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ decl_module! {
9898
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
9999
/// Deposit one of this module's events by using the default implementation.
100100
/// It is also possible to provide a custom implementation.
101-
fn deposit_event() = default;
101+
/// For non-generic events, the generic parameter just needs to be dropped, so that it
102+
/// looks like: `fn deposit_event() = default;`.
103+
fn deposit_event<T>() = default;
102104
/// This is your public interface. Be extremely careful.
103105
/// This is just a simple example of how to interact with the module from the external
104106
/// world.

0 commit comments

Comments
 (0)