aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-03-16 05:08:12 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-04-21 04:56:17 +0800
commitbf3c4f47432228a53cf2309688be5efc348026c3 (patch)
treedef62db0139bff8501b886eb54a17aafaa4f732f /packages/contracts/test
parentaeb0742434471c0a4cb28bebf569b0d4af6b4485 (diff)
downloaddexon-sol-tools-bf3c4f47432228a53cf2309688be5efc348026c3.tar
dexon-sol-tools-bf3c4f47432228a53cf2309688be5efc348026c3.tar.gz
dexon-sol-tools-bf3c4f47432228a53cf2309688be5efc348026c3.tar.bz2
dexon-sol-tools-bf3c4f47432228a53cf2309688be5efc348026c3.tar.lz
dexon-sol-tools-bf3c4f47432228a53cf2309688be5efc348026c3.tar.xz
dexon-sol-tools-bf3c4f47432228a53cf2309688be5efc348026c3.tar.zst
dexon-sol-tools-bf3c4f47432228a53cf2309688be5efc348026c3.zip
Fixed spacing
Diffstat (limited to 'packages/contracts/test')
-rw-r--r--packages/contracts/test/exchange/core.ts102
1 files changed, 51 insertions, 51 deletions
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index 3b787953b..ac8192d25 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -744,12 +744,12 @@ describe('Exchange', () => {
describe('cancelOrdersBefore', () => {
it('should fail to set timestamp less than existing CancelBefore timestamp', async () => {
- const timestamp = new BigNumber(1);
- await exWrapper.cancelOrdersBeforeAsync(timestamp, makerAddress);
- const lesser_timestamp = new BigNumber(0);
- return expect(
- exWrapper.cancelOrdersBeforeAsync(lesser_timestamp, makerAddress),
- ).to.be.rejectedWith(constants.REVERT);
+ const timestamp = new BigNumber(1);
+ await exWrapper.cancelOrdersBeforeAsync(timestamp, makerAddress);
+ const lesser_timestamp = new BigNumber(0);
+ return expect(
+ exWrapper.cancelOrdersBeforeAsync(lesser_timestamp, makerAddress),
+ ).to.be.rejectedWith(constants.REVERT);
});
it('should fail to set timestamp equal to existing CancelBefore timestamp', async () => {
@@ -761,51 +761,51 @@ describe('Exchange', () => {
});
it('should cancel only orders with a timestamp less than CancelBefore timestamp', async () => {
- // Cancel all transactions with a timestamp less than 1
- const timestamp = new BigNumber(1);
- await exWrapper.cancelOrdersBeforeAsync(timestamp, makerAddress);
-
- // Create 3 orders with timestamps 0,1,2
- // Since we cancelled with timestamp=1, orders with timestamp<1 will not be processed
- balances = await dmyBalances.getAsync();
- const signedOrders = await Promise.all([
- orderFactory.newSignedOrder({
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(17), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(17), 18),
- salt: new BigNumber(0)}),
- orderFactory.newSignedOrder({
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(97), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(97), 18),
- salt: new BigNumber(1)}),
- orderFactory.newSignedOrder({
- makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(979), 18),
- takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(979), 18),
- salt: new BigNumber(2)}),
- ]);
- await exWrapper.batchFillOrdersNoThrowAsync(signedOrders, takerAddress);
-
- const newBalances = await dmyBalances.getAsync();
- const fillMakerTokenAmount = signedOrders[1].makerTokenAmount.add(signedOrders[2].makerTokenAmount);
- const fillTakerTokenAmount = signedOrders[1].takerTokenAmount.add(signedOrders[2].takerTokenAmount);
- const makerFeeAmount = signedOrders[1].makerFeeAmount.add(signedOrders[2].makerFeeAmount);
- const takerFeeAmount = signedOrders[1].takerFeeAmount.add(signedOrders[2].takerFeeAmount);
- expect(newBalances[makerAddress][signedOrders[2].makerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][signedOrders[2].makerTokenAddress].minus(fillMakerTokenAmount),
- );
- expect(newBalances[makerAddress][signedOrders[2].takerTokenAddress]).to.be.bignumber.equal(
- balances[makerAddress][signedOrders[2].takerTokenAddress].add(fillTakerTokenAmount),
- );
- expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(balances[makerAddress][zrx.address].minus(makerFeeAmount));
- expect(newBalances[takerAddress][signedOrders[2].takerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][signedOrders[2].takerTokenAddress].minus(fillTakerTokenAmount),
- );
- expect(newBalances[takerAddress][signedOrders[2].makerTokenAddress]).to.be.bignumber.equal(
- balances[takerAddress][signedOrders[2].makerTokenAddress].add(fillMakerTokenAmount),
- );
- expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(balances[takerAddress][zrx.address].minus(takerFeeAmount));
- expect(newBalances[feeRecipientAddress][zrx.address]).to.be.bignumber.equal(
- balances[feeRecipientAddress][zrx.address].add(makerFeeAmount.add(takerFeeAmount)),
- );
+ // Cancel all transactions with a timestamp less than 1
+ const timestamp = new BigNumber(1);
+ await exWrapper.cancelOrdersBeforeAsync(timestamp, makerAddress);
+
+ // Create 3 orders with timestamps 0,1,2
+ // Since we cancelled with timestamp=1, orders with timestamp<1 will not be processed
+ balances = await dmyBalances.getAsync();
+ const signedOrders = await Promise.all([
+ orderFactory.newSignedOrder({
+ makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(17), 18),
+ takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(17), 18),
+ salt: new BigNumber(0)}),
+ orderFactory.newSignedOrder({
+ makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(97), 18),
+ takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(97), 18),
+ salt: new BigNumber(1)}),
+ orderFactory.newSignedOrder({
+ makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(979), 18),
+ takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(979), 18),
+ salt: new BigNumber(2)}),
+ ]);
+ await exWrapper.batchFillOrdersNoThrowAsync(signedOrders, takerAddress);
+
+ const newBalances = await dmyBalances.getAsync();
+ const fillMakerTokenAmount = signedOrders[1].makerTokenAmount.add(signedOrders[2].makerTokenAmount);
+ const fillTakerTokenAmount = signedOrders[1].takerTokenAmount.add(signedOrders[2].takerTokenAmount);
+ const makerFeeAmount = signedOrders[1].makerFeeAmount.add(signedOrders[2].makerFeeAmount);
+ const takerFeeAmount = signedOrders[1].takerFeeAmount.add(signedOrders[2].takerFeeAmount);
+ expect(newBalances[makerAddress][signedOrders[2].makerTokenAddress]).to.be.bignumber.equal(
+ balances[makerAddress][signedOrders[2].makerTokenAddress].minus(fillMakerTokenAmount),
+ );
+ expect(newBalances[makerAddress][signedOrders[2].takerTokenAddress]).to.be.bignumber.equal(
+ balances[makerAddress][signedOrders[2].takerTokenAddress].add(fillTakerTokenAmount),
+ );
+ expect(newBalances[makerAddress][zrx.address]).to.be.bignumber.equal(balances[makerAddress][zrx.address].minus(makerFeeAmount));
+ expect(newBalances[takerAddress][signedOrders[2].takerTokenAddress]).to.be.bignumber.equal(
+ balances[takerAddress][signedOrders[2].takerTokenAddress].minus(fillTakerTokenAmount),
+ );
+ expect(newBalances[takerAddress][signedOrders[2].makerTokenAddress]).to.be.bignumber.equal(
+ balances[takerAddress][signedOrders[2].makerTokenAddress].add(fillMakerTokenAmount),
+ );
+ expect(newBalances[takerAddress][zrx.address]).to.be.bignumber.equal(balances[takerAddress][zrx.address].minus(takerFeeAmount));
+ expect(newBalances[feeRecipientAddress][zrx.address]).to.be.bignumber.equal(
+ balances[feeRecipientAddress][zrx.address].add(makerFeeAmount.add(takerFeeAmount)),
+ );
});
});
}); // tslint:disable-line:max-file-line-count