diff --git a/contracts/exchange-forwarder/contracts/src/MixinForwarderCore.sol b/contracts/exchange-forwarder/contracts/src/MixinForwarderCore.sol index 3369f6a7ad..efe0728277 100644 --- a/contracts/exchange-forwarder/contracts/src/MixinForwarderCore.sol +++ b/contracts/exchange-forwarder/contracts/src/MixinForwarderCore.sol @@ -64,14 +64,14 @@ contract MixinForwarderCore is /// @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 ethFeeAmount Amount of ETH, denominatoed in Wei, that is payed to feeRecipient. - /// @param feeRecipient Address that will receive ETH when orders are filled. + /// @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. function marketSellOrdersWithEth( LibOrder.Order[] memory orders, bytes[] memory signatures, uint256 ethFeeAmount, - address payable feeRecipient + address payable[] memory feeRecipients ) public payable @@ -102,7 +102,7 @@ contract MixinForwarderCore is _transferEthFeeAndRefund( wethSpentAmount, ethFeeAmount, - feeRecipient + feeRecipients ); } @@ -114,7 +114,7 @@ contract MixinForwarderCore is /// @param makerAssetBuyAmount Desired amount of makerAsset to purchase. /// @param signatures Proofs that orders have been created by makers. /// @param ethFeeAmount Amount of ETH, denominatoed in Wei, that is payed to feeRecipient. - /// @param feeRecipient Address that will receive ETH when orders are filled. + /// @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. function marketBuyOrdersWithEth( @@ -122,7 +122,7 @@ contract MixinForwarderCore is uint256 makerAssetBuyAmount, bytes[] memory signatures, uint256 ethFeeAmount, - address payable feeRecipient + address payable[] memory feeRecipients ) public payable @@ -149,7 +149,7 @@ contract MixinForwarderCore is _transferEthFeeAndRefund( wethSpentAmount, ethFeeAmount, - feeRecipient + feeRecipients ); } } diff --git a/contracts/exchange-forwarder/contracts/src/MixinWeth.sol b/contracts/exchange-forwarder/contracts/src/MixinWeth.sol index f872a3c9ae..51663eb7ad 100644 --- a/contracts/exchange-forwarder/contracts/src/MixinWeth.sol +++ b/contracts/exchange-forwarder/contracts/src/MixinWeth.sol @@ -55,12 +55,12 @@ contract MixinWeth is /// Refunds any excess ETH to msg.sender. /// @param wethSpent Amount of WETH spent when filling orders. /// @param ethFeeAmount Amount of ETH, denominatoed in Wei, that is payed to feeRecipient. - /// @param feeRecipient Address that will receive ETH when orders are filled. + /// @param feeRecipients Addresses that will receive ETH when orders are filled. /// @return ethFee Amount paid to feeRecipient as a percentage fee on the total WETH sold. function _transferEthFeeAndRefund( uint256 wethSpent, uint256 ethFeeAmount, - address payable feeRecipient + address payable[] memory feeRecipients ) internal { @@ -90,7 +90,11 @@ contract MixinWeth is // Pay ETH to feeRecipient if (ethFeeAmount > 0) { - feeRecipient.transfer(ethFeeAmount); + uint256 feeRecipientsLen = feeRecipients.length; + uint256 ethFeePerRecipient = ethFeeAmount.safeDiv(feeRecipientsLen); + for (uint256 i = 0; i != feeRecipientsLen; i++) { + feeRecipients[i].transfer(ethFeePerRecipient); + } } // Refund remaining ETH to msg.sender. diff --git a/contracts/exchange-forwarder/contracts/src/interfaces/IForwarderCore.sol b/contracts/exchange-forwarder/contracts/src/interfaces/IForwarderCore.sol index 43754873f1..c8759cb119 100644 --- a/contracts/exchange-forwarder/contracts/src/interfaces/IForwarderCore.sol +++ b/contracts/exchange-forwarder/contracts/src/interfaces/IForwarderCore.sol @@ -29,15 +29,15 @@ 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 feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient. - /// @param feeRecipient Address that will receive ETH when orders are filled. + /// @param ethFeeAmount Amount of ETH, denominatoed in Wei, that is payed to feeRecipient. + /// @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. function marketSellOrdersWithEth( LibOrder.Order[] memory orders, bytes[] memory signatures, - uint256 feePercentage, - address payable feeRecipient + uint256 ethFeeAmount, + address payable[] memory feeRecipients ) public payable @@ -53,16 +53,16 @@ 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 feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient. - /// @param feeRecipient Address that will receive ETH when orders are filled. + /// @param ethFeeAmount Amount of ETH, denominatoed in Wei, that is payed to feeRecipient. + /// @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. function marketBuyOrdersWithEth( LibOrder.Order[] memory orders, uint256 makerAssetBuyAmount, bytes[] memory signatures, - uint256 feePercentage, - address payable feeRecipient + uint256 ethFeeAmount, + address payable[] memory feeRecipients ) public payable