aboutsummaryrefslogtreecommitdiffstats
path: root/packages/asset-buyer/src/utils/order_utils.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-09-24 19:17:38 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-09-24 19:17:38 +0800
commite4b664bafa24c2ee788a343edecd0124f784780d (patch)
tree54cb57eeba44a7140c326cb17624b3839c6e73d3 /packages/asset-buyer/src/utils/order_utils.ts
parent7a5376621f2c2503c6415802984b4d8ae05db723 (diff)
downloaddexon-0x-contracts-e4b664bafa24c2ee788a343edecd0124f784780d.tar.gz
dexon-0x-contracts-e4b664bafa24c2ee788a343edecd0124f784780d.tar.zst
dexon-0x-contracts-e4b664bafa24c2ee788a343edecd0124f784780d.zip
Add expiry buffer
Diffstat (limited to 'packages/asset-buyer/src/utils/order_utils.ts')
-rw-r--r--packages/asset-buyer/src/utils/order_utils.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/asset-buyer/src/utils/order_utils.ts b/packages/asset-buyer/src/utils/order_utils.ts
index 27db73257..62166eb76 100644
--- a/packages/asset-buyer/src/utils/order_utils.ts
+++ b/packages/asset-buyer/src/utils/order_utils.ts
@@ -5,9 +5,12 @@ import { constants } from '../constants';
export const orderUtils = {
isOrderExpired(order: SignedOrder): boolean {
+ return orderUtils.willOrderExpire(order, 0);
+ },
+ willOrderExpire(order: SignedOrder, secondsFromNow: number): boolean {
const millisecondsInSecond = 1000;
const currentUnixTimestampSec = new BigNumber(Date.now() / millisecondsInSecond).round();
- return order.expirationTimeSeconds.lessThan(currentUnixTimestampSec);
+ return order.expirationTimeSeconds.lessThan(currentUnixTimestampSec.minus(secondsFromNow));
},
calculateRemainingMakerAssetAmount(order: SignedOrder, remainingTakerAssetAmount: BigNumber): BigNumber {
if (remainingTakerAssetAmount.eq(0)) {