aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/utils
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-15 00:11:09 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-15 00:11:09 +0800
commitdcfe8bae1cf0dfa483ad0a3e8800dcb2b38940c7 (patch)
tree84a5225c6f08e934702f2853ad8a7bdbb0af9d64 /packages/0x.js/src/utils
parent61496d77a5d3d50d7b41a0732af375fd973fa384 (diff)
downloaddexon-0x-contracts-dcfe8bae1cf0dfa483ad0a3e8800dcb2b38940c7.tar.gz
dexon-0x-contracts-dcfe8bae1cf0dfa483ad0a3e8800dcb2b38940c7.tar.zst
dexon-0x-contracts-dcfe8bae1cf0dfa483ad0a3e8800dcb2b38940c7.zip
Name a constant
Diffstat (limited to 'packages/0x.js/src/utils')
-rw-r--r--packages/0x.js/src/utils/order_state_utils.ts6
1 files changed, 4 insertions, 2 deletions
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);