Skip to content

Commit

Permalink
turn contract_address to Address (foundry-rs#1998)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshieDo authored Jun 16, 2022
1 parent e44215c commit 068c04b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions cli/src/cmd/forge/script/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use std::{
collections::{BTreeMap, HashMap, VecDeque},
io::BufWriter,
path::{Path, PathBuf},
str::FromStr,
time::{SystemTime, UNIX_EPOCH},
};

Expand Down Expand Up @@ -171,10 +170,7 @@ impl ScriptSequence {
let mut create2_offset = 0;

if tx.is_create2() {
receipt.contract_address = Address::from_str(
tx.contract_address.as_ref().expect("There should be a contract address."),
)
.ok();
receipt.contract_address = tx.contract_address;
create2_offset = 32;
}

Expand Down Expand Up @@ -261,7 +257,7 @@ pub struct TransactionWithMetadata {
#[serde(skip_serializing_if = "Option::is_none")]
pub contract_name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub contract_address: Option<String>,
pub contract_address: Option<Address>,
#[serde(skip_serializing_if = "Option::is_none")]
pub function: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -307,7 +303,7 @@ impl TransactionWithMetadata {
}

self.contract_name = contracts.get(&address).map(|(name, _)| name.clone());
self.contract_address = Some(format!("0x{:?}", address));
self.contract_address = Some(address);
}

fn set_call(
Expand Down Expand Up @@ -349,7 +345,7 @@ impl TransactionWithMetadata {
})?);
}
}
self.contract_address = Some(format!("0x{:?}", target));
self.contract_address = Some(target);
}
}
Ok(())
Expand Down
Loading

0 comments on commit 068c04b

Please sign in to comment.