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
+19 -4
View File
@@ -25,7 +25,7 @@ pub use crate::backend::{Account, Log, Vicinity, Backend};
use sp_std::{vec::Vec, marker::PhantomData};
use frame_support::{ensure, decl_module, decl_storage, decl_event, decl_error};
use frame_support::weights::{Weight, MINIMUM_WEIGHT, DispatchClass, FunctionOf};
use frame_support::weights::{Weight, MINIMUM_WEIGHT, DispatchClass, FunctionOf, Pays};
use frame_support::traits::{Currency, WithdrawReason, ExistenceRequirement};
use frame_system::{self as system, ensure_signed};
use sp_runtime::ModuleId;
@@ -235,7 +235,12 @@ decl_module! {
}
/// Issue an EVM call operation. This is similar to a message call transaction in Ethereum.
#[weight = FunctionOf(|(_, _, _, gas_limit, gas_price, _): (&H160, &Vec<u8>, &U256, &u32, &U256, &Option<U256>)| (*gas_price).saturated_into::<Weight>().saturating_mul(*gas_limit as Weight), DispatchClass::Normal, true)]
#[weight = FunctionOf(
|(_, _, _, gas_limit, gas_price, _): (&H160, &Vec<u8>, &U256, &u32, &U256, &Option<U256>)|
(*gas_price).saturated_into::<Weight>().saturating_mul(*gas_limit as Weight),
DispatchClass::Normal,
Pays::Yes,
)]
fn call(
origin,
target: H160,
@@ -266,7 +271,12 @@ decl_module! {
/// Issue an EVM create operation. This is similar to a contract creation transaction in
/// Ethereum.
#[weight = FunctionOf(|(_, _, gas_limit, gas_price, _): (&Vec<u8>, &U256, &u32, &U256, &Option<U256>)| (*gas_price).saturated_into::<Weight>().saturating_mul(*gas_limit as Weight), DispatchClass::Normal, true)]
#[weight = FunctionOf(
|(_, _, gas_limit, gas_price, _): (&Vec<u8>, &U256, &u32, &U256, &Option<U256>)|
(*gas_price).saturated_into::<Weight>().saturating_mul(*gas_limit as Weight),
DispatchClass::Normal,
Pays::Yes,
)]
fn create(
origin,
init: Vec<u8>,
@@ -301,7 +311,12 @@ decl_module! {
}
/// Issue an EVM create2 operation.
#[weight = FunctionOf(|(_, _, _, gas_limit, gas_price, _): (&Vec<u8>, &H256, &U256, &u32, &U256, &Option<U256>)| (*gas_price).saturated_into::<Weight>().saturating_mul(*gas_limit as Weight), DispatchClass::Normal, true)]
#[weight = FunctionOf(
|(_, _, _, gas_limit, gas_price, _): (&Vec<u8>, &H256, &U256, &u32, &U256, &Option<U256>)|
(*gas_price).saturated_into::<Weight>().saturating_mul(*gas_limit as Weight),
DispatchClass::Normal,
Pays::Yes,
)]
fn create2(
origin,
init: Vec<u8>,