Fix build errors

This commit is contained in:
Amir Bandeali 2019-08-13 16:43:55 -07:00
parent 55436510b6
commit 070147db52
13 changed files with 36 additions and 23 deletions

View File

@ -48,7 +48,8 @@ library LibExchangeRichErrors {
INVALID_LENGTH, INVALID_LENGTH,
UNSUPPORTED, UNSUPPORTED,
ILLEGAL, ILLEGAL,
INAPPROPRIATE_SIGNATURE_TYPE INAPPROPRIATE_SIGNATURE_TYPE,
INVALID_SIGNER
} }
enum TransactionErrorCodes { enum TransactionErrorCodes {

View File

@ -35,7 +35,7 @@
"generate-exchange-selectors": "node lib/scripts/generate-exchange-selectors.js ../../../exchange/generated-artifacts/Exchange.json ./contracts/src/LibExchangeSelectors.sol" "generate-exchange-selectors": "node lib/scripts/generate-exchange-selectors.js ../../../exchange/generated-artifacts/Exchange.json ./contracts/src/LibExchangeSelectors.sol"
}, },
"config": { "config": {
"abis": "./generated-artifacts/@(LibEIP712ExchangeDomain|LibExchangeRichErrors|LibFillResults|LibMath|LibMathRichErrors|LibOrder|LibZeroExTransaction|TestLibEIP712ExchangeDomain|TestLibFillResults|TestLibMath|TestLibOrder|TestLibZeroExTransaction).json", "abis": "./generated-artifacts/@(LibEIP712ExchangeDomain|LibExchangeRichErrors|LibExchangeSelectors|LibFillResults|LibMath|LibMathRichErrors|LibOrder|LibZeroExTransaction|TestLibEIP712ExchangeDomain|TestLibFillResults|TestLibMath|TestLibOrder|TestLibZeroExTransaction).json",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually." "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
}, },
"repository": { "repository": {

View File

@ -7,6 +7,7 @@ import { ContractArtifact } from 'ethereum-types';
import * as LibEIP712ExchangeDomain from '../generated-artifacts/LibEIP712ExchangeDomain.json'; import * as LibEIP712ExchangeDomain from '../generated-artifacts/LibEIP712ExchangeDomain.json';
import * as LibExchangeRichErrors from '../generated-artifacts/LibExchangeRichErrors.json'; import * as LibExchangeRichErrors from '../generated-artifacts/LibExchangeRichErrors.json';
import * as LibExchangeSelectors from '../generated-artifacts/LibExchangeSelectors.json';
import * as LibFillResults from '../generated-artifacts/LibFillResults.json'; import * as LibFillResults from '../generated-artifacts/LibFillResults.json';
import * as LibMath from '../generated-artifacts/LibMath.json'; import * as LibMath from '../generated-artifacts/LibMath.json';
import * as LibMathRichErrors from '../generated-artifacts/LibMathRichErrors.json'; import * as LibMathRichErrors from '../generated-artifacts/LibMathRichErrors.json';
@ -20,6 +21,7 @@ import * as TestLibZeroExTransaction from '../generated-artifacts/TestLibZeroExT
export const artifacts = { export const artifacts = {
LibEIP712ExchangeDomain: LibEIP712ExchangeDomain as ContractArtifact, LibEIP712ExchangeDomain: LibEIP712ExchangeDomain as ContractArtifact,
LibExchangeRichErrors: LibExchangeRichErrors as ContractArtifact, LibExchangeRichErrors: LibExchangeRichErrors as ContractArtifact,
LibExchangeSelectors: LibExchangeSelectors as ContractArtifact,
LibFillResults: LibFillResults as ContractArtifact, LibFillResults: LibFillResults as ContractArtifact,
LibMath: LibMath as ContractArtifact, LibMath: LibMath as ContractArtifact,
LibMathRichErrors: LibMathRichErrors as ContractArtifact, LibMathRichErrors: LibMathRichErrors as ContractArtifact,

View File

@ -5,6 +5,7 @@
*/ */
export * from '../generated-wrappers/lib_e_i_p712_exchange_domain'; export * from '../generated-wrappers/lib_e_i_p712_exchange_domain';
export * from '../generated-wrappers/lib_exchange_rich_errors'; export * from '../generated-wrappers/lib_exchange_rich_errors';
export * from '../generated-wrappers/lib_exchange_selectors';
export * from '../generated-wrappers/lib_fill_results'; export * from '../generated-wrappers/lib_fill_results';
export * from '../generated-wrappers/lib_math'; export * from '../generated-wrappers/lib_math';
export * from '../generated-wrappers/lib_math_rich_errors'; export * from '../generated-wrappers/lib_math_rich_errors';

View File

@ -5,6 +5,7 @@
"files": [ "files": [
"generated-artifacts/LibEIP712ExchangeDomain.json", "generated-artifacts/LibEIP712ExchangeDomain.json",
"generated-artifacts/LibExchangeRichErrors.json", "generated-artifacts/LibExchangeRichErrors.json",
"generated-artifacts/LibExchangeSelectors.json",
"generated-artifacts/LibFillResults.json", "generated-artifacts/LibFillResults.json",
"generated-artifacts/LibMath.json", "generated-artifacts/LibMath.json",
"generated-artifacts/LibMathRichErrors.json", "generated-artifacts/LibMathRichErrors.json",

View File

@ -389,8 +389,8 @@ contract MixinSignatureValidator is
// Disallow address zero because it is ecrecover() returns zero on // Disallow address zero because it is ecrecover() returns zero on
// failure. // failure.
if (signerAddress == address(0)) { if (signerAddress == address(0)) {
LibRichErrors._rrevert(LibExchangeRichErrors.SignatureError( LibRichErrors.rrevert(LibExchangeRichErrors.SignatureError(
IExchangeRichErrors.SignatureErrorCodes.INVALID_SIGNER, LibExchangeRichErrors.SignatureErrorCodes.INVALID_SIGNER,
hash, hash,
signerAddress, signerAddress,
signature signature

View File

@ -82,7 +82,7 @@ contract MixinWrapperFunctions is
(bool didSucceed, bytes memory returnData) = address(this).delegatecall(fillOrderCalldata); (bool didSucceed, bytes memory returnData) = address(this).delegatecall(fillOrderCalldata);
if (didSucceed) { if (didSucceed) {
assert(returnData.length == 128); assert(returnData.length == 128);
fillResults = abi.decode(returnData, (FillResults)); fillResults = abi.decode(returnData, (LibFillResults.FillResults));
} }
// fillResults values will be 0 by default if call was unsuccessful // fillResults values will be 0 by default if call was unsuccessful
return fillResults; return fillResults;

View File

@ -20,6 +20,9 @@ pragma solidity ^0.5.5;
pragma experimental ABIEncoderV2; pragma experimental ABIEncoderV2;
import "@0x/contracts-utils/contracts/src/LibReentrancyGuardRichErrors.sol"; import "@0x/contracts-utils/contracts/src/LibReentrancyGuardRichErrors.sol";
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
import "@0x/contracts-exchange-libs/contracts/src/LibZeroExTransaction.sol";
import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
import "../src/Exchange.sol"; import "../src/Exchange.sol";
@ -71,27 +74,27 @@ contract ReentrancyTester is
/// @dev Overriden to do nothing. /// @dev Overriden to do nothing.
function _fillOrder( function _fillOrder(
Order memory order, LibOrder.Order memory order,
uint256 takerAssetFillAmount, uint256 takerAssetFillAmount,
bytes memory signature bytes memory signature
) )
internal internal
returns (FillResults memory fillResults) returns (LibFillResults.FillResults memory fillResults)
{} {}
/// @dev Overriden to do nothing. /// @dev Overriden to do nothing.
function _fillOrKillOrder( function _fillOrKillOrder(
Order memory order, LibOrder.Order memory order,
uint256 takerAssetFillAmount, uint256 takerAssetFillAmount,
bytes memory signature bytes memory signature
) )
internal internal
returns (FillResults memory fillResults) returns (LibFillResults.FillResults memory fillResults)
{} {}
/// @dev Overridden to do nothing. /// @dev Overridden to do nothing.
function _executeTransaction( function _executeTransaction(
ZeroExTransaction memory transaction, LibZeroExTransaction.ZeroExTransaction memory transaction,
bytes memory signature bytes memory signature
) )
internal internal
@ -126,7 +129,7 @@ contract ReentrancyTester is
{} {}
/// @dev Overriden to do nothing. /// @dev Overriden to do nothing.
function _cancelOrder(Order memory order) function _cancelOrder(LibOrder.Order memory order)
internal internal
{} {}
} }

View File

@ -19,6 +19,8 @@
pragma solidity ^0.5.5; pragma solidity ^0.5.5;
pragma experimental ABIEncoderV2; pragma experimental ABIEncoderV2;
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
import "../src/Exchange.sol"; import "../src/Exchange.sol";
@ -28,19 +30,19 @@ import "../src/Exchange.sol";
contract TestWrapperFunctions is contract TestWrapperFunctions is
Exchange Exchange
{ {
uint8 internal constant MAX_ORDER_STATUS = uint8(OrderStatus.CANCELLED); uint8 internal constant MAX_ORDER_STATUS = uint8(LibOrder.OrderStatus.CANCELLED);
uint256 internal constant ALWAYS_FAILING_SALT = uint256(-1); uint256 internal constant ALWAYS_FAILING_SALT = uint256(-1);
string internal constant ALWAYS_FAILING_SALT_REVERT_REASON = "ALWAYS_FAILING_SALT"; string internal constant ALWAYS_FAILING_SALT_REVERT_REASON = "ALWAYS_FAILING_SALT";
// solhint-disable no-unused-vars // solhint-disable no-unused-vars
event FillOrderCalled( event FillOrderCalled(
Order order, LibOrder.Order order,
uint256 takerAssetFillAmount, uint256 takerAssetFillAmount,
bytes signature bytes signature
); );
event CancelOrderCalled( event CancelOrderCalled(
Order order LibOrder.Order order
); );
// solhint-disable no-empty-blocks // solhint-disable no-empty-blocks
@ -51,10 +53,10 @@ contract TestWrapperFunctions is
{} {}
/// @dev Overridden to be deterministic and simplified. /// @dev Overridden to be deterministic and simplified.
function getOrderInfo(Order memory order) function getOrderInfo(LibOrder.Order memory order)
public public
view view
returns (OrderInfo memory orderInfo) returns (LibOrder.OrderInfo memory orderInfo)
{ {
// Lower uint128 of `order.salt` is the `orderTakerAssetFilledAmount`. // Lower uint128 of `order.salt` is the `orderTakerAssetFilledAmount`.
orderInfo.orderTakerAssetFilledAmount = uint128(order.salt); orderInfo.orderTakerAssetFilledAmount = uint128(order.salt);
@ -65,12 +67,12 @@ contract TestWrapperFunctions is
/// @dev Overridden to log arguments, be deterministic, and revert with certain inputs. /// @dev Overridden to log arguments, be deterministic, and revert with certain inputs.
function _fillOrder( function _fillOrder(
Order memory order, LibOrder.Order memory order,
uint256 takerAssetFillAmount, uint256 takerAssetFillAmount,
bytes memory signature bytes memory signature
) )
internal internal
returns (FillResults memory fillResults) returns (LibFillResults.FillResults memory fillResults)
{ {
emit FillOrderCalled( emit FillOrderCalled(
order, order,
@ -94,7 +96,7 @@ contract TestWrapperFunctions is
/// @dev Overridden to only log arguments and revert with certain inputs. /// @dev Overridden to only log arguments and revert with certain inputs.
function _cancelOrder( function _cancelOrder(
Order memory order LibOrder.Order memory order
) )
internal internal
{ {
@ -109,7 +111,7 @@ contract TestWrapperFunctions is
} }
/// @dev Simplified order hashing. /// @dev Simplified order hashing.
function _getOrderHash(Order memory order) function _getOrderHash(LibOrder.Order memory order)
internal internal
pure pure
returns (bytes32 hash) returns (bytes32 hash)

View File

@ -34,7 +34,7 @@
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol" "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
}, },
"config": { "config": {
"abis": "./generated-artifacts/@(Exchange|ExchangeWrapper|IAssetProxy|IAssetProxyDispatcher|IEIP1271Wallet|IExchange|IExchangeCore|IMatchOrders|ISignatureValidator|ITransactions|ITransferSimulator|IWallet|IWrapperFunctions|IsolatedExchange|LibExchangeRichErrorDecoder|MixinAssetProxyDispatcher|MixinExchangeCore|MixinMatchOrders|MixinSignatureValidator|MixinTransactions|MixinTransferSimulator|MixinWrapperFunctions|ReentrantERC20Token|TestAssetProxyDispatcher|TestExchangeInternals|TestLibExchangeRichErrorDecoder|TestSignatureValidator|TestValidatorWallet|Whitelist).json", "abis": "./generated-artifacts/@(Exchange|ExchangeWrapper|IAssetProxy|IAssetProxyDispatcher|IEIP1271Wallet|IExchange|IExchangeCore|IExchangeRichErrors|IMatchOrders|ISignatureValidator|ITransactions|ITransferSimulator|IWallet|IWrapperFunctions|IsolatedExchange|LibExchangeRichErrorDecoder|MixinAssetProxyDispatcher|MixinExchangeCore|MixinMatchOrders|MixinSignatureValidator|MixinTransactions|MixinTransferSimulator|MixinWrapperFunctions|ReentrancyTester|TestAssetProxyDispatcher|TestExchangeInternals|TestLibExchangeRichErrorDecoder|TestSignatureValidator|TestValidatorWallet|TestWrapperFunctions|Whitelist).json",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually." "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
}, },
"repository": { "repository": {

View File

@ -12,6 +12,7 @@ import * as IAssetProxyDispatcher from '../generated-artifacts/IAssetProxyDispat
import * as IEIP1271Wallet from '../generated-artifacts/IEIP1271Wallet.json'; import * as IEIP1271Wallet from '../generated-artifacts/IEIP1271Wallet.json';
import * as IExchange from '../generated-artifacts/IExchange.json'; import * as IExchange from '../generated-artifacts/IExchange.json';
import * as IExchangeCore from '../generated-artifacts/IExchangeCore.json'; import * as IExchangeCore from '../generated-artifacts/IExchangeCore.json';
import * as IExchangeRichErrors from '../generated-artifacts/IExchangeRichErrors.json';
import * as IMatchOrders from '../generated-artifacts/IMatchOrders.json'; import * as IMatchOrders from '../generated-artifacts/IMatchOrders.json';
import * as ISignatureValidator from '../generated-artifacts/ISignatureValidator.json'; import * as ISignatureValidator from '../generated-artifacts/ISignatureValidator.json';
import * as ITransactions from '../generated-artifacts/ITransactions.json'; import * as ITransactions from '../generated-artifacts/ITransactions.json';
@ -51,6 +52,7 @@ export const artifacts = {
IEIP1271Wallet: IEIP1271Wallet as ContractArtifact, IEIP1271Wallet: IEIP1271Wallet as ContractArtifact,
IExchange: IExchange as ContractArtifact, IExchange: IExchange as ContractArtifact,
IExchangeCore: IExchangeCore as ContractArtifact, IExchangeCore: IExchangeCore as ContractArtifact,
IExchangeRichErrors: IExchangeRichErrors as ContractArtifact,
IMatchOrders: IMatchOrders as ContractArtifact, IMatchOrders: IMatchOrders as ContractArtifact,
ISignatureValidator: ISignatureValidator as ContractArtifact, ISignatureValidator: ISignatureValidator as ContractArtifact,
ITransactions: ITransactions as ContractArtifact, ITransactions: ITransactions as ContractArtifact,

View File

@ -10,6 +10,7 @@ export * from '../generated-wrappers/i_asset_proxy_dispatcher';
export * from '../generated-wrappers/i_e_i_p1271_wallet'; export * from '../generated-wrappers/i_e_i_p1271_wallet';
export * from '../generated-wrappers/i_exchange'; export * from '../generated-wrappers/i_exchange';
export * from '../generated-wrappers/i_exchange_core'; export * from '../generated-wrappers/i_exchange_core';
export * from '../generated-wrappers/i_exchange_rich_errors';
export * from '../generated-wrappers/i_match_orders'; export * from '../generated-wrappers/i_match_orders';
export * from '../generated-wrappers/i_signature_validator'; export * from '../generated-wrappers/i_signature_validator';
export * from '../generated-wrappers/i_transactions'; export * from '../generated-wrappers/i_transactions';

View File

@ -10,6 +10,7 @@
"generated-artifacts/IEIP1271Wallet.json", "generated-artifacts/IEIP1271Wallet.json",
"generated-artifacts/IExchange.json", "generated-artifacts/IExchange.json",
"generated-artifacts/IExchangeCore.json", "generated-artifacts/IExchangeCore.json",
"generated-artifacts/IExchangeRichErrors.json",
"generated-artifacts/IMatchOrders.json", "generated-artifacts/IMatchOrders.json",
"generated-artifacts/ISignatureValidator.json", "generated-artifacts/ISignatureValidator.json",
"generated-artifacts/ITransactions.json", "generated-artifacts/ITransactions.json",
@ -17,7 +18,6 @@
"generated-artifacts/IWallet.json", "generated-artifacts/IWallet.json",
"generated-artifacts/IWrapperFunctions.json", "generated-artifacts/IWrapperFunctions.json",
"generated-artifacts/IsolatedExchange.json", "generated-artifacts/IsolatedExchange.json",
"generated-artifacts/ReentrancyTester.json",
"generated-artifacts/LibExchangeRichErrorDecoder.json", "generated-artifacts/LibExchangeRichErrorDecoder.json",
"generated-artifacts/MixinAssetProxyDispatcher.json", "generated-artifacts/MixinAssetProxyDispatcher.json",
"generated-artifacts/MixinExchangeCore.json", "generated-artifacts/MixinExchangeCore.json",
@ -26,7 +26,7 @@
"generated-artifacts/MixinTransactions.json", "generated-artifacts/MixinTransactions.json",
"generated-artifacts/MixinTransferSimulator.json", "generated-artifacts/MixinTransferSimulator.json",
"generated-artifacts/MixinWrapperFunctions.json", "generated-artifacts/MixinWrapperFunctions.json",
"generated-artifacts/ReentrantERC20Token.json", "generated-artifacts/ReentrancyTester.json",
"generated-artifacts/TestAssetProxyDispatcher.json", "generated-artifacts/TestAssetProxyDispatcher.json",
"generated-artifacts/TestExchangeInternals.json", "generated-artifacts/TestExchangeInternals.json",
"generated-artifacts/TestLibExchangeRichErrorDecoder.json", "generated-artifacts/TestLibExchangeRichErrorDecoder.json",