Fix import of LibBytesRevertErrors

This commit is contained in:
Jacob Evans 2019-11-25 12:53:28 +11:00
parent ad8caa2b51
commit 89dcbd0229
No known key found for this signature in database
GPG Key ID: 2036DA2ADDFB0842
2 changed files with 12 additions and 11 deletions

View File

@ -1,7 +1,7 @@
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
import { DummyERC721TokenContract } from '@0x/contracts-erc721';
import { artifacts as exchangeArtifacts, ExchangeContract } from '@0x/contracts-exchange';
import { artifacts, ForwarderContract, ForwarderRevertErrors } from '@0x/contracts-exchange-forwarder';
import { artifacts, ExchangeForwarderRevertErrors, ForwarderContract } from '@0x/contracts-exchange-forwarder';
import {
blockchainTests,
constants,
@ -127,7 +127,9 @@ blockchainTests('Forwarder integration tests', env => {
exchange.address,
deployment.tokens.weth.address,
);
await expect(deployForwarder).to.revertWith(new ForwarderRevertErrors.UnregisteredAssetProxyError());
await expect(deployForwarder).to.revertWith(
new ExchangeForwarderRevertErrors.UnregisteredAssetProxyError(),
);
});
});
blockchainTests.resets('marketSellOrdersWithEth without extra fees', () => {
@ -258,7 +260,7 @@ blockchainTests('Forwarder integration tests', env => {
takerFeeAssetData,
takerFee: toBaseUnitAmount(1),
});
const revertError = new ForwarderRevertErrors.UnsupportedFeeError(takerFeeAssetData);
const revertError = new ExchangeForwarderRevertErrors.UnsupportedFeeError(takerFeeAssetData);
await testFactory.marketSellTestAsync([order], 0.5, {
revertError,
});
@ -316,7 +318,7 @@ blockchainTests('Forwarder integration tests', env => {
it('should fail if the fee is set too high', async () => {
const order = await maker.signOrderAsync();
const forwarderFeePercentage = new BigNumber(6);
const revertError = new ForwarderRevertErrors.FeePercentageTooLargeError(
const revertError = new ExchangeForwarderRevertErrors.FeePercentageTooLargeError(
getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, forwarderFeePercentage),
);
await testFactory.marketSellTestAsync([order], 0.5, {
@ -383,7 +385,7 @@ blockchainTests('Forwarder integration tests', env => {
});
it('should revert if the amount of ETH sent is too low to fill the makerAssetAmount', async () => {
const order = await maker.signOrderAsync();
const revertError = new ForwarderRevertErrors.CompleteBuyFailedError(
const revertError = new ExchangeForwarderRevertErrors.CompleteBuyFailedError(
order.makerAssetAmount.times(0.5),
constants.ZERO_AMOUNT,
);
@ -421,7 +423,7 @@ blockchainTests('Forwarder integration tests', env => {
takerFeeAssetData,
takerFee: toBaseUnitAmount(1),
});
const revertError = new ForwarderRevertErrors.UnsupportedFeeError(takerFeeAssetData);
const revertError = new ExchangeForwarderRevertErrors.UnsupportedFeeError(takerFeeAssetData);
await testFactory.marketBuyTestAsync([order], 0.5, {
revertError,
});
@ -608,7 +610,7 @@ blockchainTests('Forwarder integration tests', env => {
});
it('should fail if the fee is set too high', async () => {
const order = await maker.signOrderAsync();
const revertError = new ForwarderRevertErrors.FeePercentageTooLargeError(
const revertError = new ExchangeForwarderRevertErrors.FeePercentageTooLargeError(
getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, new BigNumber(6)),
);
await testFactory.marketBuyTestAsync([order], 0.5, {
@ -623,7 +625,7 @@ blockchainTests('Forwarder integration tests', env => {
order.takerAssetAmount.times(0.5).plus(DeploymentManager.protocolFee),
forwarderFeePercentage,
);
const revertError = new ForwarderRevertErrors.InsufficientEthForFeeError(ethFee, ethFee.minus(1));
const revertError = new ExchangeForwarderRevertErrors.InsufficientEthForFeeError(ethFee, ethFee.minus(1));
await testFactory.marketBuyTestAsync([order], 0.5, {
ethValueAdjustment: -1,
forwarderFeePercentage,

View File

@ -22,11 +22,10 @@ import { artifacts as exchangeArtifacts, ExchangeContract } from '@0x/contracts-
import { chaiSetup, constants, LogDecoder, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { AssetProxyId } from '@0x/types';
import { BigNumber, providerUtils, StringRevertError } from '@0x/utils';
import { BigNumber, providerUtils, StringRevertError, LibBytesRevertErrors } from '@0x/utils';
import * as ethUtil from 'ethereumjs-util';
import { artifacts, LibAssetDataContract } from '@0x/contracts-dev-utils';
import { InvalidByteOperationError } from '@0x/contracts-utils/lib/src/lib_bytes_revert_errors';
chaiSetup.configure();
const expect = chai.expect;
@ -359,7 +358,7 @@ describe('LibAssetData', () => {
for (const data of assetData) {
const badData = data.substring(0, data.length - 2); // drop one byte but retain assetProxyId
await expect(libAssetData.revertIfInvalidAssetData(badData).callAsync()).to.eventually.be.rejectedWith(
InvalidByteOperationError,
LibBytesRevertErrors.InvalidByteOperationError,
);
}
});