enum Pays for PaysFee (#5733)

* enum Pays for PaysFee

* Fix doc test

* Update bin/node/executor/tests/basic.rs

* Update bin/node/executor/tests/basic.rs
This commit is contained in:
Kian Paimani
2020-04-22 15:50:25 +02:00
committed by GitHub
parent c424ce94a3
commit 6607393f9b
13 changed files with 148 additions and 87 deletions
+3 -3
View File
@@ -93,7 +93,7 @@ use sp_runtime::traits::{StaticLookup, Dispatchable};
use frame_support::{
Parameter, decl_module, decl_event, decl_storage, decl_error, ensure,
};
use frame_support::weights::{MINIMUM_WEIGHT, GetDispatchInfo, FunctionOf};
use frame_support::weights::{MINIMUM_WEIGHT, GetDispatchInfo, FunctionOf, Pays};
use frame_system::{self as system, ensure_signed};
pub trait Trait: frame_system::Trait {
@@ -124,7 +124,7 @@ decl_module! {
#[weight = FunctionOf(
|args: (&Box<<T as Trait>::Call>,)| args.0.get_dispatch_info().weight + 10_000,
|args: (&Box<<T as Trait>::Call>,)| args.0.get_dispatch_info().class,
true
Pays::Yes,
)]
fn sudo(origin, call: Box<<T as Trait>::Call>) {
// This is a public call, so we ensure that the origin is some signed account.
@@ -180,7 +180,7 @@ decl_module! {
|args: (&<T::Lookup as StaticLookup>::Source, &Box<<T as Trait>::Call>,)| {
args.1.get_dispatch_info().class
},
true
Pays::Yes,
)]
fn sudo_as(origin, who: <T::Lookup as StaticLookup>::Source, call: Box<<T as Trait>::Call>) {
// This is a public call, so we ensure that the origin is some signed account.