diff options
author | Fabio B <kandinsky454@protonmail.ch> | 2018-11-12 19:17:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-12 19:17:27 +0800 |
commit | c41622c20aea8ba89dc9899ff8b3ab6f22f53503 (patch) | |
tree | 684195b3da1e548ed398bee023d4581df01b3baf /packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts | |
parent | 6f612685141b7b81f9b99d849872fd29e881f096 (diff) | |
parent | 348556a54442fc93d76536735b8e8e4d76ed5ce6 (diff) | |
download | dexon-sol-tools-c41622c20aea8ba89dc9899ff8b3ab6f22f53503.tar dexon-sol-tools-c41622c20aea8ba89dc9899ff8b3ab6f22f53503.tar.gz dexon-sol-tools-c41622c20aea8ba89dc9899ff8b3ab6f22f53503.tar.bz2 dexon-sol-tools-c41622c20aea8ba89dc9899ff8b3ab6f22f53503.tar.lz dexon-sol-tools-c41622c20aea8ba89dc9899ff8b3ab6f22f53503.tar.xz dexon-sol-tools-c41622c20aea8ba89dc9899ff8b3ab6f22f53503.tar.zst dexon-sol-tools-c41622c20aea8ba89dc9899ff8b3ab6f22f53503.zip |
Merge pull request #1235 from 0xProject/fixOrderValidation
[order-utils] Fix order validation method
Diffstat (limited to 'packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts')
-rw-r--r-- | packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts b/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts index 5f5575c7b..af959e00e 100644 --- a/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts +++ b/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts @@ -1,4 +1,5 @@ -import { AbstractOrderFilledCancelledFetcher } from '@0x/order-utils'; +import { AbstractOrderFilledCancelledFetcher, orderHashUtils } from '@0x/order-utils'; +import { SignedOrder } from '@0x/types'; import { BigNumber } from '@0x/utils'; import { ExchangeWrapper } from './exchange_wrapper'; @@ -14,9 +15,15 @@ export class SimpleOrderFilledCancelledFetcher implements AbstractOrderFilledCan const filledTakerAmount = new BigNumber(await this._exchangeWrapper.getTakerAssetFilledAmountAsync(orderHash)); return filledTakerAmount; } - public async isOrderCancelledAsync(orderHash: string): Promise<boolean> { + public async isOrderCancelledAsync(signedOrder: SignedOrder): Promise<boolean> { + const orderHash = orderHashUtils.getOrderHashHex(signedOrder); const isCancelled = await this._exchangeWrapper.isCancelledAsync(orderHash); - return isCancelled; + const orderEpoch = await this._exchangeWrapper.getOrderEpochAsync( + signedOrder.makerAddress, + signedOrder.senderAddress, + ); + const isCancelledByOrderEpoch = orderEpoch > signedOrder.salt; + return isCancelled || isCancelledByOrderEpoch; } public getZRXAssetData(): string { return this._zrxAssetData; |