Import from @0x/utils

This commit is contained in:
Jacob Evans 2019-11-27 11:58:25 +11:00
parent 89dcbd0229
commit 389d4d10f1
No known key found for this signature in database
GPG Key ID: 2036DA2ADDFB0842
10 changed files with 15 additions and 27 deletions

View File

@ -8,14 +8,12 @@ import {
import { DevUtilsContract } from '@0x/contracts-dev-utils'; import { DevUtilsContract } from '@0x/contracts-dev-utils';
import { constants, expect, LogDecoder, orderHashUtils, orderUtils, signingUtils } from '@0x/contracts-test-utils'; import { constants, expect, LogDecoder, orderHashUtils, orderUtils, signingUtils } from '@0x/contracts-test-utils';
import { FillResults, Order, SignatureType, SignedOrder } from '@0x/types'; import { FillResults, Order, SignatureType, SignedOrder } from '@0x/types';
import { BigNumber, errorUtils, providerUtils, RevertError, StringRevertError } from '@0x/utils'; import { BigNumber, errorUtils, ExchangeRevertErrors, providerUtils, RevertError, StringRevertError } from '@0x/utils';
import { SupportedProvider, Web3Wrapper } from '@0x/web3-wrapper'; import { SupportedProvider, Web3Wrapper } from '@0x/web3-wrapper';
import { LogWithDecodedArgs, TxData } from 'ethereum-types'; import { LogWithDecodedArgs, TxData } from 'ethereum-types';
import * as _ from 'lodash'; import * as _ from 'lodash';
import 'make-promises-safe'; import 'make-promises-safe';
import { ExchangeRevertErrors } from '../../src';
import { artifacts } from '../artifacts'; import { artifacts } from '../artifacts';
import { ExchangeContract, ExchangeFillEventArgs } from '../wrappers'; import { ExchangeContract, ExchangeFillEventArgs } from '../wrappers';

View File

@ -1,6 +1,6 @@
import { IAssetDataContract } from '@0x/contracts-asset-proxy'; import { IAssetDataContract } from '@0x/contracts-asset-proxy';
import { DummyERC721TokenContract } from '@0x/contracts-erc721'; import { DummyERC721TokenContract } from '@0x/contracts-erc721';
import { ForwarderContract, ForwarderRevertErrors } from '@0x/contracts-exchange-forwarder'; import { ForwarderContract } from '@0x/contracts-exchange-forwarder';
import { import {
blockchainTests, blockchainTests,
constants, constants,
@ -10,7 +10,7 @@ import {
} from '@0x/contracts-test-utils'; } from '@0x/contracts-test-utils';
import { generatePseudoRandomSalt } from '@0x/order-utils'; import { generatePseudoRandomSalt } from '@0x/order-utils';
import { SignatureType, SignedOrder } from '@0x/types'; import { SignatureType, SignedOrder } from '@0x/types';
import { AbiEncoder, BigNumber } from '@0x/utils'; import { AbiEncoder, BigNumber, ExchangeForwarderRevertErrors } from '@0x/utils';
import { deployEth2DaiBridgeAsync } from '../bridges/deploy_eth2dai_bridge'; import { deployEth2DaiBridgeAsync } from '../bridges/deploy_eth2dai_bridge';
import { deployUniswapBridgeAsync } from '../bridges/deploy_uniswap_bridge'; import { deployUniswapBridgeAsync } from '../bridges/deploy_uniswap_bridge';
@ -251,7 +251,7 @@ blockchainTests.resets('Forwarder <> ERC20Bridge integration tests', env => {
takerFee: toBaseUnitAmount(0.01), takerFee: toBaseUnitAmount(0.01),
takerFeeAssetData: makerFeeTokenAssetData, takerFeeAssetData: makerFeeTokenAssetData,
}; };
const expectedError = new ForwarderRevertErrors.UnsupportedFeeError(makerFeeTokenAssetData); const expectedError = new ExchangeForwarderRevertErrors.UnsupportedFeeError(makerFeeTokenAssetData);
await testFactory.marketSellTestAsync([order], 1.23, { revertError: expectedError }); await testFactory.marketSellTestAsync([order], 1.23, { revertError: expectedError });
}); });
}); });
@ -301,7 +301,7 @@ blockchainTests.resets('Forwarder <> ERC20Bridge integration tests', env => {
await testFactory.marketBuyTestAsync(orders, 2.56, { forwarderFeePercentage: 1 }); await testFactory.marketBuyTestAsync(orders, 2.56, { forwarderFeePercentage: 1 });
}); });
it('should revert if the amount of ETH sent is too low to fill the makerAssetAmount (Eth2Dai)', async () => { it('should revert if the amount of ETH sent is too low to fill the makerAssetAmount (Eth2Dai)', async () => {
const expectedError = new ForwarderRevertErrors.CompleteBuyFailedError( const expectedError = new ExchangeForwarderRevertErrors.CompleteBuyFailedError(
eth2DaiBridgeOrder.makerAssetAmount.times(0.5), eth2DaiBridgeOrder.makerAssetAmount.times(0.5),
constants.ZERO_AMOUNT, constants.ZERO_AMOUNT,
); );
@ -352,7 +352,7 @@ blockchainTests.resets('Forwarder <> ERC20Bridge integration tests', env => {
await testFactory.marketBuyTestAsync(orders, 2.56, { forwarderFeePercentage: 1 }); await testFactory.marketBuyTestAsync(orders, 2.56, { forwarderFeePercentage: 1 });
}); });
it('should revert if the amount of ETH sent is too low to fill the makerAssetAmount (Uniswap)', async () => { it('should revert if the amount of ETH sent is too low to fill the makerAssetAmount (Uniswap)', async () => {
const expectedError = new ForwarderRevertErrors.CompleteBuyFailedError( const expectedError = new ExchangeForwarderRevertErrors.CompleteBuyFailedError(
uniswapBridgeOrder.makerAssetAmount.times(0.5), uniswapBridgeOrder.makerAssetAmount.times(0.5),
constants.ZERO_AMOUNT, constants.ZERO_AMOUNT,
); );
@ -370,7 +370,7 @@ blockchainTests.resets('Forwarder <> ERC20Bridge integration tests', env => {
takerFee: toBaseUnitAmount(0.01), takerFee: toBaseUnitAmount(0.01),
takerFeeAssetData: makerFeeTokenAssetData, takerFeeAssetData: makerFeeTokenAssetData,
}; };
const expectedError = new ForwarderRevertErrors.UnsupportedFeeError(makerFeeTokenAssetData); const expectedError = new ExchangeForwarderRevertErrors.UnsupportedFeeError(makerFeeTokenAssetData);
await testFactory.marketBuyTestAsync([order], 1.23, { revertError: expectedError }); await testFactory.marketBuyTestAsync([order], 1.23, { revertError: expectedError });
}); });
}); });

View File

@ -1,9 +1,8 @@
import { blockchainTests, expect } from '@0x/contracts-test-utils'; import { blockchainTests, expect } from '@0x/contracts-test-utils';
import { AuthorizableRevertErrors } from '@0x/contracts-utils'; import { AuthorizableRevertErrors } from '@0x/contracts-utils';
import { StakingRevertErrors } from '@0x/utils';
import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { StakingRevertErrors } from '../../src';
import { artifacts } from '../artifacts'; import { artifacts } from '../artifacts';
import { import {
TestExchangeManagerContract, TestExchangeManagerContract,

View File

@ -7,11 +7,10 @@ import {
Numberish, Numberish,
shortZip, shortZip,
} from '@0x/contracts-test-utils'; } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils'; import { BigNumber, StakingRevertErrors } from '@0x/utils';
import { LogEntry } from 'ethereum-types'; import { LogEntry } from 'ethereum-types';
import * as _ from 'lodash'; import * as _ from 'lodash';
import { StakingRevertErrors } from '../../src';
import { constants as stakingConstants } from '../../src/constants'; import { constants as stakingConstants } from '../../src/constants';
import { artifacts } from '../artifacts'; import { artifacts } from '../artifacts';

View File

@ -1,9 +1,8 @@
import { blockchainTests, expect, hexRandom, Numberish } from '@0x/contracts-test-utils'; import { blockchainTests, expect, hexRandom, Numberish } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils'; import { BigNumber, FixedMathRevertErrors } from '@0x/utils';
import { Decimal } from 'decimal.js'; import { Decimal } from 'decimal.js';
import * as _ from 'lodash'; import * as _ from 'lodash';
import { FixedMathRevertErrors } from '../../src';
import { assertRoughlyEquals, fromFixed, toDecimal, toFixed } from '../utils/number_utils'; import { assertRoughlyEquals, fromFixed, toDecimal, toFixed } from '../utils/number_utils';
import { artifacts } from '../artifacts'; import { artifacts } from '../artifacts';

View File

@ -1,8 +1,7 @@
import { blockchainTests, constants, expect, verifyEventsFromLogs } from '@0x/contracts-test-utils'; import { blockchainTests, constants, expect, verifyEventsFromLogs } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils'; import { BigNumber, StakingRevertErrors } from '@0x/utils';
import { LogWithDecodedArgs } from 'ethereum-types'; import { LogWithDecodedArgs } from 'ethereum-types';
import { StakingRevertErrors } from '../../src';
import { constants as stakingConstants } from '../../src/constants'; import { constants as stakingConstants } from '../../src/constants';
import { artifacts } from '../artifacts'; import { artifacts } from '../artifacts';

View File

@ -7,12 +7,10 @@ import {
Numberish, Numberish,
randomAddress, randomAddress,
} from '@0x/contracts-test-utils'; } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils'; import { BigNumber, StakingRevertErrors } from '@0x/utils';
import { LogEntry } from 'ethereum-types'; import { LogEntry } from 'ethereum-types';
import * as _ from 'lodash'; import * as _ from 'lodash';
import { StakingRevertErrors } from '../../src';
import { artifacts } from '../artifacts'; import { artifacts } from '../artifacts';
import { import {
IStakingEventsEvents, IStakingEventsEvents,

View File

@ -9,10 +9,9 @@ import {
Numberish, Numberish,
shortZip, shortZip,
} from '@0x/contracts-test-utils'; } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils'; import { BigNumber, StakingRevertErrors } from '@0x/utils';
import * as _ from 'lodash'; import * as _ from 'lodash';
import { StakingRevertErrors } from '../../src';
import { StakeStatus } from '../../src/types'; import { StakeStatus } from '../../src/types';
import { artifacts } from '../artifacts'; import { artifacts } from '../artifacts';

View File

@ -1,6 +1,6 @@
import { blockchainTests, constants, expect, verifyEventsFromLogs } from '@0x/contracts-test-utils'; import { blockchainTests, constants, expect, verifyEventsFromLogs } from '@0x/contracts-test-utils';
import { AuthorizableRevertErrors } from '@0x/contracts-utils'; import { AuthorizableRevertErrors } from '@0x/contracts-utils';
import { BigNumber } from '@0x/utils'; import { BigNumber, StakingRevertErrors } from '@0x/utils';
import * as _ from 'lodash'; import * as _ from 'lodash';
import { artifacts } from '../artifacts'; import { artifacts } from '../artifacts';
@ -11,7 +11,6 @@ import {
TestStakingProxyUnitContract, TestStakingProxyUnitContract,
} from '../wrappers'; } from '../wrappers';
import { StakingRevertErrors } from '../../src';
import { constants as stakingConstants } from '../../src/constants'; import { constants as stakingConstants } from '../../src/constants';
blockchainTests.resets('StakingProxy unit tests', env => { blockchainTests.resets('StakingProxy unit tests', env => {

View File

@ -8,12 +8,10 @@ import {
filterLogsToArguments, filterLogsToArguments,
provider, provider,
} from '@0x/contracts-test-utils'; } from '@0x/contracts-test-utils';
import { AuthorizableRevertErrors, SafeMathRevertErrors } from '@0x/contracts-utils';
import { RevertReason } from '@0x/types'; import { RevertReason } from '@0x/types';
import { BigNumber } from '@0x/utils'; import { AuthorizableRevertErrors, BigNumber, SafeMathRevertErrors, StakingRevertErrors } from '@0x/utils';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { StakingRevertErrors } from '../../src';
import { constants as stakingConstants } from '../../src/constants'; import { constants as stakingConstants } from '../../src/constants';
import { artifacts } from '../artifacts'; import { artifacts } from '../artifacts';