diff --git a/examples/erc20_gas/src/handlers/mod.rs b/examples/erc20_gas/src/handlers/mod.rs index 02af2b70ae..4ddbdb301d 100644 --- a/examples/erc20_gas/src/handlers/mod.rs +++ b/examples/erc20_gas/src/handlers/mod.rs @@ -14,11 +14,11 @@ pub use post_execution::Erc20PostExecution; pub use pre_execution::Erc20PreExecution; pub use validation::Erc20Validation; -pub type Erc20Error = EVMError<::Error, InvalidTransaction>; +pub type Erc20GasError = EVMError<::Error, InvalidTransaction>; -pub type Erc20Context = Context; +pub type Erc20GasContext = Context; -pub type Erc20Handler< +pub type CustomHandler< CTX, ERROR, VAL = Erc20Validation, @@ -27,5 +27,8 @@ pub type Erc20Handler< POSTEXEC = Erc20PostExecution, > = EthHandler; -pub type Erc20Evm = - Evm, Erc20Context, Erc20Handler, Erc20Error>>; +pub type CustomEvm = Evm< + Erc20GasError, + Erc20GasContext, + CustomHandler, Erc20GasError>, +>; diff --git a/examples/erc20_gas/src/main.rs b/examples/erc20_gas/src/main.rs index c91a7bb4d0..a24ec18e31 100644 --- a/examples/erc20_gas/src/main.rs +++ b/examples/erc20_gas/src/main.rs @@ -18,7 +18,7 @@ use revm::{ }; mod handlers; -use handlers::{Erc20Evm, Erc20Handler, Erc20PostExecution, Erc20PreExecution, Erc20Validation}; +use handlers::{CustomEvm, CustomHandler, Erc20PostExecution, Erc20PreExecution, Erc20Validation}; type AlloyCacheDB = CacheDB, Ethereum, RootProvider>>>>; @@ -142,7 +142,7 @@ fn balance_of(token: Address, address: Address, alloy_db: &mut AlloyCacheDB) -> tx.data = encoded.into(); tx.value = U256::from(0); }), - Erc20Handler::default(), + CustomHandler::default(), ); let ref_tx = evm.exec_commit().unwrap(); @@ -172,7 +172,7 @@ fn transfer( let encoded = transferCall { to, amount }.abi_encode(); - let mut evm = Erc20Evm::new( + let mut evm = CustomEvm::new( Context::builder() .with_db(cache_db) .modify_tx_chained(|tx| { @@ -181,7 +181,7 @@ fn transfer( tx.data = encoded.into(); tx.value = U256::from(0); }), - Erc20Handler::new( + CustomHandler::new( Erc20Validation::new(), Erc20PreExecution::new(), EthExecution::new(),