aboutsummaryrefslogtreecommitdiffstats
path: root/packages/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'packages/migrations')
-rw-r--r--packages/migrations/.gitignore2
-rw-r--r--packages/migrations/CHANGELOG.json340
-rw-r--r--packages/migrations/CHANGELOG.md148
-rw-r--r--packages/migrations/Dockerfile15
-rw-r--r--packages/migrations/README.md100
-rwxr-xr-xpackages/migrations/bin/0x-migrate.js2
-rw-r--r--packages/migrations/package.json72
-rw-r--r--packages/migrations/src/cli.ts38
-rw-r--r--packages/migrations/src/index.ts11
-rw-r--r--packages/migrations/src/migrate.ts23
-rw-r--r--packages/migrations/src/migrate_snapshot.ts32
-rw-r--r--packages/migrations/src/migration.ts232
-rw-r--r--packages/migrations/src/types.ts29
-rw-r--r--packages/migrations/src/utils/constants.ts18
-rw-r--r--packages/migrations/src/utils/provider_factory.ts39
-rw-r--r--packages/migrations/src/utils/token_info.ts62
-rw-r--r--packages/migrations/tsconfig.json8
-rw-r--r--packages/migrations/tslint.json3
-rw-r--r--packages/migrations/typedoc-tsconfig.json7
19 files changed, 0 insertions, 1181 deletions
diff --git a/packages/migrations/.gitignore b/packages/migrations/.gitignore
deleted file mode 100644
index 4de81c5a8..000000000
--- a/packages/migrations/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.zip
-0x_ganache_snapshot
diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json
deleted file mode 100644
index 64ae94b14..000000000
--- a/packages/migrations/CHANGELOG.json
+++ /dev/null
@@ -1,340 +0,0 @@
-[
- {
- "version": "3.0.0",
- "changes": [
- {
- "note": "Upgrade the bignumber.js to v8.0.2",
- "pr": 1517
- }
- ]
- },
- {
- "version": "2.4.0",
- "changes": [
- {
- "note": "Added migrations for `MultiAssetProxy` contract",
- "pr": 1503
- }
- ],
- "timestamp": 1547561734
- },
- {
- "timestamp": 1547225310,
- "version": "2.3.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "2.3.0",
- "changes": [
- {
- "note": "Added migrations for Dutch Auction contract",
- "pr": 1465
- }
- ],
- "timestamp": 1547040760
- },
- {
- "version": "2.2.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1544739608
- },
- {
- "version": "2.2.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1544570656
- },
- {
- "version": "2.2.0",
- "changes": [
- {
- "note": "Add CLI `0x-migrate` for running the 0x migrations in a language-agnostic way",
- "pr": 1324
- },
- {
- "note": "Deploy testnet Exchange arfitact. Previously mainnet Exchange artifact was deployed.",
- "pr": 1309
- },
- {
- "note": "Fund the Forwarder with ZRX for fees.",
- "pr": 1309
- }
- ],
- "timestamp": 1543401373
- },
- {
- "version": "2.1.0",
- "changes": [
- {
- "note": "Export all type declarations used by the public interface, as well as the `ContractAddresses` mapping",
- "pr": 1301
- }
- ],
- "timestamp": 1542821676
- },
- {
- "timestamp": 1542208198,
- "version": "2.0.4",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1542134075,
- "version": "2.0.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1542028948,
- "version": "2.0.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "2.0.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1541740904
- },
- {
- "version": "2.0.0",
- "changes": [
- {
- "note": "Contract artifacts have been moved to the new @0xproject/contract-artifacts package. v1 migrations have been removed. `runMigrationsAsync` returns the addresses of the contracts that were deployed.",
- "pr": 1105
- }
- ],
- "timestamp": 1539871071
- },
- {
- "version": "1.0.14",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1538693146
- },
- {
- "timestamp": 1538157789,
- "version": "1.0.13",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1537907159,
- "version": "1.0.12",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1537875740,
- "version": "1.0.11",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1537541580,
- "version": "1.0.10",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1537369748,
- "version": "1.0.9",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1537265493,
- "version": "1.0.8",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1536142250,
- "version": "1.0.7",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1535377027,
- "version": "1.0.6",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1535133899,
- "version": "1.0.5",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1534210131,
- "version": "1.0.4",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "1.0.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1532619515
- },
- {
- "timestamp": 1532605697,
- "version": "1.0.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1532357734,
- "version": "1.0.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1532043000,
- "version": "1.0.0",
- "changes": [
- {
- "note": "Added migrations for 0x Protocol v2"
- }
- ]
- },
- {
- "timestamp": 1531919263,
- "version": "0.0.10",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1531149657,
- "version": "0.0.9",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1529397769,
- "version": "0.0.8",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1527008794,
- "version": "0.0.7",
- "changes": [
- {
- "note": "Use AssetProxyOwner instead of MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress",
- "pr": 675
- }
- ]
- },
- {
- "timestamp": 1527008794,
- "version": "0.0.6",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1525477860,
- "version": "0.0.5",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1525428773,
- "version": "0.0.4",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1524073495,
- "version": "0.0.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- }
-]
diff --git a/packages/migrations/CHANGELOG.md b/packages/migrations/CHANGELOG.md
deleted file mode 100644
index 6c9a84018..000000000
--- a/packages/migrations/CHANGELOG.md
+++ /dev/null
@@ -1,148 +0,0 @@
-<!--
-changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
-Edit the package's CHANGELOG.json file only.
--->
-
-CHANGELOG
-
-## v2.4.0 - _January 15, 2019_
-
- * Added migrations for `MultiAssetProxy` contract (#1503)
-
-## v2.3.1 - _January 11, 2019_
-
- * Dependencies updated
-
-## v2.3.0 - _January 9, 2019_
-
- * Added migrations for Dutch Auction contract (#1465)
-
-## v2.2.2 - _December 13, 2018_
-
- * Dependencies updated
-
-## v2.2.1 - _December 11, 2018_
-
- * Dependencies updated
-
-## v2.2.0 - _November 28, 2018_
-
- * Add CLI `0x-migrate` for running the 0x migrations in a language-agnostic way (#1324)
- * Deploy testnet Exchange arfitact. Previously mainnet Exchange artifact was deployed. (#1309)
- * Fund the Forwarder with ZRX for fees. (#1309)
-
-## v2.1.0 - _November 21, 2018_
-
- * Export all type declarations used by the public interface, as well as the `ContractAddresses` mapping (#1301)
-
-## v2.0.4 - _November 14, 2018_
-
- * Dependencies updated
-
-## v2.0.3 - _November 13, 2018_
-
- * Dependencies updated
-
-## v2.0.2 - _November 12, 2018_
-
- * Dependencies updated
-
-## v2.0.1 - _November 9, 2018_
-
- * Dependencies updated
-
-## v2.0.0 - _October 18, 2018_
-
- * Contract artifacts have been moved to the new @0xproject/contract-artifacts package. v1 migrations have been removed. `runMigrationsAsync` returns the addresses of the contracts that were deployed. (#1105)
-
-## v1.0.14 - _October 4, 2018_
-
- * Dependencies updated
-
-## v1.0.13 - _September 28, 2018_
-
- * Dependencies updated
-
-## v1.0.12 - _September 25, 2018_
-
- * Dependencies updated
-
-## v1.0.11 - _September 25, 2018_
-
- * Dependencies updated
-
-## v1.0.10 - _September 21, 2018_
-
- * Dependencies updated
-
-## v1.0.9 - _September 19, 2018_
-
- * Dependencies updated
-
-## v1.0.8 - _September 18, 2018_
-
- * Dependencies updated
-
-## v1.0.7 - _September 5, 2018_
-
- * Dependencies updated
-
-## v1.0.6 - _August 27, 2018_
-
- * Dependencies updated
-
-## v1.0.5 - _August 24, 2018_
-
- * Dependencies updated
-
-## v1.0.4 - _August 14, 2018_
-
- * Dependencies updated
-
-## v1.0.3 - _July 26, 2018_
-
- * Dependencies updated
-
-## v1.0.2 - _July 26, 2018_
-
- * Dependencies updated
-
-## v1.0.1 - _July 23, 2018_
-
- * Dependencies updated
-
-## v1.0.0 - _July 19, 2018_
-
- * Added migrations for 0x Protocol v2
-
-## v0.0.10 - _July 18, 2018_
-
- * Dependencies updated
-
-## v0.0.9 - _July 9, 2018_
-
- * Dependencies updated
-
-## v0.0.8 - _June 19, 2018_
-
- * Dependencies updated
-
-## v0.0.7 - _May 22, 2018_
-
- * Use AssetProxyOwner instead of MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress (#675)
-
-## v0.0.6 - _May 22, 2018_
-
- * Dependencies updated
-
-## v0.0.5 - _May 4, 2018_
-
- * Dependencies updated
-
-## v0.0.4 - _May 4, 2018_
-
- * Dependencies updated
-
-## v0.0.3 - _April 18, 2018_
-
- * Dependencies updated
diff --git a/packages/migrations/Dockerfile b/packages/migrations/Dockerfile
deleted file mode 100644
index c4d6128c2..000000000
--- a/packages/migrations/Dockerfile
+++ /dev/null
@@ -1,15 +0,0 @@
-FROM mhart/alpine-node:10
-
-WORKDIR /usr/src/app
-
-RUN npm install -g ganache-cli@6.1.6
-
-ENV MNEMONIC "concert load couple harbor equip island argue ramp clarify fence smart topic"
-ENV NETWORK_ID 50
-ENV VERSION "latest"
-ENV SNAPSHOT_HOST "http://ganache-snapshots.0x.org.s3-website.us-east-2.amazonaws.com"
-ENV SNAPSHOT_NAME "0x_ganache_snapshot"
-EXPOSE 8545
-
-CMD [ "sh", "-c", "wget $SNAPSHOT_HOST/$SNAPSHOT_NAME-$VERSION.zip -O snapshot.zip && unzip snapshot.zip && ganache-cli --gasLimit 10000000 --db $SNAPSHOT_NAME --noVMErrorsOnRPCResponse -p 8545 --networkId \"$NETWORK_ID\" -m \"$MNEMONIC\" -h 0.0.0.0"]
-
diff --git a/packages/migrations/README.md b/packages/migrations/README.md
deleted file mode 100644
index 1e8b92bf8..000000000
--- a/packages/migrations/README.md
+++ /dev/null
@@ -1,100 +0,0 @@
-## Migrations
-
-Migrate the 0x system of smart contracts on the network of your choice using these migrations.
-
-## Contributing
-
-We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
-
-Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
-
-### Install dependencies
-
-If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
-
-```bash
-yarn config set workspaces-experimental true
-```
-
-Then install dependencies
-
-```bash
-yarn install
-```
-
-### Build
-
-To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
-
-```bash
-PKG=@0x/migrations yarn build
-```
-
-Or continuously rebuild on change:
-
-```bash
-PKG=@0x/migrations yarn watch
-```
-
-### Clean
-
-```bash
-yarn clean
-```
-
-### Lint
-
-```bash
-yarn lint
-```
-
-### Migrate
-
-#### V2 smart contracts
-
-In order to migrate the V2 0x smart contracts to TestRPC/Ganache running at `http://localhost:8545`, run:
-
-```bash
-yarn migrate:v2
-```
-
-### Publish
-
-#### 0x Ganache Snapshot
-
-The 0x Ganache snapshot can be generated and published in this package. In order to build the snapshot for this version of migrations run:
-
-```bash
-yarn build:snapshot
-```
-
-This will run the migrations in Ganache and output a zip file to be uploaded to the s3 bucket. For example, after running this command you will have created `0x_ganache_snapshot-2.2.2.zip`. To publish the zip file to the s3 bucket run:
-
-```bash
-yarn publish:snapshot
-```
-
-This snapshot will now be publicly available at http://ganache-snapshots.0x.org.s3.amazonaws.com/0x_ganache_snapshot-latest.zip and also versioned with the package.json version.
-
-#### 0x Ganache Docker Image
-
-We also publish a simple docker image which downloads the latest snapshot, extracts and runs Ganache. This is not required to be built when migrations change as it always downloads and runs the latest zip file. If you have made changes to the Dockerfile then a publish of the image is required. To do this run:
-
-```bash
-yarn build:snapshot:docker
-yarn publish:snapshot:docker
-```
-
-The result is a published docker image to the 0xorg docker registry. To start the docker image run:
-
-```bash
-docker run -p 8545:8545 -ti 0xorg/ganache-cli:latest
-```
-
-This will pull the latest zip in the s3 bucket, extract and start Ganache with the snapshot.
-
-In the event you need a specific version of the published Ganache snapshot run the following specifying the VERSION environment variable:
-
-```bash
-docker run -e VERSION=2.2.2 -p 8545:8545 -ti 0xorg/ganache-cli:latest
-```
diff --git a/packages/migrations/bin/0x-migrate.js b/packages/migrations/bin/0x-migrate.js
deleted file mode 100755
index 59778c0fc..000000000
--- a/packages/migrations/bin/0x-migrate.js
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env node
-require('../lib/cli.js');
diff --git a/packages/migrations/package.json b/packages/migrations/package.json
deleted file mode 100644
index 3ca4e8d6b..000000000
--- a/packages/migrations/package.json
+++ /dev/null
@@ -1,72 +0,0 @@
-{
- "name": "@0x/migrations",
- "version": "2.4.0",
- "engines": {
- "node": ">=6.12"
- },
- "description": "0x smart contract migrations",
- "main": "lib/index.js",
- "types": "lib/index.d.ts",
- "scripts": {
- "build": "tsc -b",
- "build:ci": "yarn build",
- "clean": "shx rm -rf lib ${npm_package_config_snapshot_name} ${npm_package_config_snapshot_name}-*.zip",
- "lint": "tslint --format stylish --project .",
- "migrate:v2": "run-s build script:migrate:v2",
- "migrate:v2:snapshot": "run-s build script:migrate:v2:snapshot",
- "script:migrate:v2": "node ./lib/migrate.js",
- "script:migrate:v2:snapshot": "node ./lib/migrate_snapshot.js",
- "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES",
- "build:snapshot": "rm -rf ${npm_package_config_snapshot_name} && yarn migrate:v2:snapshot && zip -r \"${npm_package_config_snapshot_name}-${npm_package_version}.zip\" ${npm_package_config_snapshot_name}",
- "build:snapshot:docker": "docker build --tag ${npm_package_config_docker_snapshot_name}:${npm_package_version} --tag ${npm_package_config_docker_snapshot_name}:latest .",
- "publish:snapshot": "aws s3 cp ${npm_package_config_snapshot_name}-${npm_package_version}.zip ${npm_package_config_s3_snapshot_bucket} && aws s3 cp ${npm_package_config_s3_snapshot_bucket}/${npm_package_config_snapshot_name}-${npm_package_version}.zip ${npm_package_config_s3_snapshot_bucket}/${npm_package_config_snapshot_name}-latest.zip",
- "publish:snapshot:docker": "docker push ${npm_package_config_docker_snapshot_name}:latest"
- },
- "config": {
- "s3_snapshot_bucket": "s3://ganache-snapshots.0x.org",
- "docker_snapshot_name": "0xorg/ganache-cli",
- "snapshot_name": "0x_ganache_snapshot",
- "postpublish": {
- "assets": []
- }
- },
- "bin": {
- "0x-migrate": "bin/0x-migrate.js"
- },
- "license": "Apache-2.0",
- "devDependencies": {
- "@0x/dev-utils": "^1.0.24",
- "@0x/tslint-config": "^2.0.2",
- "@0x/types": "^1.5.2",
- "@types/yargs": "^10.0.0",
- "make-promises-safe": "^1.1.0",
- "npm-run-all": "^4.1.2",
- "shx": "^0.2.2",
- "tslint": "5.11.0",
- "typedoc": "0.13.0",
- "typescript": "3.0.1",
- "yargs": "^10.0.3"
- },
- "dependencies": {
- "@0x/abi-gen-wrappers": "^2.2.0",
- "@0x/base-contract": "^3.0.13",
- "@0x/contract-addresses": "^2.2.0",
- "@0x/contract-artifacts": "^1.3.0",
- "@0x/order-utils": "^3.1.2",
- "@0x/sol-compiler": "^2.0.2",
- "@0x/subproviders": "^2.1.11",
- "@0x/typescript-typings": "^3.0.8",
- "@0x/utils": "^3.0.1",
- "@0x/web3-wrapper": "^3.2.4",
- "@ledgerhq/hw-app-eth": "^4.3.0",
- "ethereum-types": "^1.1.6",
- "ethers": "~4.0.4",
- "lodash": "^4.17.5"
- },
- "optionalDependencies": {
- "@ledgerhq/hw-transport-node-hid": "^4.3.0"
- },
- "publishConfig": {
- "access": "public"
- }
-}
diff --git a/packages/migrations/src/cli.ts b/packages/migrations/src/cli.ts
deleted file mode 100644
index 2404e7921..000000000
--- a/packages/migrations/src/cli.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env node
-import { RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
-import { logUtils } from '@0x/utils';
-import * as yargs from 'yargs';
-
-import { runMigrationsAsync } from './migration';
-
-const args = yargs
- .option('rpc-url', {
- describe: 'Endpoint where backing Ethereum JSON RPC interface is available',
- type: 'string',
- demandOption: false,
- default: 'http://localhost:8545',
- })
- .option('from', {
- describe: 'Ethereum address from which to deploy the contracts',
- type: 'string',
- demandOption: true,
- })
- .example(
- '$0 --rpc-url http://localhost:8545 --from 0x5409ed021d9299bf6814279a6a1411a7e866a631',
- 'Full usage example',
- ).argv;
-
-(async () => {
- const rpcSubprovider = new RPCSubprovider(args['rpc-url']);
- const provider = new Web3ProviderEngine();
- provider.addProvider(rpcSubprovider);
- provider.start();
- const txDefaults = {
- from: args.from,
- };
- await runMigrationsAsync(provider, txDefaults);
- process.exit(0);
-})().catch(err => {
- logUtils.log(err);
- process.exit(1);
-});
diff --git a/packages/migrations/src/index.ts b/packages/migrations/src/index.ts
deleted file mode 100644
index 4f22c30b9..000000000
--- a/packages/migrations/src/index.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-export {
- Provider,
- TxData,
- JSONRPCRequestPayload,
- JSONRPCErrorCallback,
- TxDataPayable,
- JSONRPCResponsePayload,
- JSONRPCResponseError,
-} from 'ethereum-types';
-export { ContractAddresses } from '@0x/contract-addresses';
-export { runMigrationsAsync, runMigrationsOnceAsync } from './migration';
diff --git a/packages/migrations/src/migrate.ts b/packages/migrations/src/migrate.ts
deleted file mode 100644
index d7a76d2f8..000000000
--- a/packages/migrations/src/migrate.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env node
-import { devConstants, web3Factory } from '@0x/dev-utils';
-import { logUtils } from '@0x/utils';
-import { Provider } from 'ethereum-types';
-
-import { runMigrationsAsync } from './migration';
-
-(async () => {
- let providerConfigs;
- let provider: Provider;
- let txDefaults;
-
- providerConfigs = { shouldUseInProcessGanache: false };
- provider = web3Factory.getRpcProvider(providerConfigs);
- txDefaults = {
- from: devConstants.TESTRPC_FIRST_ADDRESS,
- };
- await runMigrationsAsync(provider, txDefaults);
- process.exit(0);
-})().catch(err => {
- logUtils.log(err);
- process.exit(1);
-});
diff --git a/packages/migrations/src/migrate_snapshot.ts b/packages/migrations/src/migrate_snapshot.ts
deleted file mode 100644
index 13fb063da..000000000
--- a/packages/migrations/src/migrate_snapshot.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env node
-import { devConstants, web3Factory } from '@0x/dev-utils';
-import { logUtils } from '@0x/utils';
-import { Provider } from 'ethereum-types';
-import * as fs from 'fs';
-import * as _ from 'lodash';
-import * as path from 'path';
-
-import { runMigrationsAsync } from './migration';
-
-(async () => {
- let providerConfigs;
- let provider: Provider;
- let txDefaults;
- const packageJsonPath = path.join(__dirname, '..', 'package.json');
- const packageJsonString = fs.readFileSync(packageJsonPath, 'utf8');
- const packageJson = JSON.parse(packageJsonString);
- if (_.isUndefined(packageJson.config) || _.isUndefined(packageJson.config.snapshot_name)) {
- throw new Error(`Did not find 'snapshot_name' key in package.json config`);
- }
-
- providerConfigs = { shouldUseInProcessGanache: true, ganacheDatabasePath: packageJson.config.snapshot_name };
- provider = web3Factory.getRpcProvider(providerConfigs);
- txDefaults = {
- from: devConstants.TESTRPC_FIRST_ADDRESS,
- };
- await runMigrationsAsync(provider, txDefaults);
- process.exit(0);
-})().catch(err => {
- logUtils.log(err);
- process.exit(1);
-});
diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts
deleted file mode 100644
index e0f245017..000000000
--- a/packages/migrations/src/migration.ts
+++ /dev/null
@@ -1,232 +0,0 @@
-import * as wrappers from '@0x/abi-gen-wrappers';
-import { ContractAddresses } from '@0x/contract-addresses';
-import * as artifacts from '@0x/contract-artifacts';
-import { assetDataUtils } from '@0x/order-utils';
-import { BigNumber } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import { Provider, TxData } from 'ethereum-types';
-import * as _ from 'lodash';
-
-import { erc20TokenInfo, erc721TokenInfo } from './utils/token_info';
-
-/**
- * Creates and deploys all the contracts that are required for the latest
- * version of the 0x protocol.
- * @param provider Web3 provider instance. Your provider instance should connect to the testnet you want to deploy to.
- * @param txDefaults Default transaction values to use when deploying contracts (e.g., specify the desired contract creator with the `from` parameter).
- * @returns The addresses of the contracts that were deployed.
- */
-export async function runMigrationsAsync(provider: Provider, txDefaults: Partial<TxData>): Promise<ContractAddresses> {
- const web3Wrapper = new Web3Wrapper(provider);
- const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync();
- const owner = accounts[0];
-
- // Proxies
- const erc20Proxy = await wrappers.ERC20ProxyContract.deployFrom0xArtifactAsync(
- artifacts.ERC20Proxy,
- provider,
- txDefaults,
- );
- const erc721Proxy = await wrappers.ERC721ProxyContract.deployFrom0xArtifactAsync(
- artifacts.ERC721Proxy,
- provider,
- txDefaults,
- );
-
- // ZRX
- const zrxToken = await wrappers.ZRXTokenContract.deployFrom0xArtifactAsync(
- artifacts.ZRXToken,
- provider,
- txDefaults,
- );
-
- // Ether token
- const etherToken = await wrappers.WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults);
-
- // Exchange
- const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
- const exchange = await wrappers.ExchangeContract.deployFrom0xArtifactAsync(
- artifacts.Exchange,
- provider,
- txDefaults,
- zrxAssetData,
- );
-
- // Dummy ERC20 tokens
- for (const token of erc20TokenInfo) {
- const totalSupply = new BigNumber(1000000000000000000000000000);
- // tslint:disable-next-line:no-unused-variable
- const dummyErc20Token = await wrappers.DummyERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC20Token,
- provider,
- txDefaults,
- token.name,
- token.symbol,
- token.decimals,
- totalSupply,
- );
- }
-
- // ERC721
- // tslint:disable-next-line:no-unused-variable
- const cryptoKittieToken = await wrappers.DummyERC721TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC721Token,
- provider,
- txDefaults,
- erc721TokenInfo[0].name,
- erc721TokenInfo[0].symbol,
- );
-
- const multiAssetProxy = await wrappers.MultiAssetProxyContract.deployFrom0xArtifactAsync(
- artifacts.MultiAssetProxy,
- provider,
- txDefaults,
- );
-
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- }),
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- }),
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await multiAssetProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- }),
- );
-
- // MultiAssetProxy
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
- from: owner,
- }),
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
- from: owner,
- }),
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc20Proxy.address),
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc721Proxy.address),
- );
-
- // Register the Asset Proxies to the Exchange
- await web3Wrapper.awaitTransactionSuccessAsync(
- await exchange.registerAssetProxy.sendTransactionAsync(erc20Proxy.address),
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await exchange.registerAssetProxy.sendTransactionAsync(erc721Proxy.address),
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await exchange.registerAssetProxy.sendTransactionAsync(multiAssetProxy.address),
- );
-
- // Forwarder
- const forwarder = await wrappers.ForwarderContract.deployFrom0xArtifactAsync(
- artifacts.Forwarder,
- provider,
- txDefaults,
- exchange.address,
- assetDataUtils.encodeERC20AssetData(zrxToken.address),
- assetDataUtils.encodeERC20AssetData(etherToken.address),
- );
-
- // OrderValidator
- const orderValidator = await wrappers.OrderValidatorContract.deployFrom0xArtifactAsync(
- artifacts.OrderValidator,
- provider,
- txDefaults,
- exchange.address,
- zrxAssetData,
- );
-
- // DutchAuction
- const dutchAuction = await wrappers.DutchAuctionContract.deployFrom0xArtifactAsync(
- artifacts.DutchAuction,
- provider,
- txDefaults,
- exchange.address,
- );
-
- // Multisigs
- const owners = [accounts[0], accounts[1]];
- const confirmationsRequired = new BigNumber(2);
- const secondsRequired = new BigNumber(0);
-
- // AssetProxyOwner
- const assetProxyOwner = await wrappers.AssetProxyOwnerContract.deployFrom0xArtifactAsync(
- artifacts.AssetProxyOwner,
- provider,
- txDefaults,
- owners,
- [erc20Proxy.address, erc721Proxy.address, multiAssetProxy.address],
- confirmationsRequired,
- secondsRequired,
- );
-
- // Transfer Ownership to the Asset Proxy Owner
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
- from: owner,
- }),
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
- from: owner,
- }),
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await multiAssetProxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
- from: owner,
- }),
- );
-
- // Fund the Forwarder with ZRX
- const zrxDecimals = await zrxToken.decimals.callAsync();
- const zrxForwarderAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5000), zrxDecimals);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.transfer.sendTransactionAsync(forwarder.address, zrxForwarderAmount, txDefaults),
- );
-
- const contractAddresses = {
- erc20Proxy: erc20Proxy.address,
- erc721Proxy: erc721Proxy.address,
- zrxToken: zrxToken.address,
- etherToken: etherToken.address,
- exchange: exchange.address,
- assetProxyOwner: assetProxyOwner.address,
- forwarder: forwarder.address,
- orderValidator: orderValidator.address,
- dutchAuction: dutchAuction.address,
- };
-
- return contractAddresses;
-}
-
-let _cachedContractAddresses: ContractAddresses;
-
-/**
- * Exactly like runMigrationsAsync but will only run the migrations the first
- * time it is called. Any subsequent calls will return the cached contract
- * addresses.
- * @param provider Web3 provider instance. Your provider instance should connect to the testnet you want to deploy to.
- * @param txDefaults Default transaction values to use when deploying contracts (e.g., specify the desired contract creator with the `from` parameter).
- * @returns The addresses of the contracts that were deployed.
- */
-export async function runMigrationsOnceAsync(
- provider: Provider,
- txDefaults: Partial<TxData>,
-): Promise<ContractAddresses> {
- if (!_.isUndefined(_cachedContractAddresses)) {
- return _cachedContractAddresses;
- }
- _cachedContractAddresses = await runMigrationsAsync(provider, txDefaults);
- return _cachedContractAddresses;
-}
diff --git a/packages/migrations/src/types.ts b/packages/migrations/src/types.ts
deleted file mode 100644
index 87e66f356..000000000
--- a/packages/migrations/src/types.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { BigNumber } from '@0x/utils';
-
-export interface ERC20Token {
- address?: string;
- name: string;
- symbol: string;
- decimals: BigNumber;
- ipfsHash: string;
- swarmHash: string;
-}
-
-export interface ERC721Token {
- name: string;
- symbol: string;
-}
-
-export enum ContractName {
- TokenTransferProxy = 'TokenTransferProxy',
- TokenRegistry = 'TokenRegistry',
- MultiSigWalletWithTimeLock = 'MultiSigWalletWithTimeLock',
- Exchange = 'Exchange',
- ZRXToken = 'ZRXToken',
- DummyToken = 'DummyToken',
- WETH9 = 'WETH9',
- MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress = 'MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress',
- AccountLevels = 'AccountLevels',
- EtherDelta = 'EtherDelta',
- Arbitrage = 'Arbitrage',
-}
diff --git a/packages/migrations/src/utils/constants.ts b/packages/migrations/src/utils/constants.ts
deleted file mode 100644
index 8b16a0520..000000000
--- a/packages/migrations/src/utils/constants.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { BigNumber } from '@0x/utils';
-
-export const constants = {
- ASSET_PROXY_OWNER_OWNERS: [
- '0x9df8137872ac09a8fee71d0da5c7539923fb9bf0',
- '0xcf34d44db312d188789f43a63d11cf2bebb4da15',
- '0x73fd50f2a6beac9cdac9fe87ef68a18edc415831',
- ],
- ASSET_PROXY_OWNER_TIMELOCK: new BigNumber(0),
- ASSET_PROXY_OWNER_CONFIRMATIONS: new BigNumber(1),
- ERC20_PROXY_ID: '0xf47261b0',
- ERC721_PROXY_ID: '0x02571792',
- NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
- KOVAN_RPC_URL: 'https://kovan.infura.io/',
- KOVAN_NETWORK_ID: 42,
- MAINNET_RPC_URL: 'https://mainnet.infura.io/',
- MAINNET_NETWORK_ID: 1,
-};
diff --git a/packages/migrations/src/utils/provider_factory.ts b/packages/migrations/src/utils/provider_factory.ts
deleted file mode 100644
index 8017b672a..000000000
--- a/packages/migrations/src/utils/provider_factory.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import { LedgerEthereumClient, LedgerSubprovider, RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
-import Eth from '@ledgerhq/hw-app-eth';
-// tslint:disable:no-implicit-dependencies
-import TransportNodeHid from '@ledgerhq/hw-transport-node-hid';
-import { Provider } from 'ethereum-types';
-
-import { constants } from './constants';
-
-async function ledgerEthereumNodeJsClientFactoryAsync(): Promise<LedgerEthereumClient> {
- const ledgerConnection = await TransportNodeHid.create();
- const ledgerEthClient = new Eth(ledgerConnection);
- return ledgerEthClient;
-}
-export const providerFactory = {
- async getKovanLedgerProviderAsync(): Promise<Provider> {
- const provider = new Web3ProviderEngine();
- const ledgerWalletConfigs = {
- networkId: constants.KOVAN_NETWORK_ID,
- ledgerEthereumClientFactoryAsync: ledgerEthereumNodeJsClientFactoryAsync,
- };
- const ledgerSubprovider = new LedgerSubprovider(ledgerWalletConfigs);
- provider.addProvider(ledgerSubprovider);
- provider.addProvider(new RPCSubprovider(constants.KOVAN_RPC_URL));
- provider.start();
- return provider;
- },
- async getMainnetLedgerProviderAsync(): Promise<Provider> {
- const provider = new Web3ProviderEngine();
- const ledgerWalletConfigs = {
- networkId: constants.MAINNET_NETWORK_ID,
- ledgerEthereumClientFactoryAsync: ledgerEthereumNodeJsClientFactoryAsync,
- };
- const ledgerSubprovider = new LedgerSubprovider(ledgerWalletConfigs);
- provider.addProvider(ledgerSubprovider);
- provider.addProvider(new RPCSubprovider(constants.MAINNET_RPC_URL));
- provider.start();
- return provider;
- },
-};
diff --git a/packages/migrations/src/utils/token_info.ts b/packages/migrations/src/utils/token_info.ts
deleted file mode 100644
index 6e0411f60..000000000
--- a/packages/migrations/src/utils/token_info.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-import { BigNumber, NULL_BYTES } from '@0x/utils';
-
-import { ERC20Token, ERC721Token } from '../types';
-
-export const etherTokenByNetwork: { [networkId: number]: { address: string } } = {
- 3: {
- address: '0xc778417e063141139fce010982780140aa0cd5ab',
- },
- 4: {
- address: '0xc778417e063141139fce010982780140aa0cd5ab',
- },
- 42: {
- address: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
- },
- 50: {
- address: '',
- },
-};
-export const erc20TokenInfo: ERC20Token[] = [
- {
- name: 'Augur Reputation Token',
- symbol: 'REP',
- decimals: new BigNumber(18),
- ipfsHash: NULL_BYTES,
- swarmHash: NULL_BYTES,
- },
- {
- name: 'Digix DAO Token',
- symbol: 'DGD',
- decimals: new BigNumber(18),
- ipfsHash: NULL_BYTES,
- swarmHash: NULL_BYTES,
- },
- {
- name: 'Golem Network Token',
- symbol: 'GNT',
- decimals: new BigNumber(18),
- ipfsHash: NULL_BYTES,
- swarmHash: NULL_BYTES,
- },
- {
- name: 'MakerDAO',
- symbol: 'MKR',
- decimals: new BigNumber(18),
- ipfsHash: NULL_BYTES,
- swarmHash: NULL_BYTES,
- },
- {
- name: 'Melon Token',
- symbol: 'MLN',
- decimals: new BigNumber(18),
- ipfsHash: NULL_BYTES,
- swarmHash: NULL_BYTES,
- },
-];
-
-export const erc721TokenInfo: ERC721Token[] = [
- {
- name: '0xen ERC721',
- symbol: '0xen',
- },
-];
diff --git a/packages/migrations/tsconfig.json b/packages/migrations/tsconfig.json
deleted file mode 100644
index 56689eaa3..000000000
--- a/packages/migrations/tsconfig.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "extends": "../../tsconfig",
- "compilerOptions": {
- "outDir": "lib",
- "rootDir": "src"
- },
- "include": ["src/**/*"]
-}
diff --git a/packages/migrations/tslint.json b/packages/migrations/tslint.json
deleted file mode 100644
index dd9053357..000000000
--- a/packages/migrations/tslint.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "extends": ["@0x/tslint-config"]
-}
diff --git a/packages/migrations/typedoc-tsconfig.json b/packages/migrations/typedoc-tsconfig.json
deleted file mode 100644
index c9b0af1ae..000000000
--- a/packages/migrations/typedoc-tsconfig.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "extends": "../../typedoc-tsconfig",
- "compilerOptions": {
- "outDir": "lib"
- },
- "include": ["./src/**/*", "./test/**/*"]
-}