diff options
-rw-r--r-- | packages/0x.js/src/utils/order_state_utils.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/0x.js/src/utils/order_state_utils.ts b/packages/0x.js/src/utils/order_state_utils.ts index cc4933d39..21d842a77 100644 --- a/packages/0x.js/src/utils/order_state_utils.ts +++ b/packages/0x.js/src/utils/order_state_utils.ts @@ -117,6 +117,13 @@ export class OrderStateUtils { throw new Error(ExchangeContractErrs.InsufficientMakerFeeAllowance); } } + const minimumFillableTakerTokenAmountWithingNoRoundingErrorRange = signedOrder.takerTokenAmount + .times(1000) + .dividedBy(signedOrder.makerTokenAmount); + if (orderRelevantState.remainingFillableTakerTokenAmount + .lessThan(minimumFillableTakerTokenAmountWithingNoRoundingErrorRange)) { + throw new Error(ExchangeContractErrs.OrderFillRoundingError); + } // TODO Add linear function solver when maker token is ZRX #badass // Return the max amount that's fillable } |