aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2019-01-18 20:06:08 +0800
committerGitHub <noreply@github.com>2019-01-18 20:06:08 +0800
commit3973dec9944a10c62ec6c3d15d973a00a6ea45a6 (patch)
tree73f1528a36b8fc8a0778e164b1579eb5865d944a
parentbef30e4209b26c8d4f443f8672e9acb9471c6a37 (diff)
parentc8212f1d4d255120e5e683664b86f1830fb45ae6 (diff)
downloaddexon-sol-tools-3973dec9944a10c62ec6c3d15d973a00a6ea45a6.tar
dexon-sol-tools-3973dec9944a10c62ec6c3d15d973a00a6ea45a6.tar.gz
dexon-sol-tools-3973dec9944a10c62ec6c3d15d973a00a6ea45a6.tar.bz2
dexon-sol-tools-3973dec9944a10c62ec6c3d15d973a00a6ea45a6.tar.lz
dexon-sol-tools-3973dec9944a10c62ec6c3d15d973a00a6ea45a6.tar.xz
dexon-sol-tools-3973dec9944a10c62ec6c3d15d973a00a6ea45a6.tar.zst
dexon-sol-tools-3973dec9944a10c62ec6c3d15d973a00a6ea45a6.zip
Merge pull request #1517 from 0xProject/feature/bignumber-8.0
Bignumber 8.0
-rw-r--r--contracts/examples/CHANGELOG.json9
-rw-r--r--contracts/examples/package.json2
-rw-r--r--contracts/extensions/CHANGELOG.json9
-rw-r--r--contracts/extensions/package.json2
-rw-r--r--contracts/extensions/test/extensions/balance_threshold_filter.ts120
-rw-r--r--contracts/extensions/test/utils/forwarder_wrapper.ts2
-rw-r--r--contracts/interfaces/CHANGELOG.json9
-rw-r--r--contracts/libs/CHANGELOG.json9
-rw-r--r--contracts/libs/package.json2
-rw-r--r--contracts/multisig/CHANGELOG.json9
-rw-r--r--contracts/multisig/package.json2
-rw-r--r--contracts/protocol/CHANGELOG.json9
-rw-r--r--contracts/protocol/package.json2
-rw-r--r--contracts/protocol/test/asset_proxy/proxies.ts24
-rw-r--r--contracts/protocol/test/exchange/core.ts16
-rw-r--r--contracts/protocol/test/exchange/dispatcher.ts2
-rw-r--r--contracts/protocol/test/exchange/internal.ts54
-rw-r--r--contracts/protocol/test/exchange/transactions.ts22
-rw-r--r--contracts/protocol/test/exchange/wrapper.ts154
-rw-r--r--contracts/protocol/test/utils/fill_order_combinatorial_utils.ts6
-rw-r--r--contracts/protocol/test/utils/match_order_tester.ts24
-rw-r--r--contracts/test-utils/CHANGELOG.json9
-rw-r--r--contracts/test-utils/package.json2
-rw-r--r--contracts/test-utils/src/order_factory.ts2
-rw-r--r--contracts/test-utils/src/order_utils.ts4
-rw-r--r--contracts/tokens/CHANGELOG.json9
-rw-r--r--contracts/tokens/package.json2
-rw-r--r--contracts/tokens/test/unlimited_allowance_token.ts2
-rw-r--r--contracts/tokens/test/zrx_token.ts2
-rw-r--r--contracts/utils/CHANGELOG.json9
-rw-r--r--contracts/utils/package.json2
-rw-r--r--packages/0x.js/CHANGELOG.json9
-rw-r--r--packages/0x.js/package.json2
-rw-r--r--packages/abi-gen-templates/CHANGELOG.json9
-rw-r--r--packages/abi-gen-wrappers/CHANGELOG.json9
-rw-r--r--packages/abi-gen/CHANGELOG.json9
-rw-r--r--packages/assert/CHANGELOG.json9
-rw-r--r--packages/assert/src/index.ts4
-rw-r--r--packages/asset-buyer/CHANGELOG.json9
-rw-r--r--packages/asset-buyer/package.json2
-rw-r--r--packages/asset-buyer/src/utils/buy_quote_calculator.ts12
-rw-r--r--packages/asset-buyer/src/utils/order_provider_response_processor.ts7
-rw-r--r--packages/asset-buyer/src/utils/order_utils.ts28
-rw-r--r--packages/asset-buyer/test/buy_quote_calculator_test.ts6
-rw-r--r--packages/base-contract/CHANGELOG.json9
-rw-r--r--packages/base-contract/src/index.ts4
-rw-r--r--packages/connect/CHANGELOG.json9
-rw-r--r--packages/contract-wrappers/CHANGELOG.json9
-rw-r--r--packages/contract-wrappers/package.json2
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts6
-rw-r--r--packages/contract-wrappers/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts4
-rw-r--r--packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts4
-rw-r--r--packages/contract-wrappers/src/utils/utils.ts6
-rw-r--r--packages/contract-wrappers/test/ether_token_wrapper_test.ts6
-rw-r--r--packages/dev-utils/CHANGELOG.json9
-rw-r--r--packages/ethereum-types/CHANGELOG.json9
-rw-r--r--packages/ethereum-types/package.json2
-rw-r--r--packages/fill-scenarios/CHANGELOG.json9
-rw-r--r--packages/instant/CHANGELOG.json9
-rw-r--r--packages/instant/src/components/order_details.tsx4
-rw-r--r--packages/instant/src/constants.ts2
-rw-r--r--packages/instant/src/containers/selected_erc20_asset_amount_input.ts2
-rw-r--r--packages/instant/src/redux/async_data.ts2
-rw-r--r--packages/instant/src/util/asset.ts9
-rw-r--r--packages/instant/src/util/format.ts8
-rw-r--r--packages/instant/src/util/gas_price_estimator.ts2
-rw-r--r--packages/instant/src/util/maybe_big_number.ts2
-rw-r--r--packages/json-schemas/CHANGELOG.json9
-rw-r--r--packages/metacoin/package.json2
-rw-r--r--packages/migrations/CHANGELOG.json9
-rw-r--r--packages/monorepo-scripts/CHANGELOG.json9
-rw-r--r--packages/order-utils/CHANGELOG.json9
-rw-r--r--packages/order-utils/package.json2
-rw-r--r--packages/order-utils/src/crypto.ts3
-rw-r--r--packages/order-utils/src/exchange_transfer_simulator.ts4
-rw-r--r--packages/order-utils/src/market_utils.ts4
-rw-r--r--packages/order-utils/src/order_state_utils.ts12
-rw-r--r--packages/order-utils/src/order_validation_utils.ts8
-rw-r--r--packages/order-utils/src/rate_utils.ts6
-rw-r--r--packages/order-utils/src/remaining_fillable_calculator.ts6
-rw-r--r--packages/order-utils/src/salt.ts2
-rw-r--r--packages/order-utils/src/utils.ts6
-rw-r--r--packages/order-utils/test/remaining_fillable_calculator_test.ts2
-rw-r--r--packages/order-utils/test/signature_utils_test.ts4
-rw-r--r--packages/order-watcher/CHANGELOG.json9
-rw-r--r--packages/order-watcher/package.json2
-rw-r--r--packages/order-watcher/src/order_watcher/expiration_watcher.ts2
-rw-r--r--packages/order-watcher/src/utils/utils.ts2
-rw-r--r--packages/order-watcher/test/order_watcher_test.ts6
-rw-r--r--packages/pipeline/package.json2
-rw-r--r--packages/pipeline/src/utils/transformers/number_to_bigint.ts2
-rw-r--r--packages/react-docs/CHANGELOG.json9
-rw-r--r--packages/react-shared/CHANGELOG.json9
-rw-r--r--packages/sol-compiler/CHANGELOG.json9
-rw-r--r--packages/sol-compiler/package.json2
-rw-r--r--packages/sol-coverage/CHANGELOG.json9
-rw-r--r--packages/sol-doc/CHANGELOG.json9
-rw-r--r--packages/sol-doc/package.json2
-rw-r--r--packages/sol-profiler/CHANGELOG.json9
-rw-r--r--packages/sol-resolver/CHANGELOG.json9
-rw-r--r--packages/sol-trace/CHANGELOG.json9
-rw-r--r--packages/sol-tracing-utils/CHANGELOG.json9
-rw-r--r--packages/sra-spec/CHANGELOG.json9
-rw-r--r--packages/subproviders/CHANGELOG.json9
-rw-r--r--packages/testnet-faucets/src/ts/dispense_asset_tasks.ts4
-rw-r--r--packages/testnet-faucets/src/ts/handler.ts6
-rw-r--r--packages/tslint-config/CHANGELOG.json9
-rw-r--r--packages/types/CHANGELOG.json9
-rw-r--r--packages/types/package.json2
-rw-r--r--packages/typescript-typings/CHANGELOG.json9
-rw-r--r--packages/typescript-typings/package.json2
-rw-r--r--packages/utils/CHANGELOG.json9
-rw-r--r--packages/utils/package.json4
-rw-r--r--packages/utils/src/abi_decoder.ts2
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/bool.ts4
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/int.ts4
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/uint.ts2
-rw-r--r--packages/utils/src/abi_encoder/utils/math.ts12
-rw-r--r--packages/utils/src/sign_typed_data_utils.ts5
-rw-r--r--packages/utils/test/abi_encoder/evm_data_types_test.ts2
-rw-r--r--packages/web3-wrapper/CHANGELOG.json9
-rw-r--r--packages/web3-wrapper/package.json2
-rw-r--r--packages/web3-wrapper/src/utils.ts8
-rw-r--r--packages/web3-wrapper/test/web3_wrapper_test.ts6
-rw-r--r--packages/website/ts/blockchain.ts2
-rw-r--r--packages/website/ts/components/fill_order.tsx4
-rw-r--r--packages/website/ts/utils/utils.ts2
-rw-r--r--yarn.lock10
128 files changed, 763 insertions, 364 deletions
diff --git a/contracts/examples/CHANGELOG.json b/contracts/examples/CHANGELOG.json
index 6adebc471..724ab1e4a 100644
--- a/contracts/examples/CHANGELOG.json
+++ b/contracts/examples/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547747677,
"version": "1.0.6",
"changes": [
diff --git a/contracts/examples/package.json b/contracts/examples/package.json
index e95017eb1..845ea0636 100644
--- a/contracts/examples/package.json
+++ b/contracts/examples/package.json
@@ -45,7 +45,7 @@
"@types/yargs": "^10.0.0",
"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",
"ethereumjs-abi": "0.6.5",
"make-promises-safe": "^1.1.0",
diff --git a/contracts/extensions/CHANGELOG.json b/contracts/extensions/CHANGELOG.json
index 0accc3475..920fef05a 100644
--- a/contracts/extensions/CHANGELOG.json
+++ b/contracts/extensions/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547747677,
"version": "1.2.3",
"changes": [
diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json
index a67b7645b..14492af8f 100644
--- a/contracts/extensions/package.json
+++ b/contracts/extensions/package.json
@@ -57,7 +57,7 @@
"@types/yargs": "^10.0.0",
"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",
"ethereumjs-abi": "0.6.5",
"make-promises-safe": "^1.1.0",
diff --git a/contracts/extensions/test/extensions/balance_threshold_filter.ts b/contracts/extensions/test/extensions/balance_threshold_filter.ts
index a1c322e08..adeb7c422 100644
--- a/contracts/extensions/test/extensions/balance_threshold_filter.ts
+++ b/contracts/extensions/test/extensions/balance_threshold_filter.ts
@@ -269,7 +269,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress][zrxToken.address].minus(makerFeePaid),
@@ -278,13 +278,13 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
);
expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
);
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFeePaid.plus(takerFeePaid)),
);
});
it('should revert if the Exchange transaction function is not supported', async () => {
@@ -357,7 +357,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress][zrxToken.address].minus(makerFeePaid),
@@ -367,7 +367,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress2][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
expect(newBalances[validMakerAddress2][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress2][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[validMakerAddress2][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[validMakerAddress2][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress2][zrxToken.address].minus(makerFeePaid),
@@ -378,14 +378,14 @@ describe(ContractName.BalanceThresholdFilter, () => {
);
expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount.times(2)),
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount.times(2)),
);
expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
);
// Fee recipient
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.times(2).add(takerFeePaid)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFeePaid.times(2).plus(takerFeePaid)),
);
});
it('should revert if one maker does not meet the balance threshold', async () => {
@@ -461,7 +461,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress][zrxToken.address].minus(makerFeePaid),
@@ -471,7 +471,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress2][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
expect(newBalances[validMakerAddress2][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress2][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[validMakerAddress2][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[validMakerAddress2][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress2][zrxToken.address].minus(makerFeePaid),
@@ -482,14 +482,14 @@ describe(ContractName.BalanceThresholdFilter, () => {
);
expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount.times(2)),
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount.times(2)),
);
expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
);
// Fee recipient
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.times(2).add(takerFeePaid)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFeePaid.times(2).plus(takerFeePaid)),
);
});
it('should revert if one maker does not meet the balance threshold', async () => {
@@ -559,7 +559,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress][zrxToken.address].minus(makerFeePaid),
@@ -569,7 +569,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress2][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
expect(newBalances[validMakerAddress2][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress2][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[validMakerAddress2][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[validMakerAddress2][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress2][zrxToken.address].minus(makerFeePaid),
@@ -580,14 +580,14 @@ describe(ContractName.BalanceThresholdFilter, () => {
);
expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount.times(2)),
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount.times(2)),
);
expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
);
// Fee recipient
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.times(2).add(takerFeePaid)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFeePaid.times(2).plus(takerFeePaid)),
);
});
it('should revert if one maker does not meet the balance threshold', async () => {
@@ -658,7 +658,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress][zrxToken.address].minus(makerFeePaid),
@@ -667,13 +667,13 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
);
expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
);
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFeePaid.plus(takerFeePaid)),
);
});
it('should revert if maker does not meet the balance threshold', async () => {
@@ -736,7 +736,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress][zrxToken.address].minus(makerFeePaid),
@@ -745,13 +745,13 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
);
expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
);
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFeePaid.plus(takerFeePaid)),
);
});
it('should revert if maker does not meet the balance threshold', async () => {
@@ -811,7 +811,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount_),
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].plus(takerAssetFillAmount_),
);
expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress][zrxToken.address].minus(makerFeePaid),
@@ -820,13 +820,13 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount_),
);
expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
);
expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
);
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFeePaid.plus(takerFeePaid)),
);
});
it('should revert if maker does not meet the balance threshold', async () => {
@@ -904,7 +904,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(validSignedOrder.makerAssetAmount),
);
expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(validSignedOrder.takerAssetAmount),
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].plus(validSignedOrder.takerAssetAmount),
);
expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress][zrxToken.address].minus(validSignedOrder.makerFee),
@@ -914,7 +914,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress2][defaultMakerAssetAddress].minus(makerAssetFillAmount2),
);
expect(newBalances[validMakerAddress2][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress2][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[validMakerAddress2][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[validMakerAddress2][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress2][zrxToken.address].minus(makerFeePaid2),
@@ -924,7 +924,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(cumulativeTakerAssetFillAmount),
);
expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(cumulativeMakerAssetFillAmount),
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].plus(cumulativeMakerAssetFillAmount),
);
expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
@@ -932,9 +932,9 @@ describe(ContractName.BalanceThresholdFilter, () => {
// Fee recipient
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[feeRecipientAddress][zrxToken.address]
- .add(validSignedOrder.makerFee)
- .add(makerFeePaid2)
- .add(takerFeePaid),
+ .plus(validSignedOrder.makerFee)
+ .plus(makerFeePaid2)
+ .plus(takerFeePaid),
);
});
it('should revert if one maker does not meet the balance threshold', async () => {
@@ -1008,7 +1008,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(validSignedOrder.makerAssetAmount),
);
expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(validSignedOrder.takerAssetAmount),
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].plus(validSignedOrder.takerAssetAmount),
);
expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress][zrxToken.address].minus(validSignedOrder.makerFee),
@@ -1018,7 +1018,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress2][defaultMakerAssetAddress].minus(makerAssetFillAmount2),
);
expect(newBalances[validMakerAddress2][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress2][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[validMakerAddress2][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[validMakerAddress2][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress2][zrxToken.address].minus(makerFeePaid2),
@@ -1028,7 +1028,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(cumulativeTakerAssetFillAmount),
);
expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(cumulativeMakerAssetFillAmount),
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].plus(cumulativeMakerAssetFillAmount),
);
expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
@@ -1036,9 +1036,9 @@ describe(ContractName.BalanceThresholdFilter, () => {
// Fee recipient
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[feeRecipientAddress][zrxToken.address]
- .add(validSignedOrder.makerFee)
- .add(makerFeePaid2)
- .add(takerFeePaid),
+ .plus(validSignedOrder.makerFee)
+ .plus(makerFeePaid2)
+ .plus(takerFeePaid),
);
});
it('should revert if one maker does not meet the balance threshold', async () => {
@@ -1104,7 +1104,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(validSignedOrder.makerAssetAmount),
);
expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(validSignedOrder.takerAssetAmount),
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].plus(validSignedOrder.takerAssetAmount),
);
expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress][zrxToken.address].minus(validSignedOrder.makerFee),
@@ -1114,7 +1114,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress2][defaultMakerAssetAddress].minus(makerAssetFillAmount2),
);
expect(newBalances[validMakerAddress2][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress2][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[validMakerAddress2][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[validMakerAddress2][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress2][zrxToken.address].minus(makerFeePaid2),
@@ -1124,7 +1124,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(cumulativeTakerAssetFillAmount),
);
expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(cumulativeMakerAssetFillAmount),
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].plus(cumulativeMakerAssetFillAmount),
);
expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
@@ -1132,9 +1132,9 @@ describe(ContractName.BalanceThresholdFilter, () => {
// Fee recipient
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[feeRecipientAddress][zrxToken.address]
- .add(validSignedOrder.makerFee)
- .add(makerFeePaid2)
- .add(takerFeePaid),
+ .plus(validSignedOrder.makerFee)
+ .plus(makerFeePaid2)
+ .plus(takerFeePaid),
);
});
it('should revert if one maker does not meet the balance threshold', async () => {
@@ -1210,7 +1210,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(validSignedOrder.makerAssetAmount),
);
expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(validSignedOrder.takerAssetAmount),
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].plus(validSignedOrder.takerAssetAmount),
);
expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress][zrxToken.address].minus(validSignedOrder.makerFee),
@@ -1220,7 +1220,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validMakerAddress2][defaultMakerAssetAddress].minus(makerAssetFillAmount2),
);
expect(newBalances[validMakerAddress2][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validMakerAddress2][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[validMakerAddress2][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[validMakerAddress2][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validMakerAddress2][zrxToken.address].minus(makerFeePaid2),
@@ -1230,7 +1230,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(cumulativeTakerAssetFillAmount),
);
expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(cumulativeMakerAssetFillAmount),
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].plus(cumulativeMakerAssetFillAmount),
);
expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
@@ -1238,9 +1238,9 @@ describe(ContractName.BalanceThresholdFilter, () => {
// Fee recipient
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[feeRecipientAddress][zrxToken.address]
- .add(validSignedOrder.makerFee)
- .add(makerFeePaid2)
- .add(takerFeePaid),
+ .plus(validSignedOrder.makerFee)
+ .plus(makerFeePaid2)
+ .plus(takerFeePaid),
);
});
it('should revert if one maker does not meet the balance threshold', async () => {
@@ -1329,7 +1329,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
newBalances[signedOrderLeft.makerAddress][defaultMakerAssetAddress],
'Checking left maker egress ERC20 account balance',
).to.be.bignumber.equal(
- erc20Balances[signedOrderLeft.makerAddress][defaultMakerAssetAddress].sub(
+ erc20Balances[signedOrderLeft.makerAddress][defaultMakerAssetAddress].minus(
expectedTransferAmounts.amountSoldByLeftMaker,
),
);
@@ -1337,7 +1337,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
newBalances[signedOrderRight.makerAddress][defaultTakerAssetAddress],
'Checking right maker ingress ERC20 account balance',
).to.be.bignumber.equal(
- erc20Balances[signedOrderRight.makerAddress][defaultTakerAssetAddress].sub(
+ erc20Balances[signedOrderRight.makerAddress][defaultTakerAssetAddress].minus(
expectedTransferAmounts.amountSoldByRightMaker,
),
);
@@ -1345,7 +1345,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
newBalances[validTakerAddress][defaultMakerAssetAddress],
'Checking taker ingress ERC20 account balance',
).to.be.bignumber.equal(
- erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].plus(
expectedTransferAmounts.amountReceivedByTaker,
),
);
@@ -1353,7 +1353,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
newBalances[signedOrderLeft.makerAddress][defaultTakerAssetAddress],
'Checking left maker ingress ERC20 account balance',
).to.be.bignumber.equal(
- erc20Balances[signedOrderLeft.makerAddress][defaultTakerAssetAddress].add(
+ erc20Balances[signedOrderLeft.makerAddress][defaultTakerAssetAddress].plus(
expectedTransferAmounts.amountBoughtByLeftMaker,
),
);
@@ -1361,7 +1361,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
newBalances[signedOrderRight.makerAddress][defaultMakerAssetAddress],
'Checking right maker egress ERC20 account balance',
).to.be.bignumber.equal(
- erc20Balances[signedOrderRight.makerAddress][defaultMakerAssetAddress].add(
+ erc20Balances[signedOrderRight.makerAddress][defaultMakerAssetAddress].plus(
expectedTransferAmounts.amountBoughtByRightMaker,
),
);
@@ -1388,7 +1388,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
).to.be.bignumber.equal(
erc20Balances[validTakerAddress][zrxToken.address]
.minus(expectedTransferAmounts.feePaidByTakerLeft)
- .sub(expectedTransferAmounts.feePaidByTakerRight),
+ .minus(expectedTransferAmounts.feePaidByTakerRight),
);
// Received fees
expect(
@@ -1396,10 +1396,10 @@ describe(ContractName.BalanceThresholdFilter, () => {
'Checking left fee recipient ingress ERC20 account fees',
).to.be.bignumber.equal(
erc20Balances[feeRecipientAddress][zrxToken.address]
- .add(expectedTransferAmounts.feePaidByLeftMaker)
- .add(expectedTransferAmounts.feePaidByRightMaker)
- .add(expectedTransferAmounts.feePaidByTakerLeft)
- .add(expectedTransferAmounts.feePaidByTakerRight),
+ .plus(expectedTransferAmounts.feePaidByLeftMaker)
+ .plus(expectedTransferAmounts.feePaidByRightMaker)
+ .plus(expectedTransferAmounts.feePaidByTakerLeft)
+ .plus(expectedTransferAmounts.feePaidByTakerRight),
);
});
it('should revert if left maker does not meet the balance threshold', async () => {
@@ -1595,7 +1595,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
signedOrder,
);
const saltAsBigNumber = new BigNumber(salt);
- if (saltAsBigNumber.lessThanOrEqualTo(cancelOrdersUpToThisSalt)) {
+ if (saltAsBigNumber.isLessThanOrEqualTo(cancelOrdersUpToThisSalt)) {
return expect(orderInfoAfterCancelling.orderStatus).to.be.equal(OrderStatus.Cancelled);
} else {
return expect(orderInfoAfterCancelling.orderStatus).to.be.equal(OrderStatus.Fillable);
@@ -1631,7 +1631,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
signedOrder,
);
const saltAsBigNumber = new BigNumber(salt);
- if (saltAsBigNumber.lessThanOrEqualTo(cancelOrdersUpToThisSalt)) {
+ if (saltAsBigNumber.isLessThanOrEqualTo(cancelOrdersUpToThisSalt)) {
return expect(orderInfoAfterCancelling.orderStatus).to.be.equal(OrderStatus.Cancelled);
} else {
return expect(orderInfoAfterCancelling.orderStatus).to.be.equal(OrderStatus.Fillable);
diff --git a/contracts/extensions/test/utils/forwarder_wrapper.ts b/contracts/extensions/test/utils/forwarder_wrapper.ts
index 9e44ff6b9..4a43be04a 100644
--- a/contracts/extensions/test/utils/forwarder_wrapper.ts
+++ b/contracts/extensions/test/utils/forwarder_wrapper.ts
@@ -29,7 +29,7 @@ export class ForwarderWrapper {
feeOrder.takerAssetAmount
.times(remainingFeeAmount)
.dividedBy(feeAvailable)
- .ceil(),
+ .integerValue(BigNumber.ROUND_CEIL),
);
remainingFeeAmount = new BigNumber(0);
} else if (!remainingFeeAmount.isZero()) {
diff --git a/contracts/interfaces/CHANGELOG.json b/contracts/interfaces/CHANGELOG.json
index 6adebc471..724ab1e4a 100644
--- a/contracts/interfaces/CHANGELOG.json
+++ b/contracts/interfaces/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547747677,
"version": "1.0.6",
"changes": [
diff --git a/contracts/libs/CHANGELOG.json b/contracts/libs/CHANGELOG.json
index 6adebc471..724ab1e4a 100644
--- a/contracts/libs/CHANGELOG.json
+++ b/contracts/libs/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547747677,
"version": "1.0.6",
"changes": [
diff --git a/contracts/libs/package.json b/contracts/libs/package.json
index 2429c8aed..b28ec3774 100644
--- a/contracts/libs/package.json
+++ b/contracts/libs/package.json
@@ -56,7 +56,7 @@
"@types/yargs": "^10.0.0",
"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",
"ethereumjs-abi": "0.6.5",
"make-promises-safe": "^1.1.0",
diff --git a/contracts/multisig/CHANGELOG.json b/contracts/multisig/CHANGELOG.json
index 6adebc471..724ab1e4a 100644
--- a/contracts/multisig/CHANGELOG.json
+++ b/contracts/multisig/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547747677,
"version": "1.0.6",
"changes": [
diff --git a/contracts/multisig/package.json b/contracts/multisig/package.json
index 683bb85d4..1c3911cbc 100644
--- a/contracts/multisig/package.json
+++ b/contracts/multisig/package.json
@@ -57,7 +57,7 @@
"@types/yargs": "^10.0.0",
"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/contracts/protocol/CHANGELOG.json b/contracts/protocol/CHANGELOG.json
index f7401039a..0d513cc17 100644
--- a/contracts/protocol/CHANGELOG.json
+++ b/contracts/protocol/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.2.3",
"changes": [
diff --git a/contracts/protocol/package.json b/contracts/protocol/package.json
index 87ee10e92..d1ef70a70 100644
--- a/contracts/protocol/package.json
+++ b/contracts/protocol/package.json
@@ -55,7 +55,7 @@
"@types/yargs": "^10.0.0",
"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",
"ethereumjs-abi": "0.6.5",
"make-promises-safe": "^1.1.0",
diff --git a/contracts/protocol/test/asset_proxy/proxies.ts b/contracts/protocol/test/asset_proxy/proxies.ts
index bbb44f402..c34be9c6a 100644
--- a/contracts/protocol/test/asset_proxy/proxies.ts
+++ b/contracts/protocol/test/asset_proxy/proxies.ts
@@ -259,7 +259,7 @@ describe('Asset Transfer Proxies', () => {
erc20Balances[fromAddress][erc20TokenA.address].minus(amount),
);
expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
- erc20Balances[toAddress][erc20TokenA.address].add(amount),
+ erc20Balances[toAddress][erc20TokenA.address].plus(amount),
);
});
@@ -318,7 +318,7 @@ describe('Asset Transfer Proxies', () => {
erc20Balances[fromAddress][erc20TokenA.address].minus(amount),
);
expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
- erc20Balances[toAddress][erc20TokenA.address].add(amount),
+ erc20Balances[toAddress][erc20TokenA.address].plus(amount),
);
});
@@ -737,7 +737,7 @@ describe('Asset Transfer Proxies', () => {
erc20Balances[fromAddress][erc20TokenA.address].minus(totalAmount),
);
expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
- erc20Balances[toAddress][erc20TokenA.address].add(totalAmount),
+ erc20Balances[toAddress][erc20TokenA.address].plus(totalAmount),
);
});
it('should dispatch an ERC20 transfer when input amount is 0', async () => {
@@ -800,7 +800,7 @@ describe('Asset Transfer Proxies', () => {
erc20Balances[fromAddress][erc20TokenA.address].minus(totalAmount),
);
expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
- erc20Balances[toAddress][erc20TokenA.address].add(totalAmount),
+ erc20Balances[toAddress][erc20TokenA.address].plus(totalAmount),
);
});
it('should successfully transfer multiple different ERC20 tokens', async () => {
@@ -834,13 +834,13 @@ describe('Asset Transfer Proxies', () => {
erc20Balances[fromAddress][erc20TokenA.address].minus(totalErc20AAmount),
);
expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
- erc20Balances[toAddress][erc20TokenA.address].add(totalErc20AAmount),
+ erc20Balances[toAddress][erc20TokenA.address].plus(totalErc20AAmount),
);
expect(newBalances[fromAddress][erc20TokenB.address]).to.be.bignumber.equal(
erc20Balances[fromAddress][erc20TokenB.address].minus(totalErc20BAmount),
);
expect(newBalances[toAddress][erc20TokenB.address]).to.be.bignumber.equal(
- erc20Balances[toAddress][erc20TokenB.address].add(totalErc20BAmount),
+ erc20Balances[toAddress][erc20TokenB.address].plus(totalErc20BAmount),
);
});
it('should transfer a single ERC721 token', async () => {
@@ -970,7 +970,7 @@ describe('Asset Transfer Proxies', () => {
erc20Balances[fromAddress][erc20TokenA.address].minus(totalAmount),
);
expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
- erc20Balances[toAddress][erc20TokenA.address].add(totalAmount),
+ erc20Balances[toAddress][erc20TokenA.address].plus(totalAmount),
);
const newOwnerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
expect(newOwnerFromAsset).to.be.equal(toAddress);
@@ -1008,7 +1008,7 @@ describe('Asset Transfer Proxies', () => {
erc20Balances[fromAddress][erc20TokenA.address].minus(totalAmount),
);
expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
- erc20Balances[toAddress][erc20TokenA.address].add(totalAmount),
+ erc20Balances[toAddress][erc20TokenA.address].plus(totalAmount),
);
const newOwnerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
expect(newOwnerFromAsset).to.be.equal(toAddress);
@@ -1044,13 +1044,13 @@ describe('Asset Transfer Proxies', () => {
erc20Balances[fromAddress][erc20TokenA.address].minus(totalErc20AAmount),
);
expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
- erc20Balances[toAddress][erc20TokenA.address].add(totalErc20AAmount),
+ erc20Balances[toAddress][erc20TokenA.address].plus(totalErc20AAmount),
);
expect(newBalances[fromAddress][erc20TokenB.address]).to.be.bignumber.equal(
erc20Balances[fromAddress][erc20TokenB.address].minus(totalErc20BAmount),
);
expect(newBalances[toAddress][erc20TokenB.address]).to.be.bignumber.equal(
- erc20Balances[toAddress][erc20TokenB.address].add(totalErc20BAmount),
+ erc20Balances[toAddress][erc20TokenB.address].plus(totalErc20BAmount),
);
});
it('should successfully transfer a large amount of tokens', async () => {
@@ -1122,13 +1122,13 @@ describe('Asset Transfer Proxies', () => {
erc20Balances[fromAddress][erc20TokenA.address].minus(totalErc20AAmount),
);
expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
- erc20Balances[toAddress][erc20TokenA.address].add(totalErc20AAmount),
+ erc20Balances[toAddress][erc20TokenA.address].plus(totalErc20AAmount),
);
expect(newBalances[fromAddress][erc20TokenB.address]).to.be.bignumber.equal(
erc20Balances[fromAddress][erc20TokenB.address].minus(totalErc20BAmount),
);
expect(newBalances[toAddress][erc20TokenB.address]).to.be.bignumber.equal(
- erc20Balances[toAddress][erc20TokenB.address].add(totalErc20BAmount),
+ erc20Balances[toAddress][erc20TokenB.address].plus(totalErc20BAmount),
);
});
it('should revert if a single transfer fails', async () => {
diff --git a/contracts/protocol/test/exchange/core.ts b/contracts/protocol/test/exchange/core.ts
index 700643b79..f88be1c94 100644
--- a/contracts/protocol/test/exchange/core.ts
+++ b/contracts/protocol/test/exchange/core.ts
@@ -538,7 +538,7 @@ describe('Exchange core', () => {
it('should throw if order is expired', async () => {
const currentTimestamp = await getLatestBlockTimestampAsync();
signedOrder = await orderFactory.newSignedOrderAsync({
- expirationTimeSeconds: new BigNumber(currentTimestamp).sub(10),
+ expirationTimeSeconds: new BigNumber(currentTimestamp).minus(10),
});
return expectTransactionFailedAsync(
exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
@@ -625,15 +625,15 @@ describe('Exchange core', () => {
});
const newBalances = await erc20Wrapper.getBalancesAsync();
- const fillMakerAssetAmount = signedOrders[2].makerAssetAmount.add(signedOrders[3].makerAssetAmount);
- const fillTakerAssetAmount = signedOrders[2].takerAssetAmount.add(signedOrders[3].takerAssetAmount);
- const makerFee = signedOrders[2].makerFee.add(signedOrders[3].makerFee);
- const takerFee = signedOrders[2].takerFee.add(signedOrders[3].takerFee);
+ const fillMakerAssetAmount = signedOrders[2].makerAssetAmount.plus(signedOrders[3].makerAssetAmount);
+ const fillTakerAssetAmount = signedOrders[2].takerAssetAmount.plus(signedOrders[3].takerAssetAmount);
+ const makerFee = signedOrders[2].makerFee.plus(signedOrders[3].makerFee);
+ const takerFee = signedOrders[2].takerFee.plus(signedOrders[3].takerFee);
expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[makerAddress][defaultMakerAssetAddress].minus(fillMakerAssetAmount),
);
expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerAssetAddress].add(fillTakerAssetAmount),
+ erc20Balances[makerAddress][defaultTakerAssetAddress].plus(fillTakerAssetAmount),
);
expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
@@ -642,13 +642,13 @@ describe('Exchange core', () => {
erc20Balances[takerAddress][defaultTakerAssetAddress].minus(fillTakerAssetAmount),
);
expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].add(fillMakerAssetAmount),
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(fillMakerAssetAmount),
);
expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
);
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFee.plus(takerFee)),
);
});
});
diff --git a/contracts/protocol/test/exchange/dispatcher.ts b/contracts/protocol/test/exchange/dispatcher.ts
index 5b1ac1e20..eca1b38f1 100644
--- a/contracts/protocol/test/exchange/dispatcher.ts
+++ b/contracts/protocol/test/exchange/dispatcher.ts
@@ -205,7 +205,7 @@ describe('AssetProxyDispatcher', () => {
erc20Balances[makerAddress][zrxToken.address].minus(amount),
);
expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].add(amount),
+ erc20Balances[takerAddress][zrxToken.address].plus(amount),
);
});
diff --git a/contracts/protocol/test/exchange/internal.ts b/contracts/protocol/test/exchange/internal.ts
index 972f5efb6..6ff1fdc2f 100644
--- a/contracts/protocol/test/exchange/internal.ts
+++ b/contracts/protocol/test/exchange/internal.ts
@@ -90,14 +90,14 @@ describe('Exchange core internal functions', () => {
if (target.eq(0)) {
return false;
}
- const product = numerator.mul(target);
+ const product = numerator.multipliedBy(target);
const remainder = product.mod(denominator);
- const remainderTimes1000 = remainder.mul('1000');
+ const remainderTimes1000 = remainder.multipliedBy('1000');
const isError = remainderTimes1000.gte(product);
- if (product.greaterThan(MAX_UINT256)) {
+ if (product.isGreaterThan(MAX_UINT256)) {
throw overflowErrorForCall;
}
- if (remainderTimes1000.greaterThan(MAX_UINT256)) {
+ if (remainderTimes1000.isGreaterThan(MAX_UINT256)) {
throw overflowErrorForCall;
}
return isError;
@@ -117,15 +117,15 @@ describe('Exchange core internal functions', () => {
if (target.eq(0)) {
return false;
}
- const product = numerator.mul(target);
+ const product = numerator.multipliedBy(target);
const remainder = product.mod(denominator);
- const error = denominator.sub(remainder).mod(denominator);
- const errorTimes1000 = error.mul('1000');
+ const error = denominator.minus(remainder).mod(denominator);
+ const errorTimes1000 = error.multipliedBy('1000');
const isError = errorTimes1000.gte(product);
- if (product.greaterThan(MAX_UINT256)) {
+ if (product.isGreaterThan(MAX_UINT256)) {
throw overflowErrorForCall;
}
- if (errorTimes1000.greaterThan(MAX_UINT256)) {
+ if (errorTimes1000.isGreaterThan(MAX_UINT256)) {
throw overflowErrorForCall;
}
return isError;
@@ -143,8 +143,8 @@ describe('Exchange core internal functions', () => {
if (isRoundingError) {
throw roundingErrorForCall;
}
- const product = numerator.mul(target);
- if (product.greaterThan(MAX_UINT256)) {
+ const product = numerator.multipliedBy(target);
+ if (product.isGreaterThan(MAX_UINT256)) {
throw overflowErrorForCall;
}
return product.dividedToIntegerBy(denominator);
@@ -177,8 +177,8 @@ describe('Exchange core internal functions', () => {
_.cloneDeep(totalFillResults),
singleFillResults,
(totalVal: BigNumber, singleVal: BigNumber) => {
- const newTotal = totalVal.add(singleVal);
- if (newTotal.greaterThan(MAX_UINT256)) {
+ const newTotal = totalVal.plus(singleVal);
+ if (newTotal.isGreaterThan(MAX_UINT256)) {
throw overflowErrorForCall;
}
return newTotal;
@@ -271,8 +271,8 @@ describe('Exchange core internal functions', () => {
if (denominator.eq(0)) {
throw divisionByZeroErrorForCall;
}
- const product = numerator.mul(target);
- if (product.greaterThan(MAX_UINT256)) {
+ const product = numerator.multipliedBy(target);
+ if (product.isGreaterThan(MAX_UINT256)) {
throw overflowErrorForCall;
}
return product.dividedToIntegerBy(denominator);
@@ -301,16 +301,16 @@ describe('Exchange core internal functions', () => {
if (denominator.eq(0)) {
throw divisionByZeroErrorForCall;
}
- const product = numerator.mul(target);
- const offset = product.add(denominator.sub(1));
- if (offset.greaterThan(MAX_UINT256)) {
+ const product = numerator.multipliedBy(target);
+ const offset = product.plus(denominator.minus(1));
+ if (offset.isGreaterThan(MAX_UINT256)) {
throw overflowErrorForCall;
}
const result = offset.dividedToIntegerBy(denominator);
if (product.mod(denominator).eq(0)) {
- expect(result.mul(denominator)).to.be.bignumber.eq(product);
+ expect(result.multipliedBy(denominator)).to.be.bignumber.eq(product);
} else {
- expect(result.mul(denominator)).to.be.bignumber.gt(product);
+ expect(result.multipliedBy(denominator)).to.be.bignumber.gt(product);
}
return result;
}
@@ -358,16 +358,16 @@ describe('Exchange core internal functions', () => {
if (isRoundingError) {
throw roundingErrorForCall;
}
- const product = numerator.mul(target);
- const offset = product.add(denominator.sub(1));
- if (offset.greaterThan(MAX_UINT256)) {
+ const product = numerator.multipliedBy(target);
+ const offset = product.plus(denominator.minus(1));
+ if (offset.isGreaterThan(MAX_UINT256)) {
throw overflowErrorForCall;
}
const result = offset.dividedToIntegerBy(denominator);
if (product.mod(denominator).eq(0)) {
- expect(result.mul(denominator)).to.be.bignumber.eq(product);
+ expect(result.multipliedBy(denominator)).to.be.bignumber.eq(product);
} else {
- expect(result.mul(denominator)).to.be.bignumber.gt(product);
+ expect(result.multipliedBy(denominator)).to.be.bignumber.gt(product);
}
return result;
}
@@ -433,8 +433,8 @@ describe('Exchange core internal functions', () => {
// tslint:disable-next-line:no-unused-variable
orderHash: string,
): Promise<BigNumber> {
- const totalFilledAmount = takerAssetFilledAmount.add(orderTakerAssetFilledAmount);
- if (totalFilledAmount.greaterThan(MAX_UINT256)) {
+ const totalFilledAmount = takerAssetFilledAmount.plus(orderTakerAssetFilledAmount);
+ if (totalFilledAmount.isGreaterThan(MAX_UINT256)) {
throw overflowErrorForSendTransaction;
}
return totalFilledAmount;
diff --git a/contracts/protocol/test/exchange/transactions.ts b/contracts/protocol/test/exchange/transactions.ts
index 746f3cb04..e8c775f3e 100644
--- a/contracts/protocol/test/exchange/transactions.ts
+++ b/contracts/protocol/test/exchange/transactions.ts
@@ -160,7 +160,7 @@ describe('Exchange transactions', () => {
erc20Balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFillAmount),
);
expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
+ erc20Balances[makerAddress][defaultTakerTokenAddress].plus(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[makerAddress][zrxToken.address].minus(makerFeePaid),
@@ -169,13 +169,13 @@ describe('Exchange transactions', () => {
erc20Balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
);
expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFillAmount),
+ erc20Balances[takerAddress][defaultMakerTokenAddress].plus(makerAssetFillAmount),
);
expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[takerAddress][zrxToken.address].minus(takerFeePaid),
);
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFeePaid.plus(takerFeePaid)),
);
});
@@ -234,7 +234,7 @@ describe('Exchange transactions', () => {
senderAddress: exchangeWrapperContract.address,
salt: orderSalt,
});
- const targetOrderEpoch = orderSalt.add(1);
+ const targetOrderEpoch = orderSalt.plus(1);
const cancelData = exchange.cancelOrdersUpTo.getABIEncodedTransactionData(targetOrderEpoch);
const signedCancelTx = makerTransactionFactory.newSignedTransaction(cancelData);
await exchangeWrapperContract.cancelOrdersUpTo.sendTransactionAsync(
@@ -273,7 +273,7 @@ describe('Exchange transactions', () => {
senderAddress: exchangeWrapperContract.address,
salt: orderSalt,
});
- const targetOrderEpoch = orderSalt.add(1);
+ const targetOrderEpoch = orderSalt.plus(1);
await exchangeWrapper.cancelOrdersUpToAsync(targetOrderEpoch, makerAddress);
erc20Balances = await erc20Wrapper.getBalancesAsync();
@@ -308,7 +308,7 @@ describe('Exchange transactions', () => {
erc20Balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFillAmount),
);
expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
+ erc20Balances[makerAddress][defaultTakerTokenAddress].plus(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[makerAddress][zrxToken.address].minus(makerFeePaid),
@@ -317,13 +317,13 @@ describe('Exchange transactions', () => {
erc20Balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
);
expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFillAmount),
+ erc20Balances[takerAddress][defaultMakerTokenAddress].plus(makerAssetFillAmount),
);
expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[takerAddress][zrxToken.address].minus(takerFeePaid),
);
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFeePaid.plus(takerFeePaid)),
);
});
});
@@ -444,7 +444,7 @@ describe('Exchange transactions', () => {
erc20Balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFillAmount),
);
expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
+ erc20Balances[makerAddress][defaultTakerTokenAddress].plus(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[makerAddress][zrxToken.address].minus(makerFeePaid),
@@ -453,13 +453,13 @@ describe('Exchange transactions', () => {
erc20Balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
);
expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFillAmount),
+ erc20Balances[takerAddress][defaultMakerTokenAddress].plus(makerAssetFillAmount),
);
expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[takerAddress][zrxToken.address].minus(takerFeePaid),
);
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFeePaid.plus(takerFeePaid)),
);
});
});
diff --git a/contracts/protocol/test/exchange/wrapper.ts b/contracts/protocol/test/exchange/wrapper.ts
index 4c4506945..49ba5a2e5 100644
--- a/contracts/protocol/test/exchange/wrapper.ts
+++ b/contracts/protocol/test/exchange/wrapper.ts
@@ -189,7 +189,7 @@ describe('Exchange wrappers', () => {
erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[makerAddress][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
@@ -198,20 +198,20 @@ describe('Exchange wrappers', () => {
erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
);
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFee.plus(takerFee)),
);
});
it('should throw if a signedOrder is expired', async () => {
const currentTimestamp = await getLatestBlockTimestampAsync();
const signedOrder = await orderFactory.newSignedOrderAsync({
- expirationTimeSeconds: new BigNumber(currentTimestamp).sub(10),
+ expirationTimeSeconds: new BigNumber(currentTimestamp).minus(10),
});
return expectTransactionFailedAsync(
@@ -284,7 +284,7 @@ describe('Exchange wrappers', () => {
erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[makerAddress][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
@@ -293,13 +293,13 @@ describe('Exchange wrappers', () => {
erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
);
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFee.plus(takerFee)),
);
});
@@ -493,15 +493,15 @@ describe('Exchange wrappers', () => {
erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][
makerAssetAddress
].minus(makerAssetFilledAmount);
- erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
- takerAssetFillAmount,
- );
+ erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][
+ takerAssetAddress
+ ].plus(takerAssetFillAmount);
erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
makerFee,
);
- erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
- makerAssetFilledAmount,
- );
+ erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][
+ makerAssetAddress
+ ].plus(makerAssetFilledAmount);
erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
takerAssetAddress
].minus(takerAssetFillAmount);
@@ -510,7 +510,7 @@ describe('Exchange wrappers', () => {
);
erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
zrxToken.address
- ].add(makerFee.add(takerFee));
+ ].plus(makerFee.plus(takerFee));
});
await exchangeWrapper.batchFillOrdersAsync(signedOrders, takerAddress, {
@@ -562,15 +562,15 @@ describe('Exchange wrappers', () => {
erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][
makerAssetAddress
].minus(makerAssetFilledAmount);
- erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
- takerAssetFillAmount,
- );
+ erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][
+ takerAssetAddress
+ ].plus(takerAssetFillAmount);
erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
makerFee,
);
- erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
- makerAssetFilledAmount,
- );
+ erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][
+ makerAssetAddress
+ ].plus(makerAssetFilledAmount);
erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
takerAssetAddress
].minus(takerAssetFillAmount);
@@ -579,7 +579,7 @@ describe('Exchange wrappers', () => {
);
erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
zrxToken.address
- ].add(makerFee.add(takerFee));
+ ].plus(makerFee.plus(takerFee));
});
await exchangeWrapper.batchFillOrKillOrdersAsync(signedOrders, takerAddress, {
@@ -647,15 +647,15 @@ describe('Exchange wrappers', () => {
erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][
makerAssetAddress
].minus(makerAssetFilledAmount);
- erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
- takerAssetFillAmount,
- );
+ erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][
+ takerAssetAddress
+ ].plus(takerAssetFillAmount);
erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
makerFee,
);
- erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
- makerAssetFilledAmount,
- );
+ erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][
+ makerAssetAddress
+ ].plus(makerAssetFilledAmount);
erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
takerAssetAddress
].minus(takerAssetFillAmount);
@@ -664,7 +664,7 @@ describe('Exchange wrappers', () => {
);
erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
zrxToken.address
- ].add(makerFee.add(takerFee));
+ ].plus(makerFee.plus(takerFee));
});
await exchangeWrapper.batchFillOrdersNoThrowAsync(signedOrders, takerAddress, {
@@ -706,15 +706,15 @@ describe('Exchange wrappers', () => {
erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][
makerAssetAddress
].minus(makerAssetFilledAmount);
- erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
- takerAssetFillAmount,
- );
+ erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][
+ takerAssetAddress
+ ].plus(takerAssetFillAmount);
erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
makerFee,
);
- erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
- makerAssetFilledAmount,
- );
+ erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][
+ makerAssetAddress
+ ].plus(makerAssetFilledAmount);
erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
takerAssetAddress
].minus(takerAssetFillAmount);
@@ -723,7 +723,7 @@ describe('Exchange wrappers', () => {
);
erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
zrxToken.address
- ].add(makerFee.add(takerFee));
+ ].plus(makerFee.plus(takerFee));
});
const newOrders = [invalidOrder, ...validOrders];
@@ -773,16 +773,16 @@ describe('Exchange wrappers', () => {
const newBalances = await erc20Wrapper.getBalancesAsync();
- const makerAssetFilledAmount = signedOrders[0].makerAssetAmount.add(
+ const makerAssetFilledAmount = signedOrders[0].makerAssetAmount.plus(
signedOrders[1].makerAssetAmount.dividedToIntegerBy(2),
);
- const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
- const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
+ const makerFee = signedOrders[0].makerFee.plus(signedOrders[1].makerFee.dividedToIntegerBy(2));
+ const takerFee = signedOrders[0].takerFee.plus(signedOrders[1].takerFee.dividedToIntegerBy(2));
expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[makerAddress][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
@@ -791,13 +791,13 @@ describe('Exchange wrappers', () => {
erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
);
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFee.plus(takerFee)),
);
});
@@ -809,13 +809,13 @@ describe('Exchange wrappers', () => {
].minus(signedOrder.makerAssetAmount);
erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
defaultTakerAssetAddress
- ].add(signedOrder.takerAssetAmount);
+ ].plus(signedOrder.takerAssetAmount);
erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
signedOrder.makerFee,
);
erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
defaultMakerAssetAddress
- ].add(signedOrder.makerAssetAmount);
+ ].plus(signedOrder.makerAssetAmount);
erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
defaultTakerAssetAddress
].minus(signedOrder.takerAssetAmount);
@@ -824,7 +824,7 @@ describe('Exchange wrappers', () => {
);
erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
zrxToken.address
- ].add(signedOrder.makerFee.add(signedOrder.takerFee));
+ ].plus(signedOrder.makerFee.plus(signedOrder.takerFee));
});
await exchangeWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
takerAssetFillAmount,
@@ -890,16 +890,16 @@ describe('Exchange wrappers', () => {
const newBalances = await erc20Wrapper.getBalancesAsync();
- const makerAssetFilledAmount = signedOrders[0].makerAssetAmount.add(
+ const makerAssetFilledAmount = signedOrders[0].makerAssetAmount.plus(
signedOrders[1].makerAssetAmount.dividedToIntegerBy(2),
);
- const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
- const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
+ const makerFee = signedOrders[0].makerFee.plus(signedOrders[1].makerFee.dividedToIntegerBy(2));
+ const takerFee = signedOrders[0].takerFee.plus(signedOrders[1].takerFee.dividedToIntegerBy(2));
expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
);
expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ erc20Balances[makerAddress][defaultTakerAssetAddress].plus(takerAssetFillAmount),
);
expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
@@ -908,13 +908,13 @@ describe('Exchange wrappers', () => {
erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
);
expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFilledAmount),
);
expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
);
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFee.plus(takerFee)),
);
});
@@ -926,13 +926,13 @@ describe('Exchange wrappers', () => {
].minus(signedOrder.makerAssetAmount);
erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
defaultTakerAssetAddress
- ].add(signedOrder.takerAssetAmount);
+ ].plus(signedOrder.takerAssetAmount);
erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
signedOrder.makerFee,
);
erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
defaultMakerAssetAddress
- ].add(signedOrder.makerAssetAmount);
+ ].plus(signedOrder.makerAssetAmount);
erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
defaultTakerAssetAddress
].minus(signedOrder.takerAssetAmount);
@@ -941,7 +941,7 @@ describe('Exchange wrappers', () => {
);
erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
zrxToken.address
- ].add(signedOrder.makerFee.add(signedOrder.takerFee));
+ ].plus(signedOrder.makerFee.plus(signedOrder.takerFee));
});
await exchangeWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
takerAssetFillAmount,
@@ -971,13 +971,13 @@ describe('Exchange wrappers', () => {
].minus(signedOrder.makerAssetAmount);
erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
defaultTakerAssetAddress
- ].add(signedOrder.takerAssetAmount);
+ ].plus(signedOrder.takerAssetAmount);
erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
signedOrder.makerFee,
);
erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
defaultMakerAssetAddress
- ].add(signedOrder.makerAssetAmount);
+ ].plus(signedOrder.makerAssetAmount);
erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
defaultTakerAssetAddress
].minus(signedOrder.takerAssetAmount);
@@ -986,7 +986,7 @@ describe('Exchange wrappers', () => {
);
erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
zrxToken.address
- ].add(signedOrder.makerFee.add(signedOrder.takerFee));
+ ].plus(signedOrder.makerFee.plus(signedOrder.takerFee));
});
await exchangeWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
takerAssetFillAmount,
@@ -1034,16 +1034,16 @@ describe('Exchange wrappers', () => {
const newBalances = await erc20Wrapper.getBalancesAsync();
- const makerAmountBought = signedOrders[0].takerAssetAmount.add(
+ const makerAmountBought = signedOrders[0].takerAssetAmount.plus(
signedOrders[1].takerAssetAmount.dividedToIntegerBy(2),
);
- const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
- const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
+ const makerFee = signedOrders[0].makerFee.plus(signedOrders[1].makerFee.dividedToIntegerBy(2));
+ const takerFee = signedOrders[0].takerFee.plus(signedOrders[1].takerFee.dividedToIntegerBy(2));
expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerAssetAddress].add(makerAmountBought),
+ erc20Balances[makerAddress][defaultTakerAssetAddress].plus(makerAmountBought),
);
expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
@@ -1052,13 +1052,13 @@ describe('Exchange wrappers', () => {
erc20Balances[takerAddress][defaultTakerAssetAddress].minus(makerAmountBought),
);
expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
);
expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
);
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFee.plus(takerFee)),
);
});
@@ -1070,13 +1070,13 @@ describe('Exchange wrappers', () => {
].minus(signedOrder.makerAssetAmount);
erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
defaultTakerAssetAddress
- ].add(signedOrder.takerAssetAmount);
+ ].plus(signedOrder.takerAssetAmount);
erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
signedOrder.makerFee,
);
erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
defaultMakerAssetAddress
- ].add(signedOrder.makerAssetAmount);
+ ].plus(signedOrder.makerAssetAmount);
erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
defaultTakerAssetAddress
].minus(signedOrder.takerAssetAmount);
@@ -1085,7 +1085,7 @@ describe('Exchange wrappers', () => {
);
erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
zrxToken.address
- ].add(signedOrder.makerFee.add(signedOrder.takerFee));
+ ].plus(signedOrder.makerFee.plus(signedOrder.takerFee));
});
await exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
makerAssetFillAmount,
@@ -1149,16 +1149,16 @@ describe('Exchange wrappers', () => {
const newBalances = await erc20Wrapper.getBalancesAsync();
- const makerAmountBought = signedOrders[0].takerAssetAmount.add(
+ const makerAmountBought = signedOrders[0].takerAssetAmount.plus(
signedOrders[1].takerAssetAmount.dividedToIntegerBy(2),
);
- const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
- const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
+ const makerFee = signedOrders[0].makerFee.plus(signedOrders[1].makerFee.dividedToIntegerBy(2));
+ const takerFee = signedOrders[0].takerFee.plus(signedOrders[1].takerFee.dividedToIntegerBy(2));
expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
);
expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerAssetAddress].add(makerAmountBought),
+ erc20Balances[makerAddress][defaultTakerAssetAddress].plus(makerAmountBought),
);
expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
@@ -1167,13 +1167,13 @@ describe('Exchange wrappers', () => {
erc20Balances[takerAddress][defaultTakerAssetAddress].minus(makerAmountBought),
);
expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
);
expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
);
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(makerFee.plus(takerFee)),
);
});
@@ -1185,13 +1185,13 @@ describe('Exchange wrappers', () => {
].minus(signedOrder.makerAssetAmount);
erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
defaultTakerAssetAddress
- ].add(signedOrder.takerAssetAmount);
+ ].plus(signedOrder.takerAssetAmount);
erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
signedOrder.makerFee,
);
erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
defaultMakerAssetAddress
- ].add(signedOrder.makerAssetAmount);
+ ].plus(signedOrder.makerAssetAmount);
erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
defaultTakerAssetAddress
].minus(signedOrder.takerAssetAmount);
@@ -1200,7 +1200,7 @@ describe('Exchange wrappers', () => {
);
erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
zrxToken.address
- ].add(signedOrder.makerFee.add(signedOrder.takerFee));
+ ].plus(signedOrder.makerFee.plus(signedOrder.takerFee));
});
await exchangeWrapper.marketBuyOrdersNoThrowAsync(signedOrders, takerAddress, {
makerAssetFillAmount,
@@ -1231,13 +1231,13 @@ describe('Exchange wrappers', () => {
].minus(signedOrder.makerAssetAmount);
erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
defaultTakerAssetAddress
- ].add(signedOrder.takerAssetAmount);
+ ].plus(signedOrder.takerAssetAmount);
erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
signedOrder.makerFee,
);
erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
defaultMakerAssetAddress
- ].add(signedOrder.makerAssetAmount);
+ ].plus(signedOrder.makerAssetAmount);
erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
defaultTakerAssetAddress
].minus(signedOrder.takerAssetAmount);
@@ -1246,7 +1246,7 @@ describe('Exchange wrappers', () => {
);
erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
zrxToken.address
- ].add(signedOrder.makerFee.add(signedOrder.takerFee));
+ ].plus(signedOrder.makerFee.plus(signedOrder.takerFee));
});
await exchangeWrapper.marketBuyOrdersNoThrowAsync(signedOrders, takerAddress, {
makerAssetFillAmount,
diff --git a/contracts/protocol/test/utils/fill_order_combinatorial_utils.ts b/contracts/protocol/test/utils/fill_order_combinatorial_utils.ts
index 2fd33bebd..c2f530e5b 100644
--- a/contracts/protocol/test/utils/fill_order_combinatorial_utils.ts
+++ b/contracts/protocol/test/utils/fill_order_combinatorial_utils.ts
@@ -469,7 +469,7 @@ export class FillOrderCombinatorialUtils {
const remainingTakerAmountToFill = signedOrder.takerAssetAmount.minus(alreadyFilledTakerAmount);
const expFilledTakerAmount = takerAssetFillAmount.gt(remainingTakerAmountToFill)
? remainingTakerAmountToFill
- : alreadyFilledTakerAmount.add(takerAssetFillAmount);
+ : alreadyFilledTakerAmount.plus(takerAssetFillAmount);
const expFilledMakerAmount = orderUtils.getPartialAmountFloor(
expFilledTakerAmount,
@@ -644,7 +644,7 @@ export class FillOrderCombinatorialUtils {
break;
case TakerAssetFillAmountScenario.GreaterThanRemainingFillableTakerAssetAmount:
- takerAssetFillAmount = fillableTakerAssetAmount.add(1);
+ takerAssetFillAmount = fillableTakerAssetAmount.plus(1);
break;
case TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount:
@@ -657,7 +657,7 @@ export class FillOrderCombinatorialUtils {
'Cannot test `TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount` together with ERC721 assets since orders involving ERC721 must always be filled exactly.',
);
}
- takerAssetFillAmount = fillableTakerAssetAmount.div(2).floor();
+ takerAssetFillAmount = fillableTakerAssetAmount.div(2).integerValue(BigNumber.ROUND_FLOOR);
break;
default:
diff --git a/contracts/protocol/test/utils/match_order_tester.ts b/contracts/protocol/test/utils/match_order_tester.ts
index 31864820f..0ba8017c5 100644
--- a/contracts/protocol/test/utils/match_order_tester.ts
+++ b/contracts/protocol/test/utils/match_order_tester.ts
@@ -66,7 +66,7 @@ export class MatchOrderTester {
const feePaidByRightMaker = new BigNumber(rightLog.makerFeePaid);
const feePaidByTakerRight = new BigNumber(rightLog.takerFeePaid);
// Derive amount received by taker
- const amountReceivedByTaker = amountSoldByLeftMaker.sub(amountBoughtByRightMaker);
+ const amountReceivedByTaker = amountSoldByLeftMaker.minus(amountBoughtByRightMaker);
// Assert log values - left order
expect(amountBoughtByLeftMaker, 'Checking logged amount bought by left maker').to.be.bignumber.equal(
expectedTransferAmounts.amountBoughtByLeftMaker,
@@ -267,14 +267,16 @@ export class MatchOrderTester {
// Assert left order status
const maxAmountBoughtByLeftMaker = signedOrderLeft.takerAssetAmount.minus(initialLeftOrderFilledAmount);
const leftOrderInfo: OrderInfo = await this._exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
- const leftExpectedStatus = expectedTransferAmounts.amountBoughtByLeftMaker.equals(maxAmountBoughtByLeftMaker)
+ const leftExpectedStatus = expectedTransferAmounts.amountBoughtByLeftMaker.isEqualTo(maxAmountBoughtByLeftMaker)
? OrderStatus.FullyFilled
: OrderStatus.Fillable;
expect(leftOrderInfo.orderStatus, 'Checking exchange status for left order').to.be.equal(leftExpectedStatus);
// Assert right order status
const maxAmountBoughtByRightMaker = signedOrderRight.takerAssetAmount.minus(initialRightOrderFilledAmount);
const rightOrderInfo: OrderInfo = await this._exchangeWrapper.getOrderInfoAsync(signedOrderRight);
- const rightExpectedStatus = expectedTransferAmounts.amountBoughtByRightMaker.equals(maxAmountBoughtByRightMaker)
+ const rightExpectedStatus = expectedTransferAmounts.amountBoughtByRightMaker.isEqualTo(
+ maxAmountBoughtByRightMaker,
+ )
? OrderStatus.FullyFilled
: OrderStatus.Fillable;
expect(rightOrderInfo.orderStatus, 'Checking exchange status for right order').to.be.equal(rightExpectedStatus);
@@ -364,13 +366,13 @@ export class MatchOrderTester {
// Right Maker
expectedNewERC20BalancesByOwner[makerAddressRight][
takerAssetAddressRight
- ] = expectedNewERC20BalancesByOwner[makerAddressRight][takerAssetAddressRight].add(
+ ] = expectedNewERC20BalancesByOwner[makerAddressRight][takerAssetAddressRight].plus(
expectedTransferAmounts.amountBoughtByRightMaker,
);
// Taker
expectedNewERC20BalancesByOwner[takerAddress][makerAssetAddressLeft] = expectedNewERC20BalancesByOwner[
takerAddress
- ][makerAssetAddressLeft].add(expectedTransferAmounts.amountReceivedByTaker);
+ ][makerAssetAddressLeft].plus(expectedTransferAmounts.amountReceivedByTaker);
} else if (makerAssetProxyIdLeft === AssetProxyId.ERC721) {
// Decode asset data
const erc721AssetData = assetDataUtils.decodeERC721AssetData(signedOrderLeft.makerAssetData);
@@ -395,7 +397,7 @@ export class MatchOrderTester {
// Left Maker
expectedNewERC20BalancesByOwner[makerAddressLeft][takerAssetAddressLeft] = expectedNewERC20BalancesByOwner[
makerAddressLeft
- ][takerAssetAddressLeft].add(expectedTransferAmounts.amountBoughtByLeftMaker);
+ ][takerAssetAddressLeft].plus(expectedTransferAmounts.amountBoughtByLeftMaker);
// Right Maker
expectedNewERC20BalancesByOwner[makerAddressRight][
makerAssetAddressRight
@@ -426,19 +428,19 @@ export class MatchOrderTester {
expectedNewERC20BalancesByOwner[takerAddress][this._feeTokenAddress] = expectedNewERC20BalancesByOwner[
takerAddress
][this._feeTokenAddress].minus(
- expectedTransferAmounts.feePaidByTakerLeft.add(expectedTransferAmounts.feePaidByTakerRight),
+ expectedTransferAmounts.feePaidByTakerLeft.plus(expectedTransferAmounts.feePaidByTakerRight),
);
// Left Fee Recipient Fees
expectedNewERC20BalancesByOwner[feeRecipientAddressLeft][
this._feeTokenAddress
- ] = expectedNewERC20BalancesByOwner[feeRecipientAddressLeft][this._feeTokenAddress].add(
- expectedTransferAmounts.feePaidByLeftMaker.add(expectedTransferAmounts.feePaidByTakerLeft),
+ ] = expectedNewERC20BalancesByOwner[feeRecipientAddressLeft][this._feeTokenAddress].plus(
+ expectedTransferAmounts.feePaidByLeftMaker.plus(expectedTransferAmounts.feePaidByTakerLeft),
);
// Right Fee Recipient Fees
expectedNewERC20BalancesByOwner[feeRecipientAddressRight][
this._feeTokenAddress
- ] = expectedNewERC20BalancesByOwner[feeRecipientAddressRight][this._feeTokenAddress].add(
- expectedTransferAmounts.feePaidByRightMaker.add(expectedTransferAmounts.feePaidByTakerRight),
+ ] = expectedNewERC20BalancesByOwner[feeRecipientAddressRight][this._feeTokenAddress].plus(
+ expectedTransferAmounts.feePaidByRightMaker.plus(expectedTransferAmounts.feePaidByTakerRight),
);
return [expectedNewERC20BalancesByOwner, expectedNewERC721TokenIdsByOwner];
diff --git a/contracts/test-utils/CHANGELOG.json b/contracts/test-utils/CHANGELOG.json
index 91485313a..ae1575e43 100644
--- a/contracts/test-utils/CHANGELOG.json
+++ b/contracts/test-utils/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.0.1",
"changes": [
diff --git a/contracts/test-utils/package.json b/contracts/test-utils/package.json
index b7cfcb5b6..b0f4713af 100644
--- a/contracts/test-utils/package.json
+++ b/contracts/test-utils/package.json
@@ -61,7 +61,7 @@
"bn.js": "^4.11.8",
"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",
"ethereum-types": "^1.1.6",
"ethereumjs-abi": "0.6.5",
diff --git a/contracts/test-utils/src/order_factory.ts b/contracts/test-utils/src/order_factory.ts
index 2449d1a8a..b0f435ff2 100644
--- a/contracts/test-utils/src/order_factory.ts
+++ b/contracts/test-utils/src/order_factory.ts
@@ -21,7 +21,7 @@ export class OrderFactory {
const currentBlockTimestamp = await getLatestBlockTimestampAsync();
const order = ({
senderAddress: constants.NULL_ADDRESS,
- expirationTimeSeconds: new BigNumber(currentBlockTimestamp).add(tenMinutesInSeconds),
+ expirationTimeSeconds: new BigNumber(currentBlockTimestamp).plus(tenMinutesInSeconds),
salt: generatePseudoRandomSalt(),
takerAddress: constants.NULL_ADDRESS,
...this._defaultOrderParams,
diff --git a/contracts/test-utils/src/order_utils.ts b/contracts/test-utils/src/order_utils.ts
index 4f7a34011..fd336bb47 100644
--- a/contracts/test-utils/src/order_utils.ts
+++ b/contracts/test-utils/src/order_utils.ts
@@ -7,9 +7,9 @@ import { CancelOrder, MatchOrder } from './types';
export const orderUtils = {
getPartialAmountFloor(numerator: BigNumber, denominator: BigNumber, target: BigNumber): BigNumber {
const partialAmount = numerator
- .mul(target)
+ .multipliedBy(target)
.div(denominator)
- .floor();
+ .integerValue(BigNumber.ROUND_FLOOR);
return partialAmount;
},
createFill: (signedOrder: SignedOrder, takerAssetFillAmount?: BigNumber) => {
diff --git a/contracts/tokens/CHANGELOG.json b/contracts/tokens/CHANGELOG.json
index 6adebc471..724ab1e4a 100644
--- a/contracts/tokens/CHANGELOG.json
+++ b/contracts/tokens/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547747677,
"version": "1.0.6",
"changes": [
diff --git a/contracts/tokens/package.json b/contracts/tokens/package.json
index ce680ab09..bd0316919 100644
--- a/contracts/tokens/package.json
+++ b/contracts/tokens/package.json
@@ -56,7 +56,7 @@
"@types/yargs": "^10.0.0",
"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",
"ethereumjs-abi": "0.6.5",
"make-promises-safe": "^1.1.0",
diff --git a/contracts/tokens/test/unlimited_allowance_token.ts b/contracts/tokens/test/unlimited_allowance_token.ts
index 6d5a29b23..f0b8e53a4 100644
--- a/contracts/tokens/test/unlimited_allowance_token.ts
+++ b/contracts/tokens/test/unlimited_allowance_token.ts
@@ -109,7 +109,7 @@ describe('UnlimitedAllowanceToken', () => {
const amountToTransfer = ownerBalance;
const spenderAllowance = await token.allowance.callAsync(owner, spender);
- const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
+ const isSpenderAllowanceInsufficient = spenderAllowance.comparedTo(amountToTransfer) < 0;
expect(isSpenderAllowanceInsufficient).to.be.true();
return expectContractCallFailedAsync(
diff --git a/contracts/tokens/test/zrx_token.ts b/contracts/tokens/test/zrx_token.ts
index 5dc8447f6..820b054e6 100644
--- a/contracts/tokens/test/zrx_token.ts
+++ b/contracts/tokens/test/zrx_token.ts
@@ -117,7 +117,7 @@ describe('ZRXToken', () => {
const amountToTransfer = ownerBalance;
const spenderAllowance = await zrxToken.allowance.callAsync(owner, spender);
- const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
+ const isSpenderAllowanceInsufficient = spenderAllowance.comparedTo(amountToTransfer) < 0;
expect(isSpenderAllowanceInsufficient).to.be.true();
const didReturnTrue = await zrxToken.transferFrom.callAsync(owner, spender, amountToTransfer, {
diff --git a/contracts/utils/CHANGELOG.json b/contracts/utils/CHANGELOG.json
index 6adebc471..724ab1e4a 100644
--- a/contracts/utils/CHANGELOG.json
+++ b/contracts/utils/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547747677,
"version": "1.0.6",
"changes": [
diff --git a/contracts/utils/package.json b/contracts/utils/package.json
index a6d38d0d8..4e45169fd 100644
--- a/contracts/utils/package.json
+++ b/contracts/utils/package.json
@@ -57,7 +57,7 @@
"bn.js": "^4.11.8",
"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",
"ethereumjs-abi": "0.6.5",
"make-promises-safe": "^1.1.0",
diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json
index 276bdd479..20778f8bb 100644
--- a/packages/0x.js/CHANGELOG.json
+++ b/packages/0x.js/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "4.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547747677,
"version": "3.0.3",
"changes": [
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index f4f1c82e0..64054d288 100644
--- a/packages/0x.js/package.json
+++ b/packages/0x.js/package.json
@@ -54,7 +54,7 @@
"awesome-typescript-loader": "^5.2.1",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
- "chai-bignumber": "^2.0.1",
+ "chai-bignumber": "^3.0.0",
"copyfiles": "^2.0.0",
"dirty-chai": "^2.0.1",
"make-promises-safe": "^1.1.0",
diff --git a/packages/abi-gen-templates/CHANGELOG.json b/packages/abi-gen-templates/CHANGELOG.json
index b825c4f1f..7d444d0ca 100644
--- a/packages/abi-gen-templates/CHANGELOG.json
+++ b/packages/abi-gen-templates/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "1.0.2",
"changes": [
diff --git a/packages/abi-gen-wrappers/CHANGELOG.json b/packages/abi-gen-wrappers/CHANGELOG.json
index 381b37cda..c604302b5 100644
--- a/packages/abi-gen-wrappers/CHANGELOG.json
+++ b/packages/abi-gen-wrappers/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "3.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"version": "2.2.0",
"changes": [
{
diff --git a/packages/abi-gen/CHANGELOG.json b/packages/abi-gen/CHANGELOG.json
index ab516e4c6..173617b65 100644
--- a/packages/abi-gen/CHANGELOG.json
+++ b/packages/abi-gen/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "1.0.22",
"changes": [
diff --git a/packages/assert/CHANGELOG.json b/packages/assert/CHANGELOG.json
index 0210f9400..278b7dfa1 100644
--- a/packages/assert/CHANGELOG.json
+++ b/packages/assert/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "1.0.23",
"changes": [
diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts
index 2d28d51e1..741bd78e1 100644
--- a/packages/assert/src/index.ts
+++ b/packages/assert/src/index.ts
@@ -7,12 +7,12 @@ const HEX_REGEX = /^0x[0-9A-F]*$/i;
export const assert = {
isBigNumber(variableName: string, value: BigNumber): void {
- const isBigNumber = _.isObject(value) && (value as any).isBigNumber;
+ const isBigNumber = BigNumber.isBigNumber(value);
assert.assert(isBigNumber, assert.typeAssertionMessage(variableName, 'BigNumber', value));
},
isValidBaseUnitAmount(variableName: string, value: BigNumber): void {
assert.isBigNumber(variableName, value);
- const isNegative = value.lessThan(0);
+ const isNegative = value.isLessThan(0);
assert.assert(!isNegative, `${variableName} cannot be a negative number, found value: ${value.toNumber()}`);
const hasDecimals = value.decimalPlaces() !== 0;
assert.assert(
diff --git a/packages/asset-buyer/CHANGELOG.json b/packages/asset-buyer/CHANGELOG.json
index 3bb95fdba..2de603de0 100644
--- a/packages/asset-buyer/CHANGELOG.json
+++ b/packages/asset-buyer/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "5.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"version": "4.1.0",
"changes": [
{
diff --git a/packages/asset-buyer/package.json b/packages/asset-buyer/package.json
index 454e9cc1c..0f79ac06a 100644
--- a/packages/asset-buyer/package.json
+++ b/packages/asset-buyer/package.json
@@ -56,7 +56,7 @@
"@types/node": "*",
"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/asset-buyer/src/utils/buy_quote_calculator.ts b/packages/asset-buyer/src/utils/buy_quote_calculator.ts
index fcded6ab1..125841094 100644
--- a/packages/asset-buyer/src/utils/buy_quote_calculator.ts
+++ b/packages/asset-buyer/src/utils/buy_quote_calculator.ts
@@ -22,7 +22,7 @@ export const buyQuoteCalculator = {
const remainingFillableMakerAssetAmounts = ordersAndFillableAmounts.remainingFillableMakerAssetAmounts;
const feeOrders = feeOrdersAndFillableAmounts.orders;
const remainingFillableFeeAmounts = feeOrdersAndFillableAmounts.remainingFillableMakerAssetAmounts;
- const slippageBufferAmount = assetBuyAmount.mul(slippagePercentage).round();
+ const slippageBufferAmount = assetBuyAmount.multipliedBy(slippagePercentage).integerValue();
// find the orders that cover the desired assetBuyAmount (with slippage)
const {
resultOrders,
@@ -43,7 +43,9 @@ export const buyQuoteCalculator = {
const multiplierNeededWithSlippage = new BigNumber(1).plus(slippagePercentage);
// Given amountAvailableToFillConsideringSlippage * multiplierNeededWithSlippage = amountAbleToFill
// We divide amountUnableToFill by multiplierNeededWithSlippage to determine amountAvailableToFillConsideringSlippage
- const amountAvailableToFillConsideringSlippage = amountAbleToFill.div(multiplierNeededWithSlippage).floor();
+ const amountAvailableToFillConsideringSlippage = amountAbleToFill
+ .div(multiplierNeededWithSlippage)
+ .integerValue(BigNumber.ROUND_FLOOR);
throw new InsufficientAssetLiquidityError(amountAvailableToFillConsideringSlippage);
}
@@ -131,7 +133,7 @@ function calculateQuoteInfo(
zrxEthAmount = findEthAmountNeededToBuyZrx(feeOrdersAndFillableAmounts, zrxAmountToBuyAsset);
}
// eth amount needed to buy the affiliate fee
- const affiliateFeeEthAmount = assetEthAmount.mul(feePercentage).ceil();
+ const affiliateFeeEthAmount = assetEthAmount.multipliedBy(feePercentage).integerValue(BigNumber.ROUND_CEIL);
// eth amount needed for fees is the sum of affiliate fee and zrx fee
const feeEthAmount = affiliateFeeEthAmount.plus(zrxEthAmount);
// eth amount needed in total is the sum of the amount needed for the asset and the amount needed for fees
@@ -168,9 +170,9 @@ function findEthAmountNeededToBuyZrx(
order,
makerFillAmount,
);
- const extraFeeAmount = remainingFillableMakerAssetAmount.greaterThanOrEqualTo(adjustedMakerFillAmount)
+ const extraFeeAmount = remainingFillableMakerAssetAmount.isGreaterThanOrEqualTo(adjustedMakerFillAmount)
? constants.ZERO_AMOUNT
- : adjustedMakerFillAmount.sub(makerFillAmount);
+ : adjustedMakerFillAmount.minus(makerFillAmount);
return {
totalEthAmount: totalEthAmount.plus(takerFillAmount),
remainingZrxBuyAmount: BigNumber.max(
diff --git a/packages/asset-buyer/src/utils/order_provider_response_processor.ts b/packages/asset-buyer/src/utils/order_provider_response_processor.ts
index 4244d196c..f08cd6150 100644
--- a/packages/asset-buyer/src/utils/order_provider_response_processor.ts
+++ b/packages/asset-buyer/src/utils/order_provider_response_processor.ts
@@ -109,11 +109,8 @@ function getValidOrdersWithRemainingFillableMakerAssetAmountsFromOnChain(
return accOrders;
}
// if the order IS fillable, add the order and calculate the remaining fillable amount
- const transferrableAssetAmount = BigNumber.min([traderInfo.makerAllowance, traderInfo.makerBalance]);
- const transferrableFeeAssetAmount = BigNumber.min([
- traderInfo.makerZrxAllowance,
- traderInfo.makerZrxBalance,
- ]);
+ const transferrableAssetAmount = BigNumber.min(traderInfo.makerAllowance, traderInfo.makerBalance);
+ const transferrableFeeAssetAmount = BigNumber.min(traderInfo.makerZrxAllowance, traderInfo.makerZrxBalance);
const remainingTakerAssetAmount = order.takerAssetAmount.minus(orderInfo.orderTakerAssetFilledAmount);
const remainingMakerAssetAmount = orderUtils.getRemainingMakerAmount(order, remainingTakerAssetAmount);
const remainingFillableCalculator = new RemainingFillableCalculator(
diff --git a/packages/asset-buyer/src/utils/order_utils.ts b/packages/asset-buyer/src/utils/order_utils.ts
index 1cc2cf95f..3ea3cafd3 100644
--- a/packages/asset-buyer/src/utils/order_utils.ts
+++ b/packages/asset-buyer/src/utils/order_utils.ts
@@ -9,8 +9,8 @@ export const orderUtils = {
},
willOrderExpire(order: SignedOrder, secondsFromNow: number): boolean {
const millisecondsInSecond = 1000;
- const currentUnixTimestampSec = new BigNumber(Date.now() / millisecondsInSecond).round();
- return order.expirationTimeSeconds.lessThan(currentUnixTimestampSec.plus(secondsFromNow));
+ const currentUnixTimestampSec = new BigNumber(Date.now() / millisecondsInSecond).integerValue();
+ return order.expirationTimeSeconds.isLessThan(currentUnixTimestampSec.plus(secondsFromNow));
},
isOpenOrder(order: SignedOrder): boolean {
return order.takerAddress === constants.NULL_ADDRESS;
@@ -20,43 +20,43 @@ export const orderUtils = {
const remainingMakerAmount = remainingTakerAmount
.times(order.makerAssetAmount)
.div(order.takerAssetAmount)
- .floor();
+ .integerValue(BigNumber.ROUND_FLOOR);
return remainingMakerAmount;
},
// given a desired amount of makerAsset, calculate how much takerAsset is required to fill that amount
getTakerFillAmount(order: SignedOrder, makerFillAmount: BigNumber): BigNumber {
// Round up because exchange rate favors Maker
const takerFillAmount = makerFillAmount
- .mul(order.takerAssetAmount)
+ .multipliedBy(order.takerAssetAmount)
.div(order.makerAssetAmount)
- .ceil();
+ .integerValue(BigNumber.ROUND_CEIL);
return takerFillAmount;
},
// given a desired amount of takerAsset to fill, calculate how much fee is required by the taker to fill that amount
getTakerFeeAmount(order: SignedOrder, takerFillAmount: BigNumber): BigNumber {
// Round down because Taker fee rate favors Taker
const takerFeeAmount = takerFillAmount
- .mul(order.takerFee)
+ .multipliedBy(order.takerFee)
.div(order.takerAssetAmount)
- .floor();
+ .integerValue(BigNumber.ROUND_FLOOR);
return takerFeeAmount;
},
// given a desired amount of takerAsset to fill, calculate how much makerAsset will be filled
getMakerFillAmount(order: SignedOrder, takerFillAmount: BigNumber): BigNumber {
// Round down because exchange rate favors Maker
const makerFillAmount = takerFillAmount
- .mul(order.makerAssetAmount)
+ .multipliedBy(order.makerAssetAmount)
.div(order.takerAssetAmount)
- .floor();
+ .integerValue(BigNumber.ROUND_FLOOR);
return makerFillAmount;
},
// given a desired amount of makerAsset, calculate how much fee is required by the maker to fill that amount
getMakerFeeAmount(order: SignedOrder, makerFillAmount: BigNumber): BigNumber {
// Round down because Maker fee rate favors Maker
const makerFeeAmount = makerFillAmount
- .mul(order.makerFee)
+ .multipliedBy(order.makerFee)
.div(order.makerAssetAmount)
- .floor();
+ .integerValue(BigNumber.ROUND_FLOOR);
return makerFeeAmount;
},
// given a desired amount of ZRX from a fee order, calculate how much takerAsset is required to fill that amount
@@ -64,9 +64,9 @@ export const orderUtils = {
getTakerFillAmountForFeeOrder(order: SignedOrder, makerFillAmount: BigNumber): [BigNumber, BigNumber] {
// For each unit of TakerAsset we buy (MakerAsset - TakerFee)
const adjustedTakerFillAmount = makerFillAmount
- .mul(order.takerAssetAmount)
- .div(order.makerAssetAmount.sub(order.takerFee))
- .ceil();
+ .multipliedBy(order.takerAssetAmount)
+ .div(order.makerAssetAmount.minus(order.takerFee))
+ .integerValue(BigNumber.ROUND_CEIL);
// The amount that we buy will be greater than makerFillAmount, since we buy some amount for fees.
const adjustedMakerFillAmount = orderUtils.getMakerFillAmount(order, adjustedTakerFillAmount);
return [adjustedTakerFillAmount, adjustedMakerFillAmount];
diff --git a/packages/asset-buyer/test/buy_quote_calculator_test.ts b/packages/asset-buyer/test/buy_quote_calculator_test.ts
index 880f55180..177fd8fe6 100644
--- a/packages/asset-buyer/test/buy_quote_calculator_test.ts
+++ b/packages/asset-buyer/test/buy_quote_calculator_test.ts
@@ -234,7 +234,7 @@ describe('buyQuoteCalculator', () => {
const expectedEthAmountForAsset = new BigNumber(50);
const expectedEthAmountForZrxFees = new BigNumber(100);
const expectedFillEthAmount = expectedEthAmountForAsset;
- const expectedAffiliateFeeEthAmount = expectedEthAmountForAsset.mul(feePercentage);
+ const expectedAffiliateFeeEthAmount = expectedEthAmountForAsset.multipliedBy(feePercentage);
const expectedFeeEthAmount = expectedAffiliateFeeEthAmount.plus(expectedEthAmountForZrxFees);
const expectedTotalEthAmount = expectedFillEthAmount.plus(expectedFeeEthAmount);
expect(buyQuote.bestCaseQuoteInfo.assetEthAmount).to.bignumber.equal(expectedFillEthAmount);
@@ -272,7 +272,7 @@ describe('buyQuoteCalculator', () => {
const expectedEthAmountForAsset = new BigNumber(50);
const expectedEthAmountForZrxFees = new BigNumber(100);
const expectedFillEthAmount = expectedEthAmountForAsset;
- const expectedAffiliateFeeEthAmount = expectedEthAmountForAsset.mul(feePercentage);
+ const expectedAffiliateFeeEthAmount = expectedEthAmountForAsset.multipliedBy(feePercentage);
const expectedFeeEthAmount = expectedAffiliateFeeEthAmount.plus(expectedEthAmountForZrxFees);
const expectedTotalEthAmount = expectedFillEthAmount.plus(expectedFeeEthAmount);
expect(buyQuote.bestCaseQuoteInfo.assetEthAmount).to.bignumber.equal(expectedFillEthAmount);
@@ -282,7 +282,7 @@ describe('buyQuoteCalculator', () => {
const expectedWorstEthAmountForAsset = new BigNumber(100);
const expectedWorstEthAmountForZrxFees = new BigNumber(208);
const expectedWorstFillEthAmount = expectedWorstEthAmountForAsset;
- const expectedWorstAffiliateFeeEthAmount = expectedWorstEthAmountForAsset.mul(feePercentage);
+ const expectedWorstAffiliateFeeEthAmount = expectedWorstEthAmountForAsset.multipliedBy(feePercentage);
const expectedWorstFeeEthAmount = expectedWorstAffiliateFeeEthAmount.plus(expectedWorstEthAmountForZrxFees);
const expectedWorstTotalEthAmount = expectedWorstFillEthAmount.plus(expectedWorstFeeEthAmount);
expect(buyQuote.worstCaseQuoteInfo.assetEthAmount).to.bignumber.equal(expectedWorstFillEthAmount);
diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json
index 68ebe8d9e..63b1fe8f7 100644
--- a/packages/base-contract/CHANGELOG.json
+++ b/packages/base-contract/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "4.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "3.0.13",
"changes": [
diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts
index c2b7b943b..0238106f3 100644
--- a/packages/base-contract/src/index.ts
+++ b/packages/base-contract/src/index.ts
@@ -1,4 +1,4 @@
-import { AbiEncoder, abiUtils } from '@0x/utils';
+import { AbiEncoder, abiUtils, BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import {
AbiDefinition,
@@ -43,7 +43,7 @@ export class BaseContract {
return type === 'address' ? value.toLowerCase() : value;
}
protected static _bigNumberToString(_type: string, value: any): any {
- return _.isObject(value) && value.isBigNumber ? value.toString() : value;
+ return BigNumber.isBigNumber(value) ? value.toString() : value;
}
protected static _lookupConstructorAbi(abi: ContractAbi): ConstructorAbi {
const constructorAbiIfExists = _.find(
diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json
index 8fe9c562f..c2f16d96a 100644
--- a/packages/connect/CHANGELOG.json
+++ b/packages/connect/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "4.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "3.0.13",
"changes": [
diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json
index b9b910165..30199ae1d 100644
--- a/packages/contract-wrappers/CHANGELOG.json
+++ b/packages/contract-wrappers/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "6.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547747677,
"version": "5.0.1",
"changes": [
diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json
index 8cee730fe..cc7dc1a3e 100644
--- a/packages/contract-wrappers/package.json
+++ b/packages/contract-wrappers/package.json
@@ -49,7 +49,7 @@
"@types/web3-provider-engine": "^14.0.0",
"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/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts
index ad42cfd4f..cd79a0e5d 100644
--- a/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts
@@ -271,7 +271,7 @@ export class ERC20TokenWrapper extends ContractWrapper {
const tokenContract = await this._getTokenContractAsync(normalizedTokenAddress);
const fromAddressBalance = await this.getBalanceAsync(normalizedTokenAddress, normalizedFromAddress);
- if (fromAddressBalance.lessThan(amountInBaseUnits)) {
+ if (fromAddressBalance.isLessThan(amountInBaseUnits)) {
throw new Error(ContractWrappersError.InsufficientBalanceForTransfer);
}
@@ -327,12 +327,12 @@ export class ERC20TokenWrapper extends ContractWrapper {
normalizedFromAddress,
normalizedSenderAddress,
);
- if (fromAddressAllowance.lessThan(amountInBaseUnits)) {
+ if (fromAddressAllowance.isLessThan(amountInBaseUnits)) {
throw new Error(ContractWrappersError.InsufficientAllowanceForTransfer);
}
const fromAddressBalance = await this.getBalanceAsync(normalizedTokenAddress, normalizedFromAddress);
- if (fromAddressBalance.lessThan(amountInBaseUnits)) {
+ if (fromAddressBalance.isLessThan(amountInBaseUnits)) {
throw new Error(ContractWrappersError.InsufficientBalanceForTransfer);
}
diff --git a/packages/contract-wrappers/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts b/packages/contract-wrappers/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts
index 1ff130a48..c35b24664 100644
--- a/packages/contract-wrappers/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts
+++ b/packages/contract-wrappers/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts
@@ -39,7 +39,7 @@ export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndP
nestedAssetDataElement,
userAddress,
)).dividedToIntegerBy(nestedAmountElement);
- if (_.isUndefined(balance) || nestedAssetBalance.lessThan(balance)) {
+ if (_.isUndefined(balance) || nestedAssetBalance.isLessThan(balance)) {
balance = nestedAssetBalance;
}
}
@@ -81,7 +81,7 @@ export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndP
nestedAssetDataElement,
userAddress,
)).dividedToIntegerBy(nestedAmountElement);
- if (_.isUndefined(proxyAllowance) || nestedAssetAllowance.lessThan(proxyAllowance)) {
+ if (_.isUndefined(proxyAllowance) || nestedAssetAllowance.isLessThan(proxyAllowance)) {
proxyAllowance = nestedAssetAllowance;
}
}
diff --git a/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts b/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts
index f374d509b..4b75ea386 100644
--- a/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts
+++ b/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts
@@ -72,10 +72,10 @@ export class ExchangeTransferSimulator {
}
const balance = await this._store.getBalanceAsync(tokenAddress, from);
const proxyAllowance = await this._store.getProxyAllowanceAsync(tokenAddress, from);
- if (proxyAllowance.lessThan(amountInBaseUnits)) {
+ if (proxyAllowance.isLessThan(amountInBaseUnits)) {
ExchangeTransferSimulator._throwValidationError(FailureReason.ProxyAllowance, tradeSide, transferType);
}
- if (balance.lessThan(amountInBaseUnits)) {
+ if (balance.isLessThan(amountInBaseUnits)) {
ExchangeTransferSimulator._throwValidationError(FailureReason.Balance, tradeSide, transferType);
}
await this._decreaseProxyAllowanceAsync(tokenAddress, from, amountInBaseUnits);
diff --git a/packages/contract-wrappers/src/utils/utils.ts b/packages/contract-wrappers/src/utils/utils.ts
index 0b3270e78..ab69385e7 100644
--- a/packages/contract-wrappers/src/utils/utils.ts
+++ b/packages/contract-wrappers/src/utils/utils.ts
@@ -7,13 +7,15 @@ import { constants } from './constants';
export const utils = {
getCurrentUnixTimestampSec(): BigNumber {
const milisecondsInSecond = 1000;
- return new BigNumber(Date.now() / milisecondsInSecond).round();
+ return new BigNumber(Date.now() / milisecondsInSecond).integerValue();
},
getCurrentUnixTimestampMs(): BigNumber {
return new BigNumber(Date.now());
},
numberPercentageToEtherTokenAmountPercentage(percentage: number): BigNumber {
- return Web3Wrapper.toBaseUnitAmount(constants.ONE_AMOUNT, constants.ETHER_TOKEN_DECIMALS).mul(percentage);
+ return Web3Wrapper.toBaseUnitAmount(constants.ONE_AMOUNT, constants.ETHER_TOKEN_DECIMALS).multipliedBy(
+ percentage,
+ );
},
removeUndefinedProperties<T extends object>(obj: T): Partial<T> {
return _.pickBy(obj);
diff --git a/packages/contract-wrappers/test/ether_token_wrapper_test.ts b/packages/contract-wrappers/test/ether_token_wrapper_test.ts
index e3efef19d..cc2419aa2 100644
--- a/packages/contract-wrappers/test/ether_token_wrapper_test.ts
+++ b/packages/contract-wrappers/test/ether_token_wrapper_test.ts
@@ -116,7 +116,7 @@ describe('EtherTokenWrapper', () => {
const preETHBalance = await web3Wrapper.getBalanceInWeiAsync(addressWithETH);
const extraETHBalance = Web3Wrapper.toWei(new BigNumber(5));
- const overETHBalanceinWei = preETHBalance.add(extraETHBalance);
+ const overETHBalanceinWei = preETHBalance.plus(extraETHBalance);
return expect(
contractWrappers.etherToken.depositAsync(wethContractAddress, overETHBalanceinWei, addressWithETH),
@@ -153,7 +153,7 @@ describe('EtherTokenWrapper', () => {
);
expect(postWETHBalanceInBaseUnits).to.be.bignumber.equal(0);
- const expectedETHBalance = preETHBalance.add(depositWeiAmount).round(decimalPlaces);
+ const expectedETHBalance = preETHBalance.plus(depositWeiAmount).integerValue(decimalPlaces);
gasCost = expectedETHBalance.minus(postETHBalance);
expect(gasCost).to.be.bignumber.lte(MAX_REASONABLE_GAS_COST_IN_WEI);
});
@@ -165,7 +165,7 @@ describe('EtherTokenWrapper', () => {
expect(preWETHBalance).to.be.bignumber.equal(0);
// tslint:disable-next-line:custom-no-magic-numbers
- const overWETHBalance = preWETHBalance.add(999999999);
+ const overWETHBalance = preWETHBalance.plus(999999999);
return expect(
contractWrappers.etherToken.withdrawAsync(wethContractAddress, overWETHBalance, addressWithETH),
diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json
index 85189d70b..d05e41d2d 100644
--- a/packages/dev-utils/CHANGELOG.json
+++ b/packages/dev-utils/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "1.0.24",
"changes": [
diff --git a/packages/ethereum-types/CHANGELOG.json b/packages/ethereum-types/CHANGELOG.json
index 6265e01a1..c106d43a9 100644
--- a/packages/ethereum-types/CHANGELOG.json
+++ b/packages/ethereum-types/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "1.1.6",
"changes": [
diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json
index 953b323c6..bd3748058 100644
--- a/packages/ethereum-types/package.json
+++ b/packages/ethereum-types/package.json
@@ -37,7 +37,7 @@
},
"dependencies": {
"@types/node": "*",
- "bignumber.js": "~4.1.0"
+ "bignumber.js": "~8.0.2"
},
"publishConfig": {
"access": "public"
diff --git a/packages/fill-scenarios/CHANGELOG.json b/packages/fill-scenarios/CHANGELOG.json
index d8f2591a4..beffdd097 100644
--- a/packages/fill-scenarios/CHANGELOG.json
+++ b/packages/fill-scenarios/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "1.1.2",
"changes": [
diff --git a/packages/instant/CHANGELOG.json b/packages/instant/CHANGELOG.json
index 537670584..c7348c3c0 100644
--- a/packages/instant/CHANGELOG.json
+++ b/packages/instant/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "3.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"version": "2.0.0",
"changes": [
{
diff --git a/packages/instant/src/components/order_details.tsx b/packages/instant/src/components/order_details.tsx
index 4db20b13e..3ded50652 100644
--- a/packages/instant/src/components/order_details.tsx
+++ b/packages/instant/src/components/order_details.tsx
@@ -77,7 +77,7 @@ export class OrderDetails extends React.PureComponent<OrderDetailsProps> {
}
private _hadErrorFetchingUsdPrice(): boolean {
- return this.props.ethUsdPrice ? this.props.ethUsdPrice.equals(BIG_NUMBER_ZERO) : false;
+ return this.props.ethUsdPrice ? this.props.ethUsdPrice.isEqualTo(BIG_NUMBER_ZERO) : false;
}
private _totalCostSecondaryValue(): React.ReactNode {
@@ -156,7 +156,7 @@ export class OrderDetails extends React.PureComponent<OrderDetailsProps> {
return !_.isUndefined(assetTotalInWei) &&
!_.isUndefined(selectedAssetUnitAmount) &&
!selectedAssetUnitAmount.eq(BIG_NUMBER_ZERO)
- ? assetTotalInWei.div(selectedAssetUnitAmount).ceil()
+ ? assetTotalInWei.div(selectedAssetUnitAmount).integerValue(BigNumber.ROUND_CEIL)
: undefined;
}
diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts
index bfd9e9098..d407925a3 100644
--- a/packages/instant/src/constants.ts
+++ b/packages/instant/src/constants.ts
@@ -21,7 +21,7 @@ export const NPM_PACKAGE_VERSION = process.env.NPM_PACKAGE_VERSION;
export const DEFAULT_UNKOWN_ASSET_NAME = '???';
export const ACCOUNT_UPDATE_INTERVAL_TIME_MS = ONE_SECOND_MS * 5;
export const BUY_QUOTE_UPDATE_INTERVAL_TIME_MS = ONE_SECOND_MS * 15;
-export const DEFAULT_GAS_PRICE = GWEI_IN_WEI.mul(6);
+export const DEFAULT_GAS_PRICE = GWEI_IN_WEI.multipliedBy(6);
export const DEFAULT_ESTIMATED_TRANSACTION_TIME_MS = ONE_MINUTE_MS * 2;
export const MAGIC_TRIGGER_ERROR_INPUT = '0€';
export const MAGIC_TRIGGER_ERROR_MESSAGE = 'Triggered error';
diff --git a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts
index cb9df527e..4b9993332 100644
--- a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts
+++ b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts
@@ -84,7 +84,7 @@ const mapDispatchToProps = (
// reset our buy state
dispatch(actions.setBuyOrderStateNone());
- if (!_.isUndefined(value) && value.greaterThan(0) && !_.isUndefined(asset)) {
+ if (!_.isUndefined(value) && value.isGreaterThan(0) && !_.isUndefined(asset)) {
// even if it's debounced, give them the illusion it's loading
dispatch(actions.setQuoteRequestStatePending());
// tslint:disable-next-line:no-floating-promises
diff --git a/packages/instant/src/redux/async_data.ts b/packages/instant/src/redux/async_data.ts
index 884ab103d..f20fe319f 100644
--- a/packages/instant/src/redux/async_data.ts
+++ b/packages/instant/src/redux/async_data.ts
@@ -99,7 +99,7 @@ export const asyncData = {
if (
!_.isUndefined(selectedAssetUnitAmount) &&
!_.isUndefined(selectedAsset) &&
- selectedAssetUnitAmount.greaterThan(BIG_NUMBER_ZERO) &&
+ selectedAssetUnitAmount.isGreaterThan(BIG_NUMBER_ZERO) &&
buyOrderState.processState === OrderProcessState.None &&
selectedAsset.metaData.assetProxyId === AssetProxyId.ERC20
) {
diff --git a/packages/instant/src/util/asset.ts b/packages/instant/src/util/asset.ts
index 709561dbc..b5c97913d 100644
--- a/packages/instant/src/util/asset.ts
+++ b/packages/instant/src/util/asset.ts
@@ -114,15 +114,18 @@ export const assetUtils = {
const assetName = assetUtils.bestNameForAsset(asset, 'of this asset');
if (
error instanceof InsufficientAssetLiquidityError &&
- error.amountAvailableToFill.greaterThan(BIG_NUMBER_ZERO)
+ error.amountAvailableToFill.isGreaterThan(BIG_NUMBER_ZERO)
) {
const unitAmountAvailableToFill = Web3Wrapper.toUnitAmount(
error.amountAvailableToFill,
asset.metaData.decimals,
);
- const roundedUnitAmountAvailableToFill = unitAmountAvailableToFill.round(2, BigNumber.ROUND_DOWN);
+ const roundedUnitAmountAvailableToFill = unitAmountAvailableToFill.decimalPlaces(
+ 2,
+ BigNumber.ROUND_DOWN,
+ );
- if (roundedUnitAmountAvailableToFill.greaterThan(BIG_NUMBER_ZERO)) {
+ if (roundedUnitAmountAvailableToFill.isGreaterThan(BIG_NUMBER_ZERO)) {
return `There are only ${roundedUnitAmountAvailableToFill} ${assetName} available to buy`;
}
}
diff --git a/packages/instant/src/util/format.ts b/packages/instant/src/util/format.ts
index 4adb63e21..61aeb839f 100644
--- a/packages/instant/src/util/format.ts
+++ b/packages/instant/src/util/format.ts
@@ -25,16 +25,16 @@ export const format = {
if (_.isUndefined(ethUnitAmount)) {
return defaultText;
}
- let roundedAmount = ethUnitAmount.round(decimalPlaces).toDigits(decimalPlaces);
+ let roundedAmount = ethUnitAmount.decimalPlaces(decimalPlaces).precision(decimalPlaces);
- if (roundedAmount.eq(BIG_NUMBER_ZERO) && ethUnitAmount.greaterThan(BIG_NUMBER_ZERO)) {
+ if (roundedAmount.eq(BIG_NUMBER_ZERO) && ethUnitAmount.isGreaterThan(BIG_NUMBER_ZERO)) {
// Sometimes for small ETH amounts (i.e. 0.000045) the amount rounded to 4 decimalPlaces is 0
// If that is the case, show to 1 significant digit
roundedAmount = new BigNumber(ethUnitAmount.toPrecision(1));
}
const displayAmount =
- roundedAmount.greaterThan(BIG_NUMBER_ZERO) && roundedAmount.lessThan(minUnitAmountToDisplay)
+ roundedAmount.isGreaterThan(BIG_NUMBER_ZERO) && roundedAmount.isLessThan(minUnitAmountToDisplay)
? `< ${minUnitAmountToDisplay.toString()}`
: roundedAmount.toString();
@@ -62,7 +62,7 @@ export const format = {
if (_.isUndefined(ethUnitAmount) || _.isUndefined(ethUsdPrice)) {
return defaultText;
}
- const rawUsdPrice = ethUnitAmount.mul(ethUsdPrice);
+ const rawUsdPrice = ethUnitAmount.multipliedBy(ethUsdPrice);
const roundedUsdPrice = rawUsdPrice.toFixed(decimalPlaces);
if (roundedUsdPrice === '0.00' && rawUsdPrice.gt(BIG_NUMBER_ZERO)) {
return '<$0.01';
diff --git a/packages/instant/src/util/gas_price_estimator.ts b/packages/instant/src/util/gas_price_estimator.ts
index 332c8d00a..9792b60ba 100644
--- a/packages/instant/src/util/gas_price_estimator.ts
+++ b/packages/instant/src/util/gas_price_estimator.ts
@@ -35,7 +35,7 @@ const fetchFastAmountInWeiAsync = async (): Promise<GasInfo> => {
const gasPriceInGwei = new BigNumber(gasInfo.fast / 10);
// Time is in minutes
const estimatedTimeMs = gasInfo.fastWait * 60 * 1000; // Minutes to MS
- return { gasPriceInWei: gasPriceInGwei.mul(GWEI_IN_WEI), estimatedTimeMs };
+ return { gasPriceInWei: gasPriceInGwei.multipliedBy(GWEI_IN_WEI), estimatedTimeMs };
};
export class GasPriceEstimator {
diff --git a/packages/instant/src/util/maybe_big_number.ts b/packages/instant/src/util/maybe_big_number.ts
index 9d3746e10..f48473389 100644
--- a/packages/instant/src/util/maybe_big_number.ts
+++ b/packages/instant/src/util/maybe_big_number.ts
@@ -18,7 +18,7 @@ export const maybeBigNumberUtil = {
},
areMaybeBigNumbersEqual: (val1: Maybe<BigNumber>, val2: Maybe<BigNumber>): boolean => {
if (!_.isUndefined(val1) && !_.isUndefined(val2)) {
- return val1.equals(val2);
+ return val1.isEqualTo(val2);
}
return _.isUndefined(val1) && _.isUndefined(val2);
},
diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json
index 1388b4dca..66de84299 100644
--- a/packages/json-schemas/CHANGELOG.json
+++ b/packages/json-schemas/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "3.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "2.1.7",
"changes": [
diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json
index 4bd2bc66f..3b082f075 100644
--- a/packages/metacoin/package.json
+++ b/packages/metacoin/package.json
@@ -53,7 +53,7 @@
"@0x/sol-compiler": "^2.0.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",
"npm-run-all": "^4.1.2",
diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json
index 5962a9886..64ae94b14 100644
--- a/packages/migrations/CHANGELOG.json
+++ b/packages/migrations/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "3.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"version": "2.4.0",
"changes": [
{
diff --git a/packages/monorepo-scripts/CHANGELOG.json b/packages/monorepo-scripts/CHANGELOG.json
index cebe7ec72..a71bfbd6d 100644
--- a/packages/monorepo-scripts/CHANGELOG.json
+++ b/packages/monorepo-scripts/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"version": "1.0.6",
"changes": [
{
diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json
index ace3656c4..08d88da5b 100644
--- a/packages/order-utils/CHANGELOG.json
+++ b/packages/order-utils/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "4.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "3.1.2",
"changes": [
diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json
index bdcbd2dfc..7a4d4aa84 100644
--- a/packages/order-utils/package.json
+++ b/packages/order-utils/package.json
@@ -41,7 +41,7 @@
"@types/lodash": "4.14.104",
"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-utils/src/crypto.ts b/packages/order-utils/src/crypto.ts
index 0f1504a72..8b835ff48 100644
--- a/packages/order-utils/src/crypto.ts
+++ b/packages/order-utils/src/crypto.ts
@@ -1,3 +1,4 @@
+import { BigNumber } from '@0x/utils';
import BN = require('bn.js');
import ABI = require('ethereumjs-abi');
import ethUtil = require('ethereumjs-util');
@@ -24,7 +25,7 @@ export const crypto = {
const isNumber = _.isFinite(arg);
if (isNumber) {
argTypes.push('uint8');
- } else if (arg.isBigNumber) {
+ } else if (BigNumber.isBigNumber(arg)) {
argTypes.push('uint256');
const base = 10;
args[i] = new BN(arg.toString(base), base);
diff --git a/packages/order-utils/src/exchange_transfer_simulator.ts b/packages/order-utils/src/exchange_transfer_simulator.ts
index 06621fd9e..922ae8e17 100644
--- a/packages/order-utils/src/exchange_transfer_simulator.ts
+++ b/packages/order-utils/src/exchange_transfer_simulator.ts
@@ -88,14 +88,14 @@ export class ExchangeTransferSimulator {
}
const balance = await this._store.getBalanceAsync(assetData, from);
const proxyAllowance = await this._store.getProxyAllowanceAsync(assetData, from);
- if (proxyAllowance.lessThan(amountInBaseUnits)) {
+ if (proxyAllowance.isLessThan(amountInBaseUnits)) {
ExchangeTransferSimulator._throwValidationError(
FailureReason.ProxyAllowance,
tradeSide,
transferType,
);
}
- if (balance.lessThan(amountInBaseUnits)) {
+ if (balance.isLessThan(amountInBaseUnits)) {
ExchangeTransferSimulator._throwValidationError(FailureReason.Balance, tradeSide, transferType);
}
await this._decreaseProxyAllowanceAsync(assetData, from, amountInBaseUnits);
diff --git a/packages/order-utils/src/market_utils.ts b/packages/order-utils/src/market_utils.ts
index fa32f1413..9042551fa 100644
--- a/packages/order-utils/src/market_utils.ts
+++ b/packages/order-utils/src/market_utils.ts
@@ -52,7 +52,7 @@ export const marketUtils = {
const result = _.reduce(
orders,
({ resultOrders, remainingFillAmount, ordersRemainingFillableMakerAssetAmounts }, order, index) => {
- if (remainingFillAmount.lessThanOrEqualTo(constants.ZERO_AMOUNT)) {
+ if (remainingFillAmount.isLessThanOrEqualTo(constants.ZERO_AMOUNT)) {
return {
resultOrders,
remainingFillAmount: constants.ZERO_AMOUNT,
@@ -137,7 +137,7 @@ export const marketUtils = {
(accFees, order, index) => {
const makerAssetAmountAvailable = remainingFillableMakerAssetAmounts[index];
const feeToFillMakerAssetAmountAvailable = makerAssetAmountAvailable
- .mul(order.takerFee)
+ .multipliedBy(order.takerFee)
.dividedToIntegerBy(order.makerAssetAmount);
return accFees.plus(feeToFillMakerAssetAmountAvailable);
},
diff --git a/packages/order-utils/src/order_state_utils.ts b/packages/order-utils/src/order_state_utils.ts
index 389419587..430178b5d 100644
--- a/packages/order-utils/src/order_state_utils.ts
+++ b/packages/order-utils/src/order_state_utils.ts
@@ -214,10 +214,10 @@ export class OrderStateUtils {
const remainingFillableTakerAssetAmountGivenTakersStatus = orderRelevantTakerState.remainingFillableAssetAmount;
// The min of these two in the actualy max fillable by either party
- const fillableTakerAssetAmount = BigNumber.min([
+ const fillableTakerAssetAmount = BigNumber.min(
remainingFillableTakerAssetAmountGivenMakersStatus,
remainingFillableTakerAssetAmountGivenTakersStatus,
- ]);
+ );
return fillableTakerAssetAmount;
}
@@ -260,8 +260,8 @@ export class OrderStateUtils {
traderAddress,
);
- const transferrableTraderAssetAmount = BigNumber.min([traderProxyAllowance, traderBalance]);
- const transferrableFeeAssetAmount = BigNumber.min([traderFeeProxyAllowance, traderFeeBalance]);
+ const transferrableTraderAssetAmount = BigNumber.min(traderProxyAllowance, traderBalance);
+ const transferrableFeeAssetAmount = BigNumber.min(traderFeeProxyAllowance, traderFeeBalance);
const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
const filledTakerAssetAmount = await this._orderFilledCancelledFetcher.getFilledTakerAmountAsync(orderHash);
@@ -312,7 +312,7 @@ export class OrderStateUtils {
const tokenAddress = decodedAssetData.tokenAddress;
balances[tokenAddress] = _.isUndefined(initialBalances[tokenAddress])
? balance
- : balances[tokenAddress].add(balance);
+ : balances[tokenAddress].plus(balance);
} else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
for (const assetDataElement of decodedAssetData.nestedAssetData) {
balances = await this._getAssetBalancesAsync(assetDataElement, traderAddress, balances);
@@ -335,7 +335,7 @@ export class OrderStateUtils {
const tokenAddress = decodedAssetData.tokenAddress;
allowances[tokenAddress] = _.isUndefined(initialAllowances[tokenAddress])
? allowance
- : allowances[tokenAddress].add(allowance);
+ : allowances[tokenAddress].plus(allowance);
} else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
for (const assetDataElement of decodedAssetData.nestedAssetData) {
allowances = await this._getAssetBalancesAsync(assetDataElement, traderAddress, allowances);
diff --git a/packages/order-utils/src/order_validation_utils.ts b/packages/order-utils/src/order_validation_utils.ts
index ae4291ea8..95215d918 100644
--- a/packages/order-utils/src/order_validation_utils.ts
+++ b/packages/order-utils/src/order_validation_utils.ts
@@ -31,13 +31,13 @@ export class OrderValidationUtils {
if (denominator.eq(0)) {
throw new Error('denominator cannot be 0');
}
- const remainder = target.mul(numerator).mod(denominator);
+ const remainder = target.multipliedBy(numerator).mod(denominator);
if (remainder.eq(0)) {
return false; // no rounding error
}
// tslint:disable-next-line:custom-no-magic-numbers
- const errPercentageTimes1000000 = remainder.mul(1000000).div(numerator.mul(target));
+ const errPercentageTimes1000000 = remainder.multipliedBy(1000000).div(numerator.multipliedBy(target));
// tslint:disable-next-line:custom-no-magic-numbers
const isError = errPercentageTimes1000000.gt(1000);
return isError;
@@ -108,7 +108,7 @@ export class OrderValidationUtils {
}
private static _validateOrderNotExpiredOrThrow(expirationTimeSeconds: BigNumber): void {
const currentUnixTimestampSec = utils.getCurrentUnixTimestampSec();
- if (expirationTimeSeconds.lessThan(currentUnixTimestampSec)) {
+ if (expirationTimeSeconds.isLessThan(currentUnixTimestampSec)) {
throw new Error(RevertReason.OrderUnfillable);
}
}
@@ -216,7 +216,7 @@ export class OrderValidationUtils {
}
OrderValidationUtils._validateOrderNotExpiredOrThrow(signedOrder.expirationTimeSeconds);
const remainingTakerTokenAmount = signedOrder.takerAssetAmount.minus(filledTakerTokenAmount);
- const desiredFillTakerTokenAmount = remainingTakerTokenAmount.lessThan(fillTakerAssetAmount)
+ const desiredFillTakerTokenAmount = remainingTakerTokenAmount.isLessThan(fillTakerAssetAmount)
? remainingTakerTokenAmount
: fillTakerAssetAmount;
try {
diff --git a/packages/order-utils/src/rate_utils.ts b/packages/order-utils/src/rate_utils.ts
index 416e00c67..dacdbd5a2 100644
--- a/packages/order-utils/src/rate_utils.ts
+++ b/packages/order-utils/src/rate_utils.ts
@@ -22,7 +22,7 @@ export const rateUtils = {
feeRate.gte(constants.ZERO_AMOUNT),
`Expected feeRate: ${feeRate} to be greater than or equal to 0`,
);
- const takerAssetAmountNeededToPayForFees = order.takerFee.mul(feeRate);
+ const takerAssetAmountNeededToPayForFees = order.takerFee.multipliedBy(feeRate);
const totalTakerAssetAmount = takerAssetAmountNeededToPayForFees.plus(order.takerAssetAmount);
const rate = totalTakerAssetAmount.div(order.makerAssetAmount);
return rate;
@@ -35,9 +35,9 @@ export const rateUtils = {
*/
getFeeAdjustedRateOfFeeOrder(feeOrder: Order): BigNumber {
assert.doesConformToSchema('feeOrder', feeOrder, schemas.orderSchema);
- const zrxAmountAfterFees = feeOrder.makerAssetAmount.sub(feeOrder.takerFee);
+ const zrxAmountAfterFees = feeOrder.makerAssetAmount.minus(feeOrder.takerFee);
assert.assert(
- zrxAmountAfterFees.greaterThan(constants.ZERO_AMOUNT),
+ zrxAmountAfterFees.isGreaterThan(constants.ZERO_AMOUNT),
`Expected takerFee: ${JSON.stringify(feeOrder.takerFee)} to be less than makerAssetAmount: ${JSON.stringify(
feeOrder.makerAssetAmount,
)}`,
diff --git a/packages/order-utils/src/remaining_fillable_calculator.ts b/packages/order-utils/src/remaining_fillable_calculator.ts
index 052eafa1d..92ffc8e80 100644
--- a/packages/order-utils/src/remaining_fillable_calculator.ts
+++ b/packages/order-utils/src/remaining_fillable_calculator.ts
@@ -39,15 +39,15 @@ export class RemainingFillableCalculator {
private _hasSufficientFundsForFeeAndTransferAmount(): boolean {
if (this._isTraderAssetZRX) {
const totalZRXTransferAmountRequired = this._remainingOrderAssetAmount.plus(this._remainingOrderFeeAmount);
- const hasSufficientFunds = this._transferrableAssetAmount.greaterThanOrEqualTo(
+ const hasSufficientFunds = this._transferrableAssetAmount.isGreaterThanOrEqualTo(
totalZRXTransferAmountRequired,
);
return hasSufficientFunds;
} else {
- const hasSufficientFundsForTransferAmount = this._transferrableAssetAmount.greaterThanOrEqualTo(
+ const hasSufficientFundsForTransferAmount = this._transferrableAssetAmount.isGreaterThanOrEqualTo(
this._remainingOrderAssetAmount,
);
- const hasSufficientFundsForFeeAmount = this._transferrableFeeAmount.greaterThanOrEqualTo(
+ const hasSufficientFundsForFeeAmount = this._transferrableFeeAmount.isGreaterThanOrEqualTo(
this._remainingOrderFeeAmount,
);
const hasSufficientFunds = hasSufficientFundsForTransferAmount && hasSufficientFundsForFeeAmount;
diff --git a/packages/order-utils/src/salt.ts b/packages/order-utils/src/salt.ts
index ff47ab5d2..95df66c99 100644
--- a/packages/order-utils/src/salt.ts
+++ b/packages/order-utils/src/salt.ts
@@ -13,6 +13,6 @@ export function generatePseudoRandomSalt(): BigNumber {
// Source: https://mikemcl.github.io/bignumber.js/#random
const randomNumber = BigNumber.random(MAX_DIGITS_IN_UNSIGNED_256_INT);
const factor = new BigNumber(10).pow(MAX_DIGITS_IN_UNSIGNED_256_INT - 1);
- const salt = randomNumber.times(factor).round();
+ const salt = randomNumber.times(factor).integerValue();
return salt;
}
diff --git a/packages/order-utils/src/utils.ts b/packages/order-utils/src/utils.ts
index 6b2261001..64195dbed 100644
--- a/packages/order-utils/src/utils.ts
+++ b/packages/order-utils/src/utils.ts
@@ -10,13 +10,13 @@ export const utils = {
},
getCurrentUnixTimestampSec(): BigNumber {
const milisecondsInSecond = 1000;
- return new BigNumber(Date.now() / milisecondsInSecond).round();
+ return new BigNumber(Date.now() / milisecondsInSecond).integerValue();
},
getPartialAmountFloor(numerator: BigNumber, denominator: BigNumber, target: BigNumber): BigNumber {
const fillMakerTokenAmount = numerator
- .mul(target)
+ .multipliedBy(target)
.div(denominator)
- .round(0);
+ .integerValue(0);
return fillMakerTokenAmount;
},
};
diff --git a/packages/order-utils/test/remaining_fillable_calculator_test.ts b/packages/order-utils/test/remaining_fillable_calculator_test.ts
index c55a76def..affad8f1c 100644
--- a/packages/order-utils/test/remaining_fillable_calculator_test.ts
+++ b/packages/order-utils/test/remaining_fillable_calculator_test.ts
@@ -162,7 +162,7 @@ describe('RemainingFillableCalculator', () => {
remainingMakeAssetAmount,
);
const calculatedFillableAmount = calculator.computeRemainingFillable();
- expect(calculatedFillableAmount.lessThanOrEqualTo(transferrableMakeAssetAmount)).to.be.true();
+ expect(calculatedFillableAmount.isLessThanOrEqualTo(transferrableMakeAssetAmount)).to.be.true();
expect(calculatedFillableAmount).to.be.bignumber.greaterThan(new BigNumber(0));
const orderToFeeRatio = signedOrder.makerAssetAmount.dividedBy(signedOrder.makerFee);
const calculatedFeeAmount = calculatedFillableAmount.dividedBy(orderToFeeRatio);
diff --git a/packages/order-utils/test/signature_utils_test.ts b/packages/order-utils/test/signature_utils_test.ts
index 84e5559a9..937382056 100644
--- a/packages/order-utils/test/signature_utils_test.ts
+++ b/packages/order-utils/test/signature_utils_test.ts
@@ -132,10 +132,10 @@ describe('Signature utils', () => {
});
it('generates salt in range [0..2^256)', () => {
const salt = generatePseudoRandomSalt();
- expect(salt.greaterThanOrEqualTo(0)).to.be.true();
+ expect(salt.isGreaterThanOrEqualTo(0)).to.be.true();
// tslint:disable-next-line:custom-no-magic-numbers
const twoPow256 = new BigNumber(2).pow(256);
- expect(salt.lessThan(twoPow256)).to.be.true();
+ expect(salt.isLessThan(twoPow256)).to.be.true();
});
});
describe('#ecSignOrderAsync', () => {
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) => {
diff --git a/packages/pipeline/package.json b/packages/pipeline/package.json
index 988dd8b74..908734687 100644
--- a/packages/pipeline/package.json
+++ b/packages/pipeline/package.json
@@ -32,7 +32,7 @@
"@types/ramda": "^0.25.38",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
- "chai-bignumber": "^2.0.2",
+ "chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"mocha": "^5.2.0",
"tslint": "5.11.0",
diff --git a/packages/pipeline/src/utils/transformers/number_to_bigint.ts b/packages/pipeline/src/utils/transformers/number_to_bigint.ts
index 9736d7c18..8fbd52093 100644
--- a/packages/pipeline/src/utils/transformers/number_to_bigint.ts
+++ b/packages/pipeline/src/utils/transformers/number_to_bigint.ts
@@ -19,7 +19,7 @@ export class NumberToBigIntTransformer implements ValueTransformer {
// tslint:disable-next-line:prefer-function-over-method
public from(value: string): number {
- if (new BigNumber(value).greaterThan(Number.MAX_SAFE_INTEGER)) {
+ if (new BigNumber(value).isGreaterThan(Number.MAX_SAFE_INTEGER)) {
throw new Error(
`Attempted to convert PostgreSQL bigint value (${value}) to JavaScript number type but it is too big to safely convert`,
);
diff --git a/packages/react-docs/CHANGELOG.json b/packages/react-docs/CHANGELOG.json
index 101da65c7..8b418fc11 100644
--- a/packages/react-docs/CHANGELOG.json
+++ b/packages/react-docs/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "1.0.25",
"changes": [
diff --git a/packages/react-shared/CHANGELOG.json b/packages/react-shared/CHANGELOG.json
index a6d2c4fa0..99a8779ac 100644
--- a/packages/react-shared/CHANGELOG.json
+++ b/packages/react-shared/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "1.1.2",
"changes": [
diff --git a/packages/sol-compiler/CHANGELOG.json b/packages/sol-compiler/CHANGELOG.json
index d7dd5a454..672939a4a 100644
--- a/packages/sol-compiler/CHANGELOG.json
+++ b/packages/sol-compiler/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "3.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "2.0.2",
"changes": [
diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json
index 26c8e8833..0b53cffd5 100644
--- a/packages/sol-compiler/package.json
+++ b/packages/sol-compiler/package.json
@@ -51,7 +51,7 @@
"@types/semver": "^5.5.0",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
- "chai-bignumber": "^2.0.2",
+ "chai-bignumber": "^3.0.0",
"copyfiles": "^2.0.0",
"dirty-chai": "^2.0.1",
"make-promises-safe": "^1.1.0",
diff --git a/packages/sol-coverage/CHANGELOG.json b/packages/sol-coverage/CHANGELOG.json
index d2ad03030..550ca2feb 100644
--- a/packages/sol-coverage/CHANGELOG.json
+++ b/packages/sol-coverage/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547747677,
"version": "1.0.3",
"changes": [
diff --git a/packages/sol-doc/CHANGELOG.json b/packages/sol-doc/CHANGELOG.json
index f95702ee4..662915faf 100644
--- a/packages/sol-doc/CHANGELOG.json
+++ b/packages/sol-doc/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "1.0.14",
"changes": [
diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json
index dee6ef2e5..179f45e81 100644
--- a/packages/sol-doc/package.json
+++ b/packages/sol-doc/package.json
@@ -37,7 +37,7 @@
"@0x/tslint-config": "^2.0.2",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.0",
- "chai-bignumber": "^2.0.2",
+ "chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"make-promises-safe": "^1.1.0",
"mocha": "^5.2.0",
diff --git a/packages/sol-profiler/CHANGELOG.json b/packages/sol-profiler/CHANGELOG.json
index d2ad03030..550ca2feb 100644
--- a/packages/sol-profiler/CHANGELOG.json
+++ b/packages/sol-profiler/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547747677,
"version": "1.0.3",
"changes": [
diff --git a/packages/sol-resolver/CHANGELOG.json b/packages/sol-resolver/CHANGELOG.json
index e5f4a8ac1..f5a005fd4 100644
--- a/packages/sol-resolver/CHANGELOG.json
+++ b/packages/sol-resolver/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "1.2.3",
"changes": [
diff --git a/packages/sol-trace/CHANGELOG.json b/packages/sol-trace/CHANGELOG.json
index d2ad03030..550ca2feb 100644
--- a/packages/sol-trace/CHANGELOG.json
+++ b/packages/sol-trace/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547747677,
"version": "1.0.3",
"changes": [
diff --git a/packages/sol-tracing-utils/CHANGELOG.json b/packages/sol-tracing-utils/CHANGELOG.json
index 7e98003f7..ef96dc69b 100644
--- a/packages/sol-tracing-utils/CHANGELOG.json
+++ b/packages/sol-tracing-utils/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "5.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"version": "4.0.1",
"changes": [
{
diff --git a/packages/sra-spec/CHANGELOG.json b/packages/sra-spec/CHANGELOG.json
index 3f2a9fbc1..e22a3b0e4 100644
--- a/packages/sra-spec/CHANGELOG.json
+++ b/packages/sra-spec/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "1.0.16",
"changes": [
diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json
index dd4dccf4e..68f2e4110 100644
--- a/packages/subproviders/CHANGELOG.json
+++ b/packages/subproviders/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "3.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "2.1.11",
"changes": [
diff --git a/packages/testnet-faucets/src/ts/dispense_asset_tasks.ts b/packages/testnet-faucets/src/ts/dispense_asset_tasks.ts
index 32f5cb623..58caeeeaa 100644
--- a/packages/testnet-faucets/src/ts/dispense_asset_tasks.ts
+++ b/packages/testnet-faucets/src/ts/dispense_asset_tasks.ts
@@ -19,7 +19,7 @@ export const dispenseAssetTasks = {
logUtils.log(`Processing ETH ${recipientAddress}`);
const userBalance = await web3Wrapper.getBalanceInWeiAsync(recipientAddress);
const maxAmountInWei = Web3Wrapper.toWei(new BigNumber(DISPENSE_MAX_AMOUNT_ETHER));
- if (userBalance.greaterThanOrEqualTo(maxAmountInWei)) {
+ if (userBalance.isGreaterThanOrEqualTo(maxAmountInWei)) {
logUtils.log(
`User exceeded ETH balance maximum (${maxAmountInWei}) ${recipientAddress} ${userBalance} `,
);
@@ -55,7 +55,7 @@ export const dispenseAssetTasks = {
new BigNumber(DISPENSE_MAX_AMOUNT_TOKEN),
tokenIfExists.decimals,
);
- if (userBalanceBaseUnits.greaterThanOrEqualTo(maxAmountBaseUnits)) {
+ if (userBalanceBaseUnits.isGreaterThanOrEqualTo(maxAmountBaseUnits)) {
logUtils.log(
`User exceeded token balance maximum (${maxAmountBaseUnits}) ${recipientAddress} ${userBalanceBaseUnits} `,
);
diff --git a/packages/testnet-faucets/src/ts/handler.ts b/packages/testnet-faucets/src/ts/handler.ts
index 8f642d4b0..533e1f8b3 100644
--- a/packages/testnet-faucets/src/ts/handler.ts
+++ b/packages/testnet-faucets/src/ts/handler.ts
@@ -178,8 +178,10 @@ export class Handler {
exchangeAddress: networkConfig.contractWrappers.exchange.address,
feeRecipientAddress: NULL_ADDRESS,
senderAddress: NULL_ADDRESS,
- // tslint:disable-next-line:custom-no-magic-numbers
- expirationTimeSeconds: new BigNumber(Date.now() + FIVE_DAYS_IN_MS).div(1000).floor(),
+ expirationTimeSeconds: new BigNumber(Date.now() + FIVE_DAYS_IN_MS)
+ // tslint:disable-next-line:custom-no-magic-numbers
+ .div(1000)
+ .integerValue(BigNumber.ROUND_FLOOR),
};
const orderHash = orderHashUtils.getOrderHashHex(order);
const signature = await signatureUtils.ecSignHashAsync(
diff --git a/packages/tslint-config/CHANGELOG.json b/packages/tslint-config/CHANGELOG.json
index fe34592fd..34ea6aa6b 100644
--- a/packages/tslint-config/CHANGELOG.json
+++ b/packages/tslint-config/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "3.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "2.0.2",
"changes": [
diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json
index 40a46ac84..7a6d205ee 100644
--- a/packages/types/CHANGELOG.json
+++ b/packages/types/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "1.5.2",
"changes": [
diff --git a/packages/types/package.json b/packages/types/package.json
index 2fea809bc..440f05423 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -31,7 +31,7 @@
},
"dependencies": {
"@types/node": "*",
- "bignumber.js": "~4.1.0",
+ "bignumber.js": "~8.0.2",
"ethereum-types": "^1.1.6"
},
"publishConfig": {
diff --git a/packages/typescript-typings/CHANGELOG.json b/packages/typescript-typings/CHANGELOG.json
index cc7ef7fa4..e3ae60231 100644
--- a/packages/typescript-typings/CHANGELOG.json
+++ b/packages/typescript-typings/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "4.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "3.0.8",
"changes": [
diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json
index 6640760e4..01cab8c63 100644
--- a/packages/typescript-typings/package.json
+++ b/packages/typescript-typings/package.json
@@ -26,7 +26,7 @@
"dependencies": {
"@types/bn.js": "^4.11.0",
"@types/react": "*",
- "bignumber.js": "~4.1.0",
+ "bignumber.js": "~8.0.2",
"ethereum-types": "^1.1.6",
"popper.js": "1.14.3"
},
diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json
index 851c106d8..0fb199e58 100644
--- a/packages/utils/CHANGELOG.json
+++ b/packages/utils/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "4.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "3.0.1",
"changes": [
diff --git a/packages/utils/package.json b/packages/utils/package.json
index 315f5a08f..b6be39210 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -34,7 +34,7 @@
"@types/mocha": "^2.2.42",
"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",
@@ -48,7 +48,7 @@
"@0x/typescript-typings": "^3.0.8",
"@types/node": "*",
"abortcontroller-polyfill": "^1.1.9",
- "bignumber.js": "~4.1.0",
+ "bignumber.js": "~8.0.2",
"chalk": "^2.4.1",
"detect-node": "2.0.3",
"ethereum-types": "^1.1.6",
diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts
index 2da46db35..28b6418d8 100644
--- a/packages/utils/src/abi_decoder.ts
+++ b/packages/utils/src/abi_decoder.ts
@@ -69,7 +69,7 @@ export class AbiDecoder {
}
if (param.type === SolidityTypes.Address) {
const baseHex = 16;
- value = addressUtils.padZeros(new BigNumber(value).toString(baseHex));
+ value = addressUtils.padZeros(new BigNumber((value as string).toLowerCase()).toString(baseHex));
} else if (param.type === SolidityTypes.Uint256 || param.type === SolidityTypes.Uint) {
value = new BigNumber(value);
} else if (param.type === SolidityTypes.Uint8) {
diff --git a/packages/utils/src/abi_encoder/evm_data_types/bool.ts b/packages/utils/src/abi_encoder/evm_data_types/bool.ts
index 7f91f34e6..23298bc88 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/bool.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/bool.ts
@@ -37,11 +37,11 @@ export class BoolDataType extends AbstractBlobDataType {
const valueBuf = calldata.popWord();
const valueHex = ethUtil.bufferToHex(valueBuf);
const valueNumber = new BigNumber(valueHex, constants.HEX_BASE);
- if (!(valueNumber.equals(0) || valueNumber.equals(1))) {
+ if (!(valueNumber.isEqualTo(0) || valueNumber.isEqualTo(1))) {
throw new Error(`Failed to decode boolean. Expected 0x0 or 0x1, got ${valueHex}`);
}
/* tslint:disable boolean-naming */
- const value: boolean = !valueNumber.equals(0);
+ const value: boolean = !valueNumber.isEqualTo(0);
/* tslint:enable boolean-naming */
return value;
}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/int.ts b/packages/utils/src/abi_encoder/evm_data_types/int.ts
index cc3164b18..f8be1f778 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/int.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/int.ts
@@ -38,8 +38,8 @@ export class IntDataType extends AbstractBlobDataType {
throw new Error(`Tried to instantiate Int with bad input: ${dataItem}`);
}
this._width = IntDataType._decodeWidthFromType(dataItem.type);
- this._minValue = new BigNumber(2).toPower(this._width - 1).times(-1);
- this._maxValue = new BigNumber(2).toPower(this._width - 1).sub(1);
+ this._minValue = new BigNumber(2).exponentiatedBy(this._width - 1).times(-1);
+ this._maxValue = new BigNumber(2).exponentiatedBy(this._width - 1).minus(1);
}
public encodeValue(value: BigNumber | string | number): Buffer {
diff --git a/packages/utils/src/abi_encoder/evm_data_types/uint.ts b/packages/utils/src/abi_encoder/evm_data_types/uint.ts
index 8e382e8dc..a82aa789e 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/uint.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/uint.ts
@@ -38,7 +38,7 @@ export class UIntDataType extends AbstractBlobDataType {
throw new Error(`Tried to instantiate UInt with bad input: ${dataItem}`);
}
this._width = UIntDataType._decodeWidthFromType(dataItem.type);
- this._maxValue = new BigNumber(2).toPower(this._width).sub(1);
+ this._maxValue = new BigNumber(2).exponentiatedBy(this._width).minus(1);
}
public encodeValue(value: BigNumber | string | number): Buffer {
diff --git a/packages/utils/src/abi_encoder/utils/math.ts b/packages/utils/src/abi_encoder/utils/math.ts
index d84983c5b..a2a79e2a8 100644
--- a/packages/utils/src/abi_encoder/utils/math.ts
+++ b/packages/utils/src/abi_encoder/utils/math.ts
@@ -1,7 +1,7 @@
-import BigNumber from 'bignumber.js';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
+import { BigNumber } from '../../configured_bignumber';
import { constants } from '../utils/constants';
function sanityCheckBigNumberRange(
@@ -10,10 +10,12 @@ function sanityCheckBigNumberRange(
maxValue: BigNumber,
): void {
const value = new BigNumber(value_, 10);
- if (value.greaterThan(maxValue)) {
+ if (value.isGreaterThan(maxValue)) {
throw new Error(`Tried to assign value of ${value}, which exceeds max value of ${maxValue}`);
- } else if (value.lessThan(minValue)) {
+ } else if (value.isLessThan(minValue)) {
throw new Error(`Tried to assign value of ${value}, which exceeds min value of ${minValue}`);
+ } else if (value.isNaN()) {
+ throw new Error(`Tried to assign NaN value`);
}
}
function bigNumberToPaddedBuffer(value: BigNumber): Buffer {
@@ -30,7 +32,7 @@ function bigNumberToPaddedBuffer(value: BigNumber): Buffer {
export function encodeNumericValue(value_: BigNumber | string | number): Buffer {
const value = new BigNumber(value_, 10);
// Case 1/2: value is non-negative
- if (value.greaterThanOrEqualTo(0)) {
+ if (value.isGreaterThanOrEqualTo(0)) {
const encodedPositiveValue = bigNumberToPaddedBuffer(value);
return encodedPositiveValue;
}
@@ -74,7 +76,7 @@ export function decodeNumericValue(encodedValue: Buffer, minValue: BigNumber): B
const valueHex = ethUtil.bufferToHex(encodedValue);
// Case 1/3: value is definitely non-negative because of numeric boundaries
const value = new BigNumber(valueHex, constants.HEX_BASE);
- if (!minValue.lessThan(0)) {
+ if (!minValue.isLessThan(0)) {
return value;
}
// Case 2/3: value is non-negative because there is no leading 1 (encoded as two's-complement)
diff --git a/packages/utils/src/sign_typed_data_utils.ts b/packages/utils/src/sign_typed_data_utils.ts
index 6963b9084..adb66622d 100644
--- a/packages/utils/src/sign_typed_data_utils.ts
+++ b/packages/utils/src/sign_typed_data_utils.ts
@@ -1,8 +1,9 @@
+import { EIP712Object, EIP712ObjectValue, EIP712TypedData, EIP712Types } from '@0x/types';
import * as ethUtil from 'ethereumjs-util';
import * as ethers from 'ethers';
import * as _ from 'lodash';
-import { EIP712Object, EIP712ObjectValue, EIP712TypedData, EIP712Types } from '@0x/types';
+import { BigNumber } from './configured_bignumber';
export const signTypedDataUtils = {
/**
@@ -70,7 +71,7 @@ export const signTypedDataUtils = {
return ethers.utils.defaultAbiCoder.encode(encodedTypes, encodedValues);
},
_normalizeValue(type: string, value: any): EIP712ObjectValue {
- const normalizedValue = type === 'uint256' && _.isObject(value) && value.isBigNumber ? value.toString() : value;
+ const normalizedValue = type === 'uint256' && BigNumber.isBigNumber(value) ? value.toString() : value;
return normalizedValue;
},
_typeHash(primaryType: string, types: EIP712Types): Buffer {
diff --git a/packages/utils/test/abi_encoder/evm_data_types_test.ts b/packages/utils/test/abi_encoder/evm_data_types_test.ts
index 54d536a7e..4814ce28b 100644
--- a/packages/utils/test/abi_encoder/evm_data_types_test.ts
+++ b/packages/utils/test/abi_encoder/evm_data_types_test.ts
@@ -205,7 +205,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Encode Args and validate result
expect(() => {
dataType.encode(args, encodingRules);
- }).to.throw();
+ }).to.throw('Tried to assign NaN value');
});
});
diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json
index b9d5a37b1..e05879ba8 100644
--- a/packages/web3-wrapper/CHANGELOG.json
+++ b/packages/web3-wrapper/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "4.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
"timestamp": 1547561734,
"version": "3.2.4",
"changes": [
diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json
index ce9c41ae7..1ef7f91c6 100644
--- a/packages/web3-wrapper/package.json
+++ b/packages/web3-wrapper/package.json
@@ -41,7 +41,7 @@
"@types/lodash": "4.14.104",
"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",
"ganache-core": "0xProject/ganache-core#monorepo-dep",
"make-promises-safe": "^1.1.0",
diff --git a/packages/web3-wrapper/src/utils.ts b/packages/web3-wrapper/src/utils.ts
index c68587632..1aba3c75a 100644
--- a/packages/web3-wrapper/src/utils.ts
+++ b/packages/web3-wrapper/src/utils.ts
@@ -2,10 +2,6 @@ import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
export const utils = {
- isBigNumber(value: any): boolean {
- const isBigNumber = _.isObject(value) && value.isBigNumber;
- return isBigNumber;
- },
convertHexToNumber(value: string): number {
const valueBigNumber = new BigNumber(value);
const valueNumber = valueBigNumber.toNumber();
@@ -20,7 +16,7 @@ export const utils = {
},
convertAmountToBigNumber(value: string | number | BigNumber): BigNumber {
const num = value || 0;
- const isBigNumber = utils.isBigNumber(num);
+ const isBigNumber = BigNumber.isBigNumber(num);
if (isBigNumber) {
return num as BigNumber;
}
@@ -37,7 +33,7 @@ export const utils = {
const hexBase = 16;
const valueHex = valueBigNumber.toString(hexBase);
- return valueBigNumber.lessThan(0) ? `-0x${valueHex.substr(1)}` : `0x${valueHex}`;
+ return valueBigNumber.isLessThan(0) ? `-0x${valueHex.substr(1)}` : `0x${valueHex}`;
},
numberToHex(value: number): string {
if (!isFinite(value) && !utils.isHexStrict(value)) {
diff --git a/packages/web3-wrapper/test/web3_wrapper_test.ts b/packages/web3-wrapper/test/web3_wrapper_test.ts
index 935c67636..b6985c155 100644
--- a/packages/web3-wrapper/test/web3_wrapper_test.ts
+++ b/packages/web3-wrapper/test/web3_wrapper_test.ts
@@ -1,10 +1,10 @@
+import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import { BlockParamLiteral, JSONRPCErrorCallback, JSONRPCRequestPayload, TransactionReceipt } from 'ethereum-types';
import * as Ganache from 'ganache-core';
import * as _ from 'lodash';
import 'mocha';
-import { utils } from '../src/utils';
import { Web3Wrapper } from '../src/web3_wrapper';
import { chaiSetup } from './utils/chai_setup';
@@ -118,7 +118,7 @@ describe('Web3Wrapper tests', () => {
throw new Error('Expected block to exist');
}
expect(blockIfExists.number).to.be.equal(0);
- expect(utils.isBigNumber(blockIfExists.difficulty)).to.equal(true);
+ expect(BigNumber.isBigNumber(blockIfExists.difficulty)).to.equal(true);
expect(_.isNumber(blockIfExists.gasLimit)).to.equal(true);
});
it('gets block when supplied a block number', async () => {
@@ -151,7 +151,7 @@ describe('Web3Wrapper tests', () => {
const blockParamLiteral = BlockParamLiteral.Earliest;
const block = await web3Wrapper.getBlockWithTransactionDataAsync(blockParamLiteral);
expect(block.number).to.be.equal(0);
- expect(utils.isBigNumber(block.difficulty)).to.equal(true);
+ expect(BigNumber.isBigNumber(block.difficulty)).to.equal(true);
expect(_.isNumber(block.gasLimit)).to.equal(true);
});
it('should throw if supplied invalid blockParam value', async () => {
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index 37f746f7c..ea5a59340 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -944,7 +944,7 @@ export class Blockchain {
try {
const gasInfo = await backendClient.getGasInfoAsync();
const gasPriceInGwei = new BigNumber(gasInfo.fast / 10);
- const gasPriceInWei = gasPriceInGwei.mul(1000000000);
+ const gasPriceInWei = gasPriceInGwei.multipliedBy(1000000000);
this._defaultGasPrice = gasPriceInWei;
} catch (err) {
return;
diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx
index 7fee8c4df..95a3671c4 100644
--- a/packages/website/ts/components/fill_order.tsx
+++ b/packages/website/ts/components/fill_order.tsx
@@ -205,7 +205,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
amount: orderMakerAmount
.times(takerAssetToken.amount)
.div(orderTakerAmount)
- .floor(),
+ .integerValue(BigNumber.ROUND_FLOOR),
symbol: makerToken.symbol,
};
const fillAssetToken = {
@@ -219,7 +219,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
const orderReceiveAmountBigNumber = orderMakerAmount
.times(this.props.orderFillAmount)
.dividedBy(orderTakerAmount)
- .floor();
+ .integerValue(BigNumber.ROUND_FLOOR);
orderReceiveAmount = this._formatCurrencyAmount(orderReceiveAmountBigNumber, makerToken.decimals);
}
const isUserMaker =
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index 890f1553a..e84f9d0cc 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -394,7 +394,7 @@ export const utils = {
},
getUsdValueFormattedAmount(amount: BigNumber, decimals: number, price: BigNumber): string {
const unitAmount = Web3Wrapper.toUnitAmount(amount, decimals);
- const value = unitAmount.mul(price);
+ const value = unitAmount.multipliedBy(price);
return utils.format(value, constants.NUMERAL_USD_FORMAT);
},
openUrl(url: string): void {
diff --git a/yarn.lock b/yarn.lock
index 7e0046213..a7c126151 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3391,6 +3391,10 @@ bignumber.js@~4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-4.1.0.tgz#db6f14067c140bd46624815a7916c92d9b6c24b1"
+bignumber.js@~8.0.2:
+ version "8.0.2"
+ resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-8.0.2.tgz#d8c4e1874359573b1ef03011a2d861214aeef137"
+
binary-extensions@^1.0.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205"
@@ -4035,9 +4039,9 @@ chai-as-promised@^7.1.0, chai-as-promised@^7.1.1:
dependencies:
check-error "^1.0.2"
-chai-bignumber@^2.0.1, chai-bignumber@^2.0.2:
- version "2.0.2"
- resolved "https://registry.yarnpkg.com/chai-bignumber/-/chai-bignumber-2.0.2.tgz#de6c219c690b2d66b646ad6930096f9ba2199643"
+chai-bignumber@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/chai-bignumber/-/chai-bignumber-3.0.0.tgz#e90cf1f468355bbb11a9acd051222586cd2648a9"
chai@^3.5.0:
version "3.5.0"