Skip to content

Commit

Permalink
chore(cast): upgrade evmole to 0.6.1, use new style API
Browse files Browse the repository at this point in the history
  • Loading branch information
cdump committed Dec 5, 2024
1 parent a4de7e8 commit 5dd1ae3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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"
Expand Down
25 changes: 20 additions & 5 deletions crates/cast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2103,13 +2103,28 @@ impl SimpleCast {
/// ```
pub fn extract_functions(bytecode: &str) -> Result<Vec<(String, String, &str)>> {
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::<Vec<String>>()
.join(","),
f.state_mutability
.expect("state_mutability extraction was requested")
.as_json_str(),
)
})
.collect())
Expand Down

0 comments on commit 5dd1ae3

Please sign in to comment.