Skip to content

Commit

Permalink
fix:fix impl for ResolcContractArtifact
Browse files Browse the repository at this point in the history
  • Loading branch information
Brianspha committed Dec 2, 2024
1 parent b2150f7 commit 91562ff
Showing 1 changed file with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl Default for ResolcContractArtifact {
errors: None,
version: None,
long_version: None,
zk_version: None,
resolc_version: None,
},
}
}
Expand Down Expand Up @@ -103,8 +103,39 @@ impl ResolcArtifactOutput {
contract: Contract,
source_file: Option<&SourceFile>,
) -> ResolcContractArtifact {
todo!("Implement this function converting standard json to revive json")
}
let Contract {
abi,
metadata,
userdoc,
devdoc,
storage_layout,
eravm,
evm,
ir_optimized,
hash,
factory_dependencies,
missing_libraries,
} = contract;
let (bytecode, assembly) = eravm
.map(|eravm| (eravm.bytecode(is_unlinked), eravm.assembly))
.or_else(|| evm.map(|evm| (evm.bytecode.map(|bc| bc.object), evm.assembly)))
.unwrap_or_else(|| (None, None));
let bytecode = bytecode
.map(|object| ZkArtifactBytecode::with_object(object, is_unlinked, missing_libraries));

ZkContractArtifact {
abi,
hash,
factory_dependencies,
storage_layout: Some(storage_layout),
bytecode,
assembly,
metadata,
userdoc: Some(userdoc),
devdoc: Some(devdoc),
ir_optimized,
id: source_file.as_ref().map(|s| s.id),
}
}

fn create_byte_code(
Expand Down

0 comments on commit 91562ff

Please sign in to comment.