Struct evm_gasometer::Gasometer
source · pub struct Gasometer<'config> { /* private fields */ }
Expand description
EVM gasometer.
Implementations§
source§impl<'config> Gasometer<'config>
impl<'config> Gasometer<'config>
sourcepub fn new(gas_limit: u64, config: &'config Config) -> Self
pub fn new(gas_limit: u64, config: &'config Config) -> Self
Create a new gasometer with given gas limit and config.
sourcepub fn gas_cost(&self, cost: GasCost, gas: u64) -> Result<u64, ExitError>
pub fn gas_cost(&self, cost: GasCost, gas: u64) -> Result<u64, ExitError>
Returns the numerical gas cost value.
sourcepub fn total_used_gas(&self) -> u64
pub fn total_used_gas(&self) -> u64
Total used gas.
sourcepub fn refunded_gas(&self) -> i64
pub fn refunded_gas(&self) -> i64
Refunded gas.
sourcepub fn fail(&mut self) -> ExitError
pub fn fail(&mut self) -> ExitError
Explicitly fail the gasometer with out of gas. Return OutOfGas
error.
sourcepub fn record_refund(&mut self, refund: i64) -> Result<(), ExitError>
pub fn record_refund(&mut self, refund: i64) -> Result<(), ExitError>
Record an explicit refund.
sourcepub fn record_deposit(&mut self, len: usize) -> Result<(), ExitError>
pub fn record_deposit(&mut self, len: usize) -> Result<(), ExitError>
Record CREATE
code deposit.
sourcepub fn record_dynamic_cost(
&mut self,
cost: GasCost,
memory: Option<MemoryCost>
) -> Result<(), ExitError>
pub fn record_dynamic_cost( &mut self, cost: GasCost, memory: Option<MemoryCost> ) -> Result<(), ExitError>
Record opcode gas cost.
sourcepub fn record_transaction(
&mut self,
cost: TransactionCost
) -> Result<(), ExitError>
pub fn record_transaction( &mut self, cost: TransactionCost ) -> Result<(), ExitError>
Record transaction cost.
Trait Implementations§
Auto Trait Implementations§
impl<'config> RefUnwindSafe for Gasometer<'config>
impl<'config> Send for Gasometer<'config>
impl<'config> Sync for Gasometer<'config>
impl<'config> Unpin for Gasometer<'config>
impl<'config> UnwindSafe for Gasometer<'config>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more