Skip to content

Commit

Permalink
add method evm::Ledger::virtual_machine to return configured EVM inst…
Browse files Browse the repository at this point in the history
…ance
  • Loading branch information
saibatizoku committed Oct 12, 2021
1 parent b74cbdf commit 8f113d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion chain-impl-mockchain/src/config.rs
Expand Up @@ -843,7 +843,7 @@ impl ConfigParamVariant for EvmConfigParams {
_ => return Err(Error::InvalidTag),
};

// Read Enviroment
// Read Environment
let gas_price = rb.get_slice(32)?.into();
let origin = Origin::from_slice(rb.get_slice(20)?);
let chain_id = rb.get_slice(32)?.into();
Expand Down
8 changes: 8 additions & 0 deletions chain-impl-mockchain/src/ledger/evm.rs
Expand Up @@ -11,6 +11,14 @@ impl Ledger {
pub fn new() -> Self {
Default::default()
}
#[cfg(feature = "evm")]
pub fn virtual_machine<'runtime>(
&self,
config: &'runtime Config,
environment: &'runtime Environment,
) -> VirtualMachine<'runtime> {
VirtualMachine::new_with_state(config, environment, self.accounts.clone())
}
}

#[cfg(not(feature = "evm"))]
Expand Down

0 comments on commit 8f113d5

Please sign in to comment.