From 3bb6d8871b459c4f3975b600d391558188aa48b7 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Mon, 20 Nov 2017 09:04:26 +1100 Subject: Readability variable names --- packages/0x.js/src/utils/order_state_utils.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/0x.js/src/utils/order_state_utils.ts b/packages/0x.js/src/utils/order_state_utils.ts index 4c1bef64e..4d8f90f62 100644 --- a/packages/0x.js/src/utils/order_state_utils.ts +++ b/packages/0x.js/src/utils/order_state_utils.ts @@ -85,7 +85,7 @@ export class OrderStateUtils { let remainingFillableMakerTokenAmount; if (signedOrder.makerFee.isZero() || - (transferrableFeeTokenAmount.greaterThanOrEqualTo(signedOrder.makerFee) && + (transferrableFeeTokenAmount.greaterThanOrEqualTo(remainingFeeTokenAmount) && transferrableMakerTokenAmount.greaterThanOrEqualTo(remainingMakerTokenAmount) && signedOrder.makerTokenAddress !== zrxTokenAddress)) { remainingFillableMakerTokenAmount = transferrableMakerTokenAmount; @@ -111,17 +111,17 @@ export class OrderStateUtils { }; return orderRelevantState; } - private calculatePartiallyFillableMakerTokenAmount(makerTransferrable: BigNumber, makerFeeTransferrable: BigNumber, - remainingMakerAmount: BigNumber, remainingMakerFee: BigNumber, - totalMakerAmount: BigNumber, makerFee: BigNumber, + private calculatePartiallyFillableMakerTokenAmount(makerTransferrableAmount: BigNumber, makerFeeTransferrableAmount: BigNumber, + remainingMakerAmount: BigNumber, remainingMakerFeeAmount: BigNumber, + totalMakerAmount: BigNumber, makerFeeAmount: BigNumber, makerTokenAddress: string, zrxTokenAddress: string): BigNumber { - const orderToFeeRatio = totalMakerAmount.dividedToIntegerBy(makerFee); - let fillableTimesInMakerToken = makerTransferrable.dividedToIntegerBy(orderToFeeRatio); - const fillableTimesInFeeToken = BigNumber.min(makerFeeTransferrable, remainingMakerFee); + const orderToFeeRatio = totalMakerAmount.dividedToIntegerBy(makerFeeAmount); + const fillableTimesInFeeToken = BigNumber.min(makerFeeTransferrableAmount, remainingMakerFeeAmount); + let fillableTimesInMakerToken = makerTransferrableAmount.dividedToIntegerBy(orderToFeeRatio); if (makerTokenAddress === zrxTokenAddress) { - fillableTimesInMakerToken = makerTransferrable.plus(makerFeeTransferrable) - .dividedToIntegerBy(orderToFeeRatio.plus( - ZeroEx.toBaseUnitAmount(new BigNumber(1), 18))); + const totalFeeTokenPool = makerTransferrableAmount.plus(makerFeeTransferrableAmount); + fillableTimesInMakerToken = totalFeeTokenPool.dividedToIntegerBy( + orderToFeeRatio.plus(ZeroEx.toBaseUnitAmount(new BigNumber(1), 18))); } return BigNumber.min(fillableTimesInMakerToken.times(orderToFeeRatio), -- cgit