Skip to main content

derive_fees

Function derive_fees 

Source
pub fn derive_fees(
    base_fee_per_gas_wei: u128,
    priority_fee_per_gas_wei: u128,
    base_fee_buffer_bps: u32,
    max_fee_per_gas_wei: u128,
) -> Result<(u128, u128)>
Expand description

Derives EIP-1559 fees from the latest base fee and the node’s suggested priority fee.

max_fee_per_gas is the base fee with base_fee_buffer_bps applied plus the priority fee; max_priority_fee_per_gas is the priority fee itself. max_fee_per_gas_wei is a hard ceiling that rejects the transaction when current conditions exceed it.

§Errors

Returns an error if the derived max fee exceeds max_fee_per_gas_wei or the arithmetic overflows.