diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-15 22:33:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-15 22:33:55 +0800 |
commit | 9932240a4d7cfc877be322a65c70f6bdf73d7ca7 (patch) | |
tree | 939109f2916554b2d6d6f429e600c56380d98e16 /packages/sol-tracing-utils/src/artifact_adapters/sol_compiler_artifact_adapter.ts | |
parent | 91b57793c2b8a0bc1209dd174c6d8b946827aa7c (diff) | |
parent | f570f80674c22f69712c45e8e3c48e948b51f357 (diff) | |
download | dexon-0x-contracts-9932240a4d7cfc877be322a65c70f6bdf73d7ca7.tar dexon-0x-contracts-9932240a4d7cfc877be322a65c70f6bdf73d7ca7.tar.gz dexon-0x-contracts-9932240a4d7cfc877be322a65c70f6bdf73d7ca7.tar.bz2 dexon-0x-contracts-9932240a4d7cfc877be322a65c70f6bdf73d7ca7.tar.lz dexon-0x-contracts-9932240a4d7cfc877be322a65c70f6bdf73d7ca7.tar.xz dexon-0x-contracts-9932240a4d7cfc877be322a65c70f6bdf73d7ca7.tar.zst dexon-0x-contracts-9932240a4d7cfc877be322a65c70f6bdf73d7ca7.zip |
Merge branch 'development' into feature/new-ganache
Diffstat (limited to 'packages/sol-tracing-utils/src/artifact_adapters/sol_compiler_artifact_adapter.ts')
-rw-r--r-- | packages/sol-tracing-utils/src/artifact_adapters/sol_compiler_artifact_adapter.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/packages/sol-tracing-utils/src/artifact_adapters/sol_compiler_artifact_adapter.ts b/packages/sol-tracing-utils/src/artifact_adapters/sol_compiler_artifact_adapter.ts index 57391abbe..d52587f2c 100644 --- a/packages/sol-tracing-utils/src/artifact_adapters/sol_compiler_artifact_adapter.ts +++ b/packages/sol-tracing-utils/src/artifact_adapters/sol_compiler_artifact_adapter.ts @@ -5,7 +5,7 @@ import * as glob from 'glob'; import * as _ from 'lodash'; import * as path from 'path'; -import { ContractData } from '../types'; +import { ContractData, SourceCodes, Sources } from '../types'; import { AbstractArtifactAdapter } from './abstract_artifact_adapter'; @@ -43,9 +43,14 @@ export class SolCompilerArtifactAdapter extends AbstractArtifactAdapter { 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()); + const sources: Sources = {}; + const sourceCodes: SourceCodes = {}; + _.map(artifact.sources, (value: { id: number }, relativeFilePath: string) => { + const filePath = path.resolve(this._sourcesPath, relativeFilePath); + const fileContent = fs.readFileSync(filePath).toString(); + sources[value.id] = filePath; + sourceCodes[value.id] = fileContent; + }); const contractData = { sourceCodes, sources, |