aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov/src/artifact_adapters
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-06-09 02:18:32 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-06-09 05:56:45 +0800
commit760bab8f866ec3d5fc7627ce9bbf5c2eaaef1f36 (patch)
tree05911f7eaa9cd8a48448b371f46186d2ffc5541e /packages/sol-cov/src/artifact_adapters
parent817c332d11835f02726f0609374d1c25c9ab39b5 (diff)
downloaddexon-0x-contracts-760bab8f866ec3d5fc7627ce9bbf5c2eaaef1f36.tar.gz
dexon-0x-contracts-760bab8f866ec3d5fc7627ce9bbf5c2eaaef1f36.tar.zst
dexon-0x-contracts-760bab8f866ec3d5fc7627ce9bbf5c2eaaef1f36.zip
Implement SolidityProfiler & adapt sol-cov to work with Geth
Diffstat (limited to 'packages/sol-cov/src/artifact_adapters')
-rw-r--r--packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts
index 6e385203b..0be661106 100644
--- a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts
+++ b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts
@@ -1,3 +1,5 @@
+import { ContractArtifact } from '@0xproject/sol-compiler';
+import { logUtils } from '@0xproject/utils';
import * as fs from 'fs';
import * as glob from 'glob';
import * as _ from 'lodash';
@@ -29,7 +31,11 @@ export class SolCompilerArtifactAdapter extends AbstractArtifactAdapter {
const artifactFileNames = glob.sync(artifactsGlob, { absolute: true });
const contractsData: ContractData[] = [];
for (const artifactFileName of artifactFileNames) {
- const artifact = JSON.parse(fs.readFileSync(artifactFileName).toString());
+ const artifact: ContractArtifact = JSON.parse(fs.readFileSync(artifactFileName).toString());
+ if (_.isUndefined(artifact.compilerOutput.evm)) {
+ logUtils.warn(`${artifactFileName} doesn't contain bytecode. Skipping...`);
+ continue;
+ }
let sources = _.keys(artifact.sources);
sources = _.map(sources, relativeFilePath => path.resolve(this._sourcesPath, relativeFilePath));
const sourceCodes = _.map(sources, (source: string) => fs.readFileSync(source).toString());