diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-21 01:13:30 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-06-21 01:13:30 +0800 |
commit | 247f8c8557a501ea5081615d9b031c9e4b7aeec7 (patch) | |
tree | 51b9a9de386d7fbe453a7fc5c1e0e827fd6ecdca /packages/order-utils/src/order_state_utils.ts | |
parent | 3ce449e16739896f81b171d130afbb5774829d64 (diff) | |
download | dexon-0x-contracts-247f8c8557a501ea5081615d9b031c9e4b7aeec7.tar dexon-0x-contracts-247f8c8557a501ea5081615d9b031c9e4b7aeec7.tar.gz dexon-0x-contracts-247f8c8557a501ea5081615d9b031c9e4b7aeec7.tar.bz2 dexon-0x-contracts-247f8c8557a501ea5081615d9b031c9e4b7aeec7.tar.lz dexon-0x-contracts-247f8c8557a501ea5081615d9b031c9e4b7aeec7.tar.xz dexon-0x-contracts-247f8c8557a501ea5081615d9b031c9e4b7aeec7.tar.zst dexon-0x-contracts-247f8c8557a501ea5081615d9b031c9e4b7aeec7.zip |
Fix orderValidationUtils where was confusing a makerAssetAmount as a takerAssetAmount
Diffstat (limited to 'packages/order-utils/src/order_state_utils.ts')
-rw-r--r-- | packages/order-utils/src/order_state_utils.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/order-utils/src/order_state_utils.ts b/packages/order-utils/src/order_state_utils.ts index dbb65de59..3752fdadb 100644 --- a/packages/order-utils/src/order_state_utils.ts +++ b/packages/order-utils/src/order_state_utils.ts @@ -14,6 +14,7 @@ import { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_f import { constants } from './constants'; import { orderHashUtils } from './order_hash'; import { RemainingFillableCalculator } from './remaining_fillable_calculator'; +import { utils } from './utils'; interface SidedOrderRelevantState { isMakerSide: boolean; @@ -161,7 +162,13 @@ export class OrderStateUtils { signedOrder, signedOrder.takerAddress, ); - const remainingFillableTakerAssetAmountGivenMakersStatus = orderRelevantMakerState.remainingFillableAssetAmount; + const remainingFillableTakerAssetAmountGivenMakersStatus = signedOrder.makerAssetAmount.eq(0) + ? new BigNumber(0) + : utils.getPartialAmount( + orderRelevantMakerState.remainingFillableAssetAmount, + signedOrder.makerAssetAmount, + signedOrder.takerAssetAmount, + ); // Get max fillable amount for an order, considering the takers ability to fill isMaker = false; |