aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2019-02-05 00:03:25 +0800
committerFabio Berger <me@fabioberger.com>2019-02-05 00:03:25 +0800
commitc03e24e10b23ce1c542d3dea10bc26ae9d86fea5 (patch)
treebe8720f3a7298675303c6dd5694d72df53ec5752 /packages/order-utils
parent1d3fff32a29b4e958cd32acb016577683df95d3d (diff)
downloaddexon-0x-contracts-c03e24e10b23ce1c542d3dea10bc26ae9d86fea5.tar.gz
dexon-0x-contracts-c03e24e10b23ce1c542d3dea10bc26ae9d86fea5.tar.zst
dexon-0x-contracts-c03e24e10b23ce1c542d3dea10bc26ae9d86fea5.zip
Fix bug where passing in signerAddress instead of exchangeAddress
Diffstat (limited to 'packages/order-utils')
-rw-r--r--packages/order-utils/package.json1
-rw-r--r--packages/order-utils/src/signature_utils.ts10
2 files changed, 10 insertions, 1 deletions
diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json
index 7a4d4aa84..4e31d4094 100644
--- a/packages/order-utils/package.json
+++ b/packages/order-utils/package.json
@@ -57,6 +57,7 @@
"@0x/assert": "^1.0.23",
"@0x/base-contract": "^3.0.13",
"@0x/contract-artifacts": "^1.3.0",
+ "@0x/contract-addresses": "^2.2.0",
"@0x/json-schemas": "^2.1.7",
"@0x/types": "^1.5.2",
"@0x/typescript-typings": "^3.0.8",
diff --git a/packages/order-utils/src/signature_utils.ts b/packages/order-utils/src/signature_utils.ts
index 131144d48..efcc146bf 100644
--- a/packages/order-utils/src/signature_utils.ts
+++ b/packages/order-utils/src/signature_utils.ts
@@ -1,4 +1,5 @@
import { ExchangeContract, IValidatorContract, IWalletContract } from '@0x/abi-gen-wrappers';
+import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
import * as artifacts from '@0x/contract-artifacts';
import { schemas } from '@0x/json-schemas';
import { ECSignature, Order, SignatureType, SignedOrder, ValidatorSignature } from '@0x/types';
@@ -92,7 +93,14 @@ export const signatureUtils = {
assert.isWeb3Provider('provider', provider);
assert.isHexString('data', data);
assert.isETHAddressHex('signerAddress', signerAddress);
- const exchangeContract = new ExchangeContract(artifacts.Exchange.compilerOutput.abi, signerAddress, provider);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const networkId = await web3Wrapper.getNetworkIdAsync();
+ const addresses = getContractAddressesForNetworkOrThrow(networkId);
+ const exchangeContract = new ExchangeContract(
+ artifacts.Exchange.compilerOutput.abi,
+ addresses.exchange,
+ provider,
+ );
const isValid = await exchangeContract.preSigned.callAsync(data, signerAddress);
return isValid;
},