Skip to content

Commit

Permalink
export-artifacts: do not export interfaces or libraries by default
Browse files Browse the repository at this point in the history
  • Loading branch information
wighawag committed May 23, 2022
1 parent 06e80d8 commit 7208037
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,14 @@ task('export-artifacts')
'solcInput',
'if set, artifacts will have an associated solcInput files (required for old version of solidity to ensure verifiability'
)
.addFlag(
'includingEmptyBytecode',
'if set, even contract without bytecode (like interfaces) will be exported'
)
.addFlag(
'includingNoPublicFunctions',
'if set, even contract without public interface (like imternal libraries) will be exported'
)
.addOptionalParam(
'exclude',
'list of contract names separated by commas to exclude',
Expand Down Expand Up @@ -968,6 +976,21 @@ task('export-artifacts')
const output =
buildInfo.output.contracts[artifact.sourceName][artifactName];

if (!args.includingNoPublicFunctions) {
if (
!artifact.abi ||
artifact.abi.filter((v) => v.type !== 'event').length === 0
) {
continue;
}
}

if (!args.includingEmptyBytecode) {
if (!artifact.bytecode || artifact.bytecode === '0x') {
continue;
}
}

// TODO decide on ExtendedArtifact vs Artifact vs Deployment type
// save space by not duplicating bytecodes
if (output.evm?.bytecode?.object) {
Expand Down

0 comments on commit 7208037

Please sign in to comment.