diff --git a/crates/eips/src/eip1559/basefee.rs b/crates/eips/src/eip1559/basefee.rs index 1794344507f9..548db786eb7e 100644 --- a/crates/eips/src/eip1559/basefee.rs +++ b/crates/eips/src/eip1559/basefee.rs @@ -1,5 +1,6 @@ -use crate::eip1559::constants::{ - DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR, DEFAULT_ELASTICITY_MULTIPLIER, +use crate::{ + calc_next_block_base_fee, + eip1559::constants::{DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR, DEFAULT_ELASTICITY_MULTIPLIER}, }; /// BaseFeeParams contains the config parameters that control block base fee computation @@ -22,4 +23,12 @@ impl BaseFeeParams { elasticity_multiplier: DEFAULT_ELASTICITY_MULTIPLIER as u128, } } + + /// Calculate the base fee for the next block based on the EIP-1559 specification. + /// + /// See also [calc_next_block_base_fee] + #[inline] + pub fn next_block_base_fee(self, gas_used: u128, gas_limit: u128, base_fee: u128) -> u128 { + calc_next_block_base_fee(gas_used, gas_limit, base_fee, self) + } }