From aeb0742434471c0a4cb28bebf569b0d4af6b4485 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Thu, 15 Mar 2018 13:58:54 -0700 Subject: Implementation and tests in the protocol for cancelling all orders up to a specific time --- packages/contracts/src/utils/exchange_wrapper.ts | 12 ++++++++++++ packages/contracts/src/utils/types.ts | 4 ++++ 2 files changed, 16 insertions(+) (limited to 'packages/contracts/src/utils') diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts index 5996867cb..d4206adc3 100644 --- a/packages/contracts/src/utils/exchange_wrapper.ts +++ b/packages/contracts/src/utils/exchange_wrapper.ts @@ -167,6 +167,18 @@ export class ExchangeWrapper { const tx = await this._getTxWithDecodedExchangeLogsAsync(txHash); return tx; } + public async cancelOrdersBeforeAsync( + timestamp: BigNumber, + from: string, + ): Promise { + const txHash = await this._exchange.cancelOrdersBefore.sendTransactionAsync( + timestamp, + { from }, + ); + const tx = await this._getTxWithDecodedExchangeLogsAsync(txHash); + return tx; + } + public async getOrderHashAsync(signedOrder: SignedOrder): Promise { const order = orderUtils.getOrderStruct(signedOrder); const orderHash = await this._exchange.getOrderHash.callAsync(order); diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts index 9f874d9ec..1a924a66d 100644 --- a/packages/contracts/src/utils/types.ts +++ b/packages/contracts/src/utils/types.ts @@ -28,6 +28,10 @@ export interface BatchCancelOrders { takerTokenCancelAmounts: BigNumber[]; } +export interface CancelOrdersBefore { + timestamp: BigNumber; +} + export interface DefaultOrderParams { exchangeAddress: string; makerAddress: string; -- cgit