diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-01 21:46:27 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-01 21:46:27 +0800 |
commit | d8e35c364ea94b606810b340fb02d8706e257c3c (patch) | |
tree | 93e3f7ae35178d99efdb82b1f58c0f3c162f9615 /src | |
parent | 21d00f04d46a8067801ff539fb21cbbed416c8b3 (diff) | |
download | dexon-0x-contracts-d8e35c364ea94b606810b340fb02d8706e257c3c.tar dexon-0x-contracts-d8e35c364ea94b606810b340fb02d8706e257c3c.tar.gz dexon-0x-contracts-d8e35c364ea94b606810b340fb02d8706e257c3c.tar.bz2 dexon-0x-contracts-d8e35c364ea94b606810b340fb02d8706e257c3c.tar.lz dexon-0x-contracts-d8e35c364ea94b606810b340fb02d8706e257c3c.tar.xz dexon-0x-contracts-d8e35c364ea94b606810b340fb02d8706e257c3c.tar.zst dexon-0x-contracts-d8e35c364ea94b606810b340fb02d8706e257c3c.zip |
Add EXPIRED test
Diffstat (limited to 'src')
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 3 | ||||
-rw-r--r-- | src/types.ts | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index e53754e07..88b0fa913 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -119,6 +119,9 @@ export class ExchangeWrapper extends ContractWrapper { if (signedOrder.taker !== constants.NULL_ADDRESS && signedOrder.taker !== senderAddress) { throw new Error(FillOrderValidationErrs.NOT_A_TAKER); } + if (signedOrder.expirationUnixTimestampSec.lessThan(Date.now() / 1000)) { + throw new Error(FillOrderValidationErrs.EXPIRED); + } } private async getExchangeInstanceOrThrowAsync(): Promise<ExchangeContract> { const contractInstance = await this.instantiateContractIfExistsAsync((ExchangeArtifacts as any)); diff --git a/src/types.ts b/src/types.ts index d6970bc0b..6d4166013 100644 --- a/src/types.ts +++ b/src/types.ts @@ -31,7 +31,7 @@ export type OrderAddresses = [string, string, string, string, string]; export type OrderValues = [ BigNumber.BigNumber, BigNumber.BigNumber, BigNumber.BigNumber, - BigNumber.BigNumber, BigNumber.BigNumber, BigNumber.BigNumber, + BigNumber.BigNumber, BigNumber.BigNumber, BigNumber.BigNumber ]; export interface ExchangeContract { @@ -82,6 +82,7 @@ export enum ExchangeContractErrs { export const FillOrderValidationErrs = strEnum([ 'FILL_AMOUNT_IS_ZERO', 'NOT_A_TAKER', + 'EXPIRED', ]); export type FillOrderValidationErrs = keyof typeof FillOrderValidationErrs; |