Skip to main content

FoundryContextExt

Trait FoundryContextExt 

pub trait FoundryContextExt: ContextTr
where Self::Block: FoundryBlock + Clone, Self::Tx: FoundryTransaction + Clone, Self::Cfg: FoundryCfg<Spec = Self::Spec>, Self::Journal: FoundryJournal, Self::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; // Provided methods 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 JournalInner<JournalEntry>) { ... } fn journal_inner(&self) -> &JournalInner<JournalEntry> { ... } 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: JournalInner<JournalEntry>) { ... } 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§

type Spec: Into<SpecId> + Copy + Debug

Specification id type

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

Required Methods§

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

Mutable reference to the block environment.

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

Mutable reference to the transaction environment.

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

Mutable reference to the configuration environment.

Provided Methods§

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

Reference to the underlying CfgEnv.

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

Mutable reference to the underlying CfgEnv.

fn db_journal_inner_mut( &mut self, ) -> (&mut Self::Db, &mut JournalInner<JournalEntry>)

Mutable reference to the db and the journal inner.

fn journal_inner(&self) -> &JournalInner<JournalEntry>

Reference to the journal inner.

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

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

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

Sets block environment.

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

Sets transaction environment.

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

Sets configuration environment.

fn set_journal_inner(&mut self, journal_inner: JournalInner<JournalEntry>)

Sets journal inner.

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

Sets EVM environment.

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

Cloned transaction environment.

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".

Implementors§

§

impl<BLOCK, TX, CFG, DB, J, C> FoundryContextExt for Context<BLOCK, TX, CFG, DB, J, C>
where BLOCK: FoundryBlock + Clone, TX: FoundryTransaction + Clone, CFG: FoundryCfg, DB: Database, J: FoundryJournal<Database = DB>, C: FoundryChain<TX>,

§

type Spec = <<Context<BLOCK, TX, CFG, DB, J, C> as ContextTr>::Cfg as Cfg>::Spec