diff --git a/crates/format/src/case.rs b/crates/format/src/case.rs index 96cd299..4a5802b 100644 --- a/crates/format/src/case.rs +++ b/crates/format/src/case.rs @@ -18,6 +18,22 @@ pub struct Case { } impl Case { + pub fn inputs_iterator(&self) -> impl Iterator { + let inputs_len = self.inputs.len(); + self.inputs + .clone() + .into_iter() + .enumerate() + .map(move |(idx, mut input)| { + if idx + 1 == inputs_len { + input.expected = self.expected.clone(); + input + } else { + input + } + }) + } + pub fn handle_address_replacement( &mut self, old_to_new_mapping: &mut AddressReplacementMap, @@ -37,21 +53,3 @@ define_wrapper_type!( #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] CaseIdx(usize); ); - -impl Case { - pub fn inputs_iterator(&self) -> impl Iterator { - let inputs_len = self.inputs.len(); - self.inputs - .clone() - .into_iter() - .enumerate() - .map(move |(idx, mut input)| { - if idx + 1 == inputs_len { - input.expected = self.expected.clone(); - input - } else { - input - } - }) - } -} diff --git a/crates/format/src/input.rs b/crates/format/src/input.rs index 8de92d4..e682243 100644 --- a/crates/format/src/input.rs +++ b/crates/format/src/input.rs @@ -558,7 +558,7 @@ mod tests { } #[test] - fn test_encoded_input_address() { + fn test_encoded_input_address_with_signature() { let raw_abi = r#"[ { "inputs": [{"name": "recipient", "type": "address"}], @@ -579,8 +579,8 @@ mod tests { .0; let input: Input = Input { - instance: ContractInstance::new_from("Contract"), - method: Method::FunctionName("send".to_owned()), + instance: "Contract".to_owned().into(), + method: Method::FunctionName("send(address)".to_owned()), calldata: Calldata::Compound(vec![ "0x1000000000000000000000000000000000000001".to_string(), ]), @@ -605,7 +605,7 @@ mod tests { } #[test] - fn test_encoded_input_address_with_signature() { + fn test_encoded_input_address() { let raw_abi = r#"[ { "inputs": [{"name": "recipient", "type": "address"}], @@ -627,7 +627,7 @@ mod tests { let input: Input = Input { instance: ContractInstance::new_from("Contract"), - method: Method::FunctionName("send(address)".to_owned()), + method: Method::FunctionName("send".to_owned()), calldata: Calldata::Compound(vec![ "0x1000000000000000000000000000000000000001".to_string(), ]),