diff --git a/crates/core/src/main.rs b/crates/core/src/main.rs index c161620..2670149 100644 --- a/crates/core/src/main.rs +++ b/crates/core/src/main.rs @@ -47,7 +47,7 @@ fn main() -> anyhow::Result<()> { None } }) { - replacement_map.get(address); + replacement_map.add(address); } case.handle_address_replacement(&mut replacement_map)?; replacement_private_keys.extend( diff --git a/crates/format/src/input.rs b/crates/format/src/input.rs index 1faae0b..8de92d4 100644 --- a/crates/format/src/input.rs +++ b/crates/format/src/input.rs @@ -104,7 +104,7 @@ impl ExpectedOutput { pub fn handle_address_replacement( &mut self, - old_to_new_mapping: &mut AddressReplacementMap, + old_to_new_mapping: &AddressReplacementMap, ) -> anyhow::Result<()> { if let Some(ref mut calldata) = self.return_data { calldata.handle_address_replacement(old_to_new_mapping)?; @@ -121,7 +121,7 @@ impl ExpectedOutput { impl Event { pub fn handle_address_replacement( &mut self, - old_to_new_mapping: &mut AddressReplacementMap, + old_to_new_mapping: &AddressReplacementMap, ) -> anyhow::Result<()> { if let Some(ref mut address) = self.address { if let Some(new_address) = old_to_new_mapping.resolve(address.to_string().as_str()) { @@ -157,7 +157,7 @@ impl Calldata { pub fn handle_address_replacement( &mut self, - old_to_new_mapping: &mut AddressReplacementMap, + old_to_new_mapping: &AddressReplacementMap, ) -> anyhow::Result<()> { match self { Calldata::Single(_) => {} @@ -220,7 +220,7 @@ impl Calldata { impl Expected { pub fn handle_address_replacement( &mut self, - old_to_new_mapping: &mut AddressReplacementMap, + old_to_new_mapping: &AddressReplacementMap, ) -> anyhow::Result<()> { match self { Expected::Calldata(calldata) => { @@ -347,7 +347,7 @@ impl Input { old_to_new_mapping: &mut AddressReplacementMap, ) -> anyhow::Result<()> { if self.caller != default_caller() { - self.caller = old_to_new_mapping.get(self.caller); + self.caller = old_to_new_mapping.add(self.caller); } self.calldata .handle_address_replacement(old_to_new_mapping)?; diff --git a/crates/format/src/metadata.rs b/crates/format/src/metadata.rs index c8c9756..c62c174 100644 --- a/crates/format/src/metadata.rs +++ b/crates/format/src/metadata.rs @@ -339,7 +339,7 @@ impl AddressReplacementMap { self.0.contains_key(address) } - pub fn get(&mut self, address: Address) -> Address { + pub fn add(&mut self, address: Address) -> Address { self.0 .entry(address) .or_insert_with(|| { @@ -355,7 +355,7 @@ impl AddressReplacementMap { .1 } - pub fn resolve(&mut self, value: &str) -> Option
{ + pub fn resolve(&self, value: &str) -> Option
{ // We attempt to resolve the given string without any additional context of the deployed // contracts or the node API as we do not need them. If the resolution fails then we know // that this isn't an address and we skip it.