diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-14 22:50:32 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-15 23:25:24 +0800 |
commit | c3afc13dd660348e99b727c2dd01930eec8d99c3 (patch) | |
tree | 9a05e88e55200fdf72d08af10b5a753535e23256 /contracts/protocol/test/exchange | |
parent | f570f80674c22f69712c45e8e3c48e948b51f357 (diff) | |
download | dexon-0x-contracts-c3afc13dd660348e99b727c2dd01930eec8d99c3.tar dexon-0x-contracts-c3afc13dd660348e99b727c2dd01930eec8d99c3.tar.gz dexon-0x-contracts-c3afc13dd660348e99b727c2dd01930eec8d99c3.tar.bz2 dexon-0x-contracts-c3afc13dd660348e99b727c2dd01930eec8d99c3.tar.lz dexon-0x-contracts-c3afc13dd660348e99b727c2dd01930eec8d99c3.tar.xz dexon-0x-contracts-c3afc13dd660348e99b727c2dd01930eec8d99c3.tar.zst dexon-0x-contracts-c3afc13dd660348e99b727c2dd01930eec8d99c3.zip |
Upgrade bignumber.js version
Diffstat (limited to 'contracts/protocol/test/exchange')
-rw-r--r-- | contracts/protocol/test/exchange/core.ts | 16 | ||||
-rw-r--r-- | contracts/protocol/test/exchange/dispatcher.ts | 2 | ||||
-rw-r--r-- | contracts/protocol/test/exchange/internal.ts | 54 | ||||
-rw-r--r-- | contracts/protocol/test/exchange/transactions.ts | 22 | ||||
-rw-r--r-- | contracts/protocol/test/exchange/wrapper.ts | 122 |
5 files changed, 108 insertions, 108 deletions
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..32ec64716 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,13 +493,13 @@ describe('Exchange wrappers', () => { erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][ makerAssetAddress ].minus(makerAssetFilledAmount); - erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add( + 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( + erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].plus( makerAssetFilledAmount, ); erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][ @@ -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,13 +562,13 @@ describe('Exchange wrappers', () => { erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][ makerAssetAddress ].minus(makerAssetFilledAmount); - erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add( + 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( + erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].plus( makerAssetFilledAmount, ); erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][ @@ -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,13 +647,13 @@ describe('Exchange wrappers', () => { erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][ makerAssetAddress ].minus(makerAssetFilledAmount); - erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add( + 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( + erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].plus( makerAssetFilledAmount, ); erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][ @@ -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,13 +706,13 @@ describe('Exchange wrappers', () => { erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][ makerAssetAddress ].minus(makerAssetFilledAmount); - erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add( + 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( + erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].plus( makerAssetFilledAmount, ); erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][ @@ -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, |