Fix import of LibBytesRevertErrors
This commit is contained in:
parent
ad8caa2b51
commit
89dcbd0229
@ -1,7 +1,7 @@
|
|||||||
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
|
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
|
||||||
import { DummyERC721TokenContract } from '@0x/contracts-erc721';
|
import { DummyERC721TokenContract } from '@0x/contracts-erc721';
|
||||||
import { artifacts as exchangeArtifacts, ExchangeContract } from '@0x/contracts-exchange';
|
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 {
|
import {
|
||||||
blockchainTests,
|
blockchainTests,
|
||||||
constants,
|
constants,
|
||||||
@ -127,7 +127,9 @@ blockchainTests('Forwarder integration tests', env => {
|
|||||||
exchange.address,
|
exchange.address,
|
||||||
deployment.tokens.weth.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', () => {
|
blockchainTests.resets('marketSellOrdersWithEth without extra fees', () => {
|
||||||
@ -258,7 +260,7 @@ blockchainTests('Forwarder integration tests', env => {
|
|||||||
takerFeeAssetData,
|
takerFeeAssetData,
|
||||||
takerFee: toBaseUnitAmount(1),
|
takerFee: toBaseUnitAmount(1),
|
||||||
});
|
});
|
||||||
const revertError = new ForwarderRevertErrors.UnsupportedFeeError(takerFeeAssetData);
|
const revertError = new ExchangeForwarderRevertErrors.UnsupportedFeeError(takerFeeAssetData);
|
||||||
await testFactory.marketSellTestAsync([order], 0.5, {
|
await testFactory.marketSellTestAsync([order], 0.5, {
|
||||||
revertError,
|
revertError,
|
||||||
});
|
});
|
||||||
@ -316,7 +318,7 @@ blockchainTests('Forwarder integration tests', env => {
|
|||||||
it('should fail if the fee is set too high', async () => {
|
it('should fail if the fee is set too high', async () => {
|
||||||
const order = await maker.signOrderAsync();
|
const order = await maker.signOrderAsync();
|
||||||
const forwarderFeePercentage = new BigNumber(6);
|
const forwarderFeePercentage = new BigNumber(6);
|
||||||
const revertError = new ForwarderRevertErrors.FeePercentageTooLargeError(
|
const revertError = new ExchangeForwarderRevertErrors.FeePercentageTooLargeError(
|
||||||
getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, forwarderFeePercentage),
|
getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, forwarderFeePercentage),
|
||||||
);
|
);
|
||||||
await testFactory.marketSellTestAsync([order], 0.5, {
|
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 () => {
|
it('should revert if the amount of ETH sent is too low to fill the makerAssetAmount', async () => {
|
||||||
const order = await maker.signOrderAsync();
|
const order = await maker.signOrderAsync();
|
||||||
const revertError = new ForwarderRevertErrors.CompleteBuyFailedError(
|
const revertError = new ExchangeForwarderRevertErrors.CompleteBuyFailedError(
|
||||||
order.makerAssetAmount.times(0.5),
|
order.makerAssetAmount.times(0.5),
|
||||||
constants.ZERO_AMOUNT,
|
constants.ZERO_AMOUNT,
|
||||||
);
|
);
|
||||||
@ -421,7 +423,7 @@ blockchainTests('Forwarder integration tests', env => {
|
|||||||
takerFeeAssetData,
|
takerFeeAssetData,
|
||||||
takerFee: toBaseUnitAmount(1),
|
takerFee: toBaseUnitAmount(1),
|
||||||
});
|
});
|
||||||
const revertError = new ForwarderRevertErrors.UnsupportedFeeError(takerFeeAssetData);
|
const revertError = new ExchangeForwarderRevertErrors.UnsupportedFeeError(takerFeeAssetData);
|
||||||
await testFactory.marketBuyTestAsync([order], 0.5, {
|
await testFactory.marketBuyTestAsync([order], 0.5, {
|
||||||
revertError,
|
revertError,
|
||||||
});
|
});
|
||||||
@ -608,7 +610,7 @@ blockchainTests('Forwarder integration tests', env => {
|
|||||||
});
|
});
|
||||||
it('should fail if the fee is set too high', async () => {
|
it('should fail if the fee is set too high', async () => {
|
||||||
const order = await maker.signOrderAsync();
|
const order = await maker.signOrderAsync();
|
||||||
const revertError = new ForwarderRevertErrors.FeePercentageTooLargeError(
|
const revertError = new ExchangeForwarderRevertErrors.FeePercentageTooLargeError(
|
||||||
getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, new BigNumber(6)),
|
getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, new BigNumber(6)),
|
||||||
);
|
);
|
||||||
await testFactory.marketBuyTestAsync([order], 0.5, {
|
await testFactory.marketBuyTestAsync([order], 0.5, {
|
||||||
@ -623,7 +625,7 @@ blockchainTests('Forwarder integration tests', env => {
|
|||||||
order.takerAssetAmount.times(0.5).plus(DeploymentManager.protocolFee),
|
order.takerAssetAmount.times(0.5).plus(DeploymentManager.protocolFee),
|
||||||
forwarderFeePercentage,
|
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, {
|
await testFactory.marketBuyTestAsync([order], 0.5, {
|
||||||
ethValueAdjustment: -1,
|
ethValueAdjustment: -1,
|
||||||
forwarderFeePercentage,
|
forwarderFeePercentage,
|
||||||
|
@ -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 { chaiSetup, constants, LogDecoder, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { AssetProxyId } from '@0x/types';
|
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 * as ethUtil from 'ethereumjs-util';
|
||||||
|
|
||||||
import { artifacts, LibAssetDataContract } from '@0x/contracts-dev-utils';
|
import { artifacts, LibAssetDataContract } from '@0x/contracts-dev-utils';
|
||||||
import { InvalidByteOperationError } from '@0x/contracts-utils/lib/src/lib_bytes_revert_errors';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
@ -359,7 +358,7 @@ describe('LibAssetData', () => {
|
|||||||
for (const data of assetData) {
|
for (const data of assetData) {
|
||||||
const badData = data.substring(0, data.length - 2); // drop one byte but retain assetProxyId
|
const badData = data.substring(0, data.length - 2); // drop one byte but retain assetProxyId
|
||||||
await expect(libAssetData.revertIfInvalidAssetData(badData).callAsync()).to.eventually.be.rejectedWith(
|
await expect(libAssetData.revertIfInvalidAssetData(badData).callAsync()).to.eventually.be.rejectedWith(
|
||||||
InvalidByteOperationError,
|
LibBytesRevertErrors.InvalidByteOperationError,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user