aboutsummaryrefslogtreecommitdiffstats
path: root/src/contract_wrappers
diff options
context:
space:
mode:
Diffstat (limited to 'src/contract_wrappers')
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index 982a8c0c1..b5d5152dd 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -274,7 +274,13 @@ export class ExchangeWrapper extends ContractWrapper {
}
private async validateCancelOrderAndThrowIfInvalidAsync(order: Order,
cancelAmount: BigNumber.BigNumber): Promise<void> {
- // TODO
+ if (cancelAmount.eq(0)) {
+ throw new Error(ExchangeContractErrs.ORDER_CANCEL_AMOUNT_ZERO);
+ }
+ const currentUnixTimestampSec = Date.now() / 1000;
+ if (order.expirationUnixTimestampSec.lessThan(currentUnixTimestampSec)) {
+ throw new Error(ExchangeContractErrs.ORDER_CANCEL_EXPIRED);
+ }
}
/**