From 82922c0071e3f57127a941fb91dc9d66010e5481 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 15 May 2020 17:23:06 +0530 Subject: [PATCH] dynamic filename --- remix-analyzer/src/solidity-analyzer/modules/gasCosts.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/remix-analyzer/src/solidity-analyzer/modules/gasCosts.ts b/remix-analyzer/src/solidity-analyzer/modules/gasCosts.ts index 7e9eb10a85..71f5d8041a 100644 --- a/remix-analyzer/src/solidity-analyzer/modules/gasCosts.ts +++ b/remix-analyzer/src/solidity-analyzer/modules/gasCosts.ts @@ -24,7 +24,7 @@ export default class gasCosts implements AnalyzerModule { report (compilationResults: CompilationResult): ReportObj[] { const report: ReportObj[] = [] - + const filename = Object.keys(compilationResults.contracts)[0] const methodsWithSignature = this.warningNodes.map(node => { let signature; if(node.nodeType === 'FunctionDefinition') @@ -39,8 +39,8 @@ export default class gasCosts implements AnalyzerModule { } }) for (const method of methodsWithSignature) { - for (const contractName in compilationResults.contracts['test.sol']) { - const contract = compilationResults.contracts['test.sol'][contractName] + for (const contractName in compilationResults.contracts[filename]) { + const contract = compilationResults.contracts[filename][contractName] const methodGas: any = this.checkMethodGas(contract, method.signature) if(methodGas && methodGas.isInfinite) { if(methodGas.isFallback) { @@ -79,6 +79,7 @@ export default class gasCosts implements AnalyzerModule { if (gas === null || parseInt(gas) >= 3000000 || gas === 'infinite') { return { isInfinite: true, + isFallback: false, msg: gasString } }