fix(solc): emit empty bytecode objects for standalone sol files (#1327)
This commit is contained in:
parent
ac0560c252
commit
8e3529e9b0
|
@ -339,6 +339,8 @@ impl ArtifactOutput for ConfigurableArtifacts {
|
|||
file.source_file.ast.clone().map(|ast| ConfigurableContractArtifact {
|
||||
id: Some(file.source_file.id),
|
||||
ast: Some(ast),
|
||||
bytecode: Some(CompactBytecode::empty()),
|
||||
deployed_bytecode: Some(CompactDeployedBytecode::empty()),
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
|
|
|
@ -46,6 +46,11 @@ pub struct CompactBytecode {
|
|||
}
|
||||
|
||||
impl CompactBytecode {
|
||||
/// Returns a new `CompactBytecode` object that contains nothing, as it's the case for
|
||||
/// interfaces and standalone solidity files that don't contain any contract definitions
|
||||
pub fn empty() -> Self {
|
||||
Self { object: Default::default(), source_map: None, link_references: Default::default() }
|
||||
}
|
||||
/// Returns the parsed source map
|
||||
///
|
||||
/// See also <https://docs.soliditylang.org/en/v0.8.10/internals/source_mappings.html>
|
||||
|
@ -400,6 +405,14 @@ pub struct CompactDeployedBytecode {
|
|||
pub immutable_references: BTreeMap<String, Vec<Offsets>>,
|
||||
}
|
||||
|
||||
impl CompactDeployedBytecode {
|
||||
/// Returns a new `CompactDeployedBytecode` object that contains nothing, as it's the case for
|
||||
/// interfaces and standalone solidity files that don't contain any contract definitions
|
||||
pub fn empty() -> Self {
|
||||
Self { bytecode: Some(CompactBytecode::empty()), immutable_references: Default::default() }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<DeployedBytecode> for CompactDeployedBytecode {
|
||||
fn from(bcode: DeployedBytecode) -> CompactDeployedBytecode {
|
||||
CompactDeployedBytecode {
|
||||
|
|
Loading…
Reference in New Issue