Move LibAssetDataTransfer from forwarder to exchange-libs package
This commit is contained in:
@@ -20,7 +20,7 @@ pragma solidity ^0.5.9;
|
|||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
|
import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
|
||||||
import "@0x/contracts-exchange-forwarder/contracts/src/libs/LibAssetDataTransfer.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibAssetDataTransfer.sol";
|
||||||
import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
|
||||||
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
||||||
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
|
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
|
||||||
|
@@ -54,7 +54,6 @@
|
|||||||
"@0x/abi-gen": "^5.1.0",
|
"@0x/abi-gen": "^5.1.0",
|
||||||
"@0x/contracts-erc721": "^3.0.4",
|
"@0x/contracts-erc721": "^3.0.4",
|
||||||
"@0x/contracts-exchange": "^3.1.0",
|
"@0x/contracts-exchange": "^3.1.0",
|
||||||
"@0x/contracts-exchange-forwarder": "^4.0.4",
|
|
||||||
"@0x/contracts-exchange-libs": "^4.1.0",
|
"@0x/contracts-exchange-libs": "^4.1.0",
|
||||||
"@0x/contracts-gen": "^2.0.4",
|
"@0x/contracts-gen": "^2.0.4",
|
||||||
"@0x/contracts-test-utils": "^5.1.1",
|
"@0x/contracts-test-utils": "^5.1.1",
|
||||||
|
@@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "4.1.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Moved LibAssetDataTransfer to exchange-libs",
|
||||||
|
"pr": 2455
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1580811564,
|
"timestamp": 1580811564,
|
||||||
"version": "4.0.5",
|
"version": "4.0.5",
|
||||||
|
@@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
pragma solidity ^0.5.9;
|
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/LibBytes.sol";
|
||||||
import "@0x/contracts-utils/contracts/src/LibRichErrors.sol";
|
import "@0x/contracts-utils/contracts/src/LibRichErrors.sol";
|
||||||
import "@0x/contracts-utils/contracts/src/Ownable.sol";
|
import "@0x/contracts-utils/contracts/src/Ownable.sol";
|
||||||
import "@0x/contracts-erc20/contracts/src/LibERC20Token.sol";
|
import "@0x/contracts-erc20/contracts/src/LibERC20Token.sol";
|
||||||
import "@0x/contracts-asset-proxy/contracts/src/interfaces/IAssetData.sol";
|
import "@0x/contracts-asset-proxy/contracts/src/interfaces/IAssetData.sol";
|
||||||
import "./libs/LibConstants.sol";
|
import "./libs/LibConstants.sol";
|
||||||
import "./libs/LibAssetDataTransfer.sol";
|
|
||||||
import "./libs/LibForwarderRichErrors.sol";
|
import "./libs/LibForwarderRichErrors.sol";
|
||||||
import "./interfaces/IAssets.sol";
|
import "./interfaces/IAssets.sol";
|
||||||
|
|
||||||
|
@@ -25,10 +25,6 @@ library LibForwarderRichErrors {
|
|||||||
bytes4 internal constant UNREGISTERED_ASSET_PROXY_ERROR_SELECTOR =
|
bytes4 internal constant UNREGISTERED_ASSET_PROXY_ERROR_SELECTOR =
|
||||||
0xf3b96b8d;
|
0xf3b96b8d;
|
||||||
|
|
||||||
// bytes4(keccak256("UnsupportedAssetProxyError(bytes4)"))
|
|
||||||
bytes4 internal constant UNSUPPORTED_ASSET_PROXY_ERROR_SELECTOR =
|
|
||||||
0x7996a271;
|
|
||||||
|
|
||||||
// bytes4(keccak256("CompleteBuyFailedError(uint256,uint256)"))
|
// bytes4(keccak256("CompleteBuyFailedError(uint256,uint256)"))
|
||||||
bytes4 internal constant COMPLETE_BUY_FAILED_ERROR_SELECTOR =
|
bytes4 internal constant COMPLETE_BUY_FAILED_ERROR_SELECTOR =
|
||||||
0x91353a0c;
|
0x91353a0c;
|
||||||
@@ -49,10 +45,6 @@ library LibForwarderRichErrors {
|
|||||||
bytes4 internal constant DEFAULT_FUNCTION_WETH_CONTRACT_ONLY_ERROR_SELECTOR =
|
bytes4 internal constant DEFAULT_FUNCTION_WETH_CONTRACT_ONLY_ERROR_SELECTOR =
|
||||||
0x08b18698;
|
0x08b18698;
|
||||||
|
|
||||||
// bytes4(keccak256("Erc721AmountMustEqualOneError(uint256)"))
|
|
||||||
bytes4 internal constant ERC721_AMOUNT_MUST_EQUAL_ONE_ERROR_SELECTOR =
|
|
||||||
0xbaffa474;
|
|
||||||
|
|
||||||
// bytes4(keccak256("EthFeeLengthMismatchError(uint256,uint256)"))
|
// bytes4(keccak256("EthFeeLengthMismatchError(uint256,uint256)"))
|
||||||
bytes4 internal constant ETH_FEE_LENGTH_MISMATCH_ERROR_SELECTOR =
|
bytes4 internal constant ETH_FEE_LENGTH_MISMATCH_ERROR_SELECTOR =
|
||||||
0x3ecb6ceb;
|
0x3ecb6ceb;
|
||||||
@@ -66,19 +58,6 @@ library LibForwarderRichErrors {
|
|||||||
return abi.encodeWithSelector(UNREGISTERED_ASSET_PROXY_ERROR_SELECTOR);
|
return abi.encodeWithSelector(UNREGISTERED_ASSET_PROXY_ERROR_SELECTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
function UnsupportedAssetProxyError(
|
|
||||||
bytes4 proxyId
|
|
||||||
)
|
|
||||||
internal
|
|
||||||
pure
|
|
||||||
returns (bytes memory)
|
|
||||||
{
|
|
||||||
return abi.encodeWithSelector(
|
|
||||||
UNSUPPORTED_ASSET_PROXY_ERROR_SELECTOR,
|
|
||||||
proxyId
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function CompleteBuyFailedError(
|
function CompleteBuyFailedError(
|
||||||
uint256 expectedAssetBuyAmount,
|
uint256 expectedAssetBuyAmount,
|
||||||
uint256 actualAssetBuyAmount
|
uint256 actualAssetBuyAmount
|
||||||
@@ -150,19 +129,6 @@ library LibForwarderRichErrors {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Erc721AmountMustEqualOneError(
|
|
||||||
uint256 amount
|
|
||||||
)
|
|
||||||
internal
|
|
||||||
pure
|
|
||||||
returns (bytes memory)
|
|
||||||
{
|
|
||||||
return abi.encodeWithSelector(
|
|
||||||
ERC721_AMOUNT_MUST_EQUAL_ONE_ERROR_SELECTOR,
|
|
||||||
amount
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function EthFeeLengthMismatchError(
|
function EthFeeLengthMismatchError(
|
||||||
uint256 ethFeesLength,
|
uint256 ethFeesLength,
|
||||||
uint256 feeRecipientsLength
|
uint256 feeRecipientsLength
|
||||||
|
@@ -19,9 +19,9 @@
|
|||||||
pragma solidity ^0.5.9;
|
pragma solidity ^0.5.9;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
|
import "@0x/contracts-exchange-libs/contracts/src/LibAssetDataTransfer.sol";
|
||||||
import "../src/MixinExchangeWrapper.sol";
|
import "../src/MixinExchangeWrapper.sol";
|
||||||
import "../src/libs/LibConstants.sol";
|
import "../src/libs/LibConstants.sol";
|
||||||
import "../src/libs/LibAssetDataTransfer.sol";
|
|
||||||
import "../src/MixinReceiver.sol";
|
import "../src/MixinReceiver.sol";
|
||||||
|
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"publicInterfaceContracts": "Forwarder,IExchangeV2",
|
"publicInterfaceContracts": "Forwarder,IExchangeV2",
|
||||||
"abis": "./test/generated-artifacts/@(Forwarder|IAssets|IExchangeV2|IForwarder|IForwarderCore|LibAssetDataTransfer|LibConstants|LibForwarderRichErrors|MixinAssets|MixinExchangeWrapper|MixinForwarderCore|MixinReceiver|MixinWeth|TestForwarder).json",
|
"abis": "./test/generated-artifacts/@(Forwarder|IAssets|IExchangeV2|IForwarder|IForwarderCore|LibConstants|LibForwarderRichErrors|MixinAssets|MixinExchangeWrapper|MixinForwarderCore|MixinReceiver|MixinWeth|TestForwarder).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": {
|
||||||
|
@@ -10,7 +10,6 @@ import * as IAssets from '../test/generated-artifacts/IAssets.json';
|
|||||||
import * as IExchangeV2 from '../test/generated-artifacts/IExchangeV2.json';
|
import * as IExchangeV2 from '../test/generated-artifacts/IExchangeV2.json';
|
||||||
import * as IForwarder from '../test/generated-artifacts/IForwarder.json';
|
import * as IForwarder from '../test/generated-artifacts/IForwarder.json';
|
||||||
import * as IForwarderCore from '../test/generated-artifacts/IForwarderCore.json';
|
import * as IForwarderCore from '../test/generated-artifacts/IForwarderCore.json';
|
||||||
import * as LibAssetDataTransfer from '../test/generated-artifacts/LibAssetDataTransfer.json';
|
|
||||||
import * as LibConstants from '../test/generated-artifacts/LibConstants.json';
|
import * as LibConstants from '../test/generated-artifacts/LibConstants.json';
|
||||||
import * as LibForwarderRichErrors from '../test/generated-artifacts/LibForwarderRichErrors.json';
|
import * as LibForwarderRichErrors from '../test/generated-artifacts/LibForwarderRichErrors.json';
|
||||||
import * as MixinAssets from '../test/generated-artifacts/MixinAssets.json';
|
import * as MixinAssets from '../test/generated-artifacts/MixinAssets.json';
|
||||||
@@ -30,7 +29,6 @@ export const artifacts = {
|
|||||||
IExchangeV2: IExchangeV2 as ContractArtifact,
|
IExchangeV2: IExchangeV2 as ContractArtifact,
|
||||||
IForwarder: IForwarder as ContractArtifact,
|
IForwarder: IForwarder as ContractArtifact,
|
||||||
IForwarderCore: IForwarderCore as ContractArtifact,
|
IForwarderCore: IForwarderCore as ContractArtifact,
|
||||||
LibAssetDataTransfer: LibAssetDataTransfer as ContractArtifact,
|
|
||||||
LibConstants: LibConstants as ContractArtifact,
|
LibConstants: LibConstants as ContractArtifact,
|
||||||
LibForwarderRichErrors: LibForwarderRichErrors as ContractArtifact,
|
LibForwarderRichErrors: LibForwarderRichErrors as ContractArtifact,
|
||||||
TestForwarder: TestForwarder as ContractArtifact,
|
TestForwarder: TestForwarder as ContractArtifact,
|
||||||
|
@@ -26,7 +26,7 @@ import {
|
|||||||
randomAddress,
|
randomAddress,
|
||||||
verifyEventsFromLogs,
|
verifyEventsFromLogs,
|
||||||
} from '@0x/contracts-test-utils';
|
} from '@0x/contracts-test-utils';
|
||||||
import { BigNumber, ExchangeForwarderRevertErrors, hexUtils } from '@0x/utils';
|
import { BigNumber, hexUtils, LibAssetDataTransferRevertErrors } from '@0x/utils';
|
||||||
import { LogWithDecodedArgs } from 'ethereum-types';
|
import { LogWithDecodedArgs } from 'ethereum-types';
|
||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
@@ -235,7 +235,7 @@ blockchainTests.resets('Supported asset type unit tests', env => {
|
|||||||
const tx = forwarder
|
const tx = forwarder
|
||||||
.transferOut(erc721AssetData, invalidAmount)
|
.transferOut(erc721AssetData, invalidAmount)
|
||||||
.awaitTransactionSuccessAsync({ from: receiver });
|
.awaitTransactionSuccessAsync({ from: receiver });
|
||||||
const expectedError = new ExchangeForwarderRevertErrors.Erc721AmountMustEqualOneError(invalidAmount);
|
const expectedError = new LibAssetDataTransferRevertErrors.Erc721AmountMustEqualOneError(invalidAmount);
|
||||||
return expect(tx).to.revertWith(expectedError);
|
return expect(tx).to.revertWith(expectedError);
|
||||||
});
|
});
|
||||||
it('transfers a single ERC1155 token', async () => {
|
it('transfers a single ERC1155 token', async () => {
|
||||||
@@ -365,7 +365,7 @@ blockchainTests.resets('Supported asset type unit tests', env => {
|
|||||||
const tx = forwarder
|
const tx = forwarder
|
||||||
.transferOut(randomBytes, TRANSFER_AMOUNT)
|
.transferOut(randomBytes, TRANSFER_AMOUNT)
|
||||||
.awaitTransactionSuccessAsync({ from: receiver });
|
.awaitTransactionSuccessAsync({ from: receiver });
|
||||||
const expectedError = new ExchangeForwarderRevertErrors.UnsupportedAssetProxyError(
|
const expectedError = new LibAssetDataTransferRevertErrors.UnsupportedAssetProxyError(
|
||||||
hexUtils.slice(randomBytes, 0, 4),
|
hexUtils.slice(randomBytes, 0, 4),
|
||||||
);
|
);
|
||||||
return expect(tx).to.revertWith(expectedError);
|
return expect(tx).to.revertWith(expectedError);
|
||||||
|
@@ -8,7 +8,6 @@ export * from '../test/generated-wrappers/i_assets';
|
|||||||
export * from '../test/generated-wrappers/i_exchange_v2';
|
export * from '../test/generated-wrappers/i_exchange_v2';
|
||||||
export * from '../test/generated-wrappers/i_forwarder';
|
export * from '../test/generated-wrappers/i_forwarder';
|
||||||
export * from '../test/generated-wrappers/i_forwarder_core';
|
export * from '../test/generated-wrappers/i_forwarder_core';
|
||||||
export * from '../test/generated-wrappers/lib_asset_data_transfer';
|
|
||||||
export * from '../test/generated-wrappers/lib_constants';
|
export * from '../test/generated-wrappers/lib_constants';
|
||||||
export * from '../test/generated-wrappers/lib_forwarder_rich_errors';
|
export * from '../test/generated-wrappers/lib_forwarder_rich_errors';
|
||||||
export * from '../test/generated-wrappers/mixin_assets';
|
export * from '../test/generated-wrappers/mixin_assets';
|
||||||
|
@@ -10,7 +10,6 @@
|
|||||||
"test/generated-artifacts/IExchangeV2.json",
|
"test/generated-artifacts/IExchangeV2.json",
|
||||||
"test/generated-artifacts/IForwarder.json",
|
"test/generated-artifacts/IForwarder.json",
|
||||||
"test/generated-artifacts/IForwarderCore.json",
|
"test/generated-artifacts/IForwarderCore.json",
|
||||||
"test/generated-artifacts/LibAssetDataTransfer.json",
|
|
||||||
"test/generated-artifacts/LibConstants.json",
|
"test/generated-artifacts/LibConstants.json",
|
||||||
"test/generated-artifacts/LibForwarderRichErrors.json",
|
"test/generated-artifacts/LibForwarderRichErrors.json",
|
||||||
"test/generated-artifacts/MixinAssets.json",
|
"test/generated-artifacts/MixinAssets.json",
|
||||||
|
@@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "4.2.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Moved LibAssetDataTransfer here from forwarder",
|
||||||
|
"pr": 2455
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1580811564,
|
"timestamp": 1580811564,
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
|
@@ -26,7 +26,7 @@ import "@0x/contracts-erc20/contracts/src/LibERC20Token.sol";
|
|||||||
import "@0x/contracts-erc721/contracts/src/interfaces/IERC721Token.sol";
|
import "@0x/contracts-erc721/contracts/src/interfaces/IERC721Token.sol";
|
||||||
import "@0x/contracts-erc1155/contracts/src/interfaces/IERC1155.sol";
|
import "@0x/contracts-erc1155/contracts/src/interfaces/IERC1155.sol";
|
||||||
import "@0x/contracts-asset-proxy/contracts/src/interfaces/IAssetData.sol";
|
import "@0x/contracts-asset-proxy/contracts/src/interfaces/IAssetData.sol";
|
||||||
import "./LibForwarderRichErrors.sol";
|
import "./LibAssetDataTransferRichErrors.sol";
|
||||||
|
|
||||||
|
|
||||||
library LibAssetDataTransfer {
|
library LibAssetDataTransfer {
|
||||||
@@ -82,7 +82,7 @@ library LibAssetDataTransfer {
|
|||||||
amount
|
amount
|
||||||
);
|
);
|
||||||
} else if (proxyId != IAssetData(address(0)).StaticCall.selector) {
|
} else if (proxyId != IAssetData(address(0)).StaticCall.selector) {
|
||||||
LibRichErrors.rrevert(LibForwarderRichErrors.UnsupportedAssetProxyError(
|
LibRichErrors.rrevert(LibAssetDataTransferRichErrors.UnsupportedAssetProxyError(
|
||||||
proxyId
|
proxyId
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -165,7 +165,7 @@ library LibAssetDataTransfer {
|
|||||||
internal
|
internal
|
||||||
{
|
{
|
||||||
if (amount != 1) {
|
if (amount != 1) {
|
||||||
LibRichErrors.rrevert(LibForwarderRichErrors.Erc721AmountMustEqualOneError(
|
LibRichErrors.rrevert(LibAssetDataTransferRichErrors.Erc721AmountMustEqualOneError(
|
||||||
amount
|
amount
|
||||||
));
|
));
|
||||||
}
|
}
|
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
library LibAssetDataTransferRichErrors {
|
||||||
|
|
||||||
|
// bytes4(keccak256("UnsupportedAssetProxyError(bytes4)"))
|
||||||
|
bytes4 internal constant UNSUPPORTED_ASSET_PROXY_ERROR_SELECTOR =
|
||||||
|
0x7996a271;
|
||||||
|
|
||||||
|
// bytes4(keccak256("Erc721AmountMustEqualOneError(uint256)"))
|
||||||
|
bytes4 internal constant ERC721_AMOUNT_MUST_EQUAL_ONE_ERROR_SELECTOR =
|
||||||
|
0xbaffa474;
|
||||||
|
|
||||||
|
// solhint-disable func-name-mixedcase
|
||||||
|
function UnsupportedAssetProxyError(
|
||||||
|
bytes4 proxyId
|
||||||
|
)
|
||||||
|
internal
|
||||||
|
pure
|
||||||
|
returns (bytes memory)
|
||||||
|
{
|
||||||
|
return abi.encodeWithSelector(
|
||||||
|
UNSUPPORTED_ASSET_PROXY_ERROR_SELECTOR,
|
||||||
|
proxyId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Erc721AmountMustEqualOneError(
|
||||||
|
uint256 amount
|
||||||
|
)
|
||||||
|
internal
|
||||||
|
pure
|
||||||
|
returns (bytes memory)
|
||||||
|
{
|
||||||
|
return abi.encodeWithSelector(
|
||||||
|
ERC721_AMOUNT_MUST_EQUAL_ONE_ERROR_SELECTOR,
|
||||||
|
amount
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -39,7 +39,7 @@
|
|||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"publicInterfaceContracts": "IWallet,LibEIP712ExchangeDomain,LibExchangeRichErrors,LibMath,LibMathRichErrors,LibOrder,LibZeroExTransaction",
|
"publicInterfaceContracts": "IWallet,LibEIP712ExchangeDomain,LibExchangeRichErrors,LibMath,LibMathRichErrors,LibOrder,LibZeroExTransaction",
|
||||||
"abis": "./test/generated-artifacts/@(IWallet|LibEIP712ExchangeDomain|LibExchangeRichErrors|LibFillResults|LibMath|LibMathRichErrors|LibOrder|LibZeroExTransaction|TestLibEIP712ExchangeDomain|TestLibFillResults|TestLibMath|TestLibOrder|TestLibZeroExTransaction).json",
|
"abis": "./test/generated-artifacts/@(IWallet|LibAssetDataTransfer|LibAssetDataTransferRichErrors|LibEIP712ExchangeDomain|LibExchangeRichErrors|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": {
|
||||||
|
@@ -8,7 +8,7 @@ export {
|
|||||||
LibOrderContract,
|
LibOrderContract,
|
||||||
LibZeroExTransactionContract,
|
LibZeroExTransactionContract,
|
||||||
} from './wrappers';
|
} from './wrappers';
|
||||||
export { LibMathRevertErrors } from '@0x/utils';
|
export { LibAssetDataTransferRevertErrors, LibMathRevertErrors } from '@0x/utils';
|
||||||
|
|
||||||
import * as ReferenceFunctionsToExport from './reference_functions';
|
import * as ReferenceFunctionsToExport from './reference_functions';
|
||||||
export import ReferenceFunctions = ReferenceFunctionsToExport;
|
export import ReferenceFunctions = ReferenceFunctionsToExport;
|
||||||
|
@@ -6,6 +6,8 @@
|
|||||||
import { ContractArtifact } from 'ethereum-types';
|
import { ContractArtifact } from 'ethereum-types';
|
||||||
|
|
||||||
import * as IWallet from '../test/generated-artifacts/IWallet.json';
|
import * as IWallet from '../test/generated-artifacts/IWallet.json';
|
||||||
|
import * as LibAssetDataTransfer from '../test/generated-artifacts/LibAssetDataTransfer.json';
|
||||||
|
import * as LibAssetDataTransferRichErrors from '../test/generated-artifacts/LibAssetDataTransferRichErrors.json';
|
||||||
import * as LibEIP712ExchangeDomain from '../test/generated-artifacts/LibEIP712ExchangeDomain.json';
|
import * as LibEIP712ExchangeDomain from '../test/generated-artifacts/LibEIP712ExchangeDomain.json';
|
||||||
import * as LibExchangeRichErrors from '../test/generated-artifacts/LibExchangeRichErrors.json';
|
import * as LibExchangeRichErrors from '../test/generated-artifacts/LibExchangeRichErrors.json';
|
||||||
import * as LibFillResults from '../test/generated-artifacts/LibFillResults.json';
|
import * as LibFillResults from '../test/generated-artifacts/LibFillResults.json';
|
||||||
@@ -20,6 +22,8 @@ import * as TestLibOrder from '../test/generated-artifacts/TestLibOrder.json';
|
|||||||
import * as TestLibZeroExTransaction from '../test/generated-artifacts/TestLibZeroExTransaction.json';
|
import * as TestLibZeroExTransaction from '../test/generated-artifacts/TestLibZeroExTransaction.json';
|
||||||
export const artifacts = {
|
export const artifacts = {
|
||||||
IWallet: IWallet as ContractArtifact,
|
IWallet: IWallet as ContractArtifact,
|
||||||
|
LibAssetDataTransfer: LibAssetDataTransfer as ContractArtifact,
|
||||||
|
LibAssetDataTransferRichErrors: LibAssetDataTransferRichErrors as ContractArtifact,
|
||||||
LibEIP712ExchangeDomain: LibEIP712ExchangeDomain as ContractArtifact,
|
LibEIP712ExchangeDomain: LibEIP712ExchangeDomain as ContractArtifact,
|
||||||
LibExchangeRichErrors: LibExchangeRichErrors as ContractArtifact,
|
LibExchangeRichErrors: LibExchangeRichErrors as ContractArtifact,
|
||||||
LibFillResults: LibFillResults as ContractArtifact,
|
LibFillResults: LibFillResults as ContractArtifact,
|
||||||
|
@@ -4,6 +4,8 @@
|
|||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
export * from '../test/generated-wrappers/i_wallet';
|
export * from '../test/generated-wrappers/i_wallet';
|
||||||
|
export * from '../test/generated-wrappers/lib_asset_data_transfer';
|
||||||
|
export * from '../test/generated-wrappers/lib_asset_data_transfer_rich_errors';
|
||||||
export * from '../test/generated-wrappers/lib_e_i_p712_exchange_domain';
|
export * from '../test/generated-wrappers/lib_e_i_p712_exchange_domain';
|
||||||
export * from '../test/generated-wrappers/lib_exchange_rich_errors';
|
export * from '../test/generated-wrappers/lib_exchange_rich_errors';
|
||||||
export * from '../test/generated-wrappers/lib_fill_results';
|
export * from '../test/generated-wrappers/lib_fill_results';
|
||||||
|
@@ -11,6 +11,8 @@
|
|||||||
"generated-artifacts/LibOrder.json",
|
"generated-artifacts/LibOrder.json",
|
||||||
"generated-artifacts/LibZeroExTransaction.json",
|
"generated-artifacts/LibZeroExTransaction.json",
|
||||||
"test/generated-artifacts/IWallet.json",
|
"test/generated-artifacts/IWallet.json",
|
||||||
|
"test/generated-artifacts/LibAssetDataTransfer.json",
|
||||||
|
"test/generated-artifacts/LibAssetDataTransferRichErrors.json",
|
||||||
"test/generated-artifacts/LibEIP712ExchangeDomain.json",
|
"test/generated-artifacts/LibEIP712ExchangeDomain.json",
|
||||||
"test/generated-artifacts/LibExchangeRichErrors.json",
|
"test/generated-artifacts/LibExchangeRichErrors.json",
|
||||||
"test/generated-artifacts/LibFillResults.json",
|
"test/generated-artifacts/LibFillResults.json",
|
||||||
|
@@ -5,6 +5,10 @@
|
|||||||
{
|
{
|
||||||
"note": "Added Broker revert errors",
|
"note": "Added Broker revert errors",
|
||||||
"pr": 2455
|
"pr": 2455
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Moved LibAssetDataTransfer revert errors into their own file",
|
||||||
|
"pr": 2455
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@@ -30,6 +30,7 @@ export {
|
|||||||
export import BrokerRevertErrors = require('./revert_errors/broker/revert_errors');
|
export import BrokerRevertErrors = require('./revert_errors/broker/revert_errors');
|
||||||
export import CoordinatorRevertErrors = require('./revert_errors/coordinator/revert_errors');
|
export import CoordinatorRevertErrors = require('./revert_errors/coordinator/revert_errors');
|
||||||
export import ExchangeForwarderRevertErrors = require('./revert_errors/exchange-forwarder/revert_errors');
|
export import ExchangeForwarderRevertErrors = require('./revert_errors/exchange-forwarder/revert_errors');
|
||||||
|
export import LibAssetDataTransferRevertErrors = require('./revert_errors/exchange-libs/lib_asset_data_transfer_revert_errors');
|
||||||
export import LibMathRevertErrors = require('./revert_errors/exchange-libs/lib_math_revert_errors');
|
export import LibMathRevertErrors = require('./revert_errors/exchange-libs/lib_math_revert_errors');
|
||||||
export import ExchangeRevertErrors = require('./revert_errors/exchange/revert_errors');
|
export import ExchangeRevertErrors = require('./revert_errors/exchange/revert_errors');
|
||||||
export import FixedMathRevertErrors = require('./revert_errors/staking/fixed_math_revert_errors');
|
export import FixedMathRevertErrors = require('./revert_errors/staking/fixed_math_revert_errors');
|
||||||
|
@@ -9,12 +9,6 @@ export class UnregisteredAssetProxyError extends RevertError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UnsupportedAssetProxyError extends RevertError {
|
|
||||||
constructor(proxyId?: string) {
|
|
||||||
super('UnsupportedAssetProxyError', 'UnsupportedAssetProxyError(bytes4 proxyId)', { proxyId });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CompleteBuyFailedError extends RevertError {
|
export class CompleteBuyFailedError extends RevertError {
|
||||||
constructor(
|
constructor(
|
||||||
expectedAssetBuyAmount?: BigNumber | number | string,
|
expectedAssetBuyAmount?: BigNumber | number | string,
|
||||||
@@ -67,14 +61,6 @@ export class MsgValueCannotEqualZeroError extends RevertError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Erc721AmountMustEqualOneError extends RevertError {
|
|
||||||
constructor(amount?: BigNumber | number | string) {
|
|
||||||
super('Erc721AmountMustEqualOneError', 'Erc721AmountMustEqualOneError(uint256 amount)', {
|
|
||||||
amount,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class EthFeeLengthMismatchError extends RevertError {
|
export class EthFeeLengthMismatchError extends RevertError {
|
||||||
constructor(ethFeesLength?: BigNumber | number | string, feeRecipientsLength?: BigNumber | number | string) {
|
constructor(ethFeesLength?: BigNumber | number | string, feeRecipientsLength?: BigNumber | number | string) {
|
||||||
super(
|
super(
|
||||||
@@ -90,14 +76,12 @@ export class EthFeeLengthMismatchError extends RevertError {
|
|||||||
|
|
||||||
const types = [
|
const types = [
|
||||||
UnregisteredAssetProxyError,
|
UnregisteredAssetProxyError,
|
||||||
UnsupportedAssetProxyError,
|
|
||||||
CompleteBuyFailedError,
|
CompleteBuyFailedError,
|
||||||
UnsupportedFeeError,
|
UnsupportedFeeError,
|
||||||
InsufficientEthForFeeError,
|
InsufficientEthForFeeError,
|
||||||
OverspentWethError,
|
OverspentWethError,
|
||||||
DefaultFunctionWethContractOnlyError,
|
DefaultFunctionWethContractOnlyError,
|
||||||
MsgValueCannotEqualZeroError,
|
MsgValueCannotEqualZeroError,
|
||||||
Erc721AmountMustEqualOneError,
|
|
||||||
EthFeeLengthMismatchError,
|
EthFeeLengthMismatchError,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@@ -0,0 +1,25 @@
|
|||||||
|
import { BigNumber } from '../../configured_bignumber';
|
||||||
|
import { RevertError } from '../../revert_error';
|
||||||
|
|
||||||
|
// tslint:disable:max-classes-per-file
|
||||||
|
|
||||||
|
export class UnsupportedAssetProxyError extends RevertError {
|
||||||
|
constructor(proxyId?: string) {
|
||||||
|
super('UnsupportedAssetProxyError', 'UnsupportedAssetProxyError(bytes4 proxyId)', { proxyId });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Erc721AmountMustEqualOneError extends RevertError {
|
||||||
|
constructor(amount?: BigNumber | number | string) {
|
||||||
|
super('Erc721AmountMustEqualOneError', 'Erc721AmountMustEqualOneError(uint256 amount)', {
|
||||||
|
amount,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const types = [UnsupportedAssetProxyError, Erc721AmountMustEqualOneError];
|
||||||
|
|
||||||
|
// Register the types we've defined.
|
||||||
|
for (const type of types) {
|
||||||
|
RevertError.registerType(type);
|
||||||
|
}
|
Reference in New Issue
Block a user