diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts index beef50c7dc..3869b52646 100644 --- a/packages/migrations/src/migration.ts +++ b/packages/migrations/src/migration.ts @@ -17,41 +17,12 @@ import { ExchangeContract } from '@0x/contracts-exchange'; import { ForwarderContract } from '@0x/contracts-exchange-forwarder'; import { StakingProxyContract, TestStakingContract, ZrxVaultContract } from '@0x/contracts-staking'; import { Web3ProviderEngine } from '@0x/subproviders'; -import { AbiEncoder, BigNumber, providerUtils } from '@0x/utils'; -import { MethodAbi, SupportedProvider, TxData } from 'ethereum-types'; +import { BigNumber, providerUtils } from '@0x/utils'; +import { SupportedProvider, TxData } from 'ethereum-types'; import { constants } from './utils/constants'; import { erc20TokenInfo, erc721TokenInfo } from './utils/token_info'; -// HACK (xianny): Copied from @0x/order-utils to get rid of circular dependency -/** - * Encodes an ERC20 token address into a hex encoded assetData string, usable in the makerAssetData or - * takerAssetData fields in a 0x order. - * @param tokenAddress The ERC20 token address to encode - * @return The hex encoded assetData string - */ -function encodeERC20AssetData(tokenAddress: string): string { - const ERC20_METHOD_ABI: MethodAbi = { - constant: false, - inputs: [ - { - name: 'tokenContract', - type: 'address', - }, - ], - name: 'ERC20Token', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }; - const encodingRules: AbiEncoder.EncodingRules = { shouldOptimize: true }; - const abiEncoder = new AbiEncoder.Method(ERC20_METHOD_ABI); - const args = [tokenAddress]; - const assetData = abiEncoder.encode(args, encodingRules); - return assetData; -} - /** * Creates and deploys all the contracts that are required for the latest * version of the 0x protocol. @@ -272,7 +243,7 @@ export async function runMigrationsAsync( txDefaults, artifacts, exchange.address, - encodeERC20AssetData(etherToken.address), + etherToken.address, ); const contractAddresses = { diff --git a/packages/migrations/src/testnet_migrations.ts b/packages/migrations/src/testnet_migrations.ts index 7acce226c8..3a8c91fc0a 100644 --- a/packages/migrations/src/testnet_migrations.ts +++ b/packages/migrations/src/testnet_migrations.ts @@ -221,7 +221,7 @@ export async function runMigrationsAsync(supportedProvider: SupportedProvider, t ]); await submitAndExecuteTransactionAsync(governor, governor.address, batchTransactionData); - const devUtils = await DevUtilsContract.deployFrom0xArtifactAsync( + await DevUtilsContract.deployFrom0xArtifactAsync( devUtilsArtifacts.DevUtils, provider, txDefaults, @@ -238,14 +238,13 @@ export async function runMigrationsAsync(supportedProvider: SupportedProvider, t chainId, ); - const wethAssetData = await devUtils.encodeERC20AssetData(deployedAddresses.etherToken).callAsync(); const forwarder = await ForwarderContract.deployFrom0xArtifactAsync( forwarderArtifacts.Forwarder, provider, txDefaults, forwarderArtifacts, exchange.address, - wethAssetData, + deployedAddresses.etherToken, ); await forwarder.approveMakerAssetProxy(deployedAddresses.etherToken).awaitTransactionSuccessAsync(); }