diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/types.ts | 1 | ||||
-rw-r--r-- | src/utils/order_validation_utils.ts | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/types.ts b/src/types.ts index 0de87ca71..5ba85a7d5 100644 --- a/src/types.ts +++ b/src/types.ts @@ -180,6 +180,7 @@ export enum ExchangeContractErrs { OrderCancelExpired = 'ORDER_CANCEL_EXPIRED', OrderCancelAmountZero = 'ORDER_CANCEL_AMOUNT_ZERO', OrderAlreadyCancelledOrFilled = 'ORDER_ALREADY_CANCELLED_OR_FILLED', + OrderFillAmountZero = 'ORDER_FILL_AMOUNT_ZERO', OrderRemainingFillAmountZero = 'ORDER_REMAINING_FILL_AMOUNT_ZERO', OrderFillRoundingError = 'ORDER_FILL_ROUNDING_ERROR', FillBalanceAllowanceError = 'FILL_BALANCE_ALLOWANCE_ERROR', 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<void> { 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) { |