fix dependencies

This commit is contained in:
Michael Zhu
2019-08-17 16:33:14 -07:00
parent 146d56be84
commit 88544ae0ef
7 changed files with 62 additions and 20 deletions

View File

@@ -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,

View File

@@ -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

View File

@@ -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

View File

@@ -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": {

View File

@@ -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,
};

View File

@@ -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';

View File

@@ -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"]
}