diff --git a/contracts/exchange-forwarder/contracts/src/MixinExchangeWrapper.sol b/contracts/exchange-forwarder/contracts/src/MixinExchangeWrapper.sol index c86285acb7..fa905835f0 100644 --- a/contracts/exchange-forwarder/contracts/src/MixinExchangeWrapper.sol +++ b/contracts/exchange-forwarder/contracts/src/MixinExchangeWrapper.sol @@ -148,7 +148,7 @@ contract MixinExchangeWrapper is /// @param signatures Proofs that orders have been signed by makers. /// @return totalWethSpentAmount Total amount of WETH spent on the given orders. /// @return totalMakerAssetAcquiredAmount Total amount of maker asset acquired from the given orders. - function _marketSellWeth( + function _marketSellNoThrow( LibOrder.Order[] memory orders, uint256 wethSellAmount, bytes[] memory signatures diff --git a/contracts/exchange-forwarder/contracts/src/MixinForwarderCore.sol b/contracts/exchange-forwarder/contracts/src/MixinForwarderCore.sol index d9d7669b97..545b43bc6d 100644 --- a/contracts/exchange-forwarder/contracts/src/MixinForwarderCore.sol +++ b/contracts/exchange-forwarder/contracts/src/MixinForwarderCore.sol @@ -63,7 +63,7 @@ contract MixinForwarderCore is /// as possible, accounting for order and forwarder fees. /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset. /// @param signatures Proofs that orders have been created by makers. - /// @param ethFeeAmounts Amounts of ETH, denominated in Wei, that are payed to corresponding feeRecipients. + /// @param ethFeeAmounts Amounts of ETH, denominated in Wei, that are paid to corresponding feeRecipients. /// @param feeRecipients Addresses that will receive ETH when orders are filled. /// @return wethSpentAmount Amount of WETH spent on the given set of orders. /// @return makerAssetAcquiredAmount Amount of maker asset acquired from the given set of orders. @@ -91,7 +91,7 @@ contract MixinForwarderCore is ( wethSpentAmount, makerAssetAcquiredAmount - ) = _marketSellWeth( + ) = _marketSellNoThrow( orders, wethRemaining, signatures @@ -108,7 +108,7 @@ contract MixinForwarderCore is /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset. /// @param makerAssetBuyAmount Desired amount of makerAsset to purchase. /// @param signatures Proofs that orders have been created by makers. - /// @param ethFeeAmounts Amounts of ETH, denominated in Wei, that are payed to corresponding feeRecipients. + /// @param ethFeeAmounts Amounts of ETH, denominated in Wei, that are paid to corresponding feeRecipients. /// @param feeRecipients Addresses that will receive ETH when orders are filled. /// @return wethSpentAmount Amount of WETH spent on the given set of orders. /// @return makerAssetAcquiredAmount Amount of maker asset acquired from the given set of orders. diff --git a/contracts/exchange-forwarder/contracts/src/MixinWeth.sol b/contracts/exchange-forwarder/contracts/src/MixinWeth.sol index e0e4758ab0..ecc7b6aba6 100644 --- a/contracts/exchange-forwarder/contracts/src/MixinWeth.sol +++ b/contracts/exchange-forwarder/contracts/src/MixinWeth.sol @@ -42,7 +42,7 @@ contract MixinWeth is } /// @dev Transfers ETH denominated fees to all feeRecipient addresses - /// @param ethFeeAmounts Amounts of ETH, denominated in Wei, that are payed to corresponding feeRecipients. + /// @param ethFeeAmounts Amounts of ETH, denominated in Wei, that are paid to corresponding feeRecipients. /// @param feeRecipients Addresses that will receive ETH when orders are filled. /// @return ethRemaining msg.value minus the amount of ETH spent on affiliate fees. function _transferEthFeesAndWrapRemaining( diff --git a/contracts/exchange-forwarder/contracts/src/interfaces/IForwarderCore.sol b/contracts/exchange-forwarder/contracts/src/interfaces/IForwarderCore.sol index 58a856f6bb..f37da3f1ba 100644 --- a/contracts/exchange-forwarder/contracts/src/interfaces/IForwarderCore.sol +++ b/contracts/exchange-forwarder/contracts/src/interfaces/IForwarderCore.sol @@ -29,7 +29,7 @@ contract IForwarderCore { /// as possible, accounting for order and forwarder fees. /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset. /// @param signatures Proofs that orders have been created by makers. - /// @param ethFeeAmounts Amounts of ETH, denominated in Wei, that are payed to corresponding feeRecipients. + /// @param ethFeeAmounts Amounts of ETH, denominated in Wei, that are paid to corresponding feeRecipients. /// @param feeRecipients Addresses that will receive ETH when orders are filled. /// @return wethSpentAmount Amount of WETH spent on the given set of orders. /// @return makerAssetAcquiredAmount Amount of maker asset acquired from the given set of orders. @@ -53,7 +53,7 @@ contract IForwarderCore { /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset. /// @param makerAssetBuyAmount Desired amount of makerAsset to purchase. /// @param signatures Proofs that orders have been created by makers. - /// @param ethFeeAmounts Amounts of ETH, denominated in Wei, that are payed to corresponding feeRecipients. + /// @param ethFeeAmounts Amounts of ETH, denominated in Wei, that are paid to corresponding feeRecipients. /// @param feeRecipients Addresses that will receive ETH when orders are filled. /// @return wethSpentAmount Amount of WETH spent on the given set of orders. /// @return makerAssetAcquiredAmount Amount of maker asset acquired from the given set of orders. diff --git a/contracts/integrations/test/forwarder/forwarder_test.ts b/contracts/integrations/test/forwarder/forwarder_test.ts index 02bad698c3..9ccb465415 100644 --- a/contracts/integrations/test/forwarder/forwarder_test.ts +++ b/contracts/integrations/test/forwarder/forwarder_test.ts @@ -655,13 +655,12 @@ blockchainTests('Forwarder integration tests', env => { forwarderFeeAmounts[0], value, ); - return expect( - forwarder - .marketBuyOrdersWithEth([order], order.makerAssetAmount, [order.signature], forwarderFeeAmounts, [ - randomAddress(), - ]) - .awaitTransactionSuccessAsync({ value }), - ).to.revertWith(revertError); + await testFactory.marketBuyTestAsync([order], 0, { + revertError, + ethValueAdjustment: -1, + forwarderFeeAmounts, + forwarderFeeRecipientAddresses: [randomAddress()], + }); }); }); }); diff --git a/contracts/integrations/test/forwarder/forwarder_test_factory.ts b/contracts/integrations/test/forwarder/forwarder_test_factory.ts index a52dd2ec4c..1db48e7515 100644 --- a/contracts/integrations/test/forwarder/forwarder_test_factory.ts +++ b/contracts/integrations/test/forwarder/forwarder_test_factory.ts @@ -1,6 +1,6 @@ import { IAssetDataContract } from '@0x/contracts-asset-proxy'; import { ForwarderContract } from '@0x/contracts-exchange-forwarder'; -import { constants, expect, hexSlice, OrderStatus, provider } from '@0x/contracts-test-utils'; +import { constants, expect, OrderStatus, provider } from '@0x/contracts-test-utils'; import { AssetProxyId, OrderInfo, SignedOrder } from '@0x/types'; import { BigNumber, hexUtils, RevertError } from '@0x/utils'; import { TransactionReceiptWithDecodedLogs } from 'ethereum-types'; @@ -91,9 +91,7 @@ export class ForwarderTestFactory { forwarderFeeRecipientAddresses, ) .awaitTransactionSuccessAsync({ - value: wethSpentAmount - .plus(forwarderFeeAmounts.reduce((prev, curr) => prev.plus(curr), constants.ZERO_AMOUNT)) - .plus(ethValueAdjustment), + value: wethSpentAmount.plus(BigNumber.sum(0, ...forwarderFeeAmounts)).plus(ethValueAdjustment), from: this._taker.address, }); @@ -137,9 +135,7 @@ export class ForwarderTestFactory { forwarderFeeRecipientAddresses, ) .awaitTransactionSuccessAsync({ - value: wethSpentAmount.plus( - forwarderFeeAmounts.reduce((prev, curr) => prev.plus(curr), constants.ZERO_AMOUNT), - ), + value: wethSpentAmount.plus(BigNumber.sum(0, ...forwarderFeeAmounts)), from: this._taker.address, });