|
|
|
@ -23,7 +23,11 @@ export class CompilerMetadata extends Plugin { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_MetadataFileName (path, contractName) { |
|
|
|
|
return this.joinPath(path, this.innerPath, contractName + '_compResult.json') |
|
|
|
|
return this.joinPath(path, this.innerPath, contractName + '_metadata.json') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_OutputFileName (path, contractName) { |
|
|
|
|
return this.joinPath(path, this.innerPath, contractName + '_fullOP.json') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onActivation () { |
|
|
|
@ -53,8 +57,9 @@ export class CompilerMetadata extends Plugin { |
|
|
|
|
content = content || '{}' |
|
|
|
|
const fileName = this._JSONFileName(path, contract.name) |
|
|
|
|
const metadataFileName = this._MetadataFileName(path, contract.name) |
|
|
|
|
const opFileName = this._OutputFileName(path, contract.name) |
|
|
|
|
|
|
|
|
|
if (contract && contract.object) await this.call('fileManager', 'writeFile', metadataFileName, JSON.stringify(contract.object, null, '\t')) |
|
|
|
|
if (contract && contract.object) await this.call('fileManager', 'writeFile', opFileName, JSON.stringify(contract.object, null, '\t')) |
|
|
|
|
|
|
|
|
|
let metadata |
|
|
|
|
try { |
|
|
|
@ -62,11 +67,20 @@ export class CompilerMetadata extends Plugin { |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const deploy = metadata.deploy || {} |
|
|
|
|
this.networks.forEach((network) => { |
|
|
|
|
deploy[network] = this._syncContext(contract, deploy[network] || {}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
let parsedMetadata |
|
|
|
|
try { |
|
|
|
|
parsedMetadata = JSON.parse(contract.object.metadata) |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
if (parsedMetadata) await this.call('fileManager', 'writeFile', metadataFileName, JSON.stringify(parsedMetadata, null, '\t')) |
|
|
|
|
|
|
|
|
|
const data = { |
|
|
|
|
deploy, |
|
|
|
|
data: { |
|
|
|
|