diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-03-20 01:56:21 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-04-21 04:56:17 +0800 |
commit | 1efba5979f2c11aa70845d2ef9f32b60e1bc6971 (patch) | |
tree | 609a7e9ddadad83435b6df93d52dabef73f249b2 /packages | |
parent | bf3c4f47432228a53cf2309688be5efc348026c3 (diff) | |
download | dexon-sol-tools-1efba5979f2c11aa70845d2ef9f32b60e1bc6971.tar dexon-sol-tools-1efba5979f2c11aa70845d2ef9f32b60e1bc6971.tar.gz dexon-sol-tools-1efba5979f2c11aa70845d2ef9f32b60e1bc6971.tar.bz2 dexon-sol-tools-1efba5979f2c11aa70845d2ef9f32b60e1bc6971.tar.lz dexon-sol-tools-1efba5979f2c11aa70845d2ef9f32b60e1bc6971.tar.xz dexon-sol-tools-1efba5979f2c11aa70845d2ef9f32b60e1bc6971.tar.zst dexon-sol-tools-1efba5979f2c11aa70845d2ef9f32b60e1bc6971.zip |
Renamed all instances of timestamp to salt. Clarified test case wording.
Diffstat (limited to 'packages')
-rw-r--r-- | packages/contracts/src/utils/exchange_wrapper.ts | 4 | ||||
-rw-r--r-- | packages/contracts/src/utils/types.ts | 2 | ||||
-rw-r--r-- | packages/contracts/test/exchange/core.ts | 30 |
3 files changed, 18 insertions, 18 deletions
diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts index 705f9cd0e..808ff0fd4 100644 --- a/packages/contracts/src/utils/exchange_wrapper.ts +++ b/packages/contracts/src/utils/exchange_wrapper.ts @@ -168,11 +168,11 @@ export class ExchangeWrapper { return tx; } public async cancelOrdersBeforeAsync( - timestamp: BigNumber, + salt: BigNumber, from: string, ): Promise<TransactionReceiptWithDecodedLogs> { const txHash = await this._exchange.cancelOrdersBefore.sendTransactionAsync( - timestamp, + salt, { from }, ); const tx = await this._getTxWithDecodedExchangeLogsAsync(txHash); diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts index 1a924a66d..06fe23824 100644 --- a/packages/contracts/src/utils/types.ts +++ b/packages/contracts/src/utils/types.ts @@ -29,7 +29,7 @@ export interface BatchCancelOrders { } export interface CancelOrdersBefore { - timestamp: BigNumber; + salt: BigNumber; } export interface DefaultOrderParams { diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index ac8192d25..53863c5d8 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -743,30 +743,30 @@ 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); + it('should fail to set makerEpoch less than current makerEpoch', async () => { + const makerEpoch = new BigNumber(1); + await exWrapper.cancelOrdersBeforeAsync(makerEpoch, makerAddress); + const lesserMakerEpoch = new BigNumber(0); return expect( - exWrapper.cancelOrdersBeforeAsync(lesser_timestamp, makerAddress), + exWrapper.cancelOrdersBeforeAsync(lesserMakerEpoch, makerAddress), ).to.be.rejectedWith(constants.REVERT); }); - it('should fail to set timestamp equal to existing CancelBefore timestamp', async () => { - const timestamp = new BigNumber(1); - await exWrapper.cancelOrdersBeforeAsync(timestamp, makerAddress); + it('should fail to set makerEpoch equal to existing makerEpoch', async () => { + const makerEpoch = new BigNumber(1); + await exWrapper.cancelOrdersBeforeAsync(makerEpoch, makerAddress); return expect( - exWrapper.cancelOrdersBeforeAsync(timestamp, makerAddress), + exWrapper.cancelOrdersBeforeAsync(makerEpoch, makerAddress), ).to.be.rejectedWith(constants.REVERT); }); - 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); + it('should cancel only orders with a makerEpoch less than existing makerEpoch', async () => { + // Cancel all transactions with a makerEpoch less than 1 + const makerEpoch = new BigNumber(1); + await exWrapper.cancelOrdersBeforeAsync(makerEpoch, makerAddress); - // Create 3 orders with timestamps 0,1,2 - // Since we cancelled with timestamp=1, orders with timestamp<1 will not be processed + // Create 3 orders with makerEpoch values: 0,1,2 + // Since we cancelled with makerEpoch=1, orders with makerEpoch<1 will not be processed balances = await dmyBalances.getAsync(); const signedOrders = await Promise.all([ orderFactory.newSignedOrder({ |