aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Evans <jacob@dekz.net>2018-02-23 10:34:56 +0800
committerJacob Evans <jacob@dekz.net>2018-02-23 10:43:01 +0800
commitf689d335c0c4042e7ecf3e4636db3434d0dcd7a8 (patch)
tree6136f1c06b1bbf2a6b1cf5930a14c92f4b9f266a
parent31f9a848f90fa53d5d3817fe6cfb668a44919ef6 (diff)
downloaddexon-0x-contracts-f689d335c0c4042e7ecf3e4636db3434d0dcd7a8.tar
dexon-0x-contracts-f689d335c0c4042e7ecf3e4636db3434d0dcd7a8.tar.gz
dexon-0x-contracts-f689d335c0c4042e7ecf3e4636db3434d0dcd7a8.tar.bz2
dexon-0x-contracts-f689d335c0c4042e7ecf3e4636db3434d0dcd7a8.tar.lz
dexon-0x-contracts-f689d335c0c4042e7ecf3e4636db3434d0dcd7a8.tar.xz
dexon-0x-contracts-f689d335c0c4042e7ecf3e4636db3434d0dcd7a8.tar.zst
dexon-0x-contracts-f689d335c0c4042e7ecf3e4636db3434d0dcd7a8.zip
Check maker is valid address
-rw-r--r--packages/0x.js/src/contract_wrappers/exchange_wrapper.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
index 71f0618f0..7db13a1ba 100644
--- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
@@ -554,6 +554,8 @@ export class ExchangeWrapper extends ContractWrapper {
assert.doesConformToSchema('order', order, schemas.orderSchema);
assert.isValidBaseUnitAmount('takerTokenCancelAmount', cancelTakerTokenAmount);
await assert.isSenderAddressAsync('order.maker', order.maker, this._web3Wrapper);
+ const normalizedMakerAddress = order.maker.toLowerCase();
+ assert.isETHAddressHex('order.maker', normalizedMakerAddress);
const exchangeInstance = await this._getExchangeContractAsync();
@@ -576,7 +578,7 @@ export class ExchangeWrapper extends ContractWrapper {
orderValues,
cancelTakerTokenAmount,
{
- from: order.maker,
+ from: normalizedMakerAddress,
gas: orderTransactionOpts.gasLimit,
gasPrice: orderTransactionOpts.gasPrice,
},
@@ -612,7 +614,10 @@ export class ExchangeWrapper extends ContractWrapper {
const makers = _.map(orderCancellationRequests, cancellationRequest => cancellationRequest.order.maker);
assert.hasAtMostOneUniqueValue(makers, ExchangeContractErrs.MultipleMakersInSingleCancelBatchDisallowed);
const maker = makers[0];
- await assert.isSenderAddressAsync('maker', maker, this._web3Wrapper);
+ const normalizedMakerAddress = maker.toLowerCase();
+ assert.isETHAddressHex('maker', normalizedMakerAddress);
+ await assert.isSenderAddressAsync('maker', normalizedMakerAddress, this._web3Wrapper);
+
const shouldValidate = _.isUndefined(orderTransactionOpts.shouldValidate)
? SHOULD_VALIDATE_BY_DEFAULT
: orderTransactionOpts.shouldValidate;
@@ -646,7 +651,7 @@ export class ExchangeWrapper extends ContractWrapper {
orderValues,
cancelTakerTokenAmounts,
{
- from: maker,
+ from: normalizedMakerAddress,
gas: orderTransactionOpts.gasLimit,
gasPrice: orderTransactionOpts.gasPrice,
},