Skip to main content

FoundryContextExt

Trait FoundryContextExt 

Source
pub trait FoundryContextExt: ContextTr<Block: FoundryBlock + Clone, Tx: FoundryTransaction + Clone, Cfg: Cfg<Spec = Self::Spec> + Clone + From<CfgEnv<Self::Spec>> + Into<CfgEnv<Self::Spec>>, Journal: FoundryJournal, Chain: FoundryChain<Self::Tx>> {
    type Spec: Into<SpecId> + Copy + Debug;

Show 15 methods // Required methods fn block_mut(&mut self) -> &mut Self::Block; fn tx_mut(&mut self) -> &mut Self::Tx; fn cfg_mut(&mut self) -> &mut Self::Cfg; fn cfg_env(&self) -> &CfgEnv<Self::Spec>; fn cfg_env_mut(&mut self) -> &mut CfgEnv<Self::Spec>; fn db_journal_inner_mut(&mut self) -> (&mut Self::Db, &mut JournaledState); fn journal_inner(&self) -> &JournaledState; // Provided methods fn set_spec_and_gas_params(&mut self, spec: Self::Spec) { ... } fn set_block(&mut self, block: Self::Block) { ... } fn set_tx(&mut self, tx: Self::Tx) { ... } fn set_cfg(&mut self, cfg: Self::Cfg) { ... } fn set_journal_inner(&mut self, journal_inner: JournaledState) { ... } fn set_evm(&mut self, evm_env: EvmEnv<Self::Spec, Self::Block>) { ... } fn tx_clone(&self) -> Self::Tx { ... } fn evm_clone(&self) -> EvmEnv<Self::Spec, Self::Block> { ... }
}
Expand description

Extension trait providing mutable field access to block, tx, and cfg environments.

[ContextTr] only exposes immutable references for block, tx, and cfg. Cheatcodes like vm.warp(), vm.roll(), vm.chainId() need to mutate these fields.

Required Associated Types§

Source

type Spec: Into<SpecId> + Copy + Debug

Specification id type

Bubbled-up from ContextTr::Cfg for convenience and simplified bounds.

Required Methods§

Source

fn block_mut(&mut self) -> &mut Self::Block

Mutable reference to the block environment.

Source

fn tx_mut(&mut self) -> &mut Self::Tx

Mutable reference to the transaction environment.

Source

fn cfg_mut(&mut self) -> &mut Self::Cfg

Mutable reference to the configuration environment.

Source

fn cfg_env(&self) -> &CfgEnv<Self::Spec>

Reference to the underlying [CfgEnv].

Source

fn cfg_env_mut(&mut self) -> &mut CfgEnv<Self::Spec>

Mutable reference to the underlying [CfgEnv].

Source

fn db_journal_inner_mut(&mut self) -> (&mut Self::Db, &mut JournaledState)

Mutable reference to the db and the journal inner.

Source

fn journal_inner(&self) -> &JournaledState

Reference to the journal inner.

Provided Methods§

Source

fn set_spec_and_gas_params(&mut self, spec: Self::Spec)

Sets the spec and refreshes gas params for the concrete EVM family.

Source

fn set_block(&mut self, block: Self::Block)

Sets block environment.

Source

fn set_tx(&mut self, tx: Self::Tx)

Sets transaction environment.

Source

fn set_cfg(&mut self, cfg: Self::Cfg)

Sets configuration environment.

Source

fn set_journal_inner(&mut self, journal_inner: JournaledState)

Sets journal inner.

Source

fn set_evm(&mut self, evm_env: EvmEnv<Self::Spec, Self::Block>)

Sets EVM environment.

Source

fn tx_clone(&self) -> Self::Tx

Cloned transaction environment.

Source

fn evm_clone(&self) -> EvmEnv<Self::Spec, Self::Block>

Cloned EVM environment (Cfg + Block).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<BLOCK: FoundryBlock + Clone, TX: FoundryTransaction + Clone, SPEC: Into<SpecId> + Copy + Debug, DB: Database, C: FoundryChain<TX>> FoundryContextExt for Context<BLOCK, TX, CfgEnv<SPEC>, DB, Journal<DB>, C>

Source§

type Spec = <<Context<BLOCK, TX, CfgEnv<SPEC>, DB, Journal<DB>, C> as ContextTr>::Cfg as Cfg>::Spec

Source§

fn block_mut(&mut self) -> &mut Self::Block

Source§

fn tx_mut(&mut self) -> &mut Self::Tx

Source§

fn cfg_mut(&mut self) -> &mut Self::Cfg

Source§

fn cfg_env(&self) -> &CfgEnv<Self::Spec>

Source§

fn cfg_env_mut(&mut self) -> &mut CfgEnv<Self::Spec>

Source§

fn db_journal_inner_mut(&mut self) -> (&mut Self::Db, &mut JournaledState)

Source§

fn journal_inner(&self) -> &JournaledState

Source§

impl<DB: Database> FoundryContextExt for Context<BlockEnv, TxEnv, MonadCfgEnv, DB, MonadJournal<DB>, MonadChainContext>

Available on crate feature monad only.
Source§

type Spec = <<Context<BlockEnv, TxEnv, MonadCfgEnv, DB, MonadJournal<DB>, MonadChainContext> as ContextTr>::Cfg as Cfg>::Spec

Source§

fn block_mut(&mut self) -> &mut Self::Block

Source§

fn tx_mut(&mut self) -> &mut Self::Tx

Source§

fn cfg_mut(&mut self) -> &mut Self::Cfg

Source§

fn cfg_env(&self) -> &CfgEnv<Self::Spec>

Source§

fn cfg_env_mut(&mut self) -> &mut CfgEnv<Self::Spec>

Source§

fn set_spec_and_gas_params(&mut self, spec: Self::Spec)

Source§

fn db_journal_inner_mut(&mut self) -> (&mut Self::Db, &mut JournaledState)

Source§

fn journal_inner(&self) -> &JournaledState

Implementors§