caller_gas_allowance

Function caller_gas_allowance 

pub fn caller_gas_allowance<DB, T>(
    db: &mut DB,
    env: &T,
) -> Result<u64, CallError<<DB as Database>::Error>>
where DB: Database, T: Transaction,
Available on crate feature evm only.
Expand description

Calculates the caller gas allowance.

allowance = (account.balance - tx.value) / tx.gas_price

Returns an error if the caller has insufficient funds. Caution: This assumes non-zero env.gas_price. Otherwise, zero allowance will be returned.

Note: this takes the mut Database trait because the loaded sender can be reused for the following operation like eth_call.