aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/test
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/test
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/test')
-rw-r--r--packages/order-utils/test/remaining_fillable_calculator_test.ts50
1 files changed, 20 insertions, 30 deletions
diff --git a/packages/order-utils/test/remaining_fillable_calculator_test.ts b/packages/order-utils/test/remaining_fillable_calculator_test.ts
index 81f8132b2..45ad90626 100644
--- a/packages/order-utils/test/remaining_fillable_calculator_test.ts
+++ b/packages/order-utils/test/remaining_fillable_calculator_test.ts
@@ -65,10 +65,9 @@ describe('RemainingFillableCalculator', () => {
it('calculates the correct amount when unfilled and funds available', () => {
signedOrder = buildSignedOrder();
remainingMakeAssetAmount = signedOrder.makerAssetAmount;
- const isTraderMaker = true;
calculator = new RemainingFillableCalculator(
- isTraderMaker,
- signedOrder,
+ signedOrder.makerFee,
+ signedOrder.makerAssetAmount,
isMakeAssetZRX,
transferrableMakeAssetAmount,
transferrableMakerFeeTokenAmount,
@@ -79,10 +78,9 @@ describe('RemainingFillableCalculator', () => {
it('calculates the correct amount when partially filled and funds available', () => {
signedOrder = buildSignedOrder();
remainingMakeAssetAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(1), decimals);
- const isTraderMaker = true;
calculator = new RemainingFillableCalculator(
- isTraderMaker,
- signedOrder,
+ signedOrder.makerFee,
+ signedOrder.makerAssetAmount,
isMakeAssetZRX,
transferrableMakeAssetAmount,
transferrableMakerFeeTokenAmount,
@@ -94,10 +92,9 @@ describe('RemainingFillableCalculator', () => {
signedOrder = buildSignedOrder();
transferrableMakerFeeTokenAmount = zero;
remainingMakeAssetAmount = signedOrder.makerAssetAmount;
- const isTraderMaker = true;
calculator = new RemainingFillableCalculator(
- isTraderMaker,
- signedOrder,
+ signedOrder.makerFee,
+ signedOrder.makerAssetAmount,
isMakeAssetZRX,
transferrableMakeAssetAmount,
transferrableMakerFeeTokenAmount,
@@ -110,10 +107,9 @@ describe('RemainingFillableCalculator', () => {
const partiallyFilledAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(2), decimals);
remainingMakeAssetAmount = signedOrder.makerAssetAmount.minus(partiallyFilledAmount);
transferrableMakeAssetAmount = remainingMakeAssetAmount.minus(partiallyFilledAmount);
- const isTraderMaker = true;
calculator = new RemainingFillableCalculator(
- isTraderMaker,
- signedOrder,
+ signedOrder.makerFee,
+ signedOrder.makerAssetAmount,
isMakeAssetZRX,
transferrableMakeAssetAmount,
transferrableMakerFeeTokenAmount,
@@ -134,10 +130,9 @@ describe('RemainingFillableCalculator', () => {
remainingMakeAssetAmount = signedOrder.makerAssetAmount;
const transferredAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(2), decimals);
transferrableMakeAssetAmount = remainingMakeAssetAmount.minus(transferredAmount);
- const isTraderMaker = true;
calculator = new RemainingFillableCalculator(
- isTraderMaker,
- signedOrder,
+ signedOrder.makerFee,
+ signedOrder.makerAssetAmount,
isMakeAssetZRX,
transferrableMakeAssetAmount,
transferrableMakerFeeTokenAmount,
@@ -159,10 +154,9 @@ describe('RemainingFillableCalculator', () => {
remainingMakeAssetAmount = signedOrder.makerAssetAmount;
const transferredAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(2), decimals);
transferrableMakeAssetAmount = remainingMakeAssetAmount.minus(transferredAmount);
- const isTraderMaker = true;
calculator = new RemainingFillableCalculator(
- isTraderMaker,
- signedOrder,
+ signedOrder.makerFee,
+ signedOrder.makerAssetAmount,
isMakeAssetZRX,
transferrableMakeAssetAmount,
transferrableMakerFeeTokenAmount,
@@ -186,10 +180,9 @@ describe('RemainingFillableCalculator', () => {
transferrableMakeAssetAmount = makerAmount.plus(makerFeeAmount);
transferrableMakerFeeTokenAmount = transferrableMakeAssetAmount;
remainingMakeAssetAmount = signedOrder.makerAssetAmount;
- const isTraderMaker = true;
calculator = new RemainingFillableCalculator(
- isTraderMaker,
- signedOrder,
+ signedOrder.makerFee,
+ signedOrder.makerAssetAmount,
isMakeAssetZRX,
transferrableMakeAssetAmount,
transferrableMakerFeeTokenAmount,
@@ -200,10 +193,9 @@ describe('RemainingFillableCalculator', () => {
it('calculates the correct amount when partially filled and funds available', () => {
signedOrder = buildSignedOrder();
remainingMakeAssetAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(1), decimals);
- const isTraderMaker = true;
calculator = new RemainingFillableCalculator(
- isTraderMaker,
- signedOrder,
+ signedOrder.makerFee,
+ signedOrder.makerAssetAmount,
isMakeAssetZRX,
transferrableMakeAssetAmount,
transferrableMakerFeeTokenAmount,
@@ -216,10 +208,9 @@ describe('RemainingFillableCalculator', () => {
transferrableMakeAssetAmount = zero;
transferrableMakerFeeTokenAmount = zero;
remainingMakeAssetAmount = signedOrder.makerAssetAmount;
- const isTraderMaker = true;
calculator = new RemainingFillableCalculator(
- isTraderMaker,
- signedOrder,
+ signedOrder.makerFee,
+ signedOrder.makerAssetAmount,
isMakeAssetZRX,
transferrableMakeAssetAmount,
transferrableMakerFeeTokenAmount,
@@ -236,10 +227,9 @@ describe('RemainingFillableCalculator', () => {
const orderToFeeRatio = signedOrder.makerAssetAmount.dividedToIntegerBy(signedOrder.makerFee);
const expectedFillableAmount = new BigNumber(450980);
- const isTraderMaker = true;
calculator = new RemainingFillableCalculator(
- isTraderMaker,
- signedOrder,
+ signedOrder.makerFee,
+ signedOrder.makerAssetAmount,
isMakeAssetZRX,
transferrableMakeAssetAmount,
transferrableMakerFeeTokenAmount,