aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/exchange
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-06-27 00:53:44 +0800
committerFabio Berger <me@fabioberger.com>2018-06-27 00:53:44 +0800
commit43ae868c6945045e0c467977e1b3db143e99fc8c (patch)
tree048bd493a3ae76469fabcf7aa5ec1fffe6cdb3b3 /packages/contracts/test/exchange
parent6dc852774e23aa38c66188100c31ba42667620e8 (diff)
parent1bc742aed1e7f10b79b5ef23ebb57b6c93d64e3c (diff)
downloaddexon-sol-tools-43ae868c6945045e0c467977e1b3db143e99fc8c.tar
dexon-sol-tools-43ae868c6945045e0c467977e1b3db143e99fc8c.tar.gz
dexon-sol-tools-43ae868c6945045e0c467977e1b3db143e99fc8c.tar.bz2
dexon-sol-tools-43ae868c6945045e0c467977e1b3db143e99fc8c.tar.lz
dexon-sol-tools-43ae868c6945045e0c467977e1b3db143e99fc8c.tar.xz
dexon-sol-tools-43ae868c6945045e0c467977e1b3db143e99fc8c.tar.zst
dexon-sol-tools-43ae868c6945045e0c467977e1b3db143e99fc8c.zip
Merge branch 'refactor/check-revert-reasons' into feature/combinatorial-testing
* refactor/check-revert-reasons: Temporarily switch revert reasons to `TransferFailed`. Should be `InvalidAmount` but because of an oversight in the assembly implementation of `dispatchTransferFrom`, it always throws `TransferFailed` Expect RevertReason be passed in, not string Rename RevertReasons to RevertReason since singular enum names are more common # Conflicts: # packages/contracts/test/asset_proxy/proxies.ts # packages/contracts/test/exchange/core.ts
Diffstat (limited to 'packages/contracts/test/exchange')
-rw-r--r--packages/contracts/test/exchange/core.ts30
-rw-r--r--packages/contracts/test/exchange/dispatcher.ts10
-rw-r--r--packages/contracts/test/exchange/match_orders.ts12
-rw-r--r--packages/contracts/test/exchange/signature_validator.ts10
-rw-r--r--packages/contracts/test/exchange/transactions.ts16
-rw-r--r--packages/contracts/test/exchange/wrapper.ts12
6 files changed, 45 insertions, 45 deletions
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index 52bddf996..b3c3a891c 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';
@@ -147,7 +147,7 @@ describe('Exchange core', () => {
signedOrder.signature = invalidSigHex;
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
- RevertReasons.InvalidOrderSignature,
+ RevertReason.InvalidOrderSignature,
);
});
@@ -156,7 +156,7 @@ describe('Exchange core', () => {
await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
- RevertReasons.OrderUnfillable,
+ RevertReason.OrderUnfillable,
);
});
});
@@ -170,7 +170,7 @@ describe('Exchange core', () => {
it('should throw if not sent by maker', async () => {
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.cancelOrderAsync(signedOrder, takerAddress),
- RevertReasons.InvalidMaker,
+ RevertReason.InvalidMaker,
);
});
@@ -181,7 +181,7 @@ describe('Exchange core', () => {
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
- RevertReasons.OrderUnfillable,
+ RevertReason.OrderUnfillable,
);
});
@@ -192,7 +192,7 @@ describe('Exchange core', () => {
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
- RevertReasons.OrderUnfillable,
+ RevertReason.OrderUnfillable,
);
});
@@ -202,7 +202,7 @@ describe('Exchange core', () => {
exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
takerAssetFillAmount: signedOrder.takerAssetAmount.div(2),
}),
- RevertReasons.OrderUnfillable,
+ RevertReason.OrderUnfillable,
);
});
@@ -225,7 +225,7 @@ describe('Exchange core', () => {
await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
- RevertReasons.OrderUnfillable,
+ RevertReason.OrderUnfillable,
);
});
@@ -235,7 +235,7 @@ describe('Exchange core', () => {
});
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
- RevertReasons.OrderUnfillable,
+ RevertReason.OrderUnfillable,
);
});
@@ -255,7 +255,7 @@ describe('Exchange core', () => {
exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
takerAssetFillAmount: fillTakerAssetAmount2,
}),
- RevertReasons.RoundingError,
+ RevertReason.RoundingError,
);
});
});
@@ -267,7 +267,7 @@ describe('Exchange core', () => {
const lesserOrderEpoch = new BigNumber(0);
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.cancelOrdersUpToAsync(lesserOrderEpoch, makerAddress),
- RevertReasons.InvalidNewOrderEpoch,
+ RevertReason.InvalidNewOrderEpoch,
);
});
@@ -276,7 +276,7 @@ describe('Exchange core', () => {
await exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress);
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress),
- RevertReasons.InvalidNewOrderEpoch,
+ RevertReason.InvalidNewOrderEpoch,
);
});
@@ -410,7 +410,7 @@ describe('Exchange core', () => {
const takerAssetFillAmount = signedOrder.takerAssetAmount;
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
- RevertReasons.InvalidAmount,
+ RevertReason.TransferFailed,
);
});
@@ -433,7 +433,7 @@ describe('Exchange core', () => {
const takerAssetFillAmount = signedOrder.takerAssetAmount;
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
- RevertReasons.InvalidAmount,
+ RevertReason.TransferFailed,
);
});
@@ -450,7 +450,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 41ea88d4e..6ac57e6db 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';
@@ -185,7 +185,7 @@ describe('AssetProxyDispatcher', () => {
constants.NULL_ADDRESS,
{ from: owner },
),
- RevertReasons.AssetProxyMismatch,
+ RevertReason.AssetProxyMismatch,
);
});
@@ -227,7 +227,7 @@ describe('AssetProxyDispatcher', () => {
prevProxyAddress,
{ from: notOwner },
),
- RevertReasons.OnlyContractOwner,
+ RevertReason.OnlyContractOwner,
);
});
@@ -240,7 +240,7 @@ describe('AssetProxyDispatcher', () => {
prevProxyAddress,
{ from: owner },
),
- RevertReasons.AssetProxyIdMismatch,
+ RevertReason.AssetProxyIdMismatch,
);
});
});
@@ -319,7 +319,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 7c4ad165e..04b566740 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';
@@ -603,7 +603,7 @@ describe('matchOrders', () => {
// Match orders
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
- RevertReasons.OrderUnfillable,
+ RevertReason.OrderUnfillable,
);
});
@@ -628,7 +628,7 @@ describe('matchOrders', () => {
// Match orders
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
- RevertReasons.OrderUnfillable,
+ RevertReason.OrderUnfillable,
);
});
@@ -657,7 +657,7 @@ describe('matchOrders', () => {
erc20BalancesByOwner,
erc721TokenIdsByOwner,
),
- RevertReasons.NegativeSpreadRequired,
+ RevertReason.NegativeSpreadRequired,
);
});
@@ -690,7 +690,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,
);
});
@@ -721,7 +721,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 cfabe0435..67dc14e91 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';
@@ -130,7 +130,7 @@ describe('Exchange transactions', () => {
it('should throw if not called by specified sender', async () => {
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.executeTransactionAsync(signedTx, takerAddress),
- RevertReasons.FailedExecution,
+ RevertReason.FailedExecution,
);
});
@@ -173,7 +173,7 @@ describe('Exchange transactions', () => {
await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.executeTransactionAsync(signedTx, senderAddress),
- RevertReasons.InvalidTxHash,
+ RevertReason.InvalidTxHash,
);
});
@@ -193,7 +193,7 @@ describe('Exchange transactions', () => {
it('should throw if not called by specified sender', async () => {
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.executeTransactionAsync(signedTx, makerAddress),
- RevertReasons.FailedExecution,
+ RevertReason.FailedExecution,
);
});
@@ -201,7 +201,7 @@ describe('Exchange transactions', () => {
await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.fillOrderAsync(signedOrder, senderAddress),
- RevertReasons.OrderUnfillable,
+ RevertReason.OrderUnfillable,
);
});
});
@@ -253,7 +253,7 @@ describe('Exchange transactions', () => {
signedFillTx.signature,
{ from: takerAddress },
),
- RevertReasons.FailedExecution,
+ RevertReason.FailedExecution,
);
});
@@ -372,7 +372,7 @@ describe('Exchange transactions', () => {
signedOrder.signature,
{ from: takerAddress },
),
- RevertReasons.MakerNotWhitelisted,
+ RevertReason.MakerNotWhitelisted,
);
});
@@ -394,7 +394,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 7e3203291..32ca4859b 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';
@@ -175,7 +175,7 @@ describe('Exchange wrappers', () => {
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress),
- RevertReasons.OrderUnfillable,
+ RevertReason.OrderUnfillable,
);
});
@@ -188,7 +188,7 @@ describe('Exchange wrappers', () => {
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress),
- RevertReasons.CompleteFillFailed,
+ RevertReason.CompleteFillFailed,
);
});
});
@@ -503,7 +503,7 @@ describe('Exchange wrappers', () => {
exchangeWrapper.batchFillOrKillOrdersAsync(signedOrders, takerAddress, {
takerAssetFillAmounts,
}),
- RevertReasons.OrderUnfillable,
+ RevertReason.OrderUnfillable,
);
});
});
@@ -708,7 +708,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,
);
});
});
@@ -924,7 +924,7 @@ describe('Exchange wrappers', () => {
exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
makerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
}),
- RevertReasons.InvalidOrderSignature,
+ RevertReason.InvalidOrderSignature,
);
});
});