Skip to content

Commit

Permalink
chore: use foundry fs (#6158)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Oct 28, 2023
1 parent 44ce0ce commit dee4181
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/forge/bin/cmd/script/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use foundry_cli::utils::get_cached_entry_by_name;
use foundry_common::{
compact_to_contract,
compile::{self, ContractSources},
fs,
};
use foundry_compilers::{
artifacts::{CompactContractBytecode, ContractBytecode, ContractBytecodeSome, Libraries},
Expand All @@ -14,7 +15,7 @@ use foundry_compilers::{
ArtifactId, Project, ProjectCompileOutput,
};
use foundry_utils::{PostLinkInput, ResolvedDependency};
use std::{collections::BTreeMap, fs, str::FromStr};
use std::{collections::BTreeMap, str::FromStr};
use tracing::{trace, warn};

impl ScriptArgs {
Expand Down Expand Up @@ -42,7 +43,9 @@ impl ScriptArgs {
.ast
.ok_or(eyre::eyre!("Source from artifact has no AST."))?
.absolute_path;
let source_code = fs::read_to_string(abs_path)?;
let source_code = fs::read_to_string(abs_path).wrap_err_with(|| {
format!("Failed to read artifact source file for `{}`", id.identifier())
})?;
let contract = artifact.clone().into_contract_bytecode();
let source_contract = compact_to_contract(contract)?;
sources
Expand Down

0 comments on commit dee4181

Please sign in to comment.