|
|
|
@ -43,7 +43,14 @@ export class FetchAndCompile extends Plugin { |
|
|
|
|
async resolve (contractAddress, codeAtAddress, targetPath) { |
|
|
|
|
contractAddress = toChecksumAddress(contractAddress) |
|
|
|
|
|
|
|
|
|
const localCompilation = async () => await this.call('compilerArtefacts', 'get', contractAddress) ? await this.call('compilerArtefacts', 'get', contractAddress) : await this.call('compilerArtefacts', 'get', '__last') ? await this.call('compilerArtefacts', 'get', '__last') : null |
|
|
|
|
const localCompilation = async () => { |
|
|
|
|
const contractData = await this.call('compilerArtefacts', 'getContractDataFromByteCode', codeAtAddress) |
|
|
|
|
if (contractData) { |
|
|
|
|
return await this.call('compilerArtefacts', 'getCompilerAbstract', contractData.file) |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
return await this.call('compilerArtefacts', 'get', '__last') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const resolved = await this.call('compilerArtefacts', 'get', contractAddress) |
|
|
|
|
if (resolved) return resolved |
|
|
|
@ -87,8 +94,7 @@ export class FetchAndCompile extends Plugin { |
|
|
|
|
return localCompilation() |
|
|
|
|
} |
|
|
|
|
if (!network) return localCompilation() |
|
|
|
|
if (!this.sourceVerifierNetWork.includes(network.name)) return localCompilation() |
|
|
|
|
|
|
|
|
|
if (!this.sourceVerifierNetWork.includes(network.name)) { |
|
|
|
|
// check if the contract if part of the local compilation result
|
|
|
|
|
const compilation = await localCompilation() |
|
|
|
|
if (compilation) { |
|
|
|
@ -103,6 +109,7 @@ export class FetchAndCompile extends Plugin { |
|
|
|
|
return compilation |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
targetPath = `${targetPath}/${network.id}/${contractAddress}` |
|
|
|
|
let data |
|
|
|
|