From 433fd6f11e2547fc6232e06edff1654690ff6b80 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 17 Apr 2018 17:51:36 -0400 Subject: [PATCH] track original filepath of the contract --- lib/modules/contracts_manager/index.js | 1 + lib/modules/solidity/index.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lib/modules/contracts_manager/index.js b/lib/modules/contracts_manager/index.js index f22fddd5..f8aaa4c5 100644 --- a/lib/modules/contracts_manager/index.js +++ b/lib/modules/contracts_manager/index.js @@ -122,6 +122,7 @@ class ContractsManager { contract.functionHashes = compiledContract.functionHashes; contract.abiDefinition = compiledContract.abiDefinition; contract.filename = compiledContract.filename; + contract.originalFilename = compiledContract.originalFilename || ("contracts/" + contract.filename); contract.gas = (contractConfig && contractConfig.gas) || self.contractsConfig.gas || 'auto'; diff --git a/lib/modules/solidity/index.js b/lib/modules/solidity/index.js index 7459b996..879f6110 100644 --- a/lib/modules/solidity/index.js +++ b/lib/modules/solidity/index.js @@ -22,6 +22,9 @@ class Solidity { } let self = this; let input = {}; + let solcW; + let originalFilepath = {}; + async.waterfall([ function prepareInput(callback) { async.each(contractFiles, @@ -33,6 +36,8 @@ class Solidity { filename = filename.replace(match, ''); } + originalFilepath[filename] = file.filename; + file.content(function(fileContent) { if (!fileContent) { self.logger.error(__('Error while loading the content of ') + filename); @@ -140,6 +145,7 @@ class Solidity { compiled_object[className].functionHashes = contract.evm.methodIdentifiers; compiled_object[className].abiDefinition = contract.abi; compiled_object[className].filename = filename; + compiled_object[className].originalFilename = originalFilepath[filename]; } }