Commit e889cf7b authored by aniket-engg's avatar aniket-engg

dynamic filename

parent c27ed724
...@@ -24,7 +24,7 @@ export default class gasCosts implements AnalyzerModule { ...@@ -24,7 +24,7 @@ export default class gasCosts implements AnalyzerModule {
report (compilationResults: CompilationResult): ReportObj[] { report (compilationResults: CompilationResult): ReportObj[] {
const report: ReportObj[] = [] const report: ReportObj[] = []
const filename = Object.keys(compilationResults.contracts)[0]
const methodsWithSignature = this.warningNodes.map(node => { const methodsWithSignature = this.warningNodes.map(node => {
let signature; let signature;
if(node.nodeType === 'FunctionDefinition') if(node.nodeType === 'FunctionDefinition')
...@@ -39,8 +39,8 @@ export default class gasCosts implements AnalyzerModule { ...@@ -39,8 +39,8 @@ export default class gasCosts implements AnalyzerModule {
} }
}) })
for (const method of methodsWithSignature) { for (const method of methodsWithSignature) {
for (const contractName in compilationResults.contracts['test.sol']) { for (const contractName in compilationResults.contracts[filename]) {
const contract = compilationResults.contracts['test.sol'][contractName] const contract = compilationResults.contracts[filename][contractName]
const methodGas: any = this.checkMethodGas(contract, method.signature) const methodGas: any = this.checkMethodGas(contract, method.signature)
if(methodGas && methodGas.isInfinite) { if(methodGas && methodGas.isInfinite) {
if(methodGas.isFallback) { if(methodGas.isFallback) {
...@@ -79,6 +79,7 @@ export default class gasCosts implements AnalyzerModule { ...@@ -79,6 +79,7 @@ export default class gasCosts implements AnalyzerModule {
if (gas === null || parseInt(gas) >= 3000000 || gas === 'infinite') { if (gas === null || parseInt(gas) >= 3000000 || gas === 'infinite') {
return { return {
isInfinite: true, isInfinite: true,
isFallback: false,
msg: gasString msg: gasString
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment