Skip to content

Commit

Permalink
fix(features): remove ethers-solc for foundry-compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
Evalir committed Oct 18, 2023
1 parent e218510 commit 8e7b04d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl SourceCodeMetadata {
}
}

#[cfg(feature = "ethers-solc")]
#[cfg(feature = "foundry-compilers")]
pub fn settings(&self) -> Result<Option<Settings>> {
match self {
Self::Metadata { settings, .. } => match settings {
Expand All @@ -103,7 +103,7 @@ impl SourceCodeMetadata {
}
}

#[cfg(not(feature = "ethers-solc"))]
#[cfg(not(feature = "foundry-compilers"))]
pub fn settings(&self) -> Option<&serde_json::Value> {
match self {
Self::Metadata { settings, .. } => settings.as_ref(),
Expand Down Expand Up @@ -246,7 +246,7 @@ impl Metadata {
}

/// Returns the contract's compiler settings.
#[cfg(feature = "ethers-solc")]
#[cfg(feature = "foundry-compilers")]
pub fn settings(&self) -> Result<Settings> {
let mut settings = self.source_code.settings()?.unwrap_or_default();

Expand All @@ -261,15 +261,15 @@ impl Metadata {
}

/// Creates a Solc [ProjectBuilder] with this contract's settings.
#[cfg(feature = "ethers-solc")]
#[cfg(feature = "foundry-compilers")]
pub fn project_builder(&self) -> Result<ProjectBuilder> {
let solc_config = SolcConfig::builder().settings(self.settings()?).build();

Ok(Project::builder().solc_config(solc_config))
}

/// Parses the EVM version.
#[cfg(feature = "ethers-solc")]
#[cfg(feature = "foundry-compilers")]
pub fn evm_version(&self) -> Result<Option<EvmVersion>> {
match self.evm_version.as_str() {
"" | "Default" => {
Expand Down
4 changes: 2 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ mod tests {
de.source_code.sources().get("Contract").unwrap().content,
src
);
#[cfg(feature = "ethers-solc")]
#[cfg(feature = "foundry-compilers")]
assert!(de.source_code.settings().unwrap().is_none());

// Stringified JSON
Expand All @@ -294,7 +294,7 @@ mod tests {
de.source_code.sources().get("Contract").unwrap().content,
src
);
#[cfg(feature = "ethers-solc")]
#[cfg(feature = "foundry-compilers")]
assert!(de.source_code.settings().unwrap().is_none());

let json = r#"{"source_code": "source code text"}"#;
Expand Down

0 comments on commit 8e7b04d

Please sign in to comment.