mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 10:27:59 +00:00
Simplify deposit_event declaration in decl_module (#3506)
* simplify module deposit_event declaration * fix * bump version * fix * fix test * fix doc
This commit is contained in:
committed by
Bastian Köcher
parent
f830db9642
commit
b07fd450e2
@@ -55,7 +55,7 @@ mod module1 {
|
||||
{
|
||||
fn offchain_worker() {}
|
||||
|
||||
fn deposit_event<T, I>() = default;
|
||||
fn deposit_event() = default;
|
||||
|
||||
fn one(origin) {
|
||||
system::ensure_root(origin)?;
|
||||
@@ -132,7 +132,7 @@ mod module2 {
|
||||
pub struct Module<T: Trait<I>, I: Instance=DefaultInstance> for enum Call where
|
||||
origin: <T as system::Trait>::Origin
|
||||
{
|
||||
fn deposit_event<T, I>() = default;
|
||||
fn deposit_event() = default;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ error: Invalid call fn name: `offchain_worker`, name is reserved and doesn't mat
|
||||
|
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
error: Invalid call fn name: `deposit_event`, name is reserved and doesn't match expected signature, please refer to `decl_module!` documentation to see the appropriate usage, or rename it to an unreserved keyword.
|
||||
error: `deposit_event` function is reserved and must follow the syntax: `$vis:vis fn deposit_event() = default;`
|
||||
--> $DIR/on_initialize.rs:30:1
|
||||
|
|
||||
30 | reserved!(on_finalize on_initialize on_finalise on_initialise offchain_worker deposit_event);
|
||||
|
||||
@@ -12,8 +12,11 @@ pub trait Trait: 'static + Eq + Clone {
|
||||
|
||||
srml_support::decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
pub fn deposit_event(_event: T::Event) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> Module<T> {
|
||||
pub fn deposit_event(_event: impl Into<T::Event>) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,4 +52,4 @@ pub fn ensure_root<OuterOrigin, AccountId>(o: OuterOrigin) -> Result<(), &'stati
|
||||
where OuterOrigin: Into<Result<RawOrigin<AccountId>, OuterOrigin>>
|
||||
{
|
||||
o.into().map(|_| ()).map_err(|_| "bad origin: expected to be a root origin")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user