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

fix(solc): emit empty vec for empty artifacts #1345

Merged
merged 1 commit into from
Jun 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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