Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
enum Pays for PaysFee (#5733)
Browse files Browse the repository at this point in the history
* enum Pays for PaysFee

* Fix doc test

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

* Update bin/node/executor/tests/basic.rs
  • Loading branch information
kianenigma authored Apr 22, 2020
1 parent 3f64bd4 commit b9585bb
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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>,
Expand Down Expand Up @@ -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>,
Expand Down

0 comments on commit b9585bb

Please sign in to comment.