use revm::primitives::{BlockEnv, CfgEnvWithHandlerCfg};
#[derive(Debug, Clone)]
pub struct EvmEnv {
pub cfg_env_with_handler_cfg: CfgEnvWithHandlerCfg,
pub block_env: BlockEnv,
}
impl EvmEnv {
pub const fn new(cfg_env_with_handler_cfg: CfgEnvWithHandlerCfg, block_env: BlockEnv) -> Self {
Self { cfg_env_with_handler_cfg, block_env }
}
pub const fn block_env(&self) -> &BlockEnv {
&self.block_env
}
pub const fn cfg_env_with_handler_cfg(&self) -> &CfgEnvWithHandlerCfg {
&self.cfg_env_with_handler_cfg
}
}
impl From<(CfgEnvWithHandlerCfg, BlockEnv)> for EvmEnv {
fn from((cfg_env_with_handler_cfg, block_env): (CfgEnvWithHandlerCfg, BlockEnv)) -> Self {
Self { cfg_env_with_handler_cfg, block_env }
}
}
impl From<EvmEnv> for (CfgEnvWithHandlerCfg, BlockEnv) {
fn from(env: EvmEnv) -> Self {
(env.cfg_env_with_handler_cfg, env.block_env)
}
}