aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-09-05 19:49:47 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-09-05 19:49:47 +0800
commitec22097efb61d27aa73c979758bc0231cea7d61d (patch)
tree3cc0af33b00a3e7886f09e60bedc328d961e235d
parentbc5fd316dfb7876f5e8913f7cb196b9a9e0e5ffc (diff)
downloaddexon-0x-contracts-ec22097efb61d27aa73c979758bc0231cea7d61d.tar.gz
dexon-0x-contracts-ec22097efb61d27aa73c979758bc0231cea7d61d.tar.zst
dexon-0x-contracts-ec22097efb61d27aa73c979758bc0231cea7d61d.zip
Don't override function arguments
-rw-r--r--src/web3_wrapper.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/web3_wrapper.ts b/src/web3_wrapper.ts
index a0923bef9..7b9a28a7d 100644
--- a/src/web3_wrapper.ts
+++ b/src/web3_wrapper.ts
@@ -51,6 +51,7 @@ export class Web3Wrapper {
}
public async getContractInstanceFromArtifactAsync<A extends Web3.ContractInstance>(artifact: Artifact,
address?: string): Promise<A> {
+ let contractAddress: string;
if (_.isUndefined(address)) {
const networkIdIfExists = await this.getNetworkIdIfExistsAsync();
if (_.isUndefined(networkIdIfExists)) {
@@ -59,14 +60,16 @@ export class Web3Wrapper {
if (_.isUndefined(artifact.networks[networkIdIfExists])) {
throw new Error(ZeroExError.ContractNotDeployedOnNetwork);
}
- address = artifact.networks[networkIdIfExists].address.toLowerCase();
+ contractAddress = artifact.networks[networkIdIfExists].address.toLowerCase();
+ } else {
+ contractAddress = address;
}
- const doesContractExist = await this.doesContractExistAtAddressAsync(address);
+ const doesContractExist = await this.doesContractExistAtAddressAsync(contractAddress);
if (!doesContractExist) {
throw new Error(ZeroExError.ContractDoesNotExist);
}
const contractInstance = this.getContractInstance<A>(
- artifact.abi, address,
+ artifact.abi, contractAddress,
);
return contractInstance;
}