aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-09 21:49:56 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-09 21:49:56 +0800
commit6d4cb28b9d08df574e7f335196dfdd82f02a74c3 (patch)
treed496b61fc48c592ce71e3fb52866a9dc46128a4c
parent0d4bd7180a2d49326b2c66ad4cf080f65bccbb71 (diff)
downloaddexon-sol-tools-6d4cb28b9d08df574e7f335196dfdd82f02a74c3.tar
dexon-sol-tools-6d4cb28b9d08df574e7f335196dfdd82f02a74c3.tar.gz
dexon-sol-tools-6d4cb28b9d08df574e7f335196dfdd82f02a74c3.tar.bz2
dexon-sol-tools-6d4cb28b9d08df574e7f335196dfdd82f02a74c3.tar.lz
dexon-sol-tools-6d4cb28b9d08df574e7f335196dfdd82f02a74c3.tar.xz
dexon-sol-tools-6d4cb28b9d08df574e7f335196dfdd82f02a74c3.tar.zst
dexon-sol-tools-6d4cb28b9d08df574e7f335196dfdd82f02a74c3.zip
Address feedback
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts7
-rw-r--r--src/utils/assert.ts2
-rw-r--r--test/exchange_wrapper_test.ts2
3 files changed, 4 insertions, 7 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index 943d168c3..8ea402624 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -169,7 +169,7 @@ export class ExchangeWrapper extends ContractWrapper {
public async fillOrdersUpToAsync(signedOrders: SignedOrder[], takerTokenFillAmount: BigNumber.BigNumber,
shouldCheckTransfer: boolean, takerAddress: string): Promise<void> {
const takerTokenAddresses = _.map(signedOrders, signedOrder => signedOrder.takerTokenAddress);
- assert.hashAtMostOneUniqueValue(takerTokenAddresses,
+ assert.hasAtMostOneUniqueValue(takerTokenAddresses,
ExchangeContractErrs.MULTIPLE_TAKER_TOKENS_IN_FILL_UP_TO_DISALLOWED);
assert.isBigNumber('takerTokenFillAmount', takerTokenFillAmount);
assert.isBoolean('shouldCheckTransfer', shouldCheckTransfer);
@@ -179,9 +179,6 @@ export class ExchangeWrapper extends ContractWrapper {
await assert.isSenderAddressAsync('takerAddress', takerAddress, this.web3Wrapper);
_.forEach(signedOrders,
async (signedOrder: SignedOrder, i: number) => {
- assert.doesConformToSchema(`signedOrder[${i}]`,
- SchemaValidator.convertToJSONSchemaCompatibleObject(signedOrder as object),
- signedOrderSchema);
await this.validateFillOrderAndThrowIfInvalidAsync(
signedOrder, takerTokenFillAmount, takerAddress);
});
@@ -437,7 +434,7 @@ export class ExchangeWrapper extends ContractWrapper {
*/
public async batchCancelOrderAsync(orderCancellationRequests: OrderCancellationRequest[]): Promise<void> {
const makers = _.map(orderCancellationRequests, cancellationRequest => cancellationRequest.order.maker);
- assert.hashAtMostOneUniqueValue(makers, ExchangeContractErrs.MULTIPLE_MAKERS_IN_SINGLE_CANCEL_BATCH_DISALLOWED);
+ assert.hasAtMostOneUniqueValue(makers, ExchangeContractErrs.MULTIPLE_MAKERS_IN_SINGLE_CANCEL_BATCH_DISALLOWED);
const maker = makers[0];
await assert.isSenderAddressAsync('maker', maker, this.web3Wrapper);
_.forEach(orderCancellationRequests,
diff --git a/src/utils/assert.ts b/src/utils/assert.ts
index 2ee87e549..94b119d5a 100644
--- a/src/utils/assert.ts
+++ b/src/utils/assert.ts
@@ -38,7 +38,7 @@ export const assert = {
const availableAddresses = await web3Wrapper.getAvailableAddressesAsync();
this.assert(!_.isEmpty(availableAddresses), 'No addresses were available on the provided web3 instance');
},
- hashAtMostOneUniqueValue(value: any[], errMsg: string): void {
+ hasAtMostOneUniqueValue(value: any[], errMsg: string): void {
this.assert(_.uniq(value).length <= 1, errMsg);
},
isNumber(variableName: string, value: number): void {
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts
index 3ae8515e2..f159de759 100644
--- a/test/exchange_wrapper_test.ts
+++ b/test/exchange_wrapper_test.ts
@@ -421,7 +421,7 @@ describe('ExchangeWrapper', () => {
const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(signedOrderHashHex);
const anotherFilledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(anotherOrderHashHex);
expect(filledAmount).to.be.bignumber.equal(fillableAmount);
- const remainingFillAmount = fillUpToAmount.minus(filledAmount);
+ const remainingFillAmount = fillableAmount.minus(1);
expect(anotherFilledAmount).to.be.bignumber.equal(remainingFillAmount);
});
});