Skip to content

Commit

Permalink
remove name() method from FunctionCallDefinition
Browse files Browse the repository at this point in the history
  • Loading branch information
jinmel committed Sep 30, 2024
1 parent 3bbf1e6 commit 477c9b3
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions src/generator/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use alloy::{
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use tokio::task::JoinHandle;
use regex::Regex;

pub type RpcProvider = RootProvider<Http<Client>>;

Expand Down Expand Up @@ -114,45 +113,3 @@ impl FunctionCallDefinition {
signature.clone()
}
}

#[cfg(test)]
pub mod tests {
use super::FunctionCallDefinition;

#[test]
fn constructs_name_from_signature() {
let fn_def_with_args = FunctionCallDefinition {
to: "0x1234".to_string(),
from: "0x5678".to_string(),
signature: "transfer(address to, uint256 amount)".to_string(),
args: Some(vec!["0x8765".to_string(), "100".to_string()]),
value: Some("100".to_string()),
fuzz: None,
kind: None,
};
assert_eq!(fn_def_with_args.name(), "transfer(address to=[0x8765], uint256 amount=[100])");

let fn_def_no_args = FunctionCallDefinition {
to: "0x1234".to_string(),
from: "0x5678".to_string(),
signature: "transfer()".to_string(),
args: None,
value: Some("100".to_string()),
fuzz: None,
kind: None,
};
assert_eq!(fn_def_no_args.name(), "transfer()");

// checks if it does not fail against invalid signature.
let fn_def_invalid_sig = FunctionCallDefinition {
to: "0x1234".to_string(),
from: "0x5678".to_string(),
signature: "transfer(address, uint256 amount)".to_string(),
args: Some(vec!["0x8765".to_string(), "100".to_string()]),
value: Some("100".to_string()),
fuzz: None,
kind: None,
};
assert_eq!(fn_def_invalid_sig.name(), "transfer(uint256 amount=[100])");
}
}

0 comments on commit 477c9b3

Please sign in to comment.