diff --git a/Cargo.lock b/Cargo.lock index 51a6b026840c..66a16c97084a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "Inflector" @@ -3265,9 +3265,9 @@ dependencies = [ [[package]] name = "evmole" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fcfb15a14bc209e2b3d2bd32291ec445b1e348d7d9d986aa61a09149350fd7" +checksum = "f58e21c69e0ae62877b65241d25cae9e28477818482fab8c1101d15289725a46" dependencies = [ "alloy-dyn-abi", "alloy-primitives", diff --git a/Cargo.toml b/Cargo.toml index 0fa4b4bdb33f..0518bab796cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -224,7 +224,7 @@ alloy-chains = "0.1" alloy-rlp = "0.3" alloy-trie = "0.6.0" -## op-alloy +## op-alloy op-alloy-rpc-types = "0.7.1" op-alloy-consensus = "0.7.1" @@ -260,7 +260,7 @@ color-eyre = "0.6" comfy-table = "7" dunce = "1" evm-disassembler = "0.5" -evmole = "0.5" +evmole = "0.6" eyre = "0.6" figment = "0.10" futures = "0.3" diff --git a/crates/cast/src/lib.rs b/crates/cast/src/lib.rs index b5b719e39ae8..01d7da6efc80 100644 --- a/crates/cast/src/lib.rs +++ b/crates/cast/src/lib.rs @@ -2103,13 +2103,28 @@ impl SimpleCast { /// ``` pub fn extract_functions(bytecode: &str) -> Result> { let code = hex::decode(strip_0x(bytecode))?; - Ok(evmole::function_selectors(&code, 0) + let info = evmole::contract_info( + evmole::ContractInfoArgs::new(&code) + .with_selectors() + .with_arguments() + .with_state_mutability(), + ); + Ok(info + .functions + .expect("functions extraction was requested") .into_iter() - .map(|s| { + .map(|f| { ( - hex::encode_prefixed(s), - evmole::function_arguments(&code, &s, 0), - evmole::function_state_mutability(&code, &s, 0).as_json_str(), + hex::encode_prefixed(f.selector), + f.arguments + .expect("arguments extraction was requested") + .into_iter() + .map(|t| t.sol_type_name().to_string()) + .collect::>() + .join(","), + f.state_mutability + .expect("state_mutability extraction was requested") + .as_json_str(), ) }) .collect())