diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-27 01:18:48 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-27 01:18:48 +0800 |
commit | 271adcdb7e3ecb9f88f05f36ffb71d2147bac292 (patch) | |
tree | 80d17771617e540908dd99e9cb63a737630aa37d /packages/migrations/src | |
parent | 717a3bce8cd0d4cb782918b3ad806f6c1bdb825e (diff) | |
parent | 6d565f4bff38b12515f4d8f0e29cdc223c12d1fb (diff) | |
download | dexon-sol-tools-271adcdb7e3ecb9f88f05f36ffb71d2147bac292.tar dexon-sol-tools-271adcdb7e3ecb9f88f05f36ffb71d2147bac292.tar.gz dexon-sol-tools-271adcdb7e3ecb9f88f05f36ffb71d2147bac292.tar.bz2 dexon-sol-tools-271adcdb7e3ecb9f88f05f36ffb71d2147bac292.tar.lz dexon-sol-tools-271adcdb7e3ecb9f88f05f36ffb71d2147bac292.tar.xz dexon-sol-tools-271adcdb7e3ecb9f88f05f36ffb71d2147bac292.tar.zst dexon-sol-tools-271adcdb7e3ecb9f88f05f36ffb71d2147bac292.zip |
Merge branch 'development' into feature/instant/rollbar-env
Diffstat (limited to 'packages/migrations/src')
-rw-r--r-- | packages/migrations/src/cli.ts | 38 | ||||
-rw-r--r-- | packages/migrations/src/migration.ts | 8 |
2 files changed, 46 insertions, 0 deletions
diff --git a/packages/migrations/src/cli.ts b/packages/migrations/src/cli.ts new file mode 100644 index 000000000..2404e7921 --- /dev/null +++ b/packages/migrations/src/cli.ts @@ -0,0 +1,38 @@ +#!/usr/bin/env node +import { RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders'; +import { logUtils } from '@0x/utils'; +import * as yargs from 'yargs'; + +import { runMigrationsAsync } from './migration'; + +const args = yargs + .option('rpc-url', { + describe: 'Endpoint where backing Ethereum JSON RPC interface is available', + type: 'string', + demandOption: false, + default: 'http://localhost:8545', + }) + .option('from', { + describe: 'Ethereum address from which to deploy the contracts', + type: 'string', + demandOption: true, + }) + .example( + '$0 --rpc-url http://localhost:8545 --from 0x5409ed021d9299bf6814279a6a1411a7e866a631', + 'Full usage example', + ).argv; + +(async () => { + const rpcSubprovider = new RPCSubprovider(args['rpc-url']); + const provider = new Web3ProviderEngine(); + provider.addProvider(rpcSubprovider); + provider.start(); + const txDefaults = { + from: args.from, + }; + await runMigrationsAsync(provider, txDefaults); + process.exit(0); +})().catch(err => { + logUtils.log(err); + process.exit(1); +}); diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts index 61ac56938..c684c4970 100644 --- a/packages/migrations/src/migration.ts +++ b/packages/migrations/src/migration.ts @@ -47,6 +47,7 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial artifacts.Exchange, provider, txDefaults, + zrxAssetData, ); // Multisigs @@ -140,6 +141,13 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial zrxAssetData, ); + // Fund the Forwarder with ZRX + const zrxDecimals = await zrxToken.decimals.callAsync(); + const zrxForwarderAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5000), zrxDecimals); + await web3Wrapper.awaitTransactionSuccessAsync( + await zrxToken.transfer.sendTransactionAsync(forwarder.address, zrxForwarderAmount, txDefaults), + ); + return { erc20Proxy: erc20Proxy.address, erc721Proxy: erc721Proxy.address, |