aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-03-16 04:58:54 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-04-21 04:56:17 +0800
commitaeb0742434471c0a4cb28bebf569b0d4af6b4485 (patch)
tree9921cd5df2b80041a0655948961ddb95743e82cc /packages/contracts/src/utils
parente98b4ea26d90d5d356972fcf038eeef50ebd31f3 (diff)
downloaddexon-sol-tools-aeb0742434471c0a4cb28bebf569b0d4af6b4485.tar
dexon-sol-tools-aeb0742434471c0a4cb28bebf569b0d4af6b4485.tar.gz
dexon-sol-tools-aeb0742434471c0a4cb28bebf569b0d4af6b4485.tar.bz2
dexon-sol-tools-aeb0742434471c0a4cb28bebf569b0d4af6b4485.tar.lz
dexon-sol-tools-aeb0742434471c0a4cb28bebf569b0d4af6b4485.tar.xz
dexon-sol-tools-aeb0742434471c0a4cb28bebf569b0d4af6b4485.tar.zst
dexon-sol-tools-aeb0742434471c0a4cb28bebf569b0d4af6b4485.zip
Implementation and tests in the protocol for cancelling all orders up to a specific time
Diffstat (limited to 'packages/contracts/src/utils')
-rw-r--r--packages/contracts/src/utils/exchange_wrapper.ts12
-rw-r--r--packages/contracts/src/utils/types.ts4
2 files changed, 16 insertions, 0 deletions
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<TransactionReceiptWithDecodedLogs> {
+ const txHash = await this._exchange.cancelOrdersBefore.sendTransactionAsync(
+ timestamp,
+ { from },
+ );
+ const tx = await this._getTxWithDecodedExchangeLogsAsync(txHash);
+ return tx;
+ }
+
public async getOrderHashAsync(signedOrder: SignedOrder): Promise<string> {
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;