diff options
Diffstat (limited to 'packages/migrations/src')
-rw-r--r-- | packages/migrations/src/2.0.0/migration.ts | 18 | ||||
-rw-r--r-- | packages/migrations/src/utils/artifact_writer.ts | 4 | ||||
-rw-r--r-- | packages/migrations/src/utils/provider_factory.ts | 12 |
3 files changed, 21 insertions, 13 deletions
diff --git a/packages/migrations/src/2.0.0/migration.ts b/packages/migrations/src/2.0.0/migration.ts index 75e60d3e2..f51c236de 100644 --- a/packages/migrations/src/2.0.0/migration.ts +++ b/packages/migrations/src/2.0.0/migration.ts @@ -1,4 +1,4 @@ -import { assetProxyUtils } from '@0xproject/order-utils'; +import { assetDataUtils } from '@0xproject/order-utils'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Provider, TxData } from 'ethereum-types'; @@ -13,6 +13,7 @@ import { DummyERC721TokenContract } from './contract_wrappers/dummy_erc721_token import { ERC20ProxyContract } from './contract_wrappers/erc20_proxy'; import { ERC721ProxyContract } from './contract_wrappers/erc721_proxy'; import { ExchangeContract } from './contract_wrappers/exchange'; +import { ForwarderContract } from './contract_wrappers/forwarder'; import { WETH9Contract } from './contract_wrappers/weth9'; import { ZRXTokenContract } from './contract_wrappers/zrx_token'; @@ -52,7 +53,7 @@ export const runV2MigrationsAsync = async (provider: Provider, artifactsDir: str artifacts.Exchange, provider, txDefaults, - assetProxyUtils.encodeERC20AssetData(zrxToken.address), + assetDataUtils.encodeERC20AssetData(zrxToken.address), ); artifactsWriter.saveArtifact(exchange); @@ -127,4 +128,17 @@ export const runV2MigrationsAsync = async (provider: Provider, artifactsDir: str erc721TokenInfo[0].name, erc721TokenInfo[0].symbol, ); + + // Forwarder + const forwarder = await ForwarderContract.deployFrom0xArtifactAsync( + artifacts.Forwarder, + provider, + txDefaults, + exchange.address, + etherToken.address, + zrxToken.address, + assetDataUtils.encodeERC20AssetData(zrxToken.address), + assetDataUtils.encodeERC20AssetData(etherToken.address), + ); + artifactsWriter.saveArtifact(forwarder); }; diff --git a/packages/migrations/src/utils/artifact_writer.ts b/packages/migrations/src/utils/artifact_writer.ts index 2da5a09dd..b7522df05 100644 --- a/packages/migrations/src/utils/artifact_writer.ts +++ b/packages/migrations/src/utils/artifact_writer.ts @@ -4,8 +4,8 @@ import * as fs from 'fs'; import * as path from 'path'; export class ArtifactWriter { - private _artifactsDir: string; - private _networkId: number; + private readonly _artifactsDir: string; + private readonly _networkId: number; constructor(artifactsDir: string, networkId: number) { this._artifactsDir = artifactsDir; this._networkId = networkId; diff --git a/packages/migrations/src/utils/provider_factory.ts b/packages/migrations/src/utils/provider_factory.ts index 7a217b1e0..5f69b258d 100644 --- a/packages/migrations/src/utils/provider_factory.ts +++ b/packages/migrations/src/utils/provider_factory.ts @@ -1,10 +1,8 @@ -import { LedgerEthereumClient, LedgerSubprovider } from '@0xproject/subproviders'; +import { LedgerEthereumClient, LedgerSubprovider, RPCSubprovider, Web3ProviderEngine } from '@0xproject/subproviders'; import Eth from '@ledgerhq/hw-app-eth'; // tslint:disable:no-implicit-dependencies import TransportNodeHid from '@ledgerhq/hw-transport-node-hid'; import { Provider } from 'ethereum-types'; -import ProviderEngine = require('web3-provider-engine'); -import RpcSubprovider = require('web3-provider-engine/subproviders/rpc'); import { constants } from './constants'; @@ -15,18 +13,14 @@ async function ledgerEthereumNodeJsClientFactoryAsync(): Promise<LedgerEthereumC } export const providerFactory = { async getLedgerProviderAsync(): Promise<Provider> { - const provider = new ProviderEngine(); + const provider = new Web3ProviderEngine(); const ledgerWalletConfigs = { networkId: constants.KOVAN_NETWORK_ID, ledgerEthereumClientFactoryAsync: ledgerEthereumNodeJsClientFactoryAsync, }; const ledgerSubprovider = new LedgerSubprovider(ledgerWalletConfigs); provider.addProvider(ledgerSubprovider); - provider.addProvider( - new RpcSubprovider({ - rpcUrl: constants.RPC_URL, - }), - ); + provider.addProvider(new RPCSubprovider(constants.RPC_URL)); provider.start(); return provider; }, |