From 17148df06df36d360075fa7ef622eba804cc44f2 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 12 Mar 2018 03:47:46 +0100 Subject: Add an example deployment script --- packages/deployer/README.md | 30 ++++++++++++++++++++++++++++++ packages/deployer/src/deployer.ts | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/deployer/README.md b/packages/deployer/README.md index f92605f4a..8b6f9799c 100644 --- a/packages/deployer/README.md +++ b/packages/deployer/README.md @@ -10,6 +10,8 @@ yarn add @0xproject/deployer ## Usage +### CLI Usage + ```bash node ./node_modules/@0xproject/deployer/lib/cli.js --help cli.js [command] @@ -33,6 +35,34 @@ Options: --help Show help [boolean] ``` +### API Usage + +## Migrations + +You might want to write a migrations script (similar to `truffle migrate`), that deploys multiple contracts and configures them. Bellow you'll find a simplest example of such a script to help you get started. + +``` +import { Deployer } from '@0xproject/deployer'; +import * as path from 'path'; + +const deployerOpts = { + artifactsDir: path.resolve('src', 'artifacts'), + jsonrpcUrl: 'http://localhost:8545', + networkId: 50, + defaults: { + gas: '1000000', + }, +}; + +const deployer = new Deployer(deployerOpts); + +(async () => { + const etherToken = await deployer.deployAndSaveAsync('WETH9'); +})().catch(console.log); +``` + +More sophisticated example can be found [here](https://github.com/0xProject/0x-monorepo/tree/development/packages/contracts/migrations) + ## Contributing We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository. diff --git a/packages/deployer/src/deployer.ts b/packages/deployer/src/deployer.ts index 94f6938fc..7dfb4c9b1 100644 --- a/packages/deployer/src/deployer.ts +++ b/packages/deployer/src/deployer.ts @@ -10,8 +10,8 @@ import { ContractArtifact, ContractNetworkData, DeployerOptions, - UrlDeployerOptions, ProviderDeployerOptions, + UrlDeployerOptions, } from './utils/types'; import { utils } from './utils/utils'; -- cgit v1.2.3