diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-23 00:45:45 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-06-23 00:45:45 +0800 |
commit | 4409f11b24324e23ee2f53436c0226028820e96d (patch) | |
tree | decd3546252542e2c865c460675b9a2e0a9c27bb /packages/contracts/test/exchange | |
parent | 7a216901bec6f7f3640d41fb90dcc49ed673cc6f (diff) | |
download | dexon-sol-tools-4409f11b24324e23ee2f53436c0226028820e96d.tar dexon-sol-tools-4409f11b24324e23ee2f53436c0226028820e96d.tar.gz dexon-sol-tools-4409f11b24324e23ee2f53436c0226028820e96d.tar.bz2 dexon-sol-tools-4409f11b24324e23ee2f53436c0226028820e96d.tar.lz dexon-sol-tools-4409f11b24324e23ee2f53436c0226028820e96d.tar.xz dexon-sol-tools-4409f11b24324e23ee2f53436c0226028820e96d.tar.zst dexon-sol-tools-4409f11b24324e23ee2f53436c0226028820e96d.zip |
Rename ContractLibErrors to RevertReasons
Diffstat (limited to 'packages/contracts/test/exchange')
-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 |
6 files changed, 54 insertions, 54 deletions
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index d35ff7dee..7d4539ae6 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -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 { ContractLibErrors, ERC20BalancesByOwner } from '../../src/utils/types'; +import { RevertReasons, ERC20BalancesByOwner } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); @@ -420,7 +420,7 @@ describe('Exchange core', () => { }); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - ContractLibErrors.InvalidTaker, + RevertReasons.InvalidTaker, ); }); @@ -438,7 +438,7 @@ describe('Exchange core', () => { signedOrder.signature = invalidSigHex; return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - ContractLibErrors.InvalidOrderSignature, + RevertReasons.InvalidOrderSignature, ); }); @@ -449,7 +449,7 @@ describe('Exchange core', () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - ContractLibErrors.OrderUnfillable, + RevertReasons.OrderUnfillable, ); }); @@ -460,7 +460,7 @@ describe('Exchange core', () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - ContractLibErrors.OrderUnfillable, + RevertReasons.OrderUnfillable, ); }); @@ -471,7 +471,7 @@ describe('Exchange core', () => { exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount: new BigNumber(0), }), - ContractLibErrors.InvalidTakerAmount, + RevertReasons.InvalidTakerAmount, ); }); @@ -482,7 +482,7 @@ describe('Exchange core', () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - ContractLibErrors.TransferFailed, + RevertReasons.TransferFailed, ); }); @@ -492,7 +492,7 @@ describe('Exchange core', () => { }); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - ContractLibErrors.TransferFailed, + RevertReasons.TransferFailed, ); }); @@ -505,7 +505,7 @@ describe('Exchange core', () => { ); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - ContractLibErrors.TransferFailed, + RevertReasons.TransferFailed, ); }); @@ -518,7 +518,7 @@ describe('Exchange core', () => { ); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - ContractLibErrors.TransferFailed, + RevertReasons.TransferFailed, ); }); @@ -528,7 +528,7 @@ describe('Exchange core', () => { }); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - ContractLibErrors.OrderUnfillable, + RevertReasons.OrderUnfillable, ); }); @@ -537,7 +537,7 @@ describe('Exchange core', () => { await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), - ContractLibErrors.OrderUnfillable, + RevertReasons.OrderUnfillable, ); }); }); @@ -551,7 +551,7 @@ describe('Exchange core', () => { it('should throw if not sent by maker', async () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.cancelOrderAsync(signedOrder, takerAddress), - ContractLibErrors.InvalidMaker, + RevertReasons.InvalidMaker, ); }); @@ -562,7 +562,7 @@ describe('Exchange core', () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress), - ContractLibErrors.OrderUnfillable, + RevertReasons.OrderUnfillable, ); }); @@ -573,7 +573,7 @@ describe('Exchange core', () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress), - ContractLibErrors.OrderUnfillable, + RevertReasons.OrderUnfillable, ); }); @@ -583,7 +583,7 @@ describe('Exchange core', () => { exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount: signedOrder.takerAssetAmount.div(2), }), - ContractLibErrors.OrderUnfillable, + RevertReasons.OrderUnfillable, ); }); @@ -606,7 +606,7 @@ describe('Exchange core', () => { await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress), - ContractLibErrors.OrderUnfillable, + RevertReasons.OrderUnfillable, ); }); @@ -616,7 +616,7 @@ describe('Exchange core', () => { }); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress), - ContractLibErrors.OrderUnfillable, + RevertReasons.OrderUnfillable, ); }); @@ -636,7 +636,7 @@ describe('Exchange core', () => { exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount: fillTakerAssetAmount2, }), - ContractLibErrors.RoundingError, + RevertReasons.RoundingError, ); }); }); @@ -648,7 +648,7 @@ describe('Exchange core', () => { const lesserOrderEpoch = new BigNumber(0); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.cancelOrdersUpToAsync(lesserOrderEpoch, makerAddress), - ContractLibErrors.InvalidNewOrderEpoch, + RevertReasons.InvalidNewOrderEpoch, ); }); @@ -657,7 +657,7 @@ describe('Exchange core', () => { await exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress), - ContractLibErrors.InvalidNewOrderEpoch, + RevertReasons.InvalidNewOrderEpoch, ); }); @@ -817,7 +817,7 @@ describe('Exchange core', () => { const takerAssetFillAmount = signedOrder.takerAssetAmount; return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }), - ContractLibErrors.InvalidAmount, + RevertReasons.InvalidAmount, ); }); @@ -840,7 +840,7 @@ describe('Exchange core', () => { const takerAssetFillAmount = signedOrder.takerAssetAmount; return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }), - ContractLibErrors.InvalidAmount, + RevertReasons.InvalidAmount, ); }); @@ -857,7 +857,7 @@ describe('Exchange core', () => { const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }), - ContractLibErrors.RoundingError, + RevertReasons.RoundingError, ); }); diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts index d463f6c35..8bf1b3d37 100644 --- a/packages/contracts/test/exchange/dispatcher.ts +++ b/packages/contracts/test/exchange/dispatcher.ts @@ -14,7 +14,7 @@ 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 { ContractLibErrors } from '../../src/utils/types'; +import { RevertReasons } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); @@ -183,7 +183,7 @@ describe('AssetProxyDispatcher', () => { constants.NULL_ADDRESS, { from: owner }, ), - ContractLibErrors.AssetProxyMismatch, + RevertReasons.AssetProxyMismatch, ); }); @@ -225,7 +225,7 @@ describe('AssetProxyDispatcher', () => { prevProxyAddress, { from: notOwner }, ), - ContractLibErrors.OnlyContractOwner, + RevertReasons.OnlyContractOwner, ); }); @@ -238,7 +238,7 @@ describe('AssetProxyDispatcher', () => { prevProxyAddress, { from: owner }, ), - ContractLibErrors.AssetProxyIdMismatch, + RevertReasons.AssetProxyIdMismatch, ); }); }); @@ -320,7 +320,7 @@ describe('AssetProxyDispatcher', () => { amount, { from: owner }, ), - ContractLibErrors.AssetProxyDoesNotExist, + RevertReasons.AssetProxyDoesNotExist, ); }); }); diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index 9d2378dc8..0f7cd32fd 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -22,7 +22,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 { ContractLibErrors, ERC20BalancesByOwner, ERC721TokenIdsByOwner, OrderInfo, OrderStatus } from '../../src/utils/types'; +import { RevertReasons, ERC20BalancesByOwner, ERC721TokenIdsByOwner, OrderInfo, OrderStatus } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); @@ -602,7 +602,7 @@ describe('matchOrders', () => { // Match orders return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress), - ContractLibErrors.OrderUnfillable, + RevertReasons.OrderUnfillable, ); }); @@ -627,7 +627,7 @@ describe('matchOrders', () => { // Match orders return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress), - ContractLibErrors.OrderUnfillable, + RevertReasons.OrderUnfillable, ); }); @@ -656,7 +656,7 @@ describe('matchOrders', () => { erc20BalancesByOwner, erc721TokenIdsByOwner, ), - ContractLibErrors.NegativeSpreadRequired, + RevertReasons.NegativeSpreadRequired, ); }); @@ -689,7 +689,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 - ContractLibErrors.InvalidOrderSignature, + RevertReasons.InvalidOrderSignature, ); }); @@ -720,7 +720,7 @@ describe('matchOrders', () => { erc20BalancesByOwner, erc721TokenIdsByOwner, ), - ContractLibErrors.InvalidOrderSignature, + RevertReasons.InvalidOrderSignature, ); }); diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts index e3442a4c2..f829e0820 100644 --- a/packages/contracts/test/exchange/signature_validator.ts +++ b/packages/contracts/test/exchange/signature_validator.ts @@ -18,7 +18,7 @@ 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 { ContractLibErrors } from '../../src/utils/types'; +import { RevertReasons } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); @@ -108,7 +108,7 @@ describe('MixinSignatureValidator', () => { signedOrder.makerAddress, emptySignature, ), - ContractLibErrors.LengthGreaterThan0Required, + RevertReasons.LengthGreaterThan0Required, ); }); @@ -122,7 +122,7 @@ describe('MixinSignatureValidator', () => { signedOrder.makerAddress, unsupportedSignatureHex, ), - ContractLibErrors.SignatureUnsupported, + RevertReasons.SignatureUnsupported, ); }); @@ -135,7 +135,7 @@ describe('MixinSignatureValidator', () => { signedOrder.makerAddress, unsupportedSignatureHex, ), - ContractLibErrors.SignatureIllegal, + RevertReasons.SignatureIllegal, ); }); @@ -162,7 +162,7 @@ describe('MixinSignatureValidator', () => { signedOrder.makerAddress, signatureHex, ), - ContractLibErrors.Length0Required, + RevertReasons.Length0Required, ); }); diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts index 958a6dce8..c2a70de26 100644 --- a/packages/contracts/test/exchange/transactions.ts +++ b/packages/contracts/test/exchange/transactions.ts @@ -20,7 +20,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 { ContractLibErrors, ERC20BalancesByOwner, SignedTransaction } from '../../src/utils/types'; +import { RevertReasons, ERC20BalancesByOwner, SignedTransaction } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); @@ -129,7 +129,7 @@ describe('Exchange transactions', () => { it('should throw if not called by specified sender', async () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.executeTransactionAsync(signedTx, takerAddress), - ContractLibErrors.FailedExecution, + RevertReasons.FailedExecution, ); }); @@ -172,7 +172,7 @@ describe('Exchange transactions', () => { await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.executeTransactionAsync(signedTx, senderAddress), - ContractLibErrors.InvalidTxHash, + RevertReasons.InvalidTxHash, ); }); @@ -192,7 +192,7 @@ describe('Exchange transactions', () => { it('should throw if not called by specified sender', async () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.executeTransactionAsync(signedTx, makerAddress), - ContractLibErrors.FailedExecution, + RevertReasons.FailedExecution, ); }); @@ -200,7 +200,7 @@ describe('Exchange transactions', () => { await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress); return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrderAsync(signedOrder, senderAddress), - ContractLibErrors.OrderUnfillable, + RevertReasons.OrderUnfillable, ); }); }); @@ -252,7 +252,7 @@ describe('Exchange transactions', () => { signedFillTx.signature, { from: takerAddress }, ), - ContractLibErrors.FailedExecution, + RevertReasons.FailedExecution, ); }); @@ -371,7 +371,7 @@ describe('Exchange transactions', () => { signedOrder.signature, { from: takerAddress }, ), - ContractLibErrors.MakerNotWhitelisted, + RevertReasons.MakerNotWhitelisted, ); }); @@ -393,7 +393,7 @@ describe('Exchange transactions', () => { signedOrder.signature, { from: takerAddress }, ), - ContractLibErrors.TakerNotWhitelisted, + RevertReasons.TakerNotWhitelisted, ); }); diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 3d7465659..26bdc24d0 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -21,7 +21,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 { ContractLibErrors, ERC20BalancesByOwner } from '../../src/utils/types'; +import { RevertReasons, ERC20BalancesByOwner } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); @@ -174,7 +174,7 @@ describe('Exchange wrappers', () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress), - ContractLibErrors.OrderUnfillable, + RevertReasons.OrderUnfillable, ); }); @@ -187,7 +187,7 @@ describe('Exchange wrappers', () => { return expectRevertReasonOrAlwaysFailingTransactionAsync( exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress), - ContractLibErrors.CompleteFillFailed, + RevertReasons.CompleteFillFailed, ); }); }); @@ -502,7 +502,7 @@ describe('Exchange wrappers', () => { exchangeWrapper.batchFillOrKillOrdersAsync(signedOrders, takerAddress, { takerAssetFillAmounts, }), - ContractLibErrors.OrderUnfillable, + RevertReasons.OrderUnfillable, ); }); }); @@ -707,7 +707,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 - ContractLibErrors.InvalidOrderSignature, + RevertReasons.InvalidOrderSignature, ); }); }); @@ -923,7 +923,7 @@ describe('Exchange wrappers', () => { exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, { makerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18), }), - ContractLibErrors.InvalidOrderSignature, + RevertReasons.InvalidOrderSignature, ); }); }); |