pull/5370/head
aniket-engg 4 years ago committed by Aniket
parent 19fae427dd
commit 8d1a4934d7
  1. 16
      libs/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts

@ -1137,19 +1137,17 @@ function getTypeStringFromComponents(components: ABIParameter[]) {
* @param contractFiles compiled contract object * @param contractFiles compiled contract object
*/ */
function getCompilerVersion(contractFiles: CompiledContractObj): string { function getCompilerVersion(contractFiles: CompiledContractObj): string {
// Solidity documentation is not available for these versions let version = 'latest'
const noDocVersions = ['0.4.26', '0.5.16', '0.5.17']
let version = 'develop'
const fileNames: string[] = Object.keys(contractFiles) const fileNames: string[] = Object.keys(contractFiles)
const contracts = contractFiles[fileNames[0]] const contracts = contractFiles[fileNames[0]]
const contractNames: string[] = Object.keys(contracts) const contractNames: string[] = Object.keys(contracts)
const contract: CompiledContract = contracts[contractNames[0]] const contract: CompiledContract = contracts[contractNames[0]]
const metadata = JSON.parse(contract.metadata) // For some compiler/contract, metadata is ""
const compilerVersion: string = metadata.compiler.version if(contract && contract.metadata) {
if(!compilerVersion.includes('nightly')) { const metadata = JSON.parse(contract.metadata)
const solVersion = compilerVersion.split('+commit')[0] const compilerVersion: string = metadata.compiler.version
if(!noDocVersions.includes(solVersion)) if(!compilerVersion.includes('nightly'))
version = 'v' + solVersion version = 'v' + compilerVersion.split('+commit')[0]
} }
return version return version
} }

Loading…
Cancel
Save