Move LibAssetDataTransfer and MixinWeth(Utils) to contracts-extensions
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"version": "4.1.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Moved LibAssetDataTransfer to exchange-libs",
|
||||
"note": "Refactor, moved LibAssetDataTransfer and MixinWeth(Utils) to extensions",
|
||||
"pr": 2455
|
||||
}
|
||||
]
|
||||
|
@@ -19,19 +19,32 @@
|
||||
pragma solidity ^0.5.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "./MixinForwarderCore.sol";
|
||||
import "./libs/LibConstants.sol";
|
||||
import "@0x/contracts-asset-proxy/contracts/src/interfaces/IAssetData.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibMath.sol";
|
||||
import "@0x/contracts-extensions/contracts/src/LibAssetDataTransfer.sol";
|
||||
import "@0x/contracts-extensions/contracts/src/MixinWethUtils.sol";
|
||||
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
|
||||
import "@0x/contracts-utils/contracts/src/LibRichErrors.sol";
|
||||
import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
|
||||
import "@0x/contracts-utils/contracts/src/Ownable.sol";
|
||||
import "./libs/LibForwarderRichErrors.sol";
|
||||
import "./MixinExchangeWrapper.sol";
|
||||
import "./MixinReceiver.sol";
|
||||
import "./interfaces/IForwarder.sol";
|
||||
|
||||
|
||||
// solhint-disable no-empty-blocks
|
||||
// MixinAssets, MixinExchangeWrapper, and MixinWeth are all inherited via
|
||||
// MixinForwarderCore.
|
||||
contract Forwarder is
|
||||
LibConstants,
|
||||
MixinForwarderCore,
|
||||
IForwarder,
|
||||
Ownable,
|
||||
MixinWethUtils,
|
||||
MixinExchangeWrapper,
|
||||
MixinReceiver
|
||||
{
|
||||
using LibBytes for bytes;
|
||||
using LibAssetDataTransfer for bytes;
|
||||
using LibSafeMath for uint256;
|
||||
|
||||
constructor (
|
||||
address _exchange,
|
||||
address _exchangeV2,
|
||||
@@ -39,11 +52,158 @@ contract Forwarder is
|
||||
)
|
||||
public
|
||||
Ownable()
|
||||
LibConstants(
|
||||
MixinWethUtils(
|
||||
_exchange,
|
||||
_exchangeV2,
|
||||
_weth
|
||||
)
|
||||
MixinForwarderCore()
|
||||
{}
|
||||
MixinExchangeWrapper(
|
||||
_exchange,
|
||||
_exchangeV2
|
||||
)
|
||||
{} // solhint-disable-line no-empty-blocks
|
||||
|
||||
/// @dev Withdraws assets from this contract. It may be used by the owner to withdraw assets
|
||||
/// that were accidentally sent to this contract.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of the asset to withdraw.
|
||||
function withdrawAsset(
|
||||
bytes calldata assetData,
|
||||
uint256 amount
|
||||
)
|
||||
external
|
||||
onlyOwner
|
||||
{
|
||||
assetData.transferOut(amount);
|
||||
}
|
||||
|
||||
/// @dev Approves the respective proxy for a given asset to transfer tokens on the Forwarder contract's behalf.
|
||||
/// This is necessary because an order fee denominated in the maker asset (i.e. a percentage fee) is sent by the
|
||||
/// Forwarder contract to the fee recipient.
|
||||
/// This method needs to be called before forwarding orders of a maker asset that hasn't
|
||||
/// previously been approved.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
function approveMakerAssetProxy(bytes calldata assetData)
|
||||
external
|
||||
{
|
||||
bytes4 proxyId = assetData.readBytes4(0);
|
||||
bytes4 erc20ProxyId = IAssetData(address(0)).ERC20Token.selector;
|
||||
|
||||
// For now we only care about ERC20, since percentage fees on ERC721 tokens are invalid.
|
||||
if (proxyId == erc20ProxyId) {
|
||||
address proxyAddress = EXCHANGE.getAssetProxy(erc20ProxyId);
|
||||
if (proxyAddress == address(0)) {
|
||||
LibRichErrors.rrevert(LibForwarderRichErrors.UnregisteredAssetProxyError());
|
||||
}
|
||||
address token = assetData.readAddress(16);
|
||||
LibERC20Token.approve(token, proxyAddress, MAX_UINT256);
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Purchases as much of orders' makerAssets as possible by selling as much of the ETH value sent
|
||||
/// 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 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.
|
||||
function marketSellOrdersWithEth(
|
||||
LibOrder.Order[] memory orders,
|
||||
bytes[] memory signatures,
|
||||
uint256[] memory ethFeeAmounts,
|
||||
address payable[] memory feeRecipients
|
||||
)
|
||||
public
|
||||
payable
|
||||
returns (
|
||||
uint256 wethSpentAmount,
|
||||
uint256 makerAssetAcquiredAmount
|
||||
)
|
||||
{
|
||||
// Pay ETH affiliate fees to all feeRecipient addresses
|
||||
uint256 wethRemaining = _transferEthFeesAndWrapRemaining(
|
||||
ethFeeAmounts,
|
||||
feeRecipients
|
||||
);
|
||||
// Spends up to wethRemaining to fill orders, transfers purchased assets to msg.sender,
|
||||
// and pays WETH order fees.
|
||||
(
|
||||
wethSpentAmount,
|
||||
makerAssetAcquiredAmount
|
||||
) = _marketSellNoThrow(
|
||||
orders,
|
||||
wethRemaining,
|
||||
signatures
|
||||
);
|
||||
|
||||
// Ensure that no extra WETH owned by this contract has been spent.
|
||||
if (wethSpentAmount > wethRemaining) {
|
||||
LibRichErrors.rrevert(LibForwarderRichErrors.OverspentWethError(
|
||||
wethSpentAmount,
|
||||
msg.value
|
||||
));
|
||||
}
|
||||
|
||||
// Calculate amount of WETH that hasn't been spent.
|
||||
wethRemaining = wethRemaining.safeSub(wethSpentAmount);
|
||||
|
||||
// Refund remaining ETH to msg.sender.
|
||||
_transferEthRefund(wethRemaining);
|
||||
}
|
||||
|
||||
/// @dev Attempt to buy makerAssetBuyAmount of makerAsset by selling ETH provided with transaction.
|
||||
/// The Forwarder may *fill* more than makerAssetBuyAmount of the makerAsset so that it can
|
||||
/// pay takerFees where takerFeeAssetData == makerAssetData (i.e. percentage fees).
|
||||
/// Any ETH not spent will be refunded to sender.
|
||||
/// @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 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.
|
||||
function marketBuyOrdersWithEth(
|
||||
LibOrder.Order[] memory orders,
|
||||
uint256 makerAssetBuyAmount,
|
||||
bytes[] memory signatures,
|
||||
uint256[] memory ethFeeAmounts,
|
||||
address payable[] memory feeRecipients
|
||||
)
|
||||
public
|
||||
payable
|
||||
returns (
|
||||
uint256 wethSpentAmount,
|
||||
uint256 makerAssetAcquiredAmount
|
||||
)
|
||||
{
|
||||
// Pay ETH affiliate fees to all feeRecipient addresses
|
||||
uint256 wethRemaining = _transferEthFeesAndWrapRemaining(
|
||||
ethFeeAmounts,
|
||||
feeRecipients
|
||||
);
|
||||
|
||||
// Attempts to fill the desired amount of makerAsset and trasnfer purchased assets to msg.sender.
|
||||
(
|
||||
wethSpentAmount,
|
||||
makerAssetAcquiredAmount
|
||||
) = _marketBuyFillOrKill(
|
||||
orders,
|
||||
makerAssetBuyAmount,
|
||||
signatures
|
||||
);
|
||||
|
||||
// Ensure that no extra WETH owned by this contract has been spent.
|
||||
if (wethSpentAmount > wethRemaining) {
|
||||
LibRichErrors.rrevert(LibForwarderRichErrors.OverspentWethError(
|
||||
wethSpentAmount,
|
||||
msg.value
|
||||
));
|
||||
}
|
||||
|
||||
// Calculate amount of WETH that hasn't been spent.
|
||||
wethRemaining = wethRemaining.safeSub(wethSpentAmount);
|
||||
|
||||
// Refund remaining ETH to msg.sender.
|
||||
_transferEthRefund(wethRemaining);
|
||||
}
|
||||
}
|
||||
|
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.9;
|
||||
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibAssetDataTransfer.sol";
|
||||
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
|
||||
import "@0x/contracts-utils/contracts/src/LibRichErrors.sol";
|
||||
import "@0x/contracts-utils/contracts/src/Ownable.sol";
|
||||
import "@0x/contracts-erc20/contracts/src/LibERC20Token.sol";
|
||||
import "@0x/contracts-asset-proxy/contracts/src/interfaces/IAssetData.sol";
|
||||
import "./libs/LibConstants.sol";
|
||||
import "./libs/LibForwarderRichErrors.sol";
|
||||
import "./interfaces/IAssets.sol";
|
||||
|
||||
|
||||
contract MixinAssets is
|
||||
Ownable,
|
||||
LibConstants,
|
||||
IAssets
|
||||
{
|
||||
using LibBytes for bytes;
|
||||
using LibAssetDataTransfer for bytes;
|
||||
|
||||
/// @dev Withdraws assets from this contract. It may be used by the owner to withdraw assets
|
||||
/// that were accidentally sent to this contract.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of the asset to withdraw.
|
||||
function withdrawAsset(
|
||||
bytes calldata assetData,
|
||||
uint256 amount
|
||||
)
|
||||
external
|
||||
onlyOwner
|
||||
{
|
||||
assetData.transferOut(amount);
|
||||
}
|
||||
|
||||
/// @dev Approves the respective proxy for a given asset to transfer tokens on the Forwarder contract's behalf.
|
||||
/// This is necessary because an order fee denominated in the maker asset (i.e. a percentage fee) is sent by the
|
||||
/// Forwarder contract to the fee recipient.
|
||||
/// This method needs to be called before forwarding orders of a maker asset that hasn't
|
||||
/// previously been approved.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
function approveMakerAssetProxy(bytes calldata assetData)
|
||||
external
|
||||
{
|
||||
bytes4 proxyId = assetData.readBytes4(0);
|
||||
bytes4 erc20ProxyId = IAssetData(address(0)).ERC20Token.selector;
|
||||
|
||||
// For now we only care about ERC20, since percentage fees on ERC721 tokens are invalid.
|
||||
if (proxyId == erc20ProxyId) {
|
||||
address proxyAddress = EXCHANGE.getAssetProxy(erc20ProxyId);
|
||||
if (proxyAddress == address(0)) {
|
||||
LibRichErrors.rrevert(LibForwarderRichErrors.UnregisteredAssetProxyError());
|
||||
}
|
||||
address token = assetData.readAddress(16);
|
||||
LibERC20Token.approve(token, proxyAddress, MAX_UINT);
|
||||
}
|
||||
}
|
||||
}
|
@@ -19,28 +19,60 @@
|
||||
pragma solidity ^0.5.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
|
||||
import "@0x/contracts-utils/contracts/src/LibRichErrors.sol";
|
||||
import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
|
||||
import "@0x/contracts-asset-proxy/contracts/src/interfaces/IAssetData.sol";
|
||||
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
|
||||
import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibMath.sol";
|
||||
import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
|
||||
import "@0x/contracts-asset-proxy/contracts/src/interfaces/IAssetData.sol";
|
||||
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
|
||||
import "./libs/LibConstants.sol";
|
||||
import "@0x/contracts-extensions/contracts/src/LibAssetDataTransfer.sol";
|
||||
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
|
||||
import "@0x/contracts-utils/contracts/src/LibRichErrors.sol";
|
||||
import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
|
||||
import "./libs/LibForwarderRichErrors.sol";
|
||||
import "./interfaces/IExchangeV2.sol";
|
||||
import "./MixinAssets.sol";
|
||||
|
||||
|
||||
contract MixinExchangeWrapper is
|
||||
LibConstants,
|
||||
MixinAssets
|
||||
{
|
||||
contract MixinExchangeWrapper {
|
||||
|
||||
// The v2 order id is the first 4 bytes of the ExchangeV2 order schema hash.
|
||||
// bytes4(keccak256(abi.encodePacked(
|
||||
// "Order(",
|
||||
// "address makerAddress,",
|
||||
// "address takerAddress,",
|
||||
// "address feeRecipientAddress,",
|
||||
// "address senderAddress,",
|
||||
// "uint256 makerAssetAmount,",
|
||||
// "uint256 takerAssetAmount,",
|
||||
// "uint256 makerFee,",
|
||||
// "uint256 takerFee,",
|
||||
// "uint256 expirationTimeSeconds,",
|
||||
// "uint256 salt,",
|
||||
// "bytes makerAssetData,",
|
||||
// "bytes takerAssetData",
|
||||
// ")"
|
||||
// )));
|
||||
bytes4 constant public EXCHANGE_V2_ORDER_ID = 0x770501f8;
|
||||
|
||||
// solhint-disable var-name-mixedcase
|
||||
IExchange internal EXCHANGE;
|
||||
IExchangeV2 internal EXCHANGE_V2;
|
||||
// solhint-enable var-name-mixedcase
|
||||
|
||||
using LibBytes for bytes;
|
||||
using LibAssetDataTransfer for bytes;
|
||||
using LibSafeMath for uint256;
|
||||
|
||||
constructor (
|
||||
address _exchange,
|
||||
address _exchangeV2
|
||||
)
|
||||
public
|
||||
{
|
||||
EXCHANGE = IExchange(_exchange);
|
||||
EXCHANGE_V2 = IExchangeV2(_exchangeV2);
|
||||
}
|
||||
|
||||
/// @dev Fills the input order.
|
||||
/// Returns false if the transaction would otherwise revert.
|
||||
/// @param order Order struct containing order specifications.
|
||||
|
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
|
||||
import "@0x/contracts-utils/contracts/src/LibRichErrors.sol";
|
||||
import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibMath.sol";
|
||||
import "@0x/contracts-asset-proxy/contracts/src/interfaces/IAssetData.sol";
|
||||
import "./libs/LibConstants.sol";
|
||||
import "./libs/LibForwarderRichErrors.sol";
|
||||
import "./interfaces/IAssets.sol";
|
||||
import "./interfaces/IForwarderCore.sol";
|
||||
import "./MixinExchangeWrapper.sol";
|
||||
import "./MixinWeth.sol";
|
||||
|
||||
|
||||
contract MixinForwarderCore is
|
||||
LibConstants,
|
||||
IAssets,
|
||||
IForwarderCore,
|
||||
MixinWeth,
|
||||
MixinExchangeWrapper
|
||||
{
|
||||
using LibBytes for bytes;
|
||||
using LibSafeMath for uint256;
|
||||
|
||||
/// @dev Constructor approves ERC20 proxy to transfer WETH on this contract's behalf.
|
||||
constructor ()
|
||||
public
|
||||
{
|
||||
address proxyAddress = EXCHANGE.getAssetProxy(IAssetData(address(0)).ERC20Token.selector);
|
||||
if (proxyAddress == address(0)) {
|
||||
LibRichErrors.rrevert(LibForwarderRichErrors.UnregisteredAssetProxyError());
|
||||
}
|
||||
ETHER_TOKEN.approve(proxyAddress, MAX_UINT);
|
||||
|
||||
address protocolFeeCollector = EXCHANGE.protocolFeeCollector();
|
||||
if (protocolFeeCollector != address(0)) {
|
||||
ETHER_TOKEN.approve(protocolFeeCollector, MAX_UINT);
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Purchases as much of orders' makerAssets as possible by selling as much of the ETH value sent
|
||||
/// 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 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.
|
||||
function marketSellOrdersWithEth(
|
||||
LibOrder.Order[] memory orders,
|
||||
bytes[] memory signatures,
|
||||
uint256[] memory ethFeeAmounts,
|
||||
address payable[] memory feeRecipients
|
||||
)
|
||||
public
|
||||
payable
|
||||
returns (
|
||||
uint256 wethSpentAmount,
|
||||
uint256 makerAssetAcquiredAmount
|
||||
)
|
||||
{
|
||||
// Pay ETH affiliate fees to all feeRecipient addresses
|
||||
uint256 wethRemaining = _transferEthFeesAndWrapRemaining(
|
||||
ethFeeAmounts,
|
||||
feeRecipients
|
||||
);
|
||||
// Spends up to wethRemaining to fill orders, transfers purchased assets to msg.sender,
|
||||
// and pays WETH order fees.
|
||||
(
|
||||
wethSpentAmount,
|
||||
makerAssetAcquiredAmount
|
||||
) = _marketSellNoThrow(
|
||||
orders,
|
||||
wethRemaining,
|
||||
signatures
|
||||
);
|
||||
|
||||
// Refund remaining ETH to msg.sender.
|
||||
_transferEthRefund(wethRemaining, wethSpentAmount);
|
||||
}
|
||||
|
||||
/// @dev Attempt to buy makerAssetBuyAmount of makerAsset by selling ETH provided with transaction.
|
||||
/// The Forwarder may *fill* more than makerAssetBuyAmount of the makerAsset so that it can
|
||||
/// pay takerFees where takerFeeAssetData == makerAssetData (i.e. percentage fees).
|
||||
/// Any ETH not spent will be refunded to sender.
|
||||
/// @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 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.
|
||||
function marketBuyOrdersWithEth(
|
||||
LibOrder.Order[] memory orders,
|
||||
uint256 makerAssetBuyAmount,
|
||||
bytes[] memory signatures,
|
||||
uint256[] memory ethFeeAmounts,
|
||||
address payable[] memory feeRecipients
|
||||
)
|
||||
public
|
||||
payable
|
||||
returns (
|
||||
uint256 wethSpentAmount,
|
||||
uint256 makerAssetAcquiredAmount
|
||||
)
|
||||
{
|
||||
// Pay ETH affiliate fees to all feeRecipient addresses
|
||||
uint256 wethRemaining = _transferEthFeesAndWrapRemaining(
|
||||
ethFeeAmounts,
|
||||
feeRecipients
|
||||
);
|
||||
|
||||
// Attempts to fill the desired amount of makerAsset and trasnfer purchased assets to msg.sender.
|
||||
(
|
||||
wethSpentAmount,
|
||||
makerAssetAcquiredAmount
|
||||
) = _marketBuyFillOrKill(
|
||||
orders,
|
||||
makerAssetBuyAmount,
|
||||
signatures
|
||||
);
|
||||
|
||||
// Refund remaining ETH to msg.sender.
|
||||
_transferEthRefund(wethRemaining, wethSpentAmount);
|
||||
}
|
||||
}
|
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.9;
|
||||
|
||||
import "@0x/contracts-utils/contracts/src/LibRichErrors.sol";
|
||||
import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
|
||||
import "./libs/LibConstants.sol";
|
||||
import "./libs/LibForwarderRichErrors.sol";
|
||||
|
||||
|
||||
contract MixinWeth is
|
||||
LibConstants
|
||||
{
|
||||
using LibSafeMath for uint256;
|
||||
|
||||
/// @dev Default payable function, this allows us to withdraw WETH
|
||||
function ()
|
||||
external
|
||||
payable
|
||||
{
|
||||
if (msg.sender != address(ETHER_TOKEN)) {
|
||||
LibRichErrors.rrevert(LibForwarderRichErrors.DefaultFunctionWethContractOnlyError(
|
||||
msg.sender
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Transfers ETH denominated fees to all feeRecipient addresses
|
||||
/// @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(
|
||||
uint256[] memory ethFeeAmounts,
|
||||
address payable[] memory feeRecipients
|
||||
)
|
||||
internal
|
||||
returns (uint256 ethRemaining)
|
||||
{
|
||||
uint256 feesLen = ethFeeAmounts.length;
|
||||
// ethFeeAmounts len must equal feeRecipients len
|
||||
if (feesLen != feeRecipients.length) {
|
||||
LibRichErrors.rrevert(LibForwarderRichErrors.EthFeeLengthMismatchError(
|
||||
feesLen,
|
||||
feeRecipients.length
|
||||
));
|
||||
}
|
||||
|
||||
// This function is always called before any other function, so we assume that
|
||||
// the ETH remaining is the entire msg.value.
|
||||
ethRemaining = msg.value;
|
||||
|
||||
for (uint256 i = 0; i != feesLen; i++) {
|
||||
uint256 ethFeeAmount = ethFeeAmounts[i];
|
||||
// Ensure there is enough ETH to pay the fee
|
||||
if (ethRemaining < ethFeeAmount) {
|
||||
LibRichErrors.rrevert(LibForwarderRichErrors.InsufficientEthForFeeError(
|
||||
ethFeeAmount,
|
||||
ethRemaining
|
||||
));
|
||||
}
|
||||
// Decrease ethRemaining and transfer fee to corresponding feeRecipient
|
||||
ethRemaining = ethRemaining.safeSub(ethFeeAmount);
|
||||
feeRecipients[i].transfer(ethFeeAmount);
|
||||
}
|
||||
|
||||
// Convert remaining ETH to WETH.
|
||||
ETHER_TOKEN.deposit.value(ethRemaining)();
|
||||
|
||||
return ethRemaining;
|
||||
}
|
||||
|
||||
/// @dev Refunds any excess ETH to msg.sender.
|
||||
/// @param initialWethAmount Amount of WETH available after transferring affiliate fees.
|
||||
/// @param wethSpent Amount of WETH spent when filling orders.
|
||||
function _transferEthRefund(
|
||||
uint256 initialWethAmount,
|
||||
uint256 wethSpent
|
||||
)
|
||||
internal
|
||||
{
|
||||
// Ensure that no extra WETH owned by this contract has been spent.
|
||||
if (wethSpent > initialWethAmount) {
|
||||
LibRichErrors.rrevert(LibForwarderRichErrors.OverspentWethError(
|
||||
wethSpent,
|
||||
msg.value
|
||||
));
|
||||
}
|
||||
|
||||
// Calculate amount of WETH that hasn't been spent.
|
||||
uint256 wethRemaining = initialWethAmount.safeSub(wethSpent);
|
||||
|
||||
// Do nothing if no WETH remaining
|
||||
if (wethRemaining > 0) {
|
||||
// Convert remaining WETH to ETH
|
||||
ETHER_TOKEN.withdraw(wethRemaining);
|
||||
// Transfer remaining ETH to sender
|
||||
msg.sender.transfer(wethRemaining);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.9;
|
||||
|
||||
|
||||
contract IAssets {
|
||||
|
||||
/// @dev Withdraws assets from this contract. The contract requires a ZRX balance in order to
|
||||
/// function optimally, and this function allows the ZRX to be withdrawn by owner. It may also be
|
||||
/// used to withdraw assets that were accidentally sent to this contract.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of ERC20 token to withdraw.
|
||||
function withdrawAsset(
|
||||
bytes calldata assetData,
|
||||
uint256 amount
|
||||
)
|
||||
external;
|
||||
|
||||
/// @dev Approves the respective proxy for a given asset to transfer tokens on the Forwarder contract's behalf.
|
||||
/// This is necessary because an order fee denominated in the maker asset (i.e. a percentage fee) is sent by the
|
||||
/// Forwarder contract to the fee recipient.
|
||||
/// This method needs to be called before forwarding orders of a maker asset that hasn't
|
||||
/// previously been approved.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
function approveMakerAssetProxy(
|
||||
bytes calldata assetData
|
||||
)
|
||||
external;
|
||||
}
|
@@ -19,12 +19,77 @@
|
||||
pragma solidity ^0.5.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "./IForwarderCore.sol";
|
||||
import "./IAssets.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
|
||||
|
||||
|
||||
// solhint-disable no-empty-blocks
|
||||
contract IForwarder is
|
||||
IForwarderCore,
|
||||
IAssets
|
||||
{}
|
||||
contract IForwarder {
|
||||
|
||||
/// @dev Withdraws assets from this contract. The contract requires a ZRX balance in order to
|
||||
/// function optimally, and this function allows the ZRX to be withdrawn by owner. It may also be
|
||||
/// used to withdraw assets that were accidentally sent to this contract.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of ERC20 token to withdraw.
|
||||
function withdrawAsset(
|
||||
bytes calldata assetData,
|
||||
uint256 amount
|
||||
)
|
||||
external;
|
||||
|
||||
/// @dev Approves the respective proxy for a given asset to transfer tokens on the Forwarder contract's behalf.
|
||||
/// This is necessary because an order fee denominated in the maker asset (i.e. a percentage fee) is sent by the
|
||||
/// Forwarder contract to the fee recipient.
|
||||
/// This method needs to be called before forwarding orders of a maker asset that hasn't
|
||||
/// previously been approved.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
function approveMakerAssetProxy(
|
||||
bytes calldata assetData
|
||||
)
|
||||
external;
|
||||
|
||||
/// @dev Purchases as much of orders' makerAssets as possible by selling as much of the ETH value sent
|
||||
/// 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 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.
|
||||
function marketSellOrdersWithEth(
|
||||
LibOrder.Order[] memory orders,
|
||||
bytes[] memory signatures,
|
||||
uint256[] memory ethFeeAmounts,
|
||||
address payable[] memory feeRecipients
|
||||
)
|
||||
public
|
||||
payable
|
||||
returns (
|
||||
uint256 wethSpentAmount,
|
||||
uint256 makerAssetAcquiredAmount
|
||||
);
|
||||
|
||||
/// @dev Attempt to buy makerAssetBuyAmount of makerAsset by selling ETH provided with transaction.
|
||||
/// The Forwarder may *fill* more than makerAssetBuyAmount of the makerAsset so that it can
|
||||
/// pay takerFees where takerFeeAssetData == makerAssetData (i.e. percentage fees).
|
||||
/// Any ETH not spent will be refunded to sender.
|
||||
/// @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 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.
|
||||
function marketBuyOrdersWithEth(
|
||||
LibOrder.Order[] memory orders,
|
||||
uint256 makerAssetBuyAmount,
|
||||
bytes[] memory signatures,
|
||||
uint256[] memory ethFeeAmounts,
|
||||
address payable[] memory feeRecipients
|
||||
)
|
||||
public
|
||||
payable
|
||||
returns (
|
||||
uint256 wethSpentAmount,
|
||||
uint256 makerAssetAcquiredAmount
|
||||
);
|
||||
}
|
||||
|
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
|
||||
|
||||
|
||||
contract IForwarderCore {
|
||||
|
||||
/// @dev Purchases as much of orders' makerAssets as possible by selling as much of the ETH value sent
|
||||
/// 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 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.
|
||||
function marketSellOrdersWithEth(
|
||||
LibOrder.Order[] memory orders,
|
||||
bytes[] memory signatures,
|
||||
uint256[] memory ethFeeAmounts,
|
||||
address payable[] memory feeRecipients
|
||||
)
|
||||
public
|
||||
payable
|
||||
returns (
|
||||
uint256 wethSpentAmount,
|
||||
uint256 makerAssetAcquiredAmount
|
||||
);
|
||||
|
||||
/// @dev Attempt to buy makerAssetBuyAmount of makerAsset by selling ETH provided with transaction.
|
||||
/// The Forwarder may *fill* more than makerAssetBuyAmount of the makerAsset so that it can
|
||||
/// pay takerFees where takerFeeAssetData == makerAssetData (i.e. percentage fees).
|
||||
/// Any ETH not spent will be refunded to sender.
|
||||
/// @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 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.
|
||||
function marketBuyOrdersWithEth(
|
||||
LibOrder.Order[] memory orders,
|
||||
uint256 makerAssetBuyAmount,
|
||||
bytes[] memory signatures,
|
||||
uint256[] memory ethFeeAmounts,
|
||||
address payable[] memory feeRecipients
|
||||
)
|
||||
public
|
||||
payable
|
||||
returns (
|
||||
uint256 wethSpentAmount,
|
||||
uint256 makerAssetAcquiredAmount
|
||||
);
|
||||
}
|
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.9;
|
||||
|
||||
import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
|
||||
import "@0x/contracts-erc20/contracts/src/interfaces/IEtherToken.sol";
|
||||
import "../interfaces/IExchangeV2.sol";
|
||||
|
||||
|
||||
contract LibConstants {
|
||||
|
||||
uint256 constant internal MAX_UINT = uint256(-1);
|
||||
|
||||
// The v2 order id is the first 4 bytes of the ExchangeV2 order schema hash.
|
||||
// bytes4(keccak256(abi.encodePacked(
|
||||
// "Order(",
|
||||
// "address makerAddress,",
|
||||
// "address takerAddress,",
|
||||
// "address feeRecipientAddress,",
|
||||
// "address senderAddress,",
|
||||
// "uint256 makerAssetAmount,",
|
||||
// "uint256 takerAssetAmount,",
|
||||
// "uint256 makerFee,",
|
||||
// "uint256 takerFee,",
|
||||
// "uint256 expirationTimeSeconds,",
|
||||
// "uint256 salt,",
|
||||
// "bytes makerAssetData,",
|
||||
// "bytes takerAssetData",
|
||||
// ")"
|
||||
// )));
|
||||
bytes4 constant public EXCHANGE_V2_ORDER_ID = 0x770501f8;
|
||||
|
||||
// solhint-disable var-name-mixedcase
|
||||
IExchange internal EXCHANGE;
|
||||
IExchangeV2 internal EXCHANGE_V2;
|
||||
IEtherToken internal ETHER_TOKEN;
|
||||
// solhint-enable var-name-mixedcase
|
||||
|
||||
constructor (
|
||||
address _exchange,
|
||||
address _exchangeV2,
|
||||
address _weth
|
||||
)
|
||||
public
|
||||
{
|
||||
EXCHANGE = IExchange(_exchange);
|
||||
EXCHANGE_V2 = IExchangeV2(_exchangeV2);
|
||||
ETHER_TOKEN = IEtherToken(_weth);
|
||||
}
|
||||
}
|
@@ -33,22 +33,10 @@ library LibForwarderRichErrors {
|
||||
bytes4 internal constant UNSUPPORTED_FEE_ERROR_SELECTOR =
|
||||
0x31360af1;
|
||||
|
||||
// bytes4(keccak256("InsufficientEthForFeeError(uint256,uint256)"))
|
||||
bytes4 internal constant INSUFFICIENT_ETH_FOR_FEE_ERROR_SELECTOR =
|
||||
0xecf40fd9;
|
||||
|
||||
// bytes4(keccak256("OverspentWethError(uint256,uint256)"))
|
||||
bytes4 internal constant OVERSPENT_WETH_ERROR_SELECTOR =
|
||||
0xcdcbed5d;
|
||||
|
||||
// bytes4(keccak256("DefaultFunctionWethContractOnlyError(address)"))
|
||||
bytes4 internal constant DEFAULT_FUNCTION_WETH_CONTRACT_ONLY_ERROR_SELECTOR =
|
||||
0x08b18698;
|
||||
|
||||
// bytes4(keccak256("EthFeeLengthMismatchError(uint256,uint256)"))
|
||||
bytes4 internal constant ETH_FEE_LENGTH_MISMATCH_ERROR_SELECTOR =
|
||||
0x3ecb6ceb;
|
||||
|
||||
// solhint-disable func-name-mixedcase
|
||||
function UnregisteredAssetProxyError()
|
||||
internal
|
||||
@@ -86,21 +74,6 @@ library LibForwarderRichErrors {
|
||||
);
|
||||
}
|
||||
|
||||
function InsufficientEthForFeeError(
|
||||
uint256 ethFeeRequired,
|
||||
uint256 ethAvailable
|
||||
)
|
||||
internal
|
||||
pure
|
||||
returns (bytes memory)
|
||||
{
|
||||
return abi.encodeWithSelector(
|
||||
INSUFFICIENT_ETH_FOR_FEE_ERROR_SELECTOR,
|
||||
ethFeeRequired,
|
||||
ethAvailable
|
||||
);
|
||||
}
|
||||
|
||||
function OverspentWethError(
|
||||
uint256 wethSpent,
|
||||
uint256 msgValue
|
||||
@@ -115,32 +88,4 @@ library LibForwarderRichErrors {
|
||||
msgValue
|
||||
);
|
||||
}
|
||||
|
||||
function DefaultFunctionWethContractOnlyError(
|
||||
address senderAddress
|
||||
)
|
||||
internal
|
||||
pure
|
||||
returns (bytes memory)
|
||||
{
|
||||
return abi.encodeWithSelector(
|
||||
DEFAULT_FUNCTION_WETH_CONTRACT_ONLY_ERROR_SELECTOR,
|
||||
senderAddress
|
||||
);
|
||||
}
|
||||
|
||||
function EthFeeLengthMismatchError(
|
||||
uint256 ethFeesLength,
|
||||
uint256 feeRecipientsLength
|
||||
)
|
||||
internal
|
||||
pure
|
||||
returns (bytes memory)
|
||||
{
|
||||
return abi.encodeWithSelector(
|
||||
ETH_FEE_LENGTH_MISMATCH_ERROR_SELECTOR,
|
||||
ethFeesLength,
|
||||
feeRecipientsLength
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -19,14 +19,12 @@
|
||||
pragma solidity ^0.5.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibAssetDataTransfer.sol";
|
||||
import "@0x/contracts-extensions/contracts/src/LibAssetDataTransfer.sol";
|
||||
import "../src/MixinExchangeWrapper.sol";
|
||||
import "../src/libs/LibConstants.sol";
|
||||
import "../src/MixinReceiver.sol";
|
||||
|
||||
|
||||
contract TestForwarder is
|
||||
LibConstants,
|
||||
MixinExchangeWrapper,
|
||||
MixinReceiver
|
||||
{
|
||||
@@ -35,8 +33,7 @@ contract TestForwarder is
|
||||
// solhint-disable no-empty-blocks
|
||||
constructor ()
|
||||
public
|
||||
LibConstants(
|
||||
address(0),
|
||||
MixinExchangeWrapper(
|
||||
address(0),
|
||||
address(0)
|
||||
)
|
||||
|
@@ -39,7 +39,7 @@
|
||||
},
|
||||
"config": {
|
||||
"publicInterfaceContracts": "Forwarder,IExchangeV2",
|
||||
"abis": "./test/generated-artifacts/@(Forwarder|IAssets|IExchangeV2|IForwarder|IForwarderCore|LibConstants|LibForwarderRichErrors|MixinAssets|MixinExchangeWrapper|MixinForwarderCore|MixinReceiver|MixinWeth|TestForwarder).json",
|
||||
"abis": "./test/generated-artifacts/@(Forwarder|IExchangeV2|IForwarder|LibForwarderRichErrors|MixinExchangeWrapper|MixinReceiver|TestForwarder).json",
|
||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
|
||||
},
|
||||
"repository": {
|
||||
|
@@ -6,30 +6,18 @@
|
||||
import { ContractArtifact } from 'ethereum-types';
|
||||
|
||||
import * as Forwarder from '../test/generated-artifacts/Forwarder.json';
|
||||
import * as IAssets from '../test/generated-artifacts/IAssets.json';
|
||||
import * as IExchangeV2 from '../test/generated-artifacts/IExchangeV2.json';
|
||||
import * as IForwarder from '../test/generated-artifacts/IForwarder.json';
|
||||
import * as IForwarderCore from '../test/generated-artifacts/IForwarderCore.json';
|
||||
import * as LibConstants from '../test/generated-artifacts/LibConstants.json';
|
||||
import * as LibForwarderRichErrors from '../test/generated-artifacts/LibForwarderRichErrors.json';
|
||||
import * as MixinAssets from '../test/generated-artifacts/MixinAssets.json';
|
||||
import * as MixinExchangeWrapper from '../test/generated-artifacts/MixinExchangeWrapper.json';
|
||||
import * as MixinForwarderCore from '../test/generated-artifacts/MixinForwarderCore.json';
|
||||
import * as MixinReceiver from '../test/generated-artifacts/MixinReceiver.json';
|
||||
import * as MixinWeth from '../test/generated-artifacts/MixinWeth.json';
|
||||
import * as TestForwarder from '../test/generated-artifacts/TestForwarder.json';
|
||||
export const artifacts = {
|
||||
Forwarder: Forwarder as ContractArtifact,
|
||||
MixinAssets: MixinAssets as ContractArtifact,
|
||||
MixinExchangeWrapper: MixinExchangeWrapper as ContractArtifact,
|
||||
MixinForwarderCore: MixinForwarderCore as ContractArtifact,
|
||||
MixinReceiver: MixinReceiver as ContractArtifact,
|
||||
MixinWeth: MixinWeth as ContractArtifact,
|
||||
IAssets: IAssets as ContractArtifact,
|
||||
IExchangeV2: IExchangeV2 as ContractArtifact,
|
||||
IForwarder: IForwarder as ContractArtifact,
|
||||
IForwarderCore: IForwarderCore as ContractArtifact,
|
||||
LibConstants: LibConstants as ContractArtifact,
|
||||
LibForwarderRichErrors: LibForwarderRichErrors as ContractArtifact,
|
||||
TestForwarder: TestForwarder as ContractArtifact,
|
||||
};
|
||||
|
@@ -4,15 +4,9 @@
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
export * from '../test/generated-wrappers/forwarder';
|
||||
export * from '../test/generated-wrappers/i_assets';
|
||||
export * from '../test/generated-wrappers/i_exchange_v2';
|
||||
export * from '../test/generated-wrappers/i_forwarder';
|
||||
export * from '../test/generated-wrappers/i_forwarder_core';
|
||||
export * from '../test/generated-wrappers/lib_constants';
|
||||
export * from '../test/generated-wrappers/lib_forwarder_rich_errors';
|
||||
export * from '../test/generated-wrappers/mixin_assets';
|
||||
export * from '../test/generated-wrappers/mixin_exchange_wrapper';
|
||||
export * from '../test/generated-wrappers/mixin_forwarder_core';
|
||||
export * from '../test/generated-wrappers/mixin_receiver';
|
||||
export * from '../test/generated-wrappers/mixin_weth';
|
||||
export * from '../test/generated-wrappers/test_forwarder';
|
||||
|
@@ -6,17 +6,11 @@
|
||||
"generated-artifacts/Forwarder.json",
|
||||
"generated-artifacts/IExchangeV2.json",
|
||||
"test/generated-artifacts/Forwarder.json",
|
||||
"test/generated-artifacts/IAssets.json",
|
||||
"test/generated-artifacts/IExchangeV2.json",
|
||||
"test/generated-artifacts/IForwarder.json",
|
||||
"test/generated-artifacts/IForwarderCore.json",
|
||||
"test/generated-artifacts/LibConstants.json",
|
||||
"test/generated-artifacts/LibForwarderRichErrors.json",
|
||||
"test/generated-artifacts/MixinAssets.json",
|
||||
"test/generated-artifacts/MixinExchangeWrapper.json",
|
||||
"test/generated-artifacts/MixinForwarderCore.json",
|
||||
"test/generated-artifacts/MixinReceiver.json",
|
||||
"test/generated-artifacts/MixinWeth.json",
|
||||
"test/generated-artifacts/TestForwarder.json"
|
||||
],
|
||||
"exclude": ["./deploy/solc/solc_bin"]
|
||||
|
Reference in New Issue
Block a user