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
@@ -10,7 +10,7 @@
/// https://github.com/paritytech/substrate/blob/master/frame/example/src/lib.rs
use frame_support::{decl_module, decl_storage, decl_event, decl_error, dispatch};
use frame_support::weights::{SimpleDispatchInfo, MINIMUM_WEIGHT};
use frame_support::weights::MINIMUM_WEIGHT;
use frame_system::{self as system, ensure_signed};
#[cfg(test)]
@@ -76,7 +76,7 @@ decl_module! {
/// Just a dummy entry point.
/// function that can be called by the external world as an extrinsics call
/// takes a parameter of the type `AccountId`, stores it, and emits an event
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
pub fn do_something(origin, something: u32) -> dispatch::DispatchResult {
// Check it was signed and get the signer. See also: ensure_root and ensure_none
let who = ensure_signed(origin)?;
@@ -92,7 +92,7 @@ decl_module! {
/// Another dummy entry point.
/// takes no parameters, attempts to increment storage value, and possibly throws an error
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
pub fn cause_error(origin) -> dispatch::DispatchResult {
// Check it was signed and get the signer. See also: ensure_root and ensure_none
let _who = ensure_signed(origin)?;