aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
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
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')
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol3
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol3
-rw-r--r--packages/contracts/src/utils/exchange_wrapper.ts4
-rw-r--r--packages/contracts/test/exchange/core.ts102
4 files changed, 56 insertions, 56 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol b/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol
index 3a43fca9b..9e285e8bb 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol
@@ -164,7 +164,8 @@ contract IExchange {
/// @dev Cancels all orders for a specified maker up to a certain time.
/// @param salt Orders created with a lower salt value will be cancelled
- function cancelOrdersBefore(uint256 salt) external;
+ function cancelOrdersBefore(uint256 salt)
+ external;
/// @dev Fills an order with specified parameters and ECDSA signature. Throws if specified amount not filled entirely.
/// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient.
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol b/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol
index b39996995..77300c0f8 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MExchangeCore.sol
@@ -36,7 +36,6 @@ contract MExchangeCore is LibOrder {
public
returns (uint256 takerTokenCancelledAmount);
- function cancelOrdersBefore(
- uint256 salt)
+ function cancelOrdersBefore(uint256 salt)
external;
}
diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts
index d4206adc3..705f9cd0e 100644
--- a/packages/contracts/src/utils/exchange_wrapper.ts
+++ b/packages/contracts/src/utils/exchange_wrapper.ts
@@ -168,8 +168,8 @@ export class ExchangeWrapper {
return tx;
}
public async cancelOrdersBeforeAsync(
- timestamp: BigNumber,
- from: string,
+ timestamp: BigNumber,
+ from: string,
): Promise<TransactionReceiptWithDecodedLogs> {
const txHash = await this._exchange.cancelOrdersBefore.sendTransactionAsync(
timestamp,
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