aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-06-08 00:33:42 +0800
committerFabio Berger <me@fabioberger.com>2018-06-08 00:33:42 +0800
commitf5ad553be35bcc35fdac9620ae3d1e5546fd902c (patch)
treee73d6224df89089ec217c7a98b0d1a14cb2fef54 /packages/order-utils/src
parentdee0fec9e9521712d11f1f040ae1264c41badaba (diff)
downloaddexon-sol-tools-f5ad553be35bcc35fdac9620ae3d1e5546fd902c.tar
dexon-sol-tools-f5ad553be35bcc35fdac9620ae3d1e5546fd902c.tar.gz
dexon-sol-tools-f5ad553be35bcc35fdac9620ae3d1e5546fd902c.tar.bz2
dexon-sol-tools-f5ad553be35bcc35fdac9620ae3d1e5546fd902c.tar.lz
dexon-sol-tools-f5ad553be35bcc35fdac9620ae3d1e5546fd902c.tar.xz
dexon-sol-tools-f5ad553be35bcc35fdac9620ae3d1e5546fd902c.tar.zst
dexon-sol-tools-f5ad553be35bcc35fdac9620ae3d1e5546fd902c.zip
Pass in fee and assetAmount rather then the whole signedOrder
Diffstat (limited to 'packages/order-utils/src')
-rw-r--r--packages/order-utils/src/order_state_utils.ts5
-rw-r--r--packages/order-utils/src/remaining_fillable_calculator.ts16
2 files changed, 6 insertions, 15 deletions
diff --git a/packages/order-utils/src/order_state_utils.ts b/packages/order-utils/src/order_state_utils.ts
index ef868e60f..ca18097c9 100644
--- a/packages/order-utils/src/order_state_utils.ts
+++ b/packages/order-utils/src/order_state_utils.ts
@@ -113,10 +113,9 @@ export class OrderStateUtils {
const zrxAssetData = assetProxyUtils.encodeERC20ProxyData(zrxTokenAddress);
const isMakerAssetZRX = signedOrder.makerAssetData === zrxAssetData;
- const isTraderMaker = true;
const remainingFillableCalculator = new RemainingFillableCalculator(
- isTraderMaker,
- signedOrder,
+ signedOrder.makerFee,
+ signedOrder.makerAssetAmount,
isMakerAssetZRX,
transferrableMakerAssetAmount,
transferrableFeeAssetAmount,
diff --git a/packages/order-utils/src/remaining_fillable_calculator.ts b/packages/order-utils/src/remaining_fillable_calculator.ts
index acab2f41b..bc146e931 100644
--- a/packages/order-utils/src/remaining_fillable_calculator.ts
+++ b/packages/order-utils/src/remaining_fillable_calculator.ts
@@ -1,8 +1,6 @@
-import { SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
export class RemainingFillableCalculator {
- private _signedOrder: SignedOrder;
private _isTraderAssetZRX: boolean;
// Transferrable Amount is the minimum of Approval and Balance
private _transferrableAssetAmount: BigNumber;
@@ -12,21 +10,15 @@ export class RemainingFillableCalculator {
private _orderFee: BigNumber;
private _orderAssetAmount: BigNumber;
constructor(
- isTraderMaker: boolean,
- signedOrder: SignedOrder,
+ orderFee: BigNumber,
+ orderAssetAmount: BigNumber,
isTraderAssetZRX: boolean,
transferrableAssetAmount: BigNumber,
transferrableFeeAmount: BigNumber,
remainingOrderAssetAmount: BigNumber,
) {
- if (isTraderMaker) {
- this._orderFee = signedOrder.makerFee;
- this._orderAssetAmount = signedOrder.makerAssetAmount;
- } else {
- this._orderFee = signedOrder.takerFee;
- this._orderAssetAmount = signedOrder.takerAssetAmount;
- }
- this._signedOrder = signedOrder;
+ this._orderFee = orderFee;
+ this._orderAssetAmount = orderAssetAmount;
this._isTraderAssetZRX = isTraderAssetZRX;
this._transferrableAssetAmount = transferrableAssetAmount;
this._transferrableFeeAmount = transferrableFeeAmount;