From 34beee1edcd59b0f78c3dcce51cf847291ae06b4 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 23 Nov 2017 09:41:05 -0600 Subject: Refactor getContractAddress to contractWrapper --- .../0x.js/src/contract_wrappers/token_registry_wrapper.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts') diff --git a/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts b/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts index 468e58350..35337fa35 100644 --- a/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts @@ -104,16 +104,10 @@ export class TokenRegistryWrapper extends ContractWrapper { * @returns The Ethereum address of the TokenRegistry contract being used. */ public getContractAddress(): string { - const networkId = this._web3Wrapper.getNetworkId(); - if (_.isUndefined(this._contractAddressIfExists)) { - const contractAddress = artifacts.TokenRegistryArtifact.networks[networkId].address; - if (_.isUndefined(contractAddress)) { - throw new Error(ZeroExError.ExchangeContractDoesNotExist); - } - return contractAddress; - } else { - return this._contractAddressIfExists; - } + const contractAddress = this._getContractAddress( + artifacts.TokenRegistryArtifact, this._contractAddressIfExists, + ); + return contractAddress; } private _invalidateContractInstance(): void { delete this._tokenRegistryContractIfExists; -- cgit