aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorF. Eugene Aumson <gene@aumson.org>2018-08-15 01:52:31 +0800
committerF. Eugene Aumson <gene@aumson.org>2018-08-15 02:42:06 +0800
commite79c7632e6e82ecc53563da6d8727ce4475078c6 (patch)
tree662d43853e69c12f2c1f5148e996e42ff31cde8f
parentaa27346f93fafa5fdc9fca69c5604caca9278dfd (diff)
downloaddexon-sol-tools-e79c7632e6e82ecc53563da6d8727ce4475078c6.tar
dexon-sol-tools-e79c7632e6e82ecc53563da6d8727ce4475078c6.tar.gz
dexon-sol-tools-e79c7632e6e82ecc53563da6d8727ce4475078c6.tar.bz2
dexon-sol-tools-e79c7632e6e82ecc53563da6d8727ce4475078c6.tar.lz
dexon-sol-tools-e79c7632e6e82ecc53563da6d8727ce4475078c6.tar.xz
dexon-sol-tools-e79c7632e6e82ecc53563da6d8727ce4475078c6.tar.zst
dexon-sol-tools-e79c7632e6e82ecc53563da6d8727ce4475078c6.zip
simplify method interface
-rw-r--r--packages/sol-compiler/src/compiler.ts20
1 files changed, 12 insertions, 8 deletions
diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts
index 3b46d7b46..cf12825c4 100644
--- a/packages/sol-compiler/src/compiler.ts
+++ b/packages/sol-compiler/src/compiler.ts
@@ -215,25 +215,29 @@ export class Compiler {
const compiled = this._compile(solcInstance, input.standardInput);
for (const contractPath of input.contractsToCompile) {
- await this._verifyAndPersistCompilationAsync(
+ await this._verifyAndPersistCompiledContractAsync(
contractPath,
- contractData[contractPath].contractName,
+ contractData[contractPath],
fullSolcVersion,
compiled,
- contractData[contractPath].sourceTreeHashHex,
- contractData[contractPath].currentArtifactIfExists,
);
}
}
}
- private async _verifyAndPersistCompilationAsync(
+ private async _verifyAndPersistCompiledContractAsync(
contractPath: string,
- contractName: string,
+ contractMetadata: {
+ currentArtifactIfExists: ContractArtifact | void;
+ sourceTreeHashHex: string;
+ contractName: string;
+ },
fullSolcVersion: string,
compiled: solc.StandardOutput,
- sourceTreeHashHex: string,
- currentArtifactIfExists: ContractArtifact | void,
): Promise<void> {
+ const contractName = contractMetadata.contractName;
+ const sourceTreeHashHex = contractMetadata.sourceTreeHashHex;
+ const currentArtifactIfExists = contractMetadata.currentArtifactIfExists;
+
const compiledData = compiled.contracts[contractPath][contractName];
if (_.isUndefined(compiledData)) {
throw new Error(