fix dependencies
This commit is contained in:
@@ -20,6 +20,7 @@ pragma solidity ^0.5.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
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/LibFillResults.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibMath.sol";
|
||||
@@ -30,10 +31,10 @@ import "./libs/LibForwarderRichErrors.sol";
|
||||
|
||||
|
||||
contract MixinExchangeWrapper is
|
||||
LibConstants,
|
||||
LibFillResults,
|
||||
LibMath
|
||||
LibConstants
|
||||
{
|
||||
using LibSafeMath for uint256;
|
||||
|
||||
/// @dev Fills the input order.
|
||||
/// Returns false if the transaction would otherwise revert.
|
||||
/// @param order Order struct containing order specifications.
|
||||
@@ -46,7 +47,7 @@ contract MixinExchangeWrapper is
|
||||
bytes memory signature
|
||||
)
|
||||
internal
|
||||
returns (FillResults memory fillResults)
|
||||
returns (LibFillResults.FillResults memory fillResults)
|
||||
{
|
||||
// ABI encode calldata for `fillOrder`
|
||||
bytes memory fillOrderCalldata = abi.encodeWithSelector(
|
||||
@@ -94,7 +95,7 @@ contract MixinExchangeWrapper is
|
||||
uint256 wethSpentAmount
|
||||
)
|
||||
internal
|
||||
returns (FillResults memory singleFillResults)
|
||||
returns (LibFillResults.FillResults memory singleFillResults)
|
||||
{
|
||||
// The remaining amount of WETH to sell
|
||||
uint256 remainingTakerAssetFillAmount = wethSellAmount.safeSub(wethSpentAmount);
|
||||
@@ -111,7 +112,7 @@ contract MixinExchangeWrapper is
|
||||
} else if (order.takerFeeAssetData.equals(order.takerAssetData)) {
|
||||
// We will first sell WETH as the takerAsset, then use it to pay the takerFee.
|
||||
// This ensures that we reserve enough to pay the fee.
|
||||
uint256 takerAssetFillAmount = getPartialAmountCeil(
|
||||
uint256 takerAssetFillAmount = LibMath.getPartialAmountCeil(
|
||||
order.takerAssetAmount,
|
||||
order.takerAssetAmount.safeAdd(order.takerFee),
|
||||
remainingTakerAssetFillAmount
|
||||
@@ -154,7 +155,7 @@ contract MixinExchangeWrapper is
|
||||
));
|
||||
}
|
||||
|
||||
FillResults memory singleFillResults = _marketSellSingleOrder(
|
||||
LibFillResults.FillResults memory singleFillResults = _marketSellSingleOrder(
|
||||
orders[i],
|
||||
signatures[i],
|
||||
wethSellAmount,
|
||||
@@ -203,12 +204,12 @@ contract MixinExchangeWrapper is
|
||||
uint256 makerAssetAcquiredAmount
|
||||
)
|
||||
internal
|
||||
returns (FillResults memory singleFillResults)
|
||||
returns (LibFillResults.FillResults memory singleFillResults)
|
||||
{
|
||||
// Percentage fee
|
||||
if (order.takerFeeAssetData.equals(order.makerAssetData)) {
|
||||
// Calculate the remaining amount of takerAsset to sell
|
||||
uint256 remainingTakerAssetFillAmount = getPartialAmountCeil(
|
||||
uint256 remainingTakerAssetFillAmount = LibMath.getPartialAmountCeil(
|
||||
order.takerAssetAmount,
|
||||
order.makerAssetAmount.safeSub(order.takerFee),
|
||||
makerAssetBuyAmount.safeSub(makerAssetAcquiredAmount)
|
||||
@@ -223,7 +224,7 @@ contract MixinExchangeWrapper is
|
||||
// WETH fee
|
||||
} else if (order.takerFeeAssetData.equals(order.takerAssetData)) {
|
||||
// Calculate the remaining amount of takerAsset to sell
|
||||
uint256 remainingTakerAssetFillAmount = getPartialAmountCeil(
|
||||
uint256 remainingTakerAssetFillAmount = LibMath.getPartialAmountCeil(
|
||||
order.takerAssetAmount,
|
||||
order.makerAssetAmount,
|
||||
makerAssetBuyAmount.safeSub(makerAssetAcquiredAmount)
|
||||
@@ -268,7 +269,7 @@ contract MixinExchangeWrapper is
|
||||
));
|
||||
}
|
||||
|
||||
FillResults memory singleFillResults = _marketBuySingleOrder(
|
||||
LibFillResults.FillResults memory singleFillResults = _marketBuySingleOrder(
|
||||
orders[i],
|
||||
signatures[i],
|
||||
makerAssetBuyAmount,
|
||||
|
@@ -21,8 +21,8 @@ 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/LibFillResults.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibMath.sol";
|
||||
import "./libs/LibConstants.sol";
|
||||
import "./libs/LibForwarderRichErrors.sol";
|
||||
@@ -34,8 +34,6 @@ import "./MixinWeth.sol";
|
||||
|
||||
|
||||
contract MixinForwarderCore is
|
||||
LibFillResults,
|
||||
LibMath,
|
||||
LibConstants,
|
||||
IAssets,
|
||||
IForwarderCore,
|
||||
@@ -44,6 +42,7 @@ contract MixinForwarderCore is
|
||||
MixinExchangeWrapper
|
||||
{
|
||||
using LibBytes for bytes;
|
||||
using LibSafeMath for uint256;
|
||||
|
||||
/// @dev Constructor approves ERC20 proxy to transfer WETH on this contract's behalf.
|
||||
constructor ()
|
||||
@@ -81,7 +80,7 @@ contract MixinForwarderCore is
|
||||
_convertEthToWeth();
|
||||
|
||||
// Calculate amount of WETH that won't be spent on the forwarder fee.
|
||||
uint256 wethSellAmount = getPartialAmountFloor(
|
||||
uint256 wethSellAmount = LibMath.getPartialAmountFloor(
|
||||
PERCENTAGE_DENOMINATOR,
|
||||
feePercentage.safeAdd(PERCENTAGE_DENOMINATOR),
|
||||
msg.value
|
||||
|
@@ -19,15 +19,17 @@
|
||||
pragma solidity ^0.5.9;
|
||||
|
||||
import "@0x/contracts-utils/contracts/src/LibRichErrors.sol";
|
||||
import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibMath.sol";
|
||||
import "./libs/LibConstants.sol";
|
||||
import "./libs/LibForwarderRichErrors.sol";
|
||||
|
||||
|
||||
contract MixinWeth is
|
||||
LibMath,
|
||||
LibConstants
|
||||
{
|
||||
using LibSafeMath for uint256;
|
||||
|
||||
/// @dev Default payable function, this allows us to withdraw WETH
|
||||
function ()
|
||||
external
|
||||
@@ -83,7 +85,7 @@ contract MixinWeth is
|
||||
uint256 wethRemaining = msg.value.safeSub(wethSold);
|
||||
|
||||
// Calculate ETH fee to pay to feeRecipient.
|
||||
ethFee = getPartialAmountFloor(
|
||||
ethFee = LibMath.getPartialAmountFloor(
|
||||
feePercentage,
|
||||
PERCENTAGE_DENOMINATOR,
|
||||
wethSold
|
||||
|
@@ -34,7 +34,7 @@
|
||||
"compile:truffle": "truffle compile"
|
||||
},
|
||||
"config": {
|
||||
"abis": "./generated-artifacts/@(Forwarder).json",
|
||||
"abis": "./generated-artifacts/@(Forwarder|IAssets|IForwarder|IForwarderCore|LibConstants|LibForwarderRichErrors|MixinAssets|MixinExchangeWrapper|MixinForwarderCore|MixinWeth).json",
|
||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
|
||||
},
|
||||
"repository": {
|
||||
|
@@ -6,4 +6,24 @@
|
||||
import { ContractArtifact } from 'ethereum-types';
|
||||
|
||||
import * as Forwarder from '../generated-artifacts/Forwarder.json';
|
||||
export const artifacts = { Forwarder: Forwarder as ContractArtifact };
|
||||
import * as IAssets from '../generated-artifacts/IAssets.json';
|
||||
import * as IForwarder from '../generated-artifacts/IForwarder.json';
|
||||
import * as IForwarderCore from '../generated-artifacts/IForwarderCore.json';
|
||||
import * as LibConstants from '../generated-artifacts/LibConstants.json';
|
||||
import * as LibForwarderRichErrors from '../generated-artifacts/LibForwarderRichErrors.json';
|
||||
import * as MixinAssets from '../generated-artifacts/MixinAssets.json';
|
||||
import * as MixinExchangeWrapper from '../generated-artifacts/MixinExchangeWrapper.json';
|
||||
import * as MixinForwarderCore from '../generated-artifacts/MixinForwarderCore.json';
|
||||
import * as MixinWeth from '../generated-artifacts/MixinWeth.json';
|
||||
export const artifacts = {
|
||||
Forwarder: Forwarder as ContractArtifact,
|
||||
MixinAssets: MixinAssets as ContractArtifact,
|
||||
MixinExchangeWrapper: MixinExchangeWrapper as ContractArtifact,
|
||||
MixinForwarderCore: MixinForwarderCore as ContractArtifact,
|
||||
MixinWeth: MixinWeth as ContractArtifact,
|
||||
IAssets: IAssets as ContractArtifact,
|
||||
IForwarder: IForwarder as ContractArtifact,
|
||||
IForwarderCore: IForwarderCore as ContractArtifact,
|
||||
LibConstants: LibConstants as ContractArtifact,
|
||||
LibForwarderRichErrors: LibForwarderRichErrors as ContractArtifact,
|
||||
};
|
||||
|
@@ -4,3 +4,12 @@
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
export * from '../generated-wrappers/forwarder';
|
||||
export * from '../generated-wrappers/i_assets';
|
||||
export * from '../generated-wrappers/i_forwarder';
|
||||
export * from '../generated-wrappers/i_forwarder_core';
|
||||
export * from '../generated-wrappers/lib_constants';
|
||||
export * from '../generated-wrappers/lib_forwarder_rich_errors';
|
||||
export * from '../generated-wrappers/mixin_assets';
|
||||
export * from '../generated-wrappers/mixin_exchange_wrapper';
|
||||
export * from '../generated-wrappers/mixin_forwarder_core';
|
||||
export * from '../generated-wrappers/mixin_weth';
|
||||
|
@@ -2,6 +2,17 @@
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true },
|
||||
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
|
||||
"files": ["generated-artifacts/Forwarder.json"],
|
||||
"files": [
|
||||
"generated-artifacts/Forwarder.json",
|
||||
"generated-artifacts/IAssets.json",
|
||||
"generated-artifacts/IForwarder.json",
|
||||
"generated-artifacts/IForwarderCore.json",
|
||||
"generated-artifacts/LibConstants.json",
|
||||
"generated-artifacts/LibForwarderRichErrors.json",
|
||||
"generated-artifacts/MixinAssets.json",
|
||||
"generated-artifacts/MixinExchangeWrapper.json",
|
||||
"generated-artifacts/MixinForwarderCore.json",
|
||||
"generated-artifacts/MixinWeth.json"
|
||||
],
|
||||
"exclude": ["./deploy/solc/solc_bin"]
|
||||
}
|
||||
|
Reference in New Issue
Block a user