aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer/src/cli.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-05-11 18:32:57 +0800
committerFabio Berger <me@fabioberger.com>2018-05-11 18:32:57 +0800
commitd370296e82c11d67bbb16a1dc73432c3625682aa (patch)
treec8e5d440bc2b78feae89644c11ba3ed778da6015 /packages/deployer/src/cli.ts
parentf78b5741c3ba3495c066dc800ce62d8a1f3fb75f (diff)
parentf42f608f3f97a5244f09f17ae5ee184c0f775de3 (diff)
downloaddexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar
dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.gz
dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.bz2
dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.lz
dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.xz
dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.zst
dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.zip
Merge branch 'development' into breakUp0xjs
* development: Fix ganache subprovider config Fix a bug in compiler config precedence Fix linter errors Fix templates Remove unused deployer docs configs Add a legacy endpoint for the deployer Add a check for compiler output Add a comment Put ARTIFACTS_VERSION in a config Improve a comment Remove _applyDefaultsToDeployTxDataAsync Add a HACK comment Fix linter issues Rename deployer to sol-compiler Remove deployer Remove deployer from 0x.js and migrations Configure migrations with a compiler.json Remove deployer from metacoin and contract tests Update wallet footer and add remove token functionality # Conflicts: # .gitignore # packages/0x.js/package.json # packages/0x.js/src/0x.ts # packages/contracts/package.json # packages/contracts/test/multi_sig_with_time_lock.ts # packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts # packages/contracts/util/artifacts.ts # packages/deployer/test/deployer_test.ts # packages/migrations/package.json
Diffstat (limited to 'packages/deployer/src/cli.ts')
-rw-r--r--packages/deployer/src/cli.ts137
1 files changed, 0 insertions, 137 deletions
diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts
deleted file mode 100644
index 8c89cf382..000000000
--- a/packages/deployer/src/cli.ts
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/usr/bin/env node
-// We need the above pragma since this script will be run as a command-line tool.
-
-import { BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
-import * as _ from 'lodash';
-import * as path from 'path';
-import * as Web3 from 'web3';
-import * as yargs from 'yargs';
-
-import { commands } from './commands';
-import { constants } from './utils/constants';
-import { consoleReporter } from './utils/error_reporter';
-import { CliOptions, CompilerOptions, DeployerOptions } from './utils/types';
-
-const DEFAULT_CONTRACTS_DIR = path.resolve('src/contracts');
-const DEFAULT_ARTIFACTS_DIR = path.resolve('src/artifacts');
-const DEFAULT_NETWORK_ID = 50;
-const DEFAULT_JSONRPC_URL = 'http://localhost:8545';
-const DEFAULT_GAS_PRICE = (10 ** 9 * 2).toString();
-const DEFAULT_CONTRACTS_LIST = '*';
-const SEPARATOR = ',';
-
-/**
- * Compiles all contracts with options passed in through CLI.
- * @param argv Instance of process.argv provided by yargs.
- */
-async function onCompileCommandAsync(argv: CliOptions): Promise<void> {
- const opts: CompilerOptions = {
- contractsDir: argv.contractsDir,
- artifactsDir: argv.artifactsDir,
- contracts: argv.contracts === DEFAULT_CONTRACTS_LIST ? DEFAULT_CONTRACTS_LIST : argv.contracts.split(SEPARATOR),
- };
- await commands.compileAsync(opts);
-}
-/**
- * Deploys a single contract with provided name and args.
- * @param argv Instance of process.argv provided by yargs.
- */
-async function onDeployCommandAsync(argv: CliOptions): Promise<void> {
- const url = argv.jsonrpcUrl;
- const provider = new Web3.providers.HttpProvider(url);
- const web3Wrapper = new Web3Wrapper(provider);
- const networkId = await web3Wrapper.getNetworkIdAsync();
- const compilerOpts: CompilerOptions = {
- contractsDir: argv.contractsDir,
- artifactsDir: argv.artifactsDir,
- contracts: argv.contracts === DEFAULT_CONTRACTS_LIST ? DEFAULT_CONTRACTS_LIST : argv.contracts.split(SEPARATOR),
- };
- await commands.compileAsync(compilerOpts);
-
- const defaults = {
- gasPrice: new BigNumber(argv.gasPrice),
- from: argv.account,
- };
- const deployerOpts: DeployerOptions = {
- artifactsDir: argv.artifactsDir || DEFAULT_ARTIFACTS_DIR,
- jsonrpcUrl: argv.jsonrpcUrl,
- networkId,
- defaults,
- };
- const deployerArgsString = argv.constructorArgs as string;
- const deployerArgs = deployerArgsString.split(SEPARATOR);
- await commands.deployAsync(argv.contract as string, deployerArgs, deployerOpts);
-}
-/**
- * Adds additional required options for when the user is calling the deploy command.
- * @param yargsInstance yargs instance provided in builder function callback.
- */
-function deployCommandBuilder(yargsInstance: any) {
- return yargsInstance
- .option('network-id', {
- type: 'number',
- default: DEFAULT_NETWORK_ID,
- description: 'mainnet=1, kovan=42, testrpc=50',
- })
- .option('contract', {
- type: 'string',
- description: 'name of contract to deploy, excluding .sol extension',
- })
- .option('constructor-args', {
- type: 'string',
- description: 'comma separated list of constructor args to deploy contract with',
- })
- .option('jsonrpc-url', {
- type: 'string',
- default: DEFAULT_JSONRPC_URL,
- description: 'url of JSON RPC',
- })
- .option('account', {
- type: 'string',
- description: 'account to use for deploying contracts',
- })
- .option('gas-price', {
- type: 'string',
- default: DEFAULT_GAS_PRICE,
- description: 'gasPrice to be used for transactions',
- })
- .demandOption(['contract', 'args', 'account'])
- .help().argv;
-}
-
-/**
- * Adds additional required options for when the user is calling the compile command.
- * @param yargsInstance yargs instance provided in builder function callback.
- */
-function compileCommandBuilder(yargsInstance: any) {
- return yargsInstance
- .option('contracts', {
- type: 'string',
- default: DEFAULT_CONTRACTS_LIST,
- description: 'comma separated list of contracts to compile',
- })
- .help().argv;
-}
-
-(() => {
- const identityCommandBuilder = _.identity;
- return yargs
- .option('contracts-dir', {
- type: 'string',
- description: 'path of contracts directory to compile',
- })
- .option('artifacts-dir', {
- type: 'string',
- description: 'path to write contracts artifacts to',
- })
- .demandCommand(1)
- .command('compile', 'compile contracts', compileCommandBuilder, consoleReporter(onCompileCommandAsync))
- .command(
- 'deploy',
- 'deploy a single contract with provided arguments',
- deployCommandBuilder,
- consoleReporter(onDeployCommandAsync),
- )
- .help().argv;
-})();