@0x/sol-compiler: Insert compiler version in input artifacts.

This commit is contained in:
Lawrence Forman 2020-03-30 13:51:24 -04:00
parent dc437aacf1
commit b36373ab81

View File

@ -374,7 +374,7 @@ export class Compiler {
currentArtifactIfExists: ContractArtifact | void, currentArtifactIfExists: ContractArtifact | void,
sourceTreeHashHex: string, sourceTreeHashHex: string,
contractName: string, contractName: string,
fullSolcVersion: string, solcVersion: string,
sourcesByPath: ContractContentsByPath, sourcesByPath: ContractContentsByPath,
compilerInput: StandardInput, compilerInput: StandardInput,
compilerOutput: StandardOutput, compilerOutput: StandardOutput,
@ -401,7 +401,7 @@ export class Compiler {
sourceCodes: _.mapValues(usedSources, ({ content }) => content), sourceCodes: _.mapValues(usedSources, ({ content }) => content),
compiler: { compiler: {
name: 'solc', name: 'solc',
version: fullSolcVersion, version: solcVersion,
settings: compilerInput.settings, settings: compilerInput.settings,
}, },
}; };
@ -430,7 +430,14 @@ export class Compiler {
if (this._shouldSaveStandardInput) { if (this._shouldSaveStandardInput) {
await fsWrapper.writeFileAsync( await fsWrapper.writeFileAsync(
`${this._artifactsDir}/${contractName}.input.json`, `${this._artifactsDir}/${contractName}.input.json`,
utils.stringifyWithFormatting(compilerInput), utils.stringifyWithFormatting({
...compilerInput,
// Insert solcVersion into input.
settings: {
...compilerInput.settings,
version: solcVersion,
},
}),
); );
logUtils.warn(`${contractName} input artifact saved!`); logUtils.warn(`${contractName} input artifact saved!`);
} }