aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/exchange/dispatcher.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/test/exchange/dispatcher.ts')
-rw-r--r--packages/contracts/test/exchange/dispatcher.ts21
1 files changed, 14 insertions, 7 deletions
diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts
index f96f15f16..41ea88d4e 100644
--- a/packages/contracts/test/exchange/dispatcher.ts
+++ b/packages/contracts/test/exchange/dispatcher.ts
@@ -1,6 +1,6 @@
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { assetProxyUtils } from '@0xproject/order-utils';
-import { AssetProxyId } from '@0xproject/types';
+import { AssetProxyId, RevertReasons } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
@@ -9,7 +9,7 @@ import { ERC20ProxyContract } from '../../src/generated_contract_wrappers/e_r_c2
import { ERC721ProxyContract } from '../../src/generated_contract_wrappers/e_r_c721_proxy';
import { TestAssetProxyDispatcherContract } from '../../src/generated_contract_wrappers/test_asset_proxy_dispatcher';
import { artifacts } from '../../src/utils/artifacts';
-import { expectRevertOrAlwaysFailingTransactionAsync } from '../../src/utils/assertions';
+import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../../src/utils/assertions';
import { chaiSetup } from '../../src/utils/chai_setup';
import { constants } from '../../src/utils/constants';
import { ERC20Wrapper } from '../../src/utils/erc20_wrapper';
@@ -48,7 +48,10 @@ describe('AssetProxyDispatcher', () => {
erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
- [zrxToken] = await erc20Wrapper.deployDummyTokensAsync();
+ [zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
+ constants.NUM_DUMMY_ERC20_TO_DEPLOY,
+ constants.DUMMY_TOKEN_DECIMALS,
+ );
erc20Proxy = await erc20Wrapper.deployProxyAsync();
await erc20Wrapper.setBalancesAndAllowancesAsync();
@@ -175,13 +178,14 @@ describe('AssetProxyDispatcher', () => {
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
expect(proxyAddress).to.be.equal(erc20Proxy.address);
// The following transaction will throw because the currentAddress is no longer constants.NULL_ADDRESS
- return expectRevertOrAlwaysFailingTransactionAsync(
+ return expectRevertReasonOrAlwaysFailingTransactionAsync(
assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20Proxy.address,
constants.NULL_ADDRESS,
{ from: owner },
),
+ RevertReasons.AssetProxyMismatch,
);
});
@@ -216,25 +220,27 @@ describe('AssetProxyDispatcher', () => {
it('should throw if requesting address is not owner', async () => {
const prevProxyAddress = constants.NULL_ADDRESS;
- return expectRevertOrAlwaysFailingTransactionAsync(
+ return expectRevertReasonOrAlwaysFailingTransactionAsync(
assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20Proxy.address,
prevProxyAddress,
{ from: notOwner },
),
+ RevertReasons.OnlyContractOwner,
);
});
it('should throw if attempting to register a proxy to the incorrect id', async () => {
const prevProxyAddress = constants.NULL_ADDRESS;
- return expectRevertOrAlwaysFailingTransactionAsync(
+ return expectRevertReasonOrAlwaysFailingTransactionAsync(
assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC721,
erc20Proxy.address,
prevProxyAddress,
{ from: owner },
),
+ RevertReasons.AssetProxyIdMismatch,
);
});
});
@@ -305,7 +311,7 @@ describe('AssetProxyDispatcher', () => {
const encodedAssetData = assetProxyUtils.encodeERC20AssetData(zrxToken.address);
// Perform a transfer from makerAddress to takerAddress
const amount = new BigNumber(10);
- return expectRevertOrAlwaysFailingTransactionAsync(
+ return expectRevertReasonOrAlwaysFailingTransactionAsync(
assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
encodedAssetData,
makerAddress,
@@ -313,6 +319,7 @@ describe('AssetProxyDispatcher', () => {
amount,
{ from: owner },
),
+ RevertReasons.AssetProxyDoesNotExist,
);
});
});