aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/order-utils/test/exchange_transfer_simulator_test.ts41
-rw-r--r--packages/order-utils/test/global_hooks_test.ts45
2 files changed, 32 insertions, 54 deletions
diff --git a/packages/order-utils/test/exchange_transfer_simulator_test.ts b/packages/order-utils/test/exchange_transfer_simulator_test.ts
index 13e2dcc62..3369901b1 100644
--- a/packages/order-utils/test/exchange_transfer_simulator_test.ts
+++ b/packages/order-utils/test/exchange_transfer_simulator_test.ts
@@ -1,4 +1,4 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
+import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils';
import { ExchangeContractErrs } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
@@ -9,6 +9,8 @@ import { artifacts } from '../src/artifacts';
import { constants } from '../src/constants';
import { ExchangeTransferSimulator } from '../src/exchange_transfer_simulator';
import { DummyERC20TokenContract } from '../src/generated_contract_wrappers/dummy_e_r_c20_token';
+import { ERC20ProxyContract } from '../src/generated_contract_wrappers/e_r_c20_proxy';
+import { ERC20TokenContract } from '../src/generated_contract_wrappers/e_r_c20_token';
import { BalanceAndProxyAllowanceLazyStore } from '../src/store/balance_and_proxy_allowance_lazy_store';
import { TradeSide, TransferType } from '../src/types';
@@ -31,19 +33,40 @@ describe('ExchangeTransferSimulator', async () => {
let exchangeTransferSimulator: ExchangeTransferSimulator;
let txHash: string;
let erc20ProxyAddress: string;
- before(async () => {
+ before(async function(): Promise<void> {
+ const mochaTestTimeoutMs = 20000;
+ this.timeout(mochaTestTimeoutMs);
+
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
[coinbase, sender, recipient] = userAddresses;
- erc20ProxyAddress = getAddressFromArtifact(artifacts.ERC20Proxy, constants.TESTRPC_NETWORK_ID);
+ const txDefaults = {
+ gas: devConstants.GAS_LIMIT,
+ from: devConstants.TESTRPC_FIRST_ADDRESS,
+ };
+
+ const erc20Proxy = await ERC20ProxyContract.deployFrom0xArtifactAsync(
+ artifacts.ERC20Proxy,
+ provider,
+ txDefaults,
+ );
+ erc20ProxyAddress = erc20Proxy.address;
- const wethArtifact = artifacts.DummyERC20Token;
- const wethAddress = getAddressFromArtifact(wethArtifact, constants.TESTRPC_NETWORK_ID);
- dummyERC20Token = new DummyERC20TokenContract(
- artifacts.DummyERC20Token.compilerOutput.abi,
- wethAddress,
+ const totalSupply = new BigNumber(100000000000000000000);
+ const name = 'Test';
+ const symbol = 'TST';
+ const decimals = new BigNumber(18);
+ // tslint:disable-next-line:no-unused-variable
+ dummyERC20Token = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyERC20Token,
provider,
+ txDefaults,
+ name,
+ symbol,
+ decimals,
+ totalSupply,
);
+
exampleTokenAddress = dummyERC20Token.address;
});
beforeEach(async () => {
@@ -59,7 +82,7 @@ describe('ExchangeTransferSimulator', async () => {
beforeEach(() => {
const simpleERC20BalanceAndProxyAllowanceFetcher = new SimpleERC20BalanceAndProxyAllowanceFetcher(
- dummyERC20Token,
+ (dummyERC20Token as any) as ERC20TokenContract,
erc20ProxyAddress,
);
const balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(
diff --git a/packages/order-utils/test/global_hooks_test.ts b/packages/order-utils/test/global_hooks_test.ts
deleted file mode 100644
index 662a2cb0f..000000000
--- a/packages/order-utils/test/global_hooks_test.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import { devConstants } from '@0xproject/dev-utils';
-import { ArtifactWriter } from '@0xproject/migrations';
-import { BigNumber } from '@0xproject/utils';
-
-import { artifacts } from '../src/artifacts';
-import { constants } from '../src/constants';
-import { DummyERC20TokenContract } from '../src/generated_contract_wrappers/dummy_e_r_c20_token';
-import { ERC20ProxyContract } from '../src/generated_contract_wrappers/e_r_c20_proxy';
-
-import { provider } from './utils/web3_wrapper';
-
-before('migrate contracts', async function(): Promise<void> {
- // HACK: Since contract migrations take longer then our global mocha timeout limit
- // we manually increase it for this before hook.
- const mochaTestTimeoutMs = 20000;
- this.timeout(mochaTestTimeoutMs);
-
- const txDefaults = {
- gas: devConstants.GAS_LIMIT,
- from: devConstants.TESTRPC_FIRST_ADDRESS,
- };
-
- const networkId = constants.TESTRPC_NETWORK_ID;
- const artifactsDir = `lib/src/artifacts`;
- const artifactsWriter = new ArtifactWriter(artifactsDir, networkId);
-
- const erc20proxy = await ERC20ProxyContract.deployFrom0xArtifactAsync(artifacts.ERC20Proxy, provider, txDefaults);
- artifactsWriter.saveArtifact(erc20proxy);
-
- const totalSupply = new BigNumber(100000000000000000000);
- const name = 'Test';
- const symbol = 'TST';
- const decimals = new BigNumber(18);
- // tslint:disable-next-line:no-unused-variable
- const dummyErc20Token = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC20Token,
- provider,
- txDefaults,
- name,
- symbol,
- decimals,
- totalSupply,
- );
- artifactsWriter.saveArtifact(dummyErc20Token);
-});