Update exchange-forwarder tests.

This commit is contained in:
Lawrence Forman
2019-03-25 15:13:41 -04:00
committed by Amir Bandeali
parent 2d28fde24d
commit 35f568e346

View File

@@ -18,7 +18,7 @@ import {
import { BlockchainLifecycle } from '@0x/dev-utils'; import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils } from '@0x/order-utils'; import { assetDataUtils } from '@0x/order-utils';
import { RevertReason, SignedOrder } from '@0x/types'; import { RevertReason, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils'; import { BigNumber, providerUtils } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper'; import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai'; import * as chai from 'chai';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
@@ -32,6 +32,7 @@ const DECIMALS_DEFAULT = 18;
const MAX_WETH_FILL_PERCENTAGE = 95; const MAX_WETH_FILL_PERCENTAGE = 95;
describe(ContractName.Forwarder, () => { describe(ContractName.Forwarder, () => {
let chainId: number;
let makerAddress: string; let makerAddress: string;
let owner: string; let owner: string;
let takerAddress: string; let takerAddress: string;
@@ -64,6 +65,9 @@ describe(ContractName.Forwarder, () => {
before(async () => { before(async () => {
await blockchainLifecycle.startAsync(); await blockchainLifecycle.startAsync();
chainId = await providerUtils.getChainIdAsync(provider);
const accounts = await web3Wrapper.getAvailableAddressesAsync(); const accounts = await web3Wrapper.getAvailableAddressesAsync();
const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = accounts); const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = accounts);
@@ -99,6 +103,7 @@ describe(ContractName.Forwarder, () => {
provider, provider,
txDefaults, txDefaults,
zrxAssetData, zrxAssetData,
new BigNumber(chainId),
); );
exchangeWrapper = new ExchangeWrapper(exchangeInstance, provider); exchangeWrapper = new ExchangeWrapper(exchangeInstance, provider);
await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner); await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
@@ -115,6 +120,7 @@ describe(ContractName.Forwarder, () => {
const defaultTakerAssetAddress = wethContract.address; const defaultTakerAssetAddress = wethContract.address;
const defaultOrderParams = { const defaultOrderParams = {
exchangeAddress: exchangeInstance.address, exchangeAddress: exchangeInstance.address,
chainId,
makerAddress, makerAddress,
feeRecipientAddress, feeRecipientAddress,
makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress), makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
@@ -170,6 +176,7 @@ describe(ContractName.Forwarder, () => {
provider, provider,
txDefaults, txDefaults,
zrxAssetData, zrxAssetData,
new BigNumber(chainId),
); );
return expectContractCreationFailedAsync( return expectContractCreationFailedAsync(
(ForwarderContract.deployFrom0xArtifactAsync( (ForwarderContract.deployFrom0xArtifactAsync(