diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-18 20:06:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-18 20:06:08 +0800 |
commit | 3973dec9944a10c62ec6c3d15d973a00a6ea45a6 (patch) | |
tree | 73f1528a36b8fc8a0778e164b1579eb5865d944a /packages/order-watcher | |
parent | bef30e4209b26c8d4f443f8672e9acb9471c6a37 (diff) | |
parent | c8212f1d4d255120e5e683664b86f1830fb45ae6 (diff) | |
download | dexon-0x-contracts-3973dec9944a10c62ec6c3d15d973a00a6ea45a6.tar.gz dexon-0x-contracts-3973dec9944a10c62ec6c3d15d973a00a6ea45a6.tar.zst dexon-0x-contracts-3973dec9944a10c62ec6c3d15d973a00a6ea45a6.zip |
Merge pull request #1517 from 0xProject/feature/bignumber-8.0
Bignumber 8.0
Diffstat (limited to 'packages/order-watcher')
-rw-r--r-- | packages/order-watcher/CHANGELOG.json | 9 | ||||
-rw-r--r-- | packages/order-watcher/package.json | 2 | ||||
-rw-r--r-- | packages/order-watcher/src/order_watcher/expiration_watcher.ts | 2 | ||||
-rw-r--r-- | packages/order-watcher/src/utils/utils.ts | 2 | ||||
-rw-r--r-- | packages/order-watcher/test/order_watcher_test.ts | 6 |
5 files changed, 15 insertions, 6 deletions
diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index 29fe4e723..585bb48e6 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "version": "3.0.0", + "changes": [ + { + "note": "Upgrade the bignumber.js to v8.0.2", + "pr": 1517 + } + ] + }, + { "timestamp": 1547747677, "version": "2.4.3", "changes": [ diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 0f2464eae..895c64813 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -49,7 +49,7 @@ "@types/sinon": "^2.2.2", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", - "chai-bignumber": "^2.0.1", + "chai-bignumber": "^3.0.0", "dirty-chai": "^2.0.1", "make-promises-safe": "^1.1.0", "mocha": "^4.1.0", diff --git a/packages/order-watcher/src/order_watcher/expiration_watcher.ts b/packages/order-watcher/src/order_watcher/expiration_watcher.ts index ad20a6e3f..82590efde 100644 --- a/packages/order-watcher/src/order_watcher/expiration_watcher.ts +++ b/packages/order-watcher/src/order_watcher/expiration_watcher.ts @@ -73,7 +73,7 @@ export class ExpirationWatcher { break; } const nextOrderHashToExpire = this._orderHashByExpirationRBTree.min(); - const hasNoExpiredOrders = this._expiration[nextOrderHashToExpire].greaterThan( + const hasNoExpiredOrders = this._expiration[nextOrderHashToExpire].isGreaterThan( currentUnixTimestampMs.plus(this._expirationMarginMs), ); const isSubscriptionActive = _.isUndefined(this._orderExpirationCheckingIntervalIdIfExists); diff --git a/packages/order-watcher/src/utils/utils.ts b/packages/order-watcher/src/utils/utils.ts index a7d10aaf9..9c3849ff1 100644 --- a/packages/order-watcher/src/utils/utils.ts +++ b/packages/order-watcher/src/utils/utils.ts @@ -3,7 +3,7 @@ import { BigNumber } from '@0x/utils'; export const utils = { getCurrentUnixTimestampSec(): BigNumber { const milisecondsInASecond = 1000; - return new BigNumber(Date.now() / milisecondsInASecond).round(); + return new BigNumber(Date.now() / milisecondsInASecond).integerValue(); }, getCurrentUnixTimestampMs(): BigNumber { return new BigNumber(Date.now()); diff --git a/packages/order-watcher/test/order_watcher_test.ts b/packages/order-watcher/test/order_watcher_test.ts index 41dc884d5..28b564b32 100644 --- a/packages/order-watcher/test/order_watcher_test.ts +++ b/packages/order-watcher/test/order_watcher_test.ts @@ -317,7 +317,7 @@ describe('OrderWatcher', () => { const validOrderState = orderState as OrderStateValid; expect(validOrderState.orderHash).to.be.equal(orderHash); const orderRelevantState = validOrderState.orderRelevantState; - const remainingMakerBalance = makerBalance.sub(fillAmountInBaseUnits); + const remainingMakerBalance = makerBalance.minus(fillAmountInBaseUnits); const remainingFillable = fillableAmount.minus(fillAmountInBaseUnits); expect(orderRelevantState.remainingFillableMakerAssetAmount).to.be.bignumber.equal( remainingFillable, @@ -434,7 +434,7 @@ describe('OrderWatcher', () => { ); const remainingAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(1), decimals); - const transferAmount = makerBalance.sub(remainingAmount); + const transferAmount = makerBalance.minus(remainingAmount); await orderWatcher.addOrderAsync(signedOrder); const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { @@ -475,7 +475,7 @@ describe('OrderWatcher', () => { const remainingFeeAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(3), decimals); const remainingTokenAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(4), decimals); - const transferTokenAmount = makerFee.sub(remainingTokenAmount); + const transferTokenAmount = makerFee.minus(remainingTokenAmount); await orderWatcher.addOrderAsync(signedOrder); const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { |