aboutsummaryrefslogtreecommitdiffstats
path: root/contracts
diff options
context:
space:
mode:
Diffstat (limited to 'contracts')
-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/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.ts122
-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/src/order_factory.ts2
-rw-r--r--contracts/test-utils/src/order_utils.ts4
12 files changed, 200 insertions, 198 deletions
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/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..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,
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/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) => {