Skip to content

Commit c8b22f3

Browse files
Weights to u64 + Balances Weights (#5446)
Co-Authored-By: Kian Paimani <[email protected]>
1 parent 7df9c1f commit c8b22f3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/lib.rs

Lines changed: 6 additions & 6 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, DispatchClass, FunctionOf};
28+
use frame_support::weights::{Weight, MINIMUM_WEIGHT, DispatchClass, FunctionOf};
2929
use frame_support::traits::{Currency, WithdrawReason, ExistenceRequirement};
3030
use frame_system::{self as system, ensure_signed};
3131
use sp_runtime::ModuleId;
@@ -191,7 +191,7 @@ decl_module! {
191191
fn deposit_event() = default;
192192

193193
/// Deposit balance from currency/balances module into EVM.
194-
#[weight = SimpleDispatchInfo::FixedNormal(10_000)]
194+
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
195195
fn deposit_balance(origin, value: BalanceOf<T>) {
196196
let sender = ensure_signed(origin)?;
197197

@@ -212,7 +212,7 @@ decl_module! {
212212
}
213213

214214
/// Withdraw balance from EVM into currency/balances module.
215-
#[weight = SimpleDispatchInfo::FixedNormal(10_000)]
215+
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
216216
fn withdraw_balance(origin, value: BalanceOf<T>) {
217217
let sender = ensure_signed(origin)?;
218218
let address = T::ConvertAccountId::convert_account_id(&sender);
@@ -236,7 +236,7 @@ decl_module! {
236236
}
237237

238238
/// Issue an EVM call operation. This is similar to a message call transaction in Ethereum.
239-
#[weight = FunctionOf(|(_, _, _, gas_limit, gas_price, _): (&H160, &Vec<u8>, &U256, &u32, &U256, &Option<U256>)| (*gas_price).saturated_into::<Weight>().saturating_mul(*gas_limit), DispatchClass::Normal, true)]
239+
#[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)]
240240
fn call(
241241
origin,
242242
target: H160,
@@ -267,7 +267,7 @@ decl_module! {
267267

268268
/// Issue an EVM create operation. This is similar to a contract creation transaction in
269269
/// Ethereum.
270-
#[weight = FunctionOf(|(_, _, gas_limit, gas_price, _): (&Vec<u8>, &U256, &u32, &U256, &Option<U256>)| (*gas_price).saturated_into::<Weight>().saturating_mul(*gas_limit), DispatchClass::Normal, true)]
270+
#[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)]
271271
fn create(
272272
origin,
273273
init: Vec<u8>,
@@ -302,7 +302,7 @@ decl_module! {
302302
}
303303

304304
/// Issue an EVM create2 operation.
305-
#[weight = FunctionOf(|(_, _, _, gas_limit, gas_price, _): (&Vec<u8>, &H256, &U256, &u32, &U256, &Option<U256>)| (*gas_price).saturated_into::<Weight>().saturating_mul(*gas_limit), DispatchClass::Normal, true)]
305+
#[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)]
306306
fn create2(
307307
origin,
308308
init: Vec<u8>,

0 commit comments

Comments
 (0)