Skip to content

Commit 17a5473

Browse files
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
1 parent cbd8f73 commit 17a5473

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/lib.rs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub use crate::backend::{Account, Log, Vicinity, Backend};
2525

2626
use sp_std::{vec::Vec, marker::PhantomData};
2727
use frame_support::{ensure, decl_module, decl_storage, decl_event, decl_error};
28-
use frame_support::weights::{Weight, MINIMUM_WEIGHT, DispatchClass, FunctionOf};
28+
use frame_support::weights::{Weight, MINIMUM_WEIGHT, DispatchClass, FunctionOf, Pays};
2929
use frame_support::traits::{Currency, WithdrawReason, ExistenceRequirement};
3030
use frame_system::{self as system, ensure_signed};
3131
use sp_runtime::ModuleId;
@@ -235,7 +235,12 @@ decl_module! {
235235
}
236236

237237
/// Issue an EVM call operation. This is similar to a message call transaction in Ethereum.
238-
#[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)]
238+
#[weight = FunctionOf(
239+
|(_, _, _, gas_limit, gas_price, _): (&H160, &Vec<u8>, &U256, &u32, &U256, &Option<U256>)|
240+
(*gas_price).saturated_into::<Weight>().saturating_mul(*gas_limit as Weight),
241+
DispatchClass::Normal,
242+
Pays::Yes,
243+
)]
239244
fn call(
240245
origin,
241246
target: H160,
@@ -266,7 +271,12 @@ decl_module! {
266271

267272
/// Issue an EVM create operation. This is similar to a contract creation transaction in
268273
/// Ethereum.
269-
#[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)]
274+
#[weight = FunctionOf(
275+
|(_, _, gas_limit, gas_price, _): (&Vec<u8>, &U256, &u32, &U256, &Option<U256>)|
276+
(*gas_price).saturated_into::<Weight>().saturating_mul(*gas_limit as Weight),
277+
DispatchClass::Normal,
278+
Pays::Yes,
279+
)]
270280
fn create(
271281
origin,
272282
init: Vec<u8>,
@@ -301,7 +311,12 @@ decl_module! {
301311
}
302312

303313
/// Issue an EVM create2 operation.
304-
#[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)]
314+
#[weight = FunctionOf(
315+
|(_, _, _, gas_limit, gas_price, _): (&Vec<u8>, &H256, &U256, &u32, &U256, &Option<U256>)|
316+
(*gas_price).saturated_into::<Weight>().saturating_mul(*gas_limit as Weight),
317+
DispatchClass::Normal,
318+
Pays::Yes,
319+
)]
305320
fn create2(
306321
origin,
307322
init: Vec<u8>,

0 commit comments

Comments
 (0)