From dcfe8bae1cf0dfa483ad0a3e8800dcb2b38940c7 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 14 Nov 2017 11:11:09 -0500 Subject: Name a constant --- packages/0x.js/src/utils/order_state_utils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'packages/0x.js/src/utils/order_state_utils.ts') diff --git a/packages/0x.js/src/utils/order_state_utils.ts b/packages/0x.js/src/utils/order_state_utils.ts index 8f5c379cd..af6392c81 100644 --- a/packages/0x.js/src/utils/order_state_utils.ts +++ b/packages/0x.js/src/utils/order_state_utils.ts @@ -18,6 +18,8 @@ import {constants} from '../utils/constants'; import {OrderFilledCancelledLazyStore} from '../stores/order_filled_cancelled_lazy_store'; import {BalanceAndProxyAllowanceLazyStore} from '../stores/balance_proxy_allowance_lazy_store'; +const ACCEPTABLE_RELATIVE_ROUNDING_ERROR = 0.0001; + export class OrderStateUtils { private balanceAndProxyAllowanceLazyStore: BalanceAndProxyAllowanceLazyStore; private orderFilledCancelledLazyStore: OrderFilledCancelledLazyStore; @@ -118,8 +120,8 @@ export class OrderStateUtils { } } const minFillableTakerTokenAmountWithinNoRoundingErrorRange = signedOrder.takerTokenAmount - .times(1000) - .dividedBy(signedOrder.makerTokenAmount); + .dividedBy(ACCEPTABLE_RELATIVE_ROUNDING_ERROR) + .dividedBy(signedOrder.makerTokenAmount); if (orderRelevantState.remainingFillableTakerTokenAmount .lessThan(minFillableTakerTokenAmountWithinNoRoundingErrorRange)) { throw new Error(ExchangeContractErrs.OrderFillRoundingError); -- cgit v1.2.3