Migrate away from SimpleDispatchInfo (#5686)

* Migrate away from SimpleDispatchInfo

* Fix imports

* Better doc

* Update lib.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Kian Paimani
2020-04-22 09:20:28 +02:00
committed by GitHub
parent 25c3ab2c1e
commit 50a7e12b3f
40 changed files with 458 additions and 405 deletions
+3 -3
View File
@@ -24,7 +24,7 @@ use sp_std::prelude::*;
use sp_runtime::{traits::{BlakeTwo256, IdentityLookup}, testing::{H256, Header}};
use frame_support::{
dispatch::DispatchResult,
weights::{SimpleDispatchInfo, MINIMUM_WEIGHT},
weights::MINIMUM_WEIGHT,
decl_module, decl_storage, impl_outer_origin, assert_ok, assert_err, ensure
};
use frame_system::{RawOrigin, ensure_signed, ensure_none};
@@ -37,14 +37,14 @@ decl_storage! {
decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
fn set_value(origin, n: u32) -> DispatchResult {
let _sender = ensure_signed(origin)?;
Value::put(n);
Ok(())
}
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
fn dummy(origin, _n: u32) -> DispatchResult {
let _sender = ensure_none(origin)?;
Ok(())