diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-03-12 10:47:46 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-03-12 10:47:46 +0800 |
commit | 17148df06df36d360075fa7ef622eba804cc44f2 (patch) | |
tree | 7f33cf9cbc4e6bf104a3b3c98c21e7b73d11264b /packages/deployer | |
parent | d93089fcc0a004b9df9e8c96be181cc92639a1e8 (diff) | |
download | dexon-0x-contracts-17148df06df36d360075fa7ef622eba804cc44f2.tar.gz dexon-0x-contracts-17148df06df36d360075fa7ef622eba804cc44f2.tar.zst dexon-0x-contracts-17148df06df36d360075fa7ef622eba804cc44f2.zip |
Add an example deployment script
Diffstat (limited to 'packages/deployer')
-rw-r--r-- | packages/deployer/README.md | 30 | ||||
-rw-r--r-- | packages/deployer/src/deployer.ts | 2 |
2 files changed, 31 insertions, 1 deletions
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'; |