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
+4 -5
View File
@@ -45,7 +45,6 @@ use sp_runtime::{
use frame_support::{
decl_module, decl_event, decl_storage, ensure, decl_error,
traits::{Currency, EnsureOrigin, ReservableCurrency, OnUnbalanced, Get},
weights::SimpleDispatchInfo,
};
use frame_system::{self as system, ensure_signed, ensure_root};
@@ -141,7 +140,7 @@ decl_module! {
/// - One storage read/write.
/// - One event.
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(50_000_000)]
#[weight = 50_000_000]
fn set_name(origin, name: Vec<u8>) {
let sender = ensure_signed(origin)?;
@@ -171,7 +170,7 @@ decl_module! {
/// - One storage read/write.
/// - One event.
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(70_000_000)]
#[weight = 70_000_000]
fn clear_name(origin) {
let sender = ensure_signed(origin)?;
@@ -195,7 +194,7 @@ decl_module! {
/// - One storage read/write.
/// - One event.
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(70_000_000)]
#[weight = 70_000_000]
fn kill_name(origin, target: <T::Lookup as StaticLookup>::Source) {
T::ForceOrigin::try_origin(origin)
.map(|_| ())
@@ -223,7 +222,7 @@ decl_module! {
/// - One storage read/write.
/// - One event.
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(70_000_000)]
#[weight = 70_000_000]
fn force_name(origin, target: <T::Lookup as StaticLookup>::Source, name: Vec<u8>) {
T::ForceOrigin::try_origin(origin)
.map(|_| ())