Add an example deployment script

This commit is contained in:
Leonid Logvinov
2018-03-12 03:47:46 +01:00
parent d93089fcc0
commit 17148df06d
2 changed files with 31 additions and 1 deletions

View File

@@ -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.

View File

@@ -10,8 +10,8 @@ import {
ContractArtifact,
ContractNetworkData,
DeployerOptions,
UrlDeployerOptions,
ProviderDeployerOptions,
UrlDeployerOptions,
} from './utils/types';
import { utils } from './utils/utils';