Address PR feedback
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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()],
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user