aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-06-23 00:45:45 +0800
committerFabio Berger <me@fabioberger.com>2018-06-23 00:45:45 +0800
commit4409f11b24324e23ee2f53436c0226028820e96d (patch)
treedecd3546252542e2c865c460675b9a2e0a9c27bb /packages
parent7a216901bec6f7f3640d41fb90dcc49ed673cc6f (diff)
downloaddexon-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')
-rw-r--r--packages/contracts/src/utils/types.ts2
-rw-r--r--packages/contracts/test/asset_proxy/authorizable.ts10
-rw-r--r--packages/contracts/test/asset_proxy/proxies.ts18
-rw-r--r--packages/contracts/test/exchange/core.ts48
-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
-rw-r--r--packages/contracts/test/libraries/lib_bytes.ts46
-rw-r--r--packages/contracts/test/unlimited_allowance_token.ts8
11 files changed, 96 insertions, 96 deletions
diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts
index b3da040c3..03eb5c9b2 100644
--- a/packages/contracts/src/utils/types.ts
+++ b/packages/contracts/src/utils/types.ts
@@ -152,7 +152,7 @@ export interface MatchOrder {
rightSignature: string;
}
-export enum ContractLibErrors {
+export enum RevertReasons {
OrderUnfillable = 'ORDER_UNFILLABLE',
InvalidMaker = 'INVALID_MAKER',
InvalidTaker = 'INVALID_TAKER',
diff --git a/packages/contracts/test/asset_proxy/authorizable.ts b/packages/contracts/test/asset_proxy/authorizable.ts
index 1ebb094a1..267444ee6 100644
--- a/packages/contracts/test/asset_proxy/authorizable.ts
+++ b/packages/contracts/test/asset_proxy/authorizable.ts
@@ -8,7 +8,7 @@ import {
} from '../../src/utils/assertions';
import { chaiSetup } from '../../src/utils/chai_setup';
import { constants } from '../../src/utils/constants';
-import { ContractLibErrors } from '../../src/utils/types';
+import { RevertReasons } from '../../src/utils/types';
import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
chaiSetup.configure();
@@ -47,7 +47,7 @@ describe('Authorizable', () => {
it('should throw if not called by owner', async () => {
return expectRevertReasonOrAlwaysFailingTransactionAsync(
authorizable.addAuthorizedAddress.sendTransactionAsync(notOwner, { from: notOwner }),
- ContractLibErrors.OnlyContractOwner,
+ RevertReasons.OnlyContractOwner,
);
});
it('should allow owner to add an authorized address', async () => {
@@ -65,7 +65,7 @@ describe('Authorizable', () => {
);
return expectRevertReasonOrAlwaysFailingTransactionAsync(
authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
- ContractLibErrors.TargetAlreadyAuthorized,
+ RevertReasons.TargetAlreadyAuthorized,
);
});
});
@@ -80,7 +80,7 @@ describe('Authorizable', () => {
authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
from: notOwner,
}),
- ContractLibErrors.OnlyContractOwner,
+ RevertReasons.OnlyContractOwner,
);
});
@@ -104,7 +104,7 @@ describe('Authorizable', () => {
authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
from: owner,
}),
- ContractLibErrors.TargetNotAuthorized,
+ RevertReasons.TargetNotAuthorized,
);
});
});
diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts
index 2c1f52973..0429a3137 100644
--- a/packages/contracts/test/asset_proxy/proxies.ts
+++ b/packages/contracts/test/asset_proxy/proxies.ts
@@ -24,7 +24,7 @@ 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 { ContractLibErrors } from '../../src/utils/types';
+import { RevertReasons } from '../../src/utils/types';
import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
chaiSetup.configure();
@@ -172,7 +172,7 @@ describe('Asset Transfer Proxies', () => {
transferAmount,
{ from: exchangeAddress },
),
- ContractLibErrors.TransferFailed,
+ RevertReasons.TransferFailed,
);
});
@@ -192,7 +192,7 @@ describe('Asset Transfer Proxies', () => {
from: notAuthorized,
},
),
- ContractLibErrors.SenderNotAuthorized,
+ RevertReasons.SenderNotAuthorized,
);
});
});
@@ -246,7 +246,7 @@ describe('Asset Transfer Proxies', () => {
erc20Proxy.batchTransferFrom.sendTransactionAsync(assetData, fromAddresses, toAddresses, amounts, {
from: notAuthorized,
}),
- ContractLibErrors.SenderNotAuthorized,
+ RevertReasons.SenderNotAuthorized,
);
});
});
@@ -392,7 +392,7 @@ describe('Asset Transfer Proxies', () => {
amount,
{ from: exchangeAddress },
),
- ContractLibErrors.InvalidAmount,
+ RevertReasons.InvalidAmount,
);
});
@@ -413,7 +413,7 @@ describe('Asset Transfer Proxies', () => {
amount,
{ from: exchangeAddress },
),
- ContractLibErrors.InvalidAmount,
+ RevertReasons.InvalidAmount,
);
});
@@ -440,7 +440,7 @@ describe('Asset Transfer Proxies', () => {
from: exchangeAddress,
},
),
- ContractLibErrors.TransferFailed,
+ RevertReasons.TransferFailed,
);
});
@@ -458,7 +458,7 @@ describe('Asset Transfer Proxies', () => {
amount,
{ from: notAuthorized },
),
- ContractLibErrors.SenderNotAuthorized,
+ RevertReasons.SenderNotAuthorized,
);
});
});
@@ -513,7 +513,7 @@ describe('Asset Transfer Proxies', () => {
erc721Proxy.batchTransferFrom.sendTransactionAsync(assetData, fromAddresses, toAddresses, amounts, {
from: notAuthorized,
}),
- ContractLibErrors.SenderNotAuthorized,
+ RevertReasons.SenderNotAuthorized,
);
});
});
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,
);
});
});
diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts
index 2d54596d5..bc1856b40 100644
--- a/packages/contracts/test/libraries/lib_bytes.ts
+++ b/packages/contracts/test/libraries/lib_bytes.ts
@@ -11,7 +11,7 @@ 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 { ContractLibErrors } from '../../src/utils/types';
+import { RevertReasons } from '../../src/utils/types';
import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper';
chaiSetup.configure();
@@ -96,7 +96,7 @@ describe('LibBytes', () => {
it('should revert if length is 0', async () => {
return expectRevertOrOtherErrorAsync(
libBytes.publicPopLastByte.callAsync(constants.NULL_BYTES),
- ContractLibErrors.LibBytesGreaterThanZeroLengthRequired,
+ RevertReasons.LibBytesGreaterThanZeroLengthRequired,
);
});
it('should pop the last byte from the input and return it', async () => {
@@ -112,7 +112,7 @@ describe('LibBytes', () => {
it('should revert if length is less than 20', async () => {
return expectRevertOrOtherErrorAsync(
libBytes.publicPopLast20Bytes.callAsync(byteArrayShorterThan20Bytes),
- ContractLibErrors.LibBytesGreaterOrEqualTo20LengthRequired
+ RevertReasons.LibBytesGreaterOrEqualTo20LengthRequired
);
});
it('should pop the last 20 bytes from the input and return it', async () => {
@@ -173,7 +173,7 @@ describe('LibBytes', () => {
it('should revert if dest is shorter than source', async () => {
return expectRevertOrOtherErrorAsync(
libBytes.publicDeepCopyBytes.callAsync(byteArrayShorterThan32Bytes, byteArrayLongerThan32Bytes),
- ContractLibErrors.LibBytesGreaterOrEqualToSourceBytesLengthRequired
+ RevertReasons.LibBytesGreaterOrEqualToSourceBytesLengthRequired
);
});
it('should overwrite dest with source if source and dest have equal length', async () => {
@@ -226,7 +226,7 @@ describe('LibBytes', () => {
const offset = new BigNumber(0);
return expectRevertOrOtherErrorAsync(
libBytes.publicReadAddress.callAsync(shortByteArray, offset),
- ContractLibErrors.LibBytesGreaterOrEqualTo20LengthRequired,
+ RevertReasons.LibBytesGreaterOrEqualTo20LengthRequired,
);
});
it('should fail if the length between the offset and end of the byte array is too short to hold an address', async () => {
@@ -234,7 +234,7 @@ describe('LibBytes', () => {
const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
return expectRevertOrOtherErrorAsync(
libBytes.publicReadAddress.callAsync(byteArray, badOffset),
- ContractLibErrors.LibBytesGreaterOrEqualTo20LengthRequired,
+ RevertReasons.LibBytesGreaterOrEqualTo20LengthRequired,
);
});
});
@@ -270,7 +270,7 @@ describe('LibBytes', () => {
const offset = new BigNumber(0);
return expectRevertOrOtherErrorAsync(
libBytes.publicWriteAddress.callAsync(byteArrayShorterThan20Bytes, offset, testAddress),
- ContractLibErrors.LibBytesGreaterOrEqualTo20LengthRequired,
+ RevertReasons.LibBytesGreaterOrEqualTo20LengthRequired,
);
});
it('should fail if the length between the offset and end of the byte array is too short to hold an address', async () => {
@@ -278,7 +278,7 @@ describe('LibBytes', () => {
const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
return expectRevertOrOtherErrorAsync(
libBytes.publicWriteAddress.callAsync(byteArray, badOffset, testAddress),
- ContractLibErrors.LibBytesGreaterOrEqualTo20LengthRequired,
+ RevertReasons.LibBytesGreaterOrEqualTo20LengthRequired,
);
});
});
@@ -302,14 +302,14 @@ describe('LibBytes', () => {
const offset = new BigNumber(0);
return expectRevertOrOtherErrorAsync(
libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset),
- ContractLibErrors.LibBytesGreaterOrEqualTo32LengthRequired,
+ RevertReasons.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),
- ContractLibErrors.LibBytesGreaterOrEqualTo32LengthRequired,
+ RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired,
);
});
});
@@ -345,7 +345,7 @@ describe('LibBytes', () => {
const offset = new BigNumber(0);
return expectRevertOrOtherErrorAsync(
libBytes.publicWriteBytes32.callAsync(byteArrayShorterThan32Bytes, offset, testBytes32),
- ContractLibErrors.LibBytesGreaterOrEqualTo32LengthRequired,
+ RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired,
);
});
it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32', async () => {
@@ -353,7 +353,7 @@ describe('LibBytes', () => {
const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
return expectRevertOrOtherErrorAsync(
libBytes.publicWriteBytes32.callAsync(byteArray, badOffset, testBytes32),
- ContractLibErrors.LibBytesGreaterOrEqualTo32LengthRequired,
+ RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired,
);
});
});
@@ -381,7 +381,7 @@ describe('LibBytes', () => {
const offset = new BigNumber(0);
return expectRevertOrOtherErrorAsync(
libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset),
- ContractLibErrors.LibBytesGreaterOrEqualTo32LengthRequired,
+ RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired,
);
});
it('should fail if the length between the offset and end of the byte array is too short to hold a uint256', async () => {
@@ -391,7 +391,7 @@ describe('LibBytes', () => {
const badOffset = new BigNumber(testUint256AsBuffer.byteLength);
return expectRevertOrOtherErrorAsync(
libBytes.publicReadUint256.callAsync(byteArray, badOffset),
- ContractLibErrors.LibBytesGreaterOrEqualTo32LengthRequired,
+ RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired,
);
});
});
@@ -431,7 +431,7 @@ describe('LibBytes', () => {
const offset = new BigNumber(0);
return expectRevertOrOtherErrorAsync(
libBytes.publicWriteUint256.callAsync(byteArrayShorterThan32Bytes, offset, testUint256),
- ContractLibErrors.LibBytesGreaterOrEqualTo32LengthRequired,
+ RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired,
);
});
it('should fail if the length between the offset and end of the byte array is too short to hold a uint256', async () => {
@@ -439,7 +439,7 @@ describe('LibBytes', () => {
const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
return expectRevertOrOtherErrorAsync(
libBytes.publicWriteUint256.callAsync(byteArray, badOffset, testUint256),
- ContractLibErrors.LibBytesGreaterOrEqualTo32LengthRequired,
+ RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired,
);
});
});
@@ -450,7 +450,7 @@ describe('LibBytes', () => {
const byteArrayLessThan4Bytes = '0x010101';
return expectRevertOrOtherErrorAsync(
libBytes.publicReadFirst4.callAsync(byteArrayLessThan4Bytes),
- ContractLibErrors.LibBytesGreaterOrEqualTo4LengthRequired,
+ RevertReasons.LibBytesGreaterOrEqualTo4LengthRequired,
);
});
it('should return the first 4 bytes of a byte array of arbitrary length', async () => {
@@ -505,28 +505,28 @@ describe('LibBytes', () => {
const offset = new BigNumber(0);
return expectRevertOrOtherErrorAsync(
libBytes.publicReadBytes.callAsync(byteArrayShorterThan32Bytes, offset),
- ContractLibErrors.LibBytesGreaterOrEqualTo32LengthRequired,
+ RevertReasons.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.publicReadBytes.callAsync(testBytes32, offset),
- ContractLibErrors.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
+ RevertReasons.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.publicReadBytes.callAsync(byteArrayShorterThan32Bytes, badOffset),
- ContractLibErrors.LibBytesGreaterOrEqualTo32LengthRequired,
+ RevertReasons.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.publicReadBytes.callAsync(testBytes32, badOffset),
- ContractLibErrors.LibBytesGreaterOrEqualTo32LengthRequired,
+ RevertReasons.LibBytesGreaterOrEqualTo32LengthRequired,
);
});
});
@@ -606,7 +606,7 @@ describe('LibBytes', () => {
const emptyByteArray = ethUtil.bufferToHex(new Buffer(1));
return expectRevertOrOtherErrorAsync(
libBytes.publicWriteBytes.callAsync(emptyByteArray, offset, longData),
- ContractLibErrors.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
+ RevertReasons.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 () => {
@@ -614,7 +614,7 @@ describe('LibBytes', () => {
const badOffset = new BigNumber(ethUtil.toBuffer(shortTestBytesAsBuffer).byteLength);
return expectRevertOrOtherErrorAsync(
libBytes.publicWriteBytes.callAsync(emptyByteArray, badOffset, shortData),
- ContractLibErrors.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
+ RevertReasons.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
);
});
});
diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts
index b7d7acd48..9f52232e2 100644
--- a/packages/contracts/test/unlimited_allowance_token.ts
+++ b/packages/contracts/test/unlimited_allowance_token.ts
@@ -7,7 +7,7 @@ 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 { ContractLibErrors } from '../src/utils/types';
+import { RevertReasons } from '../src/utils/types';
import { provider, txDefaults, web3Wrapper } from '../src/utils/web3_wrapper';
chaiSetup.configure();
@@ -56,7 +56,7 @@ describe('UnlimitedAllowanceToken', () => {
const amountToTransfer = ownerBalance.plus(1);
return expectRevertOrOtherErrorAsync(
token.transfer.callAsync(spender, amountToTransfer, { from: owner }),
- ContractLibErrors.Erc20InsufficientBalance,
+ RevertReasons.Erc20InsufficientBalance,
);
});
@@ -97,7 +97,7 @@ describe('UnlimitedAllowanceToken', () => {
token.transferFrom.callAsync(owner, spender, amountToTransfer, {
from: spender,
}),
- ContractLibErrors.Erc20InsufficientBalance,
+ RevertReasons.Erc20InsufficientBalance,
);
});
@@ -113,7 +113,7 @@ describe('UnlimitedAllowanceToken', () => {
token.transferFrom.callAsync(owner, spender, amountToTransfer, {
from: spender,
}),
- ContractLibErrors.Erc20InsufficientAllowance,
+ RevertReasons.Erc20InsufficientAllowance,
);
});