Skip to content

Commit 40fff23

Browse files
committed
Recalculate decimals for gas price
1 parent 638f521 commit 40fff23

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

runtime/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,9 @@ parameter_types! {
10881088
pub SuicideQuickClearLimit: u32 = 0;
10891089
}
10901090

1091+
/// The difference between EVM decimals and Substrate decimals.
1092+
/// Substrate balances has 9 decimals, while EVM has 18, so the
1093+
/// difference factor is 9 decimals, or 10^9
10911094
const EVM_DECIMALS_FACTOR: u64 = 1_000_000_000_u64;
10921095

10931096
pub struct SubtensorEvmBalanceConverter<F>(PhantomData<F>);
@@ -1556,7 +1559,9 @@ impl_runtime_apis! {
15561559

15571560
fn gas_price() -> U256 {
15581561
let (gas_price, _) = <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price();
1559-
gas_price
1562+
1563+
// Recalculate decimals
1564+
gas_price * U256::from(EVM_DECIMALS_FACTOR)
15601565
}
15611566

15621567
fn account_code_at(address: H160) -> Vec<u8> {

0 commit comments

Comments
 (0)