diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-25 19:02:38 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-06-25 19:02:38 +0800 |
commit | 1353723b58715faf3dd10b173323dab015e2dd5b (patch) | |
tree | eea65fd6e986fa9f531a3cac4d4b432d237a76b4 /packages | |
parent | 3ed4a1ba206b52b76488cb85a7e20a277d5c0a2b (diff) | |
parent | f811c07454c87775f18374e8d955583dc157627f (diff) | |
download | dexon-sol-tools-1353723b58715faf3dd10b173323dab015e2dd5b.tar.gz dexon-sol-tools-1353723b58715faf3dd10b173323dab015e2dd5b.tar.zst dexon-sol-tools-1353723b58715faf3dd10b173323dab015e2dd5b.zip |
merge check-revert-reasons
Diffstat (limited to 'packages')
-rw-r--r-- | packages/contracts/src/utils/types.ts | 44 | ||||
-rw-r--r-- | packages/contracts/test/asset_proxy/authorizable.ts | 2 | ||||
-rw-r--r-- | packages/contracts/test/asset_proxy/proxies.ts | 2 | ||||
-rw-r--r-- | packages/contracts/test/exchange/core.ts | 4 | ||||
-rw-r--r-- | packages/contracts/test/exchange/dispatcher.ts | 3 | ||||
-rw-r--r-- | packages/contracts/test/exchange/match_orders.ts | 10 | ||||
-rw-r--r-- | packages/contracts/test/exchange/signature_validator.ts | 3 | ||||
-rw-r--r-- | packages/contracts/test/exchange/transactions.ts | 4 | ||||
-rw-r--r-- | packages/contracts/test/exchange/wrapper.ts | 4 | ||||
-rw-r--r-- | packages/contracts/test/libraries/lib_bytes.ts | 2 | ||||
-rw-r--r-- | packages/contracts/test/unlimited_allowance_token.ts | 2 | ||||
-rw-r--r-- | packages/types/src/index.ts | 44 |
12 files changed, 58 insertions, 66 deletions
diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts index e996ad96a..b792bb90a 100644 --- a/packages/contracts/src/utils/types.ts +++ b/packages/contracts/src/utils/types.ts @@ -227,47 +227,3 @@ export interface FillScenario { makerStateScenario: TraderStateScenario; takerStateScenario: TraderStateScenario; } - -export enum RevertReasons { - OrderUnfillable = 'ORDER_UNFILLABLE', - InvalidMaker = 'INVALID_MAKER', - InvalidTaker = 'INVALID_TAKER', - InvalidSender = 'INVALID_SENDER', - InvalidOrderSignature = 'INVALID_ORDER_SIGNATURE', - InvalidTakerAmount = 'INVALID_TAKER_AMOUNT', - RoundingError = 'ROUNDING_ERROR', - InvalidSignature = 'INVALID_SIGNATURE', - SignatureIllegal = 'SIGNATURE_ILLEGAL', - SignatureUnsupported = 'SIGNATURE_UNSUPPORTED', - InvalidNewOrderEpoch = 'INVALID_NEW_ORDER_EPOCH', - CompleteFillFailed = 'COMPLETE_FILL_FAILED', - NegativeSpreadRequired = 'NEGATIVE_SPREAD_REQUIRED', - ReentrancyIllegal = 'REENTRANCY_ILLEGAL', - InvalidTxHash = 'INVALID_TX_HASH', - InvalidTxSignature = 'INVALID_TX_SIGNATURE', - FailedExecution = 'FAILED_EXECUTION', - AssetProxyMismatch = 'ASSET_PROXY_MISMATCH', - AssetProxyIdMismatch = 'ASSET_PROXY_ID_MISMATCH', - LengthGreaterThan0Required = 'LENGTH_GREATER_THAN_0_REQUIRED', - Length0Required = 'LENGTH_0_REQUIRED', - Length65Required = 'LENGTH_65_REQUIRED', - InvalidAmount = 'INVALID_AMOUNT', - TransferFailed = 'TRANSFER_FAILED', - SenderNotAuthorized = 'SENDER_NOT_AUTHORIZED', - TargetNotAuthorized = 'TARGET_NOT_AUTHORIZED', - TargetAlreadyAuthorized = 'TARGET_ALREADY_AUTHORIZED', - IndexOutOfBounds = 'INDEX_OUT_OF_BOUNDS', - AuthorizedAddressMismatch = 'AUTHORIZED_ADDRESS_MISMATCH', - OnlyContractOwner = 'ONLY_CONTRACT_OWNER', - MakerNotWhitelisted = 'MAKER_NOT_WHITELISTED', - TakerNotWhitelisted = 'TAKER_NOT_WHITELISTED', - AssetProxyDoesNotExist = 'ASSET_PROXY_DOES_NOT_EXIST', - LibBytesGreaterThanZeroLengthRequired = 'GREATER_THAN_ZERO_LENGTH_REQUIRED', - LibBytesGreaterOrEqualTo4LengthRequired = 'GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED', - LibBytesGreaterOrEqualTo20LengthRequired = 'GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED', - LibBytesGreaterOrEqualTo32LengthRequired = 'GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED', - LibBytesGreaterOrEqualToNestedBytesLengthRequired = 'GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED', - LibBytesGreaterOrEqualToSourceBytesLengthRequired = 'GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED', - Erc20InsufficientBalance = 'ERC20_INSUFFICIENT_BALANCE', - Erc20InsufficientAllowance = 'ERC20_INSUFFICIENT_ALLOWANCE', -} diff --git a/packages/contracts/test/asset_proxy/authorizable.ts b/packages/contracts/test/asset_proxy/authorizable.ts index dfee83cf2..badf50bfd 100644 --- a/packages/contracts/test/asset_proxy/authorizable.ts +++ b/packages/contracts/test/asset_proxy/authorizable.ts @@ -1,4 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; +import { RevertReasons } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; @@ -10,7 +11,6 @@ import { } from '../../src/utils/assertions'; import { chaiSetup } from '../../src/utils/chai_setup'; import { constants } from '../../src/utils/constants'; -import { RevertReasons } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts index a0aa03800..f99f03875 100644 --- a/packages/contracts/test/asset_proxy/proxies.ts +++ b/packages/contracts/test/asset_proxy/proxies.ts @@ -1,5 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils, generatePseudoRandomSalt } from '@0xproject/order-utils'; +import { RevertReasons } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; @@ -24,7 +25,6 @@ import { constants } from '../../src/utils/constants'; import { ERC20Wrapper } from '../../src/utils/erc20_wrapper'; import { ERC721Wrapper } from '../../src/utils/erc721_wrapper'; import { LogDecoder } from '../../src/utils/log_decoder'; -import { RevertReasons } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index e2bd596db..449bc5601 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils, orderHashUtils } from '@0xproject/order-utils'; -import { AssetProxyId, SignedOrder } from '@0xproject/types'; +import { AssetProxyId, RevertReasons, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; @@ -27,7 +27,7 @@ import { ERC20Wrapper } from '../../src/utils/erc20_wrapper'; import { ERC721Wrapper } from '../../src/utils/erc721_wrapper'; import { ExchangeWrapper } from '../../src/utils/exchange_wrapper'; import { OrderFactory } from '../../src/utils/order_factory'; -import { ERC20BalancesByOwner, RevertReasons } from '../../src/utils/types'; +import { ERC20BalancesByOwner } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts index d0c193bd2..59d80c6d6 100644 --- a/packages/contracts/test/exchange/dispatcher.ts +++ b/packages/contracts/test/exchange/dispatcher.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils } from '@0xproject/order-utils'; -import { AssetProxyId } from '@0xproject/types'; +import { AssetProxyId, RevertReasons } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; @@ -14,7 +14,6 @@ import { chaiSetup } from '../../src/utils/chai_setup'; import { constants } from '../../src/utils/constants'; import { ERC20Wrapper } from '../../src/utils/erc20_wrapper'; import { ERC721Wrapper } from '../../src/utils/erc721_wrapper'; -import { RevertReasons } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index 66fdd8472..044108bfb 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils } from '@0xproject/order-utils'; -import { AssetProxyId } from '@0xproject/types'; +import { AssetProxyId, RevertReasons } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; @@ -20,13 +20,7 @@ import { ERC721Wrapper } from '../../src/utils/erc721_wrapper'; import { ExchangeWrapper } from '../../src/utils/exchange_wrapper'; import { MatchOrderTester } from '../../src/utils/match_order_tester'; import { OrderFactory } from '../../src/utils/order_factory'; -import { - ERC20BalancesByOwner, - ERC721TokenIdsByOwner, - OrderInfo, - OrderStatus, - RevertReasons, -} from '../../src/utils/types'; +import { ERC20BalancesByOwner, ERC721TokenIdsByOwner, OrderInfo, OrderStatus } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts index f829e0820..c610ead61 100644 --- a/packages/contracts/test/exchange/signature_validator.ts +++ b/packages/contracts/test/exchange/signature_validator.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { addSignedMessagePrefix, assetProxyUtils, MessagePrefixType, orderHashUtils } from '@0xproject/order-utils'; -import { SignatureType, SignedOrder } from '@0xproject/types'; +import { RevertReasons, SignatureType, SignedOrder } from '@0xproject/types'; import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; import ethUtil = require('ethereumjs-util'); @@ -18,7 +18,6 @@ import { chaiSetup } from '../../src/utils/chai_setup'; import { constants } from '../../src/utils/constants'; import { LogDecoder } from '../../src/utils/log_decoder'; import { OrderFactory } from '../../src/utils/order_factory'; -import { RevertReasons } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts index 329a3c2f9..6f820e673 100644 --- a/packages/contracts/test/exchange/transactions.ts +++ b/packages/contracts/test/exchange/transactions.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils, generatePseudoRandomSalt } from '@0xproject/order-utils'; -import { AssetProxyId, OrderWithoutExchangeAddress, SignedOrder } from '@0xproject/types'; +import { AssetProxyId, OrderWithoutExchangeAddress, RevertReasons, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; @@ -18,7 +18,7 @@ import { ExchangeWrapper } from '../../src/utils/exchange_wrapper'; import { OrderFactory } from '../../src/utils/order_factory'; import { orderUtils } from '../../src/utils/order_utils'; import { TransactionFactory } from '../../src/utils/transaction_factory'; -import { ERC20BalancesByOwner, RevertReasons, SignedTransaction } from '../../src/utils/types'; +import { ERC20BalancesByOwner, SignedTransaction } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index c652d22e5..504b78f5c 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils } from '@0xproject/order-utils'; -import { AssetProxyId, SignedOrder } from '@0xproject/types'; +import { AssetProxyId, RevertReasons, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; @@ -19,7 +19,7 @@ import { ERC20Wrapper } from '../../src/utils/erc20_wrapper'; import { ERC721Wrapper } from '../../src/utils/erc721_wrapper'; import { ExchangeWrapper } from '../../src/utils/exchange_wrapper'; import { OrderFactory } from '../../src/utils/order_factory'; -import { ERC20BalancesByOwner, RevertReasons } from '../../src/utils/types'; +import { ERC20BalancesByOwner } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index e4b3abb7f..5ab299b73 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -1,5 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils, generatePseudoRandomSalt } from '@0xproject/order-utils'; +import { RevertReasons } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import BN = require('bn.js'); import * as chai from 'chai'; @@ -11,7 +12,6 @@ import { artifacts } from '../../src/utils/artifacts'; import { expectRevertOrOtherErrorAsync } from '../../src/utils/assertions'; import { chaiSetup } from '../../src/utils/chai_setup'; import { constants } from '../../src/utils/constants'; -import { RevertReasons } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts index 9f52232e2..6ad59d4f1 100644 --- a/packages/contracts/test/unlimited_allowance_token.ts +++ b/packages/contracts/test/unlimited_allowance_token.ts @@ -1,4 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; +import { RevertReasons } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; @@ -7,7 +8,6 @@ import { artifacts } from '../src/utils/artifacts'; import { expectRevertOrOtherErrorAsync } from '../src/utils/assertions'; import { chaiSetup } from '../src/utils/chai_setup'; import { constants } from '../src/utils/constants'; -import { RevertReasons } from '../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../src/utils/web3_wrapper'; chaiSetup.configure(); diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index e5a0f41a9..70665a123 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -168,3 +168,47 @@ export interface ERC721AssetData { tokenId: BigNumber; receiverData: string; } + +export enum RevertReasons { + OrderUnfillable = 'ORDER_UNFILLABLE', + InvalidMaker = 'INVALID_MAKER', + InvalidTaker = 'INVALID_TAKER', + InvalidSender = 'INVALID_SENDER', + InvalidOrderSignature = 'INVALID_ORDER_SIGNATURE', + InvalidTakerAmount = 'INVALID_TAKER_AMOUNT', + RoundingError = 'ROUNDING_ERROR', + InvalidSignature = 'INVALID_SIGNATURE', + SignatureIllegal = 'SIGNATURE_ILLEGAL', + SignatureUnsupported = 'SIGNATURE_UNSUPPORTED', + InvalidNewOrderEpoch = 'INVALID_NEW_ORDER_EPOCH', + CompleteFillFailed = 'COMPLETE_FILL_FAILED', + NegativeSpreadRequired = 'NEGATIVE_SPREAD_REQUIRED', + ReentrancyIllegal = 'REENTRANCY_ILLEGAL', + InvalidTxHash = 'INVALID_TX_HASH', + InvalidTxSignature = 'INVALID_TX_SIGNATURE', + FailedExecution = 'FAILED_EXECUTION', + AssetProxyMismatch = 'ASSET_PROXY_MISMATCH', + AssetProxyIdMismatch = 'ASSET_PROXY_ID_MISMATCH', + LengthGreaterThan0Required = 'LENGTH_GREATER_THAN_0_REQUIRED', + Length0Required = 'LENGTH_0_REQUIRED', + Length65Required = 'LENGTH_65_REQUIRED', + InvalidAmount = 'INVALID_AMOUNT', + TransferFailed = 'TRANSFER_FAILED', + SenderNotAuthorized = 'SENDER_NOT_AUTHORIZED', + TargetNotAuthorized = 'TARGET_NOT_AUTHORIZED', + TargetAlreadyAuthorized = 'TARGET_ALREADY_AUTHORIZED', + IndexOutOfBounds = 'INDEX_OUT_OF_BOUNDS', + AuthorizedAddressMismatch = 'AUTHORIZED_ADDRESS_MISMATCH', + OnlyContractOwner = 'ONLY_CONTRACT_OWNER', + MakerNotWhitelisted = 'MAKER_NOT_WHITELISTED', + TakerNotWhitelisted = 'TAKER_NOT_WHITELISTED', + AssetProxyDoesNotExist = 'ASSET_PROXY_DOES_NOT_EXIST', + LibBytesGreaterThanZeroLengthRequired = 'GREATER_THAN_ZERO_LENGTH_REQUIRED', + LibBytesGreaterOrEqualTo4LengthRequired = 'GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED', + LibBytesGreaterOrEqualTo20LengthRequired = 'GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED', + LibBytesGreaterOrEqualTo32LengthRequired = 'GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED', + LibBytesGreaterOrEqualToNestedBytesLengthRequired = 'GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED', + LibBytesGreaterOrEqualToSourceBytesLengthRequired = 'GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED', + Erc20InsufficientBalance = 'ERC20_INSUFFICIENT_BALANCE', + Erc20InsufficientAllowance = 'ERC20_INSUFFICIENT_ALLOWANCE', +} |