aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-23 23:41:05 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-24 05:15:00 +0800
commit34beee1edcd59b0f78c3dcce51cf847291ae06b4 (patch)
tree4befed4f518ec6d1d285b52e429db8c44a22ad46 /packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
parent7bc6a7b23f655a62a71f5d28e3aadcd245f856b8 (diff)
downloaddexon-0x-contracts-34beee1edcd59b0f78c3dcce51cf847291ae06b4.tar.gz
dexon-0x-contracts-34beee1edcd59b0f78c3dcce51cf847291ae06b4.tar.zst
dexon-0x-contracts-34beee1edcd59b0f78c3dcce51cf847291ae06b4.zip
Refactor getContractAddress to contractWrapper
Diffstat (limited to 'packages/0x.js/src/contract_wrappers/exchange_wrapper.ts')
-rw-r--r--packages/0x.js/src/contract_wrappers/exchange_wrapper.ts14
1 files changed, 4 insertions, 10 deletions
diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
index b35219b24..883cc0f49 100644
--- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
@@ -830,16 +830,10 @@ export class ExchangeWrapper extends ContractWrapper {
* @return Address of ZRX token
*/
public getZRXTokenAddress(): string {
- const networkId = this._web3Wrapper.getNetworkId();
- if (_.isUndefined(this._zrxContractAddressIfExists)) {
- const zrxTokenAddress = artifacts.ZRXArtifact.networks[networkId].address;
- if (_.isUndefined(zrxTokenAddress)) {
- throw new Error(ZeroExError.ZRXContractDoesNotExist);
- }
- return zrxTokenAddress;
- } else {
- return this._zrxContractAddressIfExists;
- }
+ const contractAddress = this._getContractAddress(
+ artifacts.ZRXArtifact, this._zrxContractAddressIfExists,
+ );
+ return contractAddress;
}
private async _invalidateContractInstancesAsync(): Promise<void> {
this.unsubscribeAll();