diff options
author | Jacob Evans <jacob@dekz.net> | 2017-11-16 05:20:39 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2017-11-16 05:20:39 +0800 |
commit | c32938fa43ef7ab538465e5eeade924b23776e6c (patch) | |
tree | a156b236e580ea6839f7e430c8575cc5a85474fb /packages/0x.js/src | |
parent | 54c891a447fb5b47355e8f44a5b29bcc20bae1a1 (diff) | |
download | dexon-sol-tools-c32938fa43ef7ab538465e5eeade924b23776e6c.tar dexon-sol-tools-c32938fa43ef7ab538465e5eeade924b23776e6c.tar.gz dexon-sol-tools-c32938fa43ef7ab538465e5eeade924b23776e6c.tar.bz2 dexon-sol-tools-c32938fa43ef7ab538465e5eeade924b23776e6c.tar.lz dexon-sol-tools-c32938fa43ef7ab538465e5eeade924b23776e6c.tar.xz dexon-sol-tools-c32938fa43ef7ab538465e5eeade924b23776e6c.tar.zst dexon-sol-tools-c32938fa43ef7ab538465e5eeade924b23776e6c.zip |
Shortcut if everything satisfies in the non dependent use case
Diffstat (limited to 'packages/0x.js/src')
-rw-r--r-- | packages/0x.js/src/utils/order_state_utils.ts | 6 |
1 files changed, 6 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 69e749952..d1b2feb43 100644 --- a/packages/0x.js/src/utils/order_state_utils.ts +++ b/packages/0x.js/src/utils/order_state_utils.ts @@ -110,7 +110,13 @@ export class OrderStateUtils { if (makerFee.isZero()) { return BigNumber.min(makerTransferrable, remainingMakerAmount); } + if (makerFeeTransferrable.greaterThanOrEqualTo(makerFee) && + makerTransferrable.greaterThanOrEqualTo(remainingMakerAmount) && + makerTokenAddress !== zrxTokenAddress) { + return BigNumber.min(makerTransferrable, remainingMakerAmount); + } const orderToFeeRatio = totalMakerAmount.dividedToIntegerBy(makerFee); + console.log('order to fee ratio: ', orderToFeeRatio.toString()); let fillableTimesInMakerToken = makerTransferrable.dividedToIntegerBy(orderToFeeRatio); const fillableTimesInFeeToken = BigNumber.min(makerFeeTransferrable, remainingMakerFee); if (makerTokenAddress === zrxTokenAddress) { |