aboutsummaryrefslogtreecommitdiffstats
path: root/src/contract_wrappers/exchange_wrapper.ts
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2017-09-20 20:59:48 +0800
committerGitHub <noreply@github.com>2017-09-20 20:59:48 +0800
commitd424933d70a0a6a210b19960451ef2796844c8d8 (patch)
tree349592a214b320b9a60e2775093639fe9ad6c278 /src/contract_wrappers/exchange_wrapper.ts
parentfe9f692a4f472e5decbda96aad6afaf98c10d850 (diff)
parent91679caf936d3b3df369b2339c55468b222c9a16 (diff)
downloaddexon-0x-contracts-d424933d70a0a6a210b19960451ef2796844c8d8.tar
dexon-0x-contracts-d424933d70a0a6a210b19960451ef2796844c8d8.tar.gz
dexon-0x-contracts-d424933d70a0a6a210b19960451ef2796844c8d8.tar.bz2
dexon-0x-contracts-d424933d70a0a6a210b19960451ef2796844c8d8.tar.lz
dexon-0x-contracts-d424933d70a0a6a210b19960451ef2796844c8d8.tar.xz
dexon-0x-contracts-d424933d70a0a6a210b19960451ef2796844c8d8.tar.zst
dexon-0x-contracts-d424933d70a0a6a210b19960451ef2796844c8d8.zip
Merge pull request #165 from 0xProject/feature/configurable-addresses
Allow users to pass contract addresses as a config
Diffstat (limited to 'src/contract_wrappers/exchange_wrapper.ts')
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index 73c4d935b..54d7f62d5 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -56,6 +56,7 @@ export class ExchangeWrapper extends ContractWrapper {
[ExchangeContractErrCodes.ERROR_FILL_TRUNCATION]: ExchangeContractErrs.OrderFillRoundingError,
[ExchangeContractErrCodes.ERROR_FILL_BALANCE_ALLOWANCE]: ExchangeContractErrs.FillBalanceAllowanceError,
};
+ private _contractAddressIfExists?: string;
private static _getOrderAddressesAndValues(order: Order): [OrderAddresses, OrderValues] {
const orderAddresses: OrderAddresses = [
order.maker,
@@ -74,11 +75,12 @@ export class ExchangeWrapper extends ContractWrapper {
];
return [orderAddresses, orderValues];
}
- constructor(web3Wrapper: Web3Wrapper, tokenWrapper: TokenWrapper) {
+ constructor(web3Wrapper: Web3Wrapper, tokenWrapper: TokenWrapper, contractAddressIfExists?: string) {
super(web3Wrapper);
this._tokenWrapper = tokenWrapper;
this._orderValidationUtils = new OrderValidationUtils(tokenWrapper, this);
this._exchangeLogEventEmitters = [];
+ this._contractAddressIfExists = contractAddressIfExists;
}
/**
* Returns the unavailable takerAmount of an order. Unavailable amount is defined as the total
@@ -738,7 +740,7 @@ export class ExchangeWrapper extends ContractWrapper {
return this._exchangeContractIfExists;
}
const contractInstance = await this._instantiateContractIfExistsAsync<ExchangeContract>(
- artifacts.ExchangeArtifact,
+ artifacts.ExchangeArtifact, this._contractAddressIfExists,
);
this._exchangeContractIfExists = contractInstance as ExchangeContract;
return this._exchangeContractIfExists;
@@ -748,4 +750,10 @@ export class ExchangeWrapper extends ContractWrapper {
const ZRXtokenAddress = await exchangeInstance.ZRX_TOKEN_CONTRACT.callAsync();
return ZRXtokenAddress;
}
+ private async _getTokenTransferProxyAddressAsync(): Promise<string> {
+ const exchangeInstance = await this._getExchangeContractAsync();
+ const tokenTransferProxyAddress = await exchangeInstance.TOKEN_TRANSFER_PROXY_CONTRACT.callAsync();
+ const tokenTransferProxyAddressLowerCase = tokenTransferProxyAddress.toLowerCase();
+ return tokenTransferProxyAddressLowerCase;
+ }
}