From 8d1a4934d7158e3ae217f9ed828421180c11b014 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 24 Jul 2020 12:06:12 +0530 Subject: [PATCH] fixes #42 --- .../modules/staticAnalysisCommon.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/libs/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts b/libs/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts index 8d0e694a1a..4120f37412 100644 --- a/libs/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts +++ b/libs/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts @@ -1137,19 +1137,17 @@ function getTypeStringFromComponents(components: ABIParameter[]) { * @param contractFiles compiled contract object */ function getCompilerVersion(contractFiles: CompiledContractObj): string { - // Solidity documentation is not available for these versions - const noDocVersions = ['0.4.26', '0.5.16', '0.5.17'] - let version = 'develop' + let version = 'latest' const fileNames: string[] = Object.keys(contractFiles) const contracts = contractFiles[fileNames[0]] const contractNames: string[] = Object.keys(contracts) const contract: CompiledContract = contracts[contractNames[0]] - const metadata = JSON.parse(contract.metadata) - const compilerVersion: string = metadata.compiler.version - if(!compilerVersion.includes('nightly')) { - const solVersion = compilerVersion.split('+commit')[0] - if(!noDocVersions.includes(solVersion)) - version = 'v' + solVersion + // For some compiler/contract, metadata is "" + if(contract && contract.metadata) { + const metadata = JSON.parse(contract.metadata) + const compilerVersion: string = metadata.compiler.version + if(!compilerVersion.includes('nightly')) + version = 'v' + compilerVersion.split('+commit')[0] } return version }