|
|
@ -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 { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
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 { |
|
|
|
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 |
|
|
|
} |
|
|
|
} |
|
|
|
}
|
|
|
|
}
|
|
|
|