diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-26 14:11:14 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-06-26 14:11:14 +0800 |
commit | 27670f4da679f5dbd3a3b399f14ba437184d2633 (patch) | |
tree | 064b746936595b2d55edbb336cff631e531431d0 /packages | |
parent | e051743a3d9b92c8a5b275dc5843b98c37830b8c (diff) | |
download | dexon-sol-tools-27670f4da679f5dbd3a3b399f14ba437184d2633.tar.gz dexon-sol-tools-27670f4da679f5dbd3a3b399f14ba437184d2633.tar.zst dexon-sol-tools-27670f4da679f5dbd3a3b399f14ba437184d2633.zip |
Rename RevertReasons to RevertReason since singular enum names are more common
Diffstat (limited to 'packages')
-rw-r--r-- | packages/contracts/test/asset_proxy/authorizable.ts | 10 | ||||
-rw-r--r-- | packages/contracts/test/asset_proxy/proxies.ts | 18 | ||||
-rw-r--r-- | packages/contracts/test/exchange/core.ts | 48 | ||||
-rw-r--r-- | packages/contracts/test/exchange/dispatcher.ts | 10 | ||||
-rw-r--r-- | packages/contracts/test/exchange/match_orders.ts | 12 | ||||
-rw-r--r-- | packages/contracts/test/exchange/signature_validator.ts | 10 | ||||
-rw-r--r-- | packages/contracts/test/exchange/transactions.ts | 16 | ||||
-rw-r--r-- | packages/contracts/test/exchange/wrapper.ts | 12 | ||||
-rw-r--r-- | packages/contracts/test/libraries/lib_bytes.ts | 46 | ||||
-rw-r--r-- | packages/contracts/test/unlimited_allowance_token.ts | 8 | ||||
-rw-r--r-- | packages/types/src/index.ts | 2 |
11 files changed, 96 insertions, 96 deletions
diff --git a/packages/contracts/test/asset_proxy/authorizable.ts b/packages/contracts/test/asset_proxy/authorizable.ts index badf50bfd..c2295dda6 100644 --- a/packages/contracts/test/asset_proxy/authorizable.ts +++ b/packages/contracts/test/asset_proxy/authorizable.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { RevertReasons } from '@0xproject/types'; +import { RevertReason } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; @@ -49,7 +49,7 @@ describe('Authorizable', () => { it('should throw if not called by owner', async () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( authorizable.addAuthorizedAddress.sendTransactionAsync(notOwner, { from: notOwner }), - RevertReasons.OnlyContractOwner, + RevertReason.OnlyContractOwner, ); }); it('should allow owner to add an authorized address', async () => { @@ -67,7 +67,7 @@ describe('Authorizable', () => { ); return expectRevertReasonOrAlwaysFailingTransactionAsync( authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }), - RevertReasons.TargetAlreadyAuthorized, + RevertReason.TargetAlreadyAuthorized, ); }); }); @@ -82,7 +82,7 @@ describe('Authorizable', () => { authorizable.removeAuthorizedAddress.sendTransactionAsync(address, { from: notOwner, }), - RevertReasons.OnlyContractOwner, + RevertReason.OnlyContractOwner, ); }); @@ -106,7 +106,7 @@ describe('Authorizable', () => { authorizable.removeAuthorizedAddress.sendTransactionAsync(address, { from: owner, }), - RevertReasons.TargetNotAuthorized, + RevertReason.TargetNotAuthorized, ); }); }); diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts index 0457eb3ef..7960e46d2 100644 --- a/packages/contracts/test/asset_proxy/proxies.ts +++ b/packages/contracts/test/asset_proxy/proxies.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils, generatePseudoRandomSalt } from '@0xproject/order-utils'; -import { RevertReasons } from '@0xproject/types'; +import { RevertReason } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; @@ -170,7 +170,7 @@ describe('Asset Transfer Proxies', () => { transferAmount, { from: exchangeAddress }, ), - RevertReasons.TransferFailed, + RevertReason.TransferFailed, ); }); @@ -184,7 +184,7 @@ describe('Asset Transfer Proxies', () => { erc20Proxy.transferFrom.sendTransactionAsync(encodedAssetData, makerAddress, takerAddress, amount, { from: notAuthorized, }), - RevertReasons.SenderNotAuthorized, + RevertReason.SenderNotAuthorized, ); }); }); @@ -236,7 +236,7 @@ describe('Asset Transfer Proxies', () => { erc20Proxy.batchTransferFrom.sendTransactionAsync(assetData, fromAddresses, toAddresses, amounts, { from: notAuthorized, }), - RevertReasons.SenderNotAuthorized, + RevertReason.SenderNotAuthorized, ); }); }); @@ -378,7 +378,7 @@ describe('Asset Transfer Proxies', () => { amount, { from: exchangeAddress }, ), - RevertReasons.InvalidAmount, + RevertReason.InvalidAmount, ); }); @@ -398,7 +398,7 @@ describe('Asset Transfer Proxies', () => { amount, { from: exchangeAddress }, ), - RevertReasons.InvalidAmount, + RevertReason.InvalidAmount, ); }); @@ -418,7 +418,7 @@ describe('Asset Transfer Proxies', () => { erc20Proxy.transferFrom.sendTransactionAsync(encodedAssetData, makerAddress, takerAddress, amount, { from: exchangeAddress, }), - RevertReasons.TransferFailed, + RevertReason.TransferFailed, ); }); @@ -435,7 +435,7 @@ describe('Asset Transfer Proxies', () => { amount, { from: notAuthorized }, ), - RevertReasons.SenderNotAuthorized, + RevertReason.SenderNotAuthorized, ); }); }); @@ -490,7 +490,7 @@ describe('Asset Transfer Proxies', () => { erc721Proxy.batchTransferFrom.sendTransactionAsync(assetData, fromAddresses, toAddresses, amounts, { from: notAuthorized, }), - RevertReasons.SenderNotAuthorized, + RevertReason.SenderNotAuthorized, ); }); }); diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index c83041638..59756fe9a 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, RevertReasons, SignedOrder } from '@0xproject/types'; +import { AssetProxyId, RevertReason, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; @@ -420,7 +420,7 @@ describe('Exchange core', () => { }); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.InvalidTaker, + RevertReason.InvalidTaker, ); }); @@ -438,7 +438,7 @@ describe('Exchange core', () => { signedOrder.signature = invalidSigHex; return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.InvalidOrderSignature, + RevertReason.InvalidOrderSignature, ); }); @@ -449,7 +449,7 @@ describe('Exchange core', () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.OrderUnfillable, + RevertReason.OrderUnfillable, ); }); @@ -460,7 +460,7 @@ describe('Exchange core', () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.OrderUnfillable, + RevertReason.OrderUnfillable, ); }); @@ -471,7 +471,7 @@ describe('Exchange core', () => { exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount: new BigNumber(0), }), - RevertReasons.InvalidTakerAmount, + RevertReason.InvalidTakerAmount, ); }); @@ -482,7 +482,7 @@ describe('Exchange core', () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.TransferFailed, + RevertReason.TransferFailed, ); }); @@ -492,7 +492,7 @@ describe('Exchange core', () => { }); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.TransferFailed, + RevertReason.TransferFailed, ); }); @@ -505,7 +505,7 @@ describe('Exchange core', () => { ); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.TransferFailed, + RevertReason.TransferFailed, ); }); @@ -518,7 +518,7 @@ describe('Exchange core', () => { ); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.TransferFailed, + RevertReason.TransferFailed, ); }); @@ -528,7 +528,7 @@ describe('Exchange core', () => { }); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.OrderUnfillable, + RevertReason.OrderUnfillable, ); }); @@ -537,7 +537,7 @@ describe('Exchange core', () => { await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - RevertReasons.OrderUnfillable, + RevertReason.OrderUnfillable, ); }); }); @@ -551,7 +551,7 @@ describe('Exchange core', () => { it('should throw if not sent by maker', async () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.cancelOrderAsync(signedOrder, takerAddress), - RevertReasons.InvalidMaker, + RevertReason.InvalidMaker, ); }); @@ -562,7 +562,7 @@ describe('Exchange core', () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress), - RevertReasons.OrderUnfillable, + RevertReason.OrderUnfillable, ); }); @@ -573,7 +573,7 @@ describe('Exchange core', () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress), - RevertReasons.OrderUnfillable, + RevertReason.OrderUnfillable, ); }); @@ -583,7 +583,7 @@ describe('Exchange core', () => { exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount: signedOrder.takerAssetAmount.div(2), }), - RevertReasons.OrderUnfillable, + RevertReason.OrderUnfillable, ); }); @@ -606,7 +606,7 @@ describe('Exchange core', () => { await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress), - RevertReasons.OrderUnfillable, + RevertReason.OrderUnfillable, ); }); @@ -616,7 +616,7 @@ describe('Exchange core', () => { }); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress), - RevertReasons.OrderUnfillable, + RevertReason.OrderUnfillable, ); }); @@ -636,7 +636,7 @@ describe('Exchange core', () => { exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount: fillTakerAssetAmount2, }), - RevertReasons.RoundingError, + RevertReason.RoundingError, ); }); }); @@ -648,7 +648,7 @@ describe('Exchange core', () => { const lesserOrderEpoch = new BigNumber(0); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.cancelOrdersUpToAsync(lesserOrderEpoch, makerAddress), - RevertReasons.InvalidNewOrderEpoch, + RevertReason.InvalidNewOrderEpoch, ); }); @@ -657,7 +657,7 @@ describe('Exchange core', () => { await exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress), - RevertReasons.InvalidNewOrderEpoch, + RevertReason.InvalidNewOrderEpoch, ); }); @@ -817,7 +817,7 @@ describe('Exchange core', () => { const takerAssetFillAmount = signedOrder.takerAssetAmount; return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }), - RevertReasons.InvalidAmount, + RevertReason.InvalidAmount, ); }); @@ -840,7 +840,7 @@ describe('Exchange core', () => { const takerAssetFillAmount = signedOrder.takerAssetAmount; return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }), - RevertReasons.InvalidAmount, + RevertReason.InvalidAmount, ); }); @@ -857,7 +857,7 @@ describe('Exchange core', () => { const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }), - RevertReasons.RoundingError, + RevertReason.RoundingError, ); }); diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts index 495f6d3c8..8adbee6a3 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, RevertReasons } from '@0xproject/types'; +import { AssetProxyId, RevertReason } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; @@ -182,7 +182,7 @@ describe('AssetProxyDispatcher', () => { constants.NULL_ADDRESS, { from: owner }, ), - RevertReasons.AssetProxyMismatch, + RevertReason.AssetProxyMismatch, ); }); @@ -224,7 +224,7 @@ describe('AssetProxyDispatcher', () => { prevProxyAddress, { from: notOwner }, ), - RevertReasons.OnlyContractOwner, + RevertReason.OnlyContractOwner, ); }); @@ -237,7 +237,7 @@ describe('AssetProxyDispatcher', () => { prevProxyAddress, { from: owner }, ), - RevertReasons.AssetProxyIdMismatch, + RevertReason.AssetProxyIdMismatch, ); }); }); @@ -316,7 +316,7 @@ describe('AssetProxyDispatcher', () => { amount, { from: owner }, ), - RevertReasons.AssetProxyDoesNotExist, + RevertReason.AssetProxyDoesNotExist, ); }); }); diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index 6f4feb8b7..bcf691471 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, RevertReasons } from '@0xproject/types'; +import { AssetProxyId, RevertReason } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; @@ -600,7 +600,7 @@ describe('matchOrders', () => { // Match orders return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress), - RevertReasons.OrderUnfillable, + RevertReason.OrderUnfillable, ); }); @@ -625,7 +625,7 @@ describe('matchOrders', () => { // Match orders return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress), - RevertReasons.OrderUnfillable, + RevertReason.OrderUnfillable, ); }); @@ -654,7 +654,7 @@ describe('matchOrders', () => { erc20BalancesByOwner, erc721TokenIdsByOwner, ), - RevertReasons.NegativeSpreadRequired, + RevertReason.NegativeSpreadRequired, ); }); @@ -687,7 +687,7 @@ describe('matchOrders', () => { // reverse of the left order, rather than checking equality. This // saves a bunch of gas, but as a result if the assetData fields are // off then the failure ends up happening at signature validation - RevertReasons.InvalidOrderSignature, + RevertReason.InvalidOrderSignature, ); }); @@ -718,7 +718,7 @@ describe('matchOrders', () => { erc20BalancesByOwner, erc721TokenIdsByOwner, ), - RevertReasons.InvalidOrderSignature, + RevertReason.InvalidOrderSignature, ); }); diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts index c610ead61..21cc343b3 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 { RevertReasons, SignatureType, SignedOrder } from '@0xproject/types'; +import { RevertReason, SignatureType, SignedOrder } from '@0xproject/types'; import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; import ethUtil = require('ethereumjs-util'); @@ -107,7 +107,7 @@ describe('MixinSignatureValidator', () => { signedOrder.makerAddress, emptySignature, ), - RevertReasons.LengthGreaterThan0Required, + RevertReason.LengthGreaterThan0Required, ); }); @@ -121,7 +121,7 @@ describe('MixinSignatureValidator', () => { signedOrder.makerAddress, unsupportedSignatureHex, ), - RevertReasons.SignatureUnsupported, + RevertReason.SignatureUnsupported, ); }); @@ -134,7 +134,7 @@ describe('MixinSignatureValidator', () => { signedOrder.makerAddress, unsupportedSignatureHex, ), - RevertReasons.SignatureIllegal, + RevertReason.SignatureIllegal, ); }); @@ -161,7 +161,7 @@ describe('MixinSignatureValidator', () => { signedOrder.makerAddress, signatureHex, ), - RevertReasons.Length0Required, + RevertReason.Length0Required, ); }); diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts index 44ed98c53..b0c08e46e 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, RevertReasons, SignedOrder } from '@0xproject/types'; +import { AssetProxyId, OrderWithoutExchangeAddress, RevertReason, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; @@ -127,7 +127,7 @@ describe('Exchange transactions', () => { it('should throw if not called by specified sender', async () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.executeTransactionAsync(signedTx, takerAddress), - RevertReasons.FailedExecution, + RevertReason.FailedExecution, ); }); @@ -170,7 +170,7 @@ describe('Exchange transactions', () => { await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.executeTransactionAsync(signedTx, senderAddress), - RevertReasons.InvalidTxHash, + RevertReason.InvalidTxHash, ); }); @@ -190,7 +190,7 @@ describe('Exchange transactions', () => { it('should throw if not called by specified sender', async () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.executeTransactionAsync(signedTx, makerAddress), - RevertReasons.FailedExecution, + RevertReason.FailedExecution, ); }); @@ -198,7 +198,7 @@ describe('Exchange transactions', () => { await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, senderAddress), - RevertReasons.OrderUnfillable, + RevertReason.OrderUnfillable, ); }); }); @@ -250,7 +250,7 @@ describe('Exchange transactions', () => { signedFillTx.signature, { from: takerAddress }, ), - RevertReasons.FailedExecution, + RevertReason.FailedExecution, ); }); @@ -369,7 +369,7 @@ describe('Exchange transactions', () => { signedOrder.signature, { from: takerAddress }, ), - RevertReasons.MakerNotWhitelisted, + RevertReason.MakerNotWhitelisted, ); }); @@ -391,7 +391,7 @@ describe('Exchange transactions', () => { signedOrder.signature, { from: takerAddress }, ), - RevertReasons.TakerNotWhitelisted, + RevertReason.TakerNotWhitelisted, ); }); diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index a4ba54904..9ee68f94d 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, RevertReasons, SignedOrder } from '@0xproject/types'; +import { AssetProxyId, RevertReason, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; @@ -172,7 +172,7 @@ describe('Exchange wrappers', () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress), - RevertReasons.OrderUnfillable, + RevertReason.OrderUnfillable, ); }); @@ -185,7 +185,7 @@ describe('Exchange wrappers', () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress), - RevertReasons.CompleteFillFailed, + RevertReason.CompleteFillFailed, ); }); }); @@ -500,7 +500,7 @@ describe('Exchange wrappers', () => { exchangeWrapper.batchFillOrKillOrdersAsync(signedOrders, takerAddress, { takerAssetFillAmounts, }), - RevertReasons.OrderUnfillable, + RevertReason.OrderUnfillable, ); }); }); @@ -705,7 +705,7 @@ describe('Exchange wrappers', () => { }), // We simply use the takerAssetData from the first order for all orders. // If they are not the same, the contract throws when validating the order signature - RevertReasons.InvalidOrderSignature, + RevertReason.InvalidOrderSignature, ); }); }); @@ -921,7 +921,7 @@ describe('Exchange wrappers', () => { exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, { makerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18), }), - RevertReasons.InvalidOrderSignature, + RevertReason.InvalidOrderSignature, ); }); }); diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index 5ab299b73..3d4058cbc 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils, generatePseudoRandomSalt } from '@0xproject/order-utils'; -import { RevertReasons } from '@0xproject/types'; +import { RevertReason } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import BN = require('bn.js'); import * as chai from 'chai'; @@ -102,7 +102,7 @@ describe('LibBytes', () => { it('should revert if length is 0', async () => { return expectRevertOrOtherErrorAsync( libBytes.publicPopLastByte.callAsync(constants.NULL_BYTES), - RevertReasons.LibBytesGreaterThanZeroLengthRequired, + RevertReason.LibBytesGreaterThanZeroLengthRequired, ); }); it('should pop the last byte from the input and return it', async () => { @@ -118,7 +118,7 @@ describe('LibBytes', () => { it('should revert if length is less than 20', async () => { return expectRevertOrOtherErrorAsync( libBytes.publicPopLast20Bytes.callAsync(byteArrayShorterThan20Bytes), - RevertReasons.LibBytesGreaterOrEqualTo20LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo20LengthRequired, ); }); it('should pop the last 20 bytes from the input and return it', async () => { @@ -186,7 +186,7 @@ describe('LibBytes', () => { it('should revert if dest is shorter than source', async () => { return expectRevertOrOtherErrorAsync( libBytes.publicDeepCopyBytes.callAsync(byteArrayShorterThan32Bytes, byteArrayLongerThan32Bytes), - RevertReasons.LibBytesGreaterOrEqualToSourceBytesLengthRequired, + RevertReason.LibBytesGreaterOrEqualToSourceBytesLengthRequired, ); }); it('should overwrite dest with source if source and dest have equal length', async () => { @@ -239,7 +239,7 @@ describe('LibBytes', () => { const offset = new BigNumber(0); return expectRevertOrOtherErrorAsync( libBytes.publicReadAddress.callAsync(shortByteArray, offset), - RevertReasons.LibBytesGreaterOrEqualTo20LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo20LengthRequired, ); }); it('should fail if the length between the offset and end of the byte array is too short to hold an address', async () => { @@ -247,7 +247,7 @@ describe('LibBytes', () => { const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength); return expectRevertOrOtherErrorAsync( libBytes.publicReadAddress.callAsync(byteArray, badOffset), - RevertReasons.LibBytesGreaterOrEqualTo20LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo20LengthRequired, ); }); }); @@ -283,7 +283,7 @@ describe('LibBytes', () => { const offset = new BigNumber(0); return expectRevertOrOtherErrorAsync( libBytes.publicWriteAddress.callAsync(byteArrayShorterThan20Bytes, offset, testAddress), - RevertReasons.LibBytesGreaterOrEqualTo20LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo20LengthRequired, ); }); it('should fail if the length between the offset and end of the byte array is too short to hold an address', async () => { @@ -291,7 +291,7 @@ describe('LibBytes', () => { const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength); return expectRevertOrOtherErrorAsync( libBytes.publicWriteAddress.callAsync(byteArray, badOffset, testAddress), - RevertReasons.LibBytesGreaterOrEqualTo20LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo20LengthRequired, ); }); }); @@ -315,14 +315,14 @@ describe('LibBytes', () => { const offset = new BigNumber(0); return expectRevertOrOtherErrorAsync( libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset), - RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); }); it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32', async () => { const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength); return expectRevertOrOtherErrorAsync( libBytes.publicReadBytes32.callAsync(testBytes32, badOffset), - RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); }); }); @@ -358,7 +358,7 @@ describe('LibBytes', () => { const offset = new BigNumber(0); return expectRevertOrOtherErrorAsync( libBytes.publicWriteBytes32.callAsync(byteArrayShorterThan32Bytes, offset, testBytes32), - RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); }); it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32', async () => { @@ -366,7 +366,7 @@ describe('LibBytes', () => { const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength); return expectRevertOrOtherErrorAsync( libBytes.publicWriteBytes32.callAsync(byteArray, badOffset, testBytes32), - RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); }); }); @@ -394,7 +394,7 @@ describe('LibBytes', () => { const offset = new BigNumber(0); return expectRevertOrOtherErrorAsync( libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset), - RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); }); it('should fail if the length between the offset and end of the byte array is too short to hold a uint256', async () => { @@ -404,7 +404,7 @@ describe('LibBytes', () => { const badOffset = new BigNumber(testUint256AsBuffer.byteLength); return expectRevertOrOtherErrorAsync( libBytes.publicReadUint256.callAsync(byteArray, badOffset), - RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); }); }); @@ -444,7 +444,7 @@ describe('LibBytes', () => { const offset = new BigNumber(0); return expectRevertOrOtherErrorAsync( libBytes.publicWriteUint256.callAsync(byteArrayShorterThan32Bytes, offset, testUint256), - RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); }); it('should fail if the length between the offset and end of the byte array is too short to hold a uint256', async () => { @@ -452,7 +452,7 @@ describe('LibBytes', () => { const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength); return expectRevertOrOtherErrorAsync( libBytes.publicWriteUint256.callAsync(byteArray, badOffset, testUint256), - RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); }); }); @@ -463,7 +463,7 @@ describe('LibBytes', () => { const byteArrayLessThan4Bytes = '0x010101'; return expectRevertOrOtherErrorAsync( libBytes.publicReadBytes4.callAsync(byteArrayLessThan4Bytes, new BigNumber(0)), - RevertReasons.LibBytesGreaterOrEqualTo4LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo4LengthRequired, ); }); it('should return the first 4 bytes of a byte array of arbitrary length', async () => { @@ -518,28 +518,28 @@ describe('LibBytes', () => { const offset = new BigNumber(0); return expectRevertOrOtherErrorAsync( libBytes.publicReadBytesWithLength.callAsync(byteArrayShorterThan32Bytes, offset), - RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); }); it('should fail if we store a nested byte array length, without a nested byte array', async () => { const offset = new BigNumber(0); return expectRevertOrOtherErrorAsync( libBytes.publicReadBytesWithLength.callAsync(testBytes32, offset), - RevertReasons.LibBytesGreaterOrEqualToNestedBytesLengthRequired, + RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired, ); }); it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array', async () => { const badOffset = new BigNumber(ethUtil.toBuffer(byteArrayShorterThan32Bytes).byteLength); return expectRevertOrOtherErrorAsync( libBytes.publicReadBytesWithLength.callAsync(byteArrayShorterThan32Bytes, badOffset), - RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); }); it('should fail if the length between the offset and end of the byte array is too short to hold the nested byte array', async () => { const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength); return expectRevertOrOtherErrorAsync( libBytes.publicReadBytesWithLength.callAsync(testBytes32, badOffset), - RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired, + RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); }); }); @@ -651,7 +651,7 @@ describe('LibBytes', () => { const emptyByteArray = ethUtil.bufferToHex(new Buffer(1)); return expectRevertOrOtherErrorAsync( libBytes.publicWriteBytesWithLength.callAsync(emptyByteArray, offset, longData), - RevertReasons.LibBytesGreaterOrEqualToNestedBytesLengthRequired, + RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired, ); }); it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array)', async () => { @@ -659,7 +659,7 @@ describe('LibBytes', () => { const badOffset = new BigNumber(ethUtil.toBuffer(shortTestBytesAsBuffer).byteLength); return expectRevertOrOtherErrorAsync( libBytes.publicWriteBytesWithLength.callAsync(emptyByteArray, badOffset, shortData), - RevertReasons.LibBytesGreaterOrEqualToNestedBytesLengthRequired, + RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired, ); }); }); diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts index 6ad59d4f1..0eb82b5fe 100644 --- a/packages/contracts/test/unlimited_allowance_token.ts +++ b/packages/contracts/test/unlimited_allowance_token.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { RevertReasons } from '@0xproject/types'; +import { RevertReason } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; @@ -56,7 +56,7 @@ describe('UnlimitedAllowanceToken', () => { const amountToTransfer = ownerBalance.plus(1); return expectRevertOrOtherErrorAsync( token.transfer.callAsync(spender, amountToTransfer, { from: owner }), - RevertReasons.Erc20InsufficientBalance, + RevertReason.Erc20InsufficientBalance, ); }); @@ -97,7 +97,7 @@ describe('UnlimitedAllowanceToken', () => { token.transferFrom.callAsync(owner, spender, amountToTransfer, { from: spender, }), - RevertReasons.Erc20InsufficientBalance, + RevertReason.Erc20InsufficientBalance, ); }); @@ -113,7 +113,7 @@ describe('UnlimitedAllowanceToken', () => { token.transferFrom.callAsync(owner, spender, amountToTransfer, { from: spender, }), - RevertReasons.Erc20InsufficientAllowance, + RevertReason.Erc20InsufficientAllowance, ); }); diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index fa7d91347..423292d45 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -169,7 +169,7 @@ export interface ERC721AssetData { receiverData: string; } -export enum RevertReasons { +export enum RevertReason { OrderUnfillable = 'ORDER_UNFILLABLE', InvalidMaker = 'INVALID_MAKER', InvalidTaker = 'INVALID_TAKER', |