From 8d6045c1d5737ff2e62f6f3b906cf639da1aa2ba Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 23 Aug 2017 18:50:51 +0200 Subject: Add validation for the case where the order is fully filled or canceled and a test --- src/utils/order_validation_utils.ts | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/utils') diff --git a/src/utils/order_validation_utils.ts b/src/utils/order_validation_utils.ts index 6f9cd7b1a..445ad43f9 100644 --- a/src/utils/order_validation_utils.ts +++ b/src/utils/order_validation_utils.ts @@ -16,6 +16,11 @@ export class OrderValidationUtils { takerAddress: string, zrxTokenAddress: string): Promise { if (fillTakerTokenAmount.eq(0)) { + throw new Error(ExchangeContractErrs.OrderFillAmountZero); + } + const orderHash = utils.getOrderHashHex(signedOrder); + const unavailableTakerTokenAmount = await this.exchangeWrapper.getUnavailableTakerAmountAsync(orderHash); + if (signedOrder.makerTokenAmount.eq(unavailableTakerTokenAmount)) { throw new Error(ExchangeContractErrs.OrderRemainingFillAmountZero); } if (signedOrder.taker !== constants.NULL_ADDRESS && signedOrder.taker !== takerAddress) { -- cgit v1.2.3