diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-11 18:12:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-11 18:12:39 +0800 |
commit | f42f608f3f97a5244f09f17ae5ee184c0f775de3 (patch) | |
tree | 08fd03d69f8a7dfcc7beadcd56c5d1624928c430 /packages/website | |
parent | 44f17c1706e7b3208fdc0702c54a8cd943132fd3 (diff) | |
parent | c093aab350dfbd86972d6388c3923ec60fc4501a (diff) | |
download | dexon-sol-tools-f42f608f3f97a5244f09f17ae5ee184c0f775de3.tar dexon-sol-tools-f42f608f3f97a5244f09f17ae5ee184c0f775de3.tar.gz dexon-sol-tools-f42f608f3f97a5244f09f17ae5ee184c0f775de3.tar.bz2 dexon-sol-tools-f42f608f3f97a5244f09f17ae5ee184c0f775de3.tar.lz dexon-sol-tools-f42f608f3f97a5244f09f17ae5ee184c0f775de3.tar.xz dexon-sol-tools-f42f608f3f97a5244f09f17ae5ee184c0f775de3.tar.zst dexon-sol-tools-f42f608f3f97a5244f09f17ae5ee184c0f775de3.zip |
Merge pull request #574 from 0xProject/feature/rm-rf-deployer
Remove @0xproject/deployer.Deployer. Make contracts able to deploy themselves
Diffstat (limited to 'packages/website')
18 files changed, 102 insertions, 148 deletions
diff --git a/packages/website/md/docs/deployer/installation.md b/packages/website/md/docs/deployer/installation.md deleted file mode 100644 index c02dbadc6..000000000 --- a/packages/website/md/docs/deployer/installation.md +++ /dev/null @@ -1,24 +0,0 @@ -#### CLI Installation - -```bash -yarn global add @0xproject/deployer -``` - -#### API Installation - -```bash -yarn add @0xproject/deployer -``` - -**Import** - -```typescript -import { Deployer, Compiler } from '@0xproject/deployer'; -``` - -or - -```javascript -var Deployer = require('@0xproject/deployer').Deployer; -var Compiler = require('@0xproject/deployer').Compiler; -``` diff --git a/packages/website/md/docs/deployer/introduction.md b/packages/website/md/docs/deployer/introduction.md deleted file mode 100644 index 7ebd26a3c..000000000 --- a/packages/website/md/docs/deployer/introduction.md +++ /dev/null @@ -1,18 +0,0 @@ -Welcome to the [Deployer](https://github.com/0xProject/0x-monorepo/tree/development/packages/deployer) documentation! Deployer is a tool for compiling and deploying Solidity smart contracts with ease. - -It serves a similar purpose as parts of the [Truffle framework](http://truffleframework.com/), but with the UNIX philosophy in mind: Make each program do one thing well. This tool is for intermediate to advanced Solidity developers that require greater configurability and reliability. - -Deployer has the following advantages over Truffle: - -* Deploy each smart contract with a specific version of Solidity. -* Improved artifact files: - * Properly segregated artifacts to support storing different versions of smart contract deployed on different networks. - * Storage of constructor args, source maps and paths to all requisite source files. - * An easy to maintain codebase: TypeScript + Single repo. - * Allows you to specify the deployer RPC address. - * Supports Solidity version ranges - contract compiled with latest Solidity version that satisfies the range. - * Migrations that work with `async/await`. - * Migrations that can be written synchronously in order to guarentee deterministic contract addresses. - * No race conditions when running migrations. - -Deployer can be used as a command-line tool or as an imported module. diff --git a/packages/website/md/docs/deployer/usage.md b/packages/website/md/docs/deployer/usage.md deleted file mode 100644 index 295af55e1..000000000 --- a/packages/website/md/docs/deployer/usage.md +++ /dev/null @@ -1,56 +0,0 @@ -#### CLI Usage - -```bash -$ 0x-deployer --help -0x-deployer [command] - -Commands: - 0x-deployer compile compile contracts - 0x-deployer deploy deploy a single contract with provided arguments - -Options: - --version Show version number [boolean] - --contracts-dir path of contracts directory to compile [string] [default: - "/path/to/contracts"] - --network-id mainnet=1, kovan=42, testrpc=50 [number] [default: 50] - --should-optimize enable optimizer [boolean] [default: false] - --artifacts-dir path to write contracts artifacts to [string] [default: - "/path/to/artifacts"] - --jsonrpc-port port connected to JSON RPC [number] [default: 8545] - --gas-price gasPrice to be used for transactions - [string] [default: "2000000000"] - --account account to use for deploying contracts [string] - --contracts comma separated list of contracts to compile - [string] [default: "*"] - --help Show help [boolean] -``` - -#### API Usage - -##### Migrations - -You can write migration scripts (similar to `truffle migrate`), that deploys multiple contracts and configures them. Below you'll find a simple example of such a script to help you get started. - -```typescript -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); -``` - -**Tip:** Be sure to start an Ethereum node at the supplied `jsonrpcUrl`. We recommend testing with [Ganache-cli](https://github.com/trufflesuite/ganache-cli) - -A more sophisticated example can be found [here](https://github.com/0xProject/0x-monorepo/tree/development/packages/contracts/migrations) diff --git a/packages/website/md/docs/sol-compiler/installation.md b/packages/website/md/docs/sol-compiler/installation.md new file mode 100644 index 000000000..9c8561d9b --- /dev/null +++ b/packages/website/md/docs/sol-compiler/installation.md @@ -0,0 +1,23 @@ +#### CLI Installation + +```bash +yarn global add @0xproject/sol-compiler +``` + +#### API Installation + +```bash +yarn add @0xproject/sol-compiler +``` + +**Import** + +```typescript +import { Compiler } from '@0xproject/sol-compiler'; +``` + +or + +```javascript +var Compiler = require('@0xproject/sol-compiler').Compiler; +``` diff --git a/packages/website/md/docs/sol-compiler/introduction.md b/packages/website/md/docs/sol-compiler/introduction.md new file mode 100644 index 000000000..aa1939006 --- /dev/null +++ b/packages/website/md/docs/sol-compiler/introduction.md @@ -0,0 +1,13 @@ +Welcome to the [sol-compiler](https://github.com/0xProject/0x-monorepo/tree/development/packages/sol-compiler) documentation! Sol-compiler is a tool for compiling Solidity smart contracts and generating artifacts with ease. + +It serves a similar purpose as parts of the [Truffle framework](http://truffleframework.com/), but with the UNIX philosophy in mind: Make each program do one thing well. This tool is for intermediate to advanced Solidity developers that require greater configurability and reliability. + +Sol-compiler has the following advantages over Truffle: + +* Compile each smart contract with a specific version of Solidity. +* Improved artifact files: + * Storage of constructor args, source maps and paths to all requisite source files. + * An easy to maintain codebase: TypeScript + Single repo. + * Supports Solidity version ranges - contract compiled with latest Solidity version that satisfies the range. + +Sol-compiler can be used as a command-line tool or as an imported module. diff --git a/packages/website/md/docs/sol-compiler/usage.md b/packages/website/md/docs/sol-compiler/usage.md new file mode 100644 index 000000000..79c9b32ba --- /dev/null +++ b/packages/website/md/docs/sol-compiler/usage.md @@ -0,0 +1,24 @@ +#### CLI Usage + +```bash +$ sol-compiler +Options: + --version Show version number [boolean] + --contracts-dir path of contracts directory to compile [string] + --artifacts-dir path to write contracts artifacts to [string] + --contracts comma separated list of contracts to compile + [string] [default: "*"] + --help Show help [boolean] +``` + +#### API Usage + +```typescript +import { Compiler } from '@0xproject/sol-compiler'; + +const compiler = new Compiler(); + +(async () => { + await compiler.compileAllAsync(); +})().catch(console.log); +``` diff --git a/packages/website/md/docs/sol_cov/usage.md b/packages/website/md/docs/sol_cov/usage.md index ea1982d97..63a88f595 100644 --- a/packages/website/md/docs/sol_cov/usage.md +++ b/packages/website/md/docs/sol_cov/usage.md @@ -12,7 +12,7 @@ const contractsPath = 'src/contracts'; const networkId = 50; // Some calls might not have `from` address specified. Nevertheless - transactions need to be submitted from an address with at least some funds. defaultFromAddress is the address that will be used to submit those calls as transactions from. const defaultFromAddress = '0x5409ed021d9299bf6814279a6a1411a7e866a631'; -const coverageSubprovider = new CoverageSubprovider(artifactsPath, contractsPath, networkId, defaultFromAddress); +const coverageSubprovider = new CoverageSubprovider(artifactsPath, contractsPath, defaultFromAddress); provider.addProvider(coverageSubprovider); ``` diff --git a/packages/website/translations/chinese.json b/packages/website/translations/chinese.json index d37b1abdf..966457a93 100644 --- a/packages/website/translations/chinese.json +++ b/packages/website/translations/chinese.json @@ -56,7 +56,7 @@ "ABOUT": "关于我们", "CAREERS": "人才招聘", "CONTACT": "联系方式", - "DEPLOYER": "Deployer", + "SOL_COMPILER": "Solidity Compiler", "JSON_SCHEMAS": "JSON Schemas", "SOL_COV": "Solidity Coverage", "SUBPROVIDERS": "Subproviders", diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json index 8d7485e9a..f3acea3be 100644 --- a/packages/website/translations/english.json +++ b/packages/website/translations/english.json @@ -57,7 +57,7 @@ "ABOUT": "about", "CAREERS": "careers", "CONTACT": "contact", - "DEPLOYER": "Deployer", + "SOL_COMPILER": "Solidity Compiler", "JSON_SCHEMAS": "JSON Schemas", "SOL_COV": "Solidity Coverage", "SUBPROVIDERS": "Subproviders", diff --git a/packages/website/translations/korean.json b/packages/website/translations/korean.json index 028476d2c..7414207f7 100644 --- a/packages/website/translations/korean.json +++ b/packages/website/translations/korean.json @@ -56,7 +56,7 @@ "ABOUT": "기업 정보", "CAREERS": "채용", "CONTACT": "문의", - "DEPLOYER": "Deployer", + "SOL_COMPILER": "Solidity Compiler", "JSON_SCHEMAS": "JSON Schemas", "SOL_COV": "Solidity Coverage", "SUBPROVIDERS": "Subproviders", diff --git a/packages/website/translations/russian.json b/packages/website/translations/russian.json index 9254ab1c0..75ab02a27 100644 --- a/packages/website/translations/russian.json +++ b/packages/website/translations/russian.json @@ -56,7 +56,7 @@ "ABOUT": "Kоманда", "CAREERS": "Карьера", "CONTACT": "Связаться с нами", - "DEPLOYER": "Deployer", + "SOL_COMPILER": "Solidity Compiler", "JSON_SCHEMAS": "JSON Schemas", "SOL_COV": "Solidity Coverage", "SUBPROVIDERS": "Subproviders", diff --git a/packages/website/translations/spanish.json b/packages/website/translations/spanish.json index eb8f4035c..8f537ea40 100644 --- a/packages/website/translations/spanish.json +++ b/packages/website/translations/spanish.json @@ -57,7 +57,7 @@ "ABOUT": "equipo", "CAREERS": "empleo", "CONTACT": "contacto", - "DEPLOYER": "Deployer", + "SOL_COMPILER": "Solidity Compiler", "JSON_SCHEMAS": "JSON Schemas", "SOL_COV": "Solidity Coverage", "SUBPROVIDERS": "Subproviders", diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index 2502bea6d..5a1b50310 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -149,10 +149,10 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { primaryText={this.props.translate.get(Key.OrderUtils, Deco.CapWords)} /> </Link>, - <Link key="subMenuItem-deployer" to={WebsitePaths.Deployer} className="text-decoration-none"> + <Link key="subMenuItem-sol-compiler" to={WebsitePaths.SolCompiler} className="text-decoration-none"> <MenuItem style={{ fontSize: styles.menuItem.fontSize }} - primaryText={this.props.translate.get(Key.Deployer, Deco.CapWords)} + primaryText={this.props.translate.get(Key.SolCompiler, Deco.CapWords)} /> </Link>, <Link key="subMenuItem-sol-cov" to={WebsitePaths.SolCov} className="text-decoration-none"> @@ -328,10 +328,10 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { </MenuItem> </Link> )} - {!this._isViewingDeployerDocs() && ( - <Link to={WebsitePaths.Deployer} className="text-decoration-none"> + {!this._isViewingSolCompilerDocs() && ( + <Link to={WebsitePaths.SolCompiler} className="text-decoration-none"> <MenuItem className="py2"> - {this.props.translate.get(Key.Deployer, Deco.Cap)}{' '} + {this.props.translate.get(Key.SolCompiler, Deco.Cap)}{' '} {this.props.translate.get(Key.Docs, Deco.Cap)} </MenuItem> </Link> @@ -390,7 +390,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { (!this._isViewing0xjsDocs() && !this._isViewingSmartContractsDocs() && !this._isViewingWeb3WrapperDocs() && - !this._isViewingDeployerDocs() && + !this._isViewingSolCompilerDocs() && !this._isViewingJsonSchemasDocs() && !this._isViewingSolCovDocs() && !this._isViewingSubprovidersDocs() && @@ -476,8 +476,8 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { _.includes(this.props.location.pathname, WebsiteLegacyPaths.Web3Wrapper) ); } - private _isViewingDeployerDocs() { - return _.includes(this.props.location.pathname, WebsitePaths.Deployer); + private _isViewingSolCompilerDocs() { + return _.includes(this.props.location.pathname, WebsitePaths.SolCompiler); } private _isViewingJsonSchemasDocs() { return _.includes(this.props.location.pathname, WebsitePaths.JSONSchemas); @@ -498,7 +498,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { this._isViewingFAQ() || this._isViewingSmartContractsDocs() || this._isViewingWeb3WrapperDocs() || - this._isViewingDeployerDocs() || + this._isViewingSolCompilerDocs() || this._isViewingJsonSchemasDocs() || this._isViewingSolCovDocs() || this._isViewingSubprovidersDocs() || diff --git a/packages/website/ts/containers/deployer_documentation.ts b/packages/website/ts/containers/sol_compiler_documentation.ts index e20cc195b..2f6486146 100644 --- a/packages/website/ts/containers/deployer_documentation.ts +++ b/packages/website/ts/containers/sol_compiler_documentation.ts @@ -12,9 +12,9 @@ import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; /* tslint:disable:no-var-requires */ -const IntroMarkdown = require('md/docs/deployer/introduction'); -const InstallationMarkdown = require('md/docs/deployer/installation'); -const UsageMarkdown = require('md/docs/deployer/usage'); +const IntroMarkdown = require('md/docs/sol-compiler/introduction'); +const InstallationMarkdown = require('md/docs/sol-compiler/installation'); +const UsageMarkdown = require('md/docs/sol-compiler/usage'); /* tslint:enable:no-var-requires */ const docSections = { @@ -22,21 +22,19 @@ const docSections = { installation: 'installation', usage: 'usage', compiler: 'compiler', - deployer: 'deployer', types: docConstants.TYPES_SECTION_NAME, }; const docsInfoConfig: DocsInfoConfig = { - id: DocPackages.Deployer, + id: DocPackages.SolCompiler, type: SupportedDocJson.TypeDoc, - displayName: 'Deployer', + displayName: 'Solidity Compiler', packageUrl: 'https://github.com/0xProject/0x-monorepo', menu: { introduction: [docSections.introduction], install: [docSections.installation], usage: [docSections.usage], compiler: [docSections.compiler], - deployer: [docSections.deployer], types: [docSections.types], }, sectionNameToMarkdown: { @@ -45,32 +43,18 @@ const docsInfoConfig: DocsInfoConfig = { [docSections.usage]: UsageMarkdown, }, sectionNameToModulePath: { - [docSections.compiler]: ['"deployer/src/compiler"'], - [docSections.deployer]: ['"deployer/src/deployer"'], - [docSections.types]: ['"deployer/src/utils/types"', '"types/src/index"'], + [docSections.compiler]: ['"sol-compiler/src/compiler"'], + [docSections.types]: ['"sol-compiler/src/utils/types"', '"types/src/index"'], }, menuSubsectionToVersionWhenIntroduced: {}, sections: docSections, - visibleConstructors: [docSections.compiler, docSections.deployer], + visibleConstructors: [docSections.compiler], typeConfigs: { // Note: This needs to be kept in sync with the types exported in index.ts. Unfortunately there is // currently no way to extract the re-exported types from index.ts via TypeDoc :( - publicTypes: [ - 'CompilerOptions', - 'DeployerOptions', - 'BaseDeployerOptions', - 'UrlDeployerOptions', - 'ProviderDeployerOptions', - 'TxData', - ], - typeNameToExternalLink: { - Web3: constants.URL_WEB3_DOCS, - BigNumber: constants.URL_BIGNUMBERJS_GITHUB, - ContractInstance: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L98', - }, - typeNameToPrefix: { - ContractInstance: 'Web3', - }, + publicTypes: ['CompilerOptions'], + typeNameToExternalLink: {}, + typeNameToPrefix: {}, }, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/subproviders_documentation.ts b/packages/website/ts/containers/subproviders_documentation.ts index a14d06a3f..2178baea8 100644 --- a/packages/website/ts/containers/subproviders_documentation.ts +++ b/packages/website/ts/containers/subproviders_documentation.ts @@ -74,7 +74,7 @@ const docsInfoConfig: DocsInfoConfig = { [docSections.redundantRPCSubprovider]: ['"subproviders/src/subproviders/redundant_rpc"'], [docSections.ganacheSubprovider]: ['"subproviders/src/subproviders/ganache"'], [docSections.nonceTrackerSubprovider]: ['"subproviders/src/subproviders/nonce_tracker"'], - [docSections.types]: ['"deployer/src/utils/types"', '"types/src/index"', '"subproviders/src/types"'], + [docSections.types]: ['"sol-compiler/src/utils/types"', '"types/src/index"', '"subproviders/src/types"'], }, menuSubsectionToVersionWhenIntroduced: {}, sections: docSections, diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index 1b1255214..49bcdeaac 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -54,8 +54,8 @@ const LazyConnectDocumentation = createLazyComponent('Documentation', async () = const LazyWeb3WrapperDocumentation = createLazyComponent('Documentation', async () => System.import<any>(/* webpackChunkName: "web3WrapperDocs" */ 'ts/containers/web3_wrapper_documentation'), ); -const LazyDeployerDocumentation = createLazyComponent('Documentation', async () => - System.import<any>(/* webpackChunkName: "deployerDocs" */ 'ts/containers/deployer_documentation'), +const LazySolCompilerDocumentation = createLazyComponent('Documentation', async () => + System.import<any>(/* webpackChunkName: "solCompilerDocs" */ 'ts/containers/sol_compiler_documentation'), ); const LazyJSONSchemasDocumentation = createLazyComponent('Documentation', async () => System.import<any>(/* webpackChunkName: "jsonSchemasDocs" */ 'ts/containers/json_schemas_documentation'), @@ -91,7 +91,10 @@ render( <Route path={WebsitePaths.Wiki} component={Wiki as any} /> <Route path={`${WebsitePaths.ZeroExJs}/:version?`} component={LazyZeroExJSDocumentation} /> <Route path={`${WebsitePaths.Connect}/:version?`} component={LazyConnectDocumentation} /> - <Route path={`${WebsitePaths.Deployer}/:version?`} component={LazyDeployerDocumentation} /> + <Route + path={`${WebsitePaths.SolCompiler}/:version?`} + component={LazySolCompilerDocumentation} + /> <Route path={`${WebsitePaths.SolCov}/:version?`} component={LazySolCovDocumentation} /> <Route path={`${WebsitePaths.JSONSchemas}/:version?`} @@ -123,6 +126,10 @@ render( path={`${WebsiteLegacyPaths.Web3Wrapper}/:version?`} component={LazyWeb3WrapperDocumentation} /> + <Route + path={`${WebsiteLegacyPaths.Deployer}/:version?`} + component={LazySolCompilerDocumentation} + /> <Route component={NotFound as any} /> </Switch> diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx index 9feb27dac..be8ae02f4 100644 --- a/packages/website/ts/pages/documentation/doc_page.tsx +++ b/packages/website/ts/pages/documentation/doc_page.tsx @@ -30,7 +30,7 @@ const docIdToSubpackageName: { [id: string]: string } = { [DocPackages.Connect]: 'connect', [DocPackages.SmartContracts]: 'contracts', [DocPackages.Web3Wrapper]: 'web3-wrapper', - [DocPackages.Deployer]: 'deployer', + [DocPackages.SolCompiler]: 'sol-compiler', [DocPackages.JSONSchemas]: 'json-schemas', [DocPackages.SolCov]: 'sol-cov', [DocPackages.Subproviders]: 'subproviders', diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index 67e4a5d7d..58929a0c6 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -344,6 +344,7 @@ export enum Docs { export enum WebsiteLegacyPaths { ZeroExJs = '/docs/0xjs', Web3Wrapper = '/docs/web3_wrapper', + Deployer = '/docs/deployer', } export enum WebsitePaths { @@ -357,7 +358,7 @@ export enum WebsitePaths { SmartContracts = '/docs/contracts', Connect = '/docs/connect', Web3Wrapper = '/docs/web3-wrapper', - Deployer = '/docs/deployer', + SolCompiler = '/docs/sol-compiler', JSONSchemas = '/docs/json-schemas', SolCov = '/docs/sol-cov', Subproviders = '/docs/subproviders', @@ -370,7 +371,7 @@ export enum DocPackages { ZeroExJs = 'ZERO_EX_JS', SmartContracts = 'SMART_CONTRACTS', Web3Wrapper = 'WEB3_WRAPPER', - Deployer = 'DEPLOYER', + SolCompiler = 'SOL_COMPILER', JSONSchemas = 'JSON_SCHEMAS', SolCov = 'SOL_COV', Subproviders = 'SUBPROVIDERS', @@ -423,7 +424,7 @@ export enum Key { About = 'ABOUT', Careers = 'CAREERS', Contact = 'CONTACT', - Deployer = 'DEPLOYER', + SolCompiler = 'SOL_COMPILER', JsonSchemas = 'JSON_SCHEMAS', SolCov = 'SOL_COV', Subproviders = 'SUBPROVIDERS', |