Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
fix(solc): emit empty vec for empty artifacts (#1345)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jun 4, 2022
1 parent 1dfe6d0 commit 85a572c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions ethers-solc/src/artifact_output/configurable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ impl ArtifactOutput for ConfigurableArtifacts {
file: &VersionedSourceFile,
) -> Option<Self::Artifact> {
file.source_file.ast.clone().map(|ast| ConfigurableContractArtifact {
abi: Some(LosslessAbi::default()),
id: Some(file.source_file.id),
ast: Some(ast),
bytecode: Some(CompactBytecode::empty()),
Expand Down
8 changes: 7 additions & 1 deletion ethers-solc/src/artifacts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1318,14 +1318,20 @@ impl OutputContracts {
/// ethabi as it would require a redesign of the overall `Param` and `ParamType` types. Instead,
/// this type keeps a copy of the [`serde_json::Value`] when deserialized from the `solc` json
/// compiler output and uses it to serialize the `abi` without loss.
#[derive(Clone, Debug, PartialEq, Default)]
#[derive(Clone, Debug, PartialEq)]
pub struct LosslessAbi {
/// The complete abi as json value
pub abi_value: serde_json::Value,
/// The deserialised version of `abi_value`
pub abi: Abi,
}

impl Default for LosslessAbi {
fn default() -> Self {
LosslessAbi { abi_value: serde_json::json!([]), abi: Default::default() }
}
}

impl From<LosslessAbi> for Abi {
fn from(abi: LosslessAbi) -> Self {
abi.abi
Expand Down

0 comments on commit 85a572c

Please sign in to comment.