aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer
diff options
context:
space:
mode:
Diffstat (limited to 'packages/deployer')
-rw-r--r--packages/deployer/.npmignore7
-rw-r--r--packages/deployer/CHANGELOG.json141
-rw-r--r--packages/deployer/CHANGELOG.md52
-rw-r--r--packages/deployer/README.md104
-rw-r--r--packages/deployer/coverage/.gitkeep0
-rw-r--r--packages/deployer/package.json92
-rw-r--r--packages/deployer/solc_bin/.gitkeep0
-rw-r--r--packages/deployer/src/cli.ts153
-rw-r--r--packages/deployer/src/commands.ts14
-rw-r--r--packages/deployer/src/compiler.ts264
-rw-r--r--packages/deployer/src/deployer.ts219
-rw-r--r--packages/deployer/src/globals.d.ts6
-rw-r--r--packages/deployer/src/index.ts2
-rw-r--r--packages/deployer/src/monorepo_scripts/postpublish.ts8
-rw-r--r--packages/deployer/src/monorepo_scripts/stage_docs.ts8
-rw-r--r--packages/deployer/src/solc/bin_paths.ts20
-rw-r--r--packages/deployer/src/utils/compiler.ts107
-rw-r--r--packages/deployer/src/utils/constants.ts4
-rw-r--r--packages/deployer/src/utils/contract.ts80
-rw-r--r--packages/deployer/src/utils/encoder.ts18
-rw-r--r--packages/deployer/src/utils/error_reporter.ts18
-rw-r--r--packages/deployer/src/utils/fs_wrapper.ts12
-rw-r--r--packages/deployer/src/utils/types.ts95
-rw-r--r--packages/deployer/src/utils/utils.ts8
-rw-r--r--packages/deployer/test/compiler_test.ts47
-rw-r--r--packages/deployer/test/compiler_utils_test.ts83
-rw-r--r--packages/deployer/test/deployer_test.ts77
-rw-r--r--packages/deployer/test/fixtures/contracts/Exchange.sol603
-rw-r--r--packages/deployer/test/fixtures/contracts/TokenTransferProxy.sol115
-rw-r--r--packages/deployer/test/fixtures/contracts/base/SafeMath.sol41
-rw-r--r--packages/deployer/test/fixtures/contracts/base/Token.sol38
-rw-r--r--packages/deployer/test/fixtures/exchange_bin.ts4
-rw-r--r--packages/deployer/test/util/constants.ts11
-rw-r--r--packages/deployer/test/util/provider.ts9
-rw-r--r--packages/deployer/tsconfig.json8
-rw-r--r--packages/deployer/tslint.json3
36 files changed, 0 insertions, 2471 deletions
diff --git a/packages/deployer/.npmignore b/packages/deployer/.npmignore
deleted file mode 100644
index 44df80fad..000000000
--- a/packages/deployer/.npmignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.*
-yarn-error.log
-/src/
-/scripts/
-test/
-tsconfig.json
-/lib/src/monorepo_scripts/
diff --git a/packages/deployer/CHANGELOG.json b/packages/deployer/CHANGELOG.json
deleted file mode 100644
index 943d4a6f5..000000000
--- a/packages/deployer/CHANGELOG.json
+++ /dev/null
@@ -1,141 +0,0 @@
-[
- {
- "version": "0.4.2",
- "changes": [
- {
- "note": "Add support for solidity 0.4.23",
- "pr": 545
- }
- ]
- },
- {
- "version": "0.4.1",
- "changes": [
- {
- "note": "Add support for solidity 0.4.22",
- "pr": 531
- }
- ],
- "timestamp": 1524044013
- },
- {
- "version": "0.4.0",
- "changes": [
- {
- "note": "Changed the config key `web3Provider` to `provider` to be consistent with other tools",
- "pr": 501
- }
- ],
- "timestamp": 1523462196
- },
- {
- "version": "0.3.5",
- "changes": [
- {
- "note": "Don't try to write contract artifact if an error occured",
- "pr": 485
- }
- ],
- "timestamp": 1522673609
- },
- {
- "version": "0.3.4",
- "changes": [
- {
- "note": "Create solc_bin directory if does not exist before attempting to compile",
- "pr": 491
- }
- ],
- "timestamp": 1522658513
- },
- {
- "version": "0.3.1",
- "changes": [
- {
- "note": "Add TS types for `yargs`"
- }
- ],
- "timestamp": 1521298800
- },
- {
- "version": "0.3.0",
- "changes": [
- {
- "note": "Add support for Solidity 0.4.20 and 0.4.21"
- },
- {
- "note": "Replace `jsonrpcPort` config with `jsonrpcUrl`",
- "pr": 426
- },
- {
- "note": "Replace `jsonrpc-port` CLI option with `jsonrpc-url`",
- "pr": 426
- },
- {
- "note": "Export the `Compiler`",
- "pr": 426
- },
- {
- "note": "Load solc from remote source instead of having it locally",
- "pr": 426
- },
- {
- "note":
- "Add `bytecode`, `runtime_bytecode`, `source_map`, `source_map_runtime` and `sources` fields to artifacts",
- "pr": 426
- },
- {
- "note": "Remove 0x-specific `migrate` command",
- "pr": 426
- },
- {
- "note":
- "Allow deployer to accept a provider instead of port and host. This makes it possible to run it with in-process ganache-core",
- "pr": 426
- },
- {
- "note": "Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package",
- "pr": 452
- },
- {
- "note": "Add `#!/usr/bin/env node` pragma above `cli.ts` script to fix command-line error."
- }
- ],
- "timestamp": 1521298800
- },
- {
- "version": "0.2.0",
- "changes": [
- {
- "note": "Check dependencies when determining if contracts should be recompiled",
- "pr": 408
- },
- {
- "note":
- "Improve an error message for when deployer is supplied with an incorrect number of constructor arguments",
- "pr": 419
- }
- ],
- "timestamp": 1520089200
- },
- {
- "version": "0.1.0",
- "changes": [
- {
- "note": "Add the ability to pass in specific contracts to compile in CLI",
- "pr": 400
- }
- ],
- "timestamp": 1518706800
- },
- {
- "version": "0.0.8",
- "changes": [
- {
- "note": "Fix publishing issue where .npmignore was not properly excluding undesired content",
- "pr": 389
- }
- ],
- "timestamp": 1518102000
- }
-]
diff --git a/packages/deployer/CHANGELOG.md b/packages/deployer/CHANGELOG.md
deleted file mode 100644
index bf0c19d28..000000000
--- a/packages/deployer/CHANGELOG.md
+++ /dev/null
@@ -1,52 +0,0 @@
-<!--
-This file is auto-generated using the monorepo-scripts package. Don't edit directly.
-Edit the package's CHANGELOG.json file only.
--->
-
-CHANGELOG
-
-## v0.4.1 - _April 18, 2018_
-
- * Add support for solidity 0.4.22 (#531)
-
-## v0.4.0 - _April 12, 2018_
-
- * Changed the config key `web3Provider` to `provider` to be consistent with other tools (#501)
-
-## v0.3.5 - _April 2, 2018_
-
- * Don't try to write contract artifact if an error occured (#485)
-
-## v0.3.4 - _April 2, 2018_
-
- * Create solc_bin directory if does not exist before attempting to compile (#491)
-
-## v0.3.1 - _March 18, 2018_
-
- * Add TS types for `yargs`
-
-## v0.3.0 - _March 18, 2018_
-
- * Add support for Solidity 0.4.20 and 0.4.21
- * Replace `jsonrpcPort` config with `jsonrpcUrl` (#426)
- * Replace `jsonrpc-port` CLI option with `jsonrpc-url` (#426)
- * Export the `Compiler` (#426)
- * Load solc from remote source instead of having it locally (#426)
- * Add `bytecode`, `runtime_bytecode`, `source_map`, `source_map_runtime` and `sources` fields to artifacts (#426)
- * Remove 0x-specific `migrate` command (#426)
- * Allow deployer to accept a provider instead of port and host. This makes it possible to run it with in-process ganache-core (#426)
- * Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
- * Add `#!/usr/bin/env node` pragma above `cli.ts` script to fix command-line error.
-
-## v0.2.0 - _March 4, 2018_
-
- * Check dependencies when determining if contracts should be recompiled (#408)
- * Improve an error message for when deployer is supplied with an incorrect number of constructor arguments (#419)
-
-## v0.1.0 - _February 16, 2018_
-
- * Add the ability to pass in specific contracts to compile in CLI (#400)
-
-## v0.0.8 - _February 9, 2018_
-
- * Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
diff --git a/packages/deployer/README.md b/packages/deployer/README.md
deleted file mode 100644
index ef0ddd59d..000000000
--- a/packages/deployer/README.md
+++ /dev/null
@@ -1,104 +0,0 @@
-## @0xproject/deployer
-
-This repository contains a CLI tool that facilitates compiling and deployment of smart contracts.
-
-### Read the [Documentation](https://0xproject.com/docs/deployer).
-
-## Installation
-
-#### CLI Installation
-
-```bash
-yarn global add @0xproject/deployer
-```
-
-#### API Installation
-
-```bash
-yarn add @0xproject/deployer
-```
-
-If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
-
-```json
-"compilerOptions": {
- "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
-}
-```
-
-**Import**
-
-```typescript
-import { Deployer, Compiler } from '@0xproject/deployer';
-```
-
-or
-
-```javascript
-var Deployer = require('@0xproject/deployer').Deployer;
-var Compiler = require('@0xproject/deployer').Compiler;
-```
-
-## 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
-
-If this is your **first** time building this package, you must first build **all** packages within the monorepo. This is because packages that depend on other packages located inside this monorepo are symlinked when run from **within** the monorepo. This allows you to make changes across multiple packages without first publishing dependent packages to NPM. To build all packages, run the following from the monorepo root directory:
-
-```bash
-yarn lerna:rebuild
-```
-
-Or continuously rebuild on change:
-
-```bash
-yarn dev
-```
-
-You can also build this specific package by running the following from within its directory:
-
-```bash
-yarn build
-```
-
-or continuously rebuild on change:
-
-```bash
-yarn build:watch
-```
-
-### Clean
-
-```bash
-yarn clean
-```
-
-### Lint
-
-```bash
-yarn lint
-```
-
-### Run Tests
-
-```bash
-yarn test
-```
diff --git a/packages/deployer/coverage/.gitkeep b/packages/deployer/coverage/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
--- a/packages/deployer/coverage/.gitkeep
+++ /dev/null
diff --git a/packages/deployer/package.json b/packages/deployer/package.json
deleted file mode 100644
index 2d5538c97..000000000
--- a/packages/deployer/package.json
+++ /dev/null
@@ -1,92 +0,0 @@
-{
- "name": "@0xproject/deployer",
- "version": "0.4.1",
- "description": "Smart contract deployer of 0x protocol",
- "main": "lib/src/index.js",
- "types": "lib/src/index.d.ts",
- "scripts": {
- "build:watch": "tsc -w",
- "build": "yarn clean && copyfiles 'test/fixtures/contracts/**/*' ./lib && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
- "test": "run-s build run_mocha",
- "run_mocha": "mocha lib/test/*_test.js --bail --exit",
- "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
- "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
- "compile": "npm run build; node lib/src/cli.js compile",
- "clean": "shx rm -rf lib scripts",
- "migrate": "npm run build; node lib/src/cli.js migrate",
- "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
- "test:circleci": "yarn test:coverage",
- "docs:stage": "yarn build && node ./scripts/stage_docs.js",
- "manual:postpublish": "yarn build; node ./scripts/postpublish.js",
- "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
- "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json"
- },
- "config": {
- "postpublish": {
- "assets": [],
- "docPublishConfigs": {
- "extraFileIncludes": [
- "../types/src/index.ts"
- ],
- "s3BucketPath": "s3://doc-jsons/deployer/",
- "s3StagingBucketPath": "s3://staging-doc-jsons/deployer/"
- }
- }
- },
- "bin": {
- "0x-deployer": "lib/src/cli.js"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/0xProject/0x-monorepo.git"
- },
- "author": "Amir Bandeali",
- "license": "Apache-2.0",
- "bugs": {
- "url": "https://github.com/0xProject/0x-monorepo/issues"
- },
- "homepage": "https://github.com/0xProject/0x-monorepo/packages/deployer/README.md",
- "devDependencies": {
- "@0xproject/dev-utils": "^0.3.6",
- "@0xproject/monorepo-scripts": "^0.1.18",
- "@0xproject/tslint-config": "^0.4.16",
- "@types/require-from-string": "^1.2.0",
- "@types/semver": "^5.5.0",
- "chai": "^4.0.1",
- "chai-as-promised": "^7.1.0",
- "copyfiles": "^1.2.0",
- "dirty-chai": "^2.0.1",
- "mocha": "^4.0.1",
- "npm-run-all": "^4.1.2",
- "nyc": "^11.0.1",
- "shx": "^0.2.2",
- "tslint": "5.8.0",
- "typedoc": "0xProject/typedoc",
- "types-bn": "^0.0.1",
- "typescript": "2.7.1",
- "web3-typescript-typings": "^0.10.2",
- "zeppelin-solidity": "1.8.0"
- },
- "dependencies": {
- "@0xproject/json-schemas": "^0.7.21",
- "@0xproject/sol-resolver": "^0.0.2",
- "@0xproject/types": "^0.6.1",
- "@0xproject/typescript-typings": "^0.2.0",
- "@0xproject/utils": "^0.5.2",
- "@0xproject/web3-wrapper": "^0.6.1",
- "@types/yargs": "^11.0.0",
- "chalk": "^2.3.0",
- "ethereumjs-util": "^5.1.1",
- "isomorphic-fetch": "^2.2.1",
- "lodash": "^4.17.4",
- "require-from-string": "^2.0.1",
- "semver": "^5.5.0",
- "solc": "^0.4.23",
- "web3": "^0.20.0",
- "web3-eth-abi": "^1.0.0-beta.24",
- "yargs": "^10.0.3"
- },
- "publishConfig": {
- "access": "public"
- }
-}
diff --git a/packages/deployer/solc_bin/.gitkeep b/packages/deployer/solc_bin/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
--- a/packages/deployer/solc_bin/.gitkeep
+++ /dev/null
diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts
deleted file mode 100644
index 7f1ae708a..000000000
--- a/packages/deployer/src/cli.ts
+++ /dev/null
@@ -1,153 +0,0 @@
-#!/usr/bin/env node
-// We need the above pragma since this script will be run as a command-line tool.
-
-import { BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
-import * as _ from 'lodash';
-import * as path from 'path';
-import * as Web3 from 'web3';
-import * as yargs from 'yargs';
-
-import { commands } from './commands';
-import { constants } from './utils/constants';
-import { consoleReporter } from './utils/error_reporter';
-import { CliOptions, CompilerOptions, DeployerOptions } from './utils/types';
-
-const DEFAULT_OPTIMIZER_ENABLED = false;
-const DEFAULT_CONTRACTS_DIR = path.resolve('src/contracts');
-const DEFAULT_ARTIFACTS_DIR = path.resolve('src/artifacts');
-const DEFAULT_NETWORK_ID = 50;
-const DEFAULT_JSONRPC_URL = 'http://localhost:8545';
-const DEFAULT_GAS_PRICE = (10 ** 9 * 2).toString();
-const DEFAULT_CONTRACTS_LIST = '*';
-
-/**
- * Compiles all contracts with options passed in through CLI.
- * @param argv Instance of process.argv provided by yargs.
- */
-async function onCompileCommandAsync(argv: CliOptions): Promise<void> {
- const opts: CompilerOptions = {
- contractsDir: argv.contractsDir,
- networkId: argv.networkId,
- optimizerEnabled: argv.shouldOptimize,
- artifactsDir: argv.artifactsDir,
- specifiedContracts: getContractsSetFromList(argv.contracts),
- };
- await commands.compileAsync(opts);
-}
-/**
- * Deploys a single contract with provided name and args.
- * @param argv Instance of process.argv provided by yargs.
- */
-async function onDeployCommandAsync(argv: CliOptions): Promise<void> {
- const url = argv.jsonrpcUrl;
- const provider = new Web3.providers.HttpProvider(url);
- const web3Wrapper = new Web3Wrapper(provider);
- const networkId = await web3Wrapper.getNetworkIdAsync();
- const compilerOpts: CompilerOptions = {
- contractsDir: argv.contractsDir,
- networkId,
- optimizerEnabled: argv.shouldOptimize,
- artifactsDir: argv.artifactsDir,
- specifiedContracts: getContractsSetFromList(argv.contracts),
- };
- await commands.compileAsync(compilerOpts);
-
- const defaults = {
- gasPrice: new BigNumber(argv.gasPrice),
- from: argv.account,
- };
- const deployerOpts: DeployerOptions = {
- artifactsDir: argv.artifactsDir,
- jsonrpcUrl: argv.jsonrpcUrl,
- networkId,
- defaults,
- };
- const deployerArgsString = argv.args as string;
- const deployerArgs = deployerArgsString.split(',');
- await commands.deployAsync(argv.contract as string, deployerArgs, deployerOpts);
-}
-/**
- * Creates a set of contracts to compile.
- * @param contracts Comma separated list of contracts to compile
- */
-function getContractsSetFromList(contracts: string): Set<string> {
- const specifiedContracts = new Set();
- if (contracts === '*') {
- return new Set(['*']);
- }
- const contractsArray = contracts.split(',');
- _.forEach(contractsArray, contractName => {
- specifiedContracts.add(contractName);
- });
- return specifiedContracts;
-}
-/**
- * Provides extra required options for deploy command.
- * @param yargsInstance yargs instance provided in builder function callback.
- */
-function deployCommandBuilder(yargsInstance: any) {
- return yargsInstance
- .option('contract', {
- type: 'string',
- description: 'name of contract to deploy, exluding .sol extension',
- })
- .option('args', {
- type: 'string',
- description: 'comma separated list of constructor args to deploy contract with',
- })
- .demandOption(['contract', 'args'])
- .help().argv;
-}
-
-(() => {
- const identityCommandBuilder = _.identity;
- return yargs
- .option('contracts-dir', {
- type: 'string',
- default: DEFAULT_CONTRACTS_DIR,
- description: 'path of contracts directory to compile',
- })
- .option('network-id', {
- type: 'number',
- default: DEFAULT_NETWORK_ID,
- description: 'mainnet=1, kovan=42, testrpc=50',
- })
- .option('should-optimize', {
- type: 'boolean',
- default: DEFAULT_OPTIMIZER_ENABLED,
- description: 'enable optimizer',
- })
- .option('artifacts-dir', {
- type: 'string',
- default: DEFAULT_ARTIFACTS_DIR,
- description: 'path to write contracts artifacts to',
- })
- .option('jsonrpc-url', {
- type: 'string',
- default: DEFAULT_JSONRPC_URL,
- description: 'url of JSON RPC',
- })
- .option('gas-price', {
- type: 'string',
- default: DEFAULT_GAS_PRICE,
- description: 'gasPrice to be used for transactions',
- })
- .option('account', {
- type: 'string',
- description: 'account to use for deploying contracts',
- })
- .option('contracts', {
- type: 'string',
- default: DEFAULT_CONTRACTS_LIST,
- description: 'comma separated list of contracts to compile',
- })
- .command('compile', 'compile contracts', identityCommandBuilder, consoleReporter(onCompileCommandAsync))
- .command(
- 'deploy',
- 'deploy a single contract with provided arguments',
- deployCommandBuilder,
- consoleReporter(onDeployCommandAsync),
- )
- .help().argv;
-})();
diff --git a/packages/deployer/src/commands.ts b/packages/deployer/src/commands.ts
deleted file mode 100644
index 8e544a60b..000000000
--- a/packages/deployer/src/commands.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { Compiler } from './compiler';
-import { Deployer } from './deployer';
-import { CompilerOptions, DeployerOptions } from './utils/types';
-
-export const commands = {
- async compileAsync(opts: CompilerOptions): Promise<void> {
- const compiler = new Compiler(opts);
- await compiler.compileAsync();
- },
- async deployAsync(contractName: string, args: any[], opts: DeployerOptions): Promise<void> {
- const deployer = new Deployer(opts);
- await deployer.deployAndSaveAsync(contractName, args);
- },
-};
diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts
deleted file mode 100644
index a3c8004ec..000000000
--- a/packages/deployer/src/compiler.ts
+++ /dev/null
@@ -1,264 +0,0 @@
-import {
- ContractSource,
- ContractSources,
- EnumerableResolver,
- FallthroughResolver,
- FSResolver,
- NameResolver,
- NPMResolver,
- Resolver,
- URLResolver,
-} from '@0xproject/sol-resolver';
-import { ContractAbi } from '@0xproject/types';
-import { logUtils, promisify } from '@0xproject/utils';
-import chalk from 'chalk';
-import * as ethUtil from 'ethereumjs-util';
-import * as fs from 'fs';
-import 'isomorphic-fetch';
-import * as _ from 'lodash';
-import * as path from 'path';
-import * as requireFromString from 'require-from-string';
-import * as semver from 'semver';
-import solc = require('solc');
-
-import { binPaths } from './solc/bin_paths';
-import {
- createDirIfDoesNotExistAsync,
- getContractArtifactIfExistsAsync,
- getNormalizedErrMsg,
- parseDependencies,
- parseSolidityVersionRange,
-} from './utils/compiler';
-import { constants } from './utils/constants';
-import { fsWrapper } from './utils/fs_wrapper';
-import {
- CompilerOptions,
- ContractArtifact,
- ContractNetworkData,
- ContractNetworks,
- ContractSourceData,
- ContractSpecificSourceData,
-} from './utils/types';
-import { utils } from './utils/utils';
-
-const ALL_CONTRACTS_IDENTIFIER = '*';
-const SOLC_BIN_DIR = path.join(__dirname, '..', '..', 'solc_bin');
-
-/**
- * The Compiler facilitates compiling Solidity smart contracts and saves the results
- * to artifact files.
- */
-export class Compiler {
- private _resolver: Resolver;
- private _nameResolver: NameResolver;
- private _contractsDir: string;
- private _networkId: number;
- private _optimizerEnabled: boolean;
- private _artifactsDir: string;
- private _specifiedContracts: Set<string> = new Set();
- /**
- * Instantiates a new instance of the Compiler class.
- * @param opts Options specifying directories, network, and optimization settings.
- * @return An instance of the Compiler class.
- */
- constructor(opts: CompilerOptions) {
- this._contractsDir = opts.contractsDir;
- this._networkId = opts.networkId;
- this._optimizerEnabled = opts.optimizerEnabled;
- this._artifactsDir = opts.artifactsDir;
- this._specifiedContracts = opts.specifiedContracts;
- this._nameResolver = new NameResolver(path.resolve(this._contractsDir));
- const resolver = new FallthroughResolver();
- resolver.appendResolver(new URLResolver());
- const packagePath = path.resolve('');
- resolver.appendResolver(new NPMResolver(packagePath));
- resolver.appendResolver(new FSResolver());
- resolver.appendResolver(this._nameResolver);
- this._resolver = resolver;
- }
- /**
- * Compiles selected Solidity files found in `contractsDir` and writes JSON artifacts to `artifactsDir`.
- */
- public async compileAsync(): Promise<void> {
- await createDirIfDoesNotExistAsync(this._artifactsDir);
- await createDirIfDoesNotExistAsync(SOLC_BIN_DIR);
- let contractNamesToCompile: string[] = [];
- if (this._specifiedContracts.has(ALL_CONTRACTS_IDENTIFIER)) {
- const allContracts = this._nameResolver.getAll();
- contractNamesToCompile = _.map(allContracts, contractSource =>
- path.basename(contractSource.path, constants.SOLIDITY_FILE_EXTENSION),
- );
- } else {
- contractNamesToCompile = Array.from(this._specifiedContracts.values());
- }
- for (const contractNameToCompile of contractNamesToCompile) {
- await this._compileContractAsync(contractNameToCompile);
- }
- }
- /**
- * Compiles contract and saves artifact to artifactsDir.
- * @param fileName Name of contract with '.sol' extension.
- */
- private async _compileContractAsync(contractName: string): Promise<void> {
- const contractSource = this._resolver.resolve(contractName);
- const currentArtifactIfExists = await getContractArtifactIfExistsAsync(this._artifactsDir, contractName);
- const sourceTreeHashHex = `0x${this._getSourceTreeHash(contractSource.path).toString('hex')}`;
-
- let shouldCompile = false;
- if (_.isUndefined(currentArtifactIfExists)) {
- shouldCompile = true;
- } else {
- const currentArtifact = currentArtifactIfExists as ContractArtifact;
- shouldCompile =
- currentArtifact.networks[this._networkId].optimizer_enabled !== this._optimizerEnabled ||
- currentArtifact.networks[this._networkId].source_tree_hash !== sourceTreeHashHex;
- }
- if (!shouldCompile) {
- return;
- }
- const solcVersionRange = parseSolidityVersionRange(contractSource.source);
- const availableCompilerVersions = _.keys(binPaths);
- const solcVersion = semver.maxSatisfying(availableCompilerVersions, solcVersionRange);
- const fullSolcVersion = binPaths[solcVersion];
- const compilerBinFilename = path.join(SOLC_BIN_DIR, fullSolcVersion);
- let solcjs: string;
- const isCompilerAvailableLocally = fs.existsSync(compilerBinFilename);
- if (isCompilerAvailableLocally) {
- solcjs = fs.readFileSync(compilerBinFilename).toString();
- } else {
- logUtils.log(`Downloading ${fullSolcVersion}...`);
- const url = `${constants.BASE_COMPILER_URL}${fullSolcVersion}`;
- const response = await fetch(url);
- if (response.status !== 200) {
- throw new Error(`Failed to load ${fullSolcVersion}`);
- }
- solcjs = await response.text();
- fs.writeFileSync(compilerBinFilename, solcjs);
- }
- const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename));
-
- logUtils.log(`Compiling ${contractName} with Solidity v${solcVersion}...`);
- const source = contractSource.source;
- const absoluteFilePath = contractSource.path;
- const standardInput: solc.StandardInput = {
- language: 'Solidity',
- sources: {
- [absoluteFilePath]: {
- urls: [`file://${absoluteFilePath}`],
- },
- },
- settings: {
- optimizer: {
- enabled: this._optimizerEnabled,
- },
- outputSelection: {
- '*': {
- '*': [
- 'abi',
- 'evm.bytecode.object',
- 'evm.bytecode.sourceMap',
- 'evm.deployedBytecode.object',
- 'evm.deployedBytecode.sourceMap',
- ],
- },
- },
- },
- };
- const compiled: solc.StandardOutput = JSON.parse(
- solcInstance.compileStandardWrapper(JSON.stringify(standardInput), importPath => {
- const sourceCodeIfExists = this._resolver.resolve(importPath);
- return { contents: sourceCodeIfExists.source };
- }),
- );
-
- if (!_.isUndefined(compiled.errors)) {
- const SOLIDITY_WARNING = 'warning';
- const errors = _.filter(compiled.errors, entry => entry.severity !== SOLIDITY_WARNING);
- const warnings = _.filter(compiled.errors, entry => entry.severity === SOLIDITY_WARNING);
- if (!_.isEmpty(errors)) {
- errors.forEach(error => {
- const normalizedErrMsg = getNormalizedErrMsg(error.formattedMessage || error.message);
- logUtils.log(chalk.red(normalizedErrMsg));
- });
- process.exit(1);
- } else {
- warnings.forEach(warning => {
- const normalizedWarningMsg = getNormalizedErrMsg(warning.formattedMessage || warning.message);
- logUtils.log(chalk.yellow(normalizedWarningMsg));
- });
- }
- }
- const compiledData = compiled.contracts[absoluteFilePath][contractName];
- if (_.isUndefined(compiledData)) {
- throw new Error(
- `Contract ${contractName} not found in ${absoluteFilePath}. Please make sure your contract has the same name as it's file name`,
- );
- }
- const abi: ContractAbi = compiledData.abi;
- const bytecode = `0x${compiledData.evm.bytecode.object}`;
- const runtimeBytecode = `0x${compiledData.evm.deployedBytecode.object}`;
- const sourceMap = compiledData.evm.bytecode.sourceMap;
- const sourceMapRuntime = compiledData.evm.deployedBytecode.sourceMap;
- const unresolvedSourcePaths = _.keys(compiled.sources);
- const sources = _.map(
- unresolvedSourcePaths,
- unresolvedSourcePath => this._resolver.resolve(unresolvedSourcePath).path,
- );
- const updated_at = Date.now();
- const contractNetworkData: ContractNetworkData = {
- solc_version: solcVersion,
- source_tree_hash: sourceTreeHashHex,
- optimizer_enabled: this._optimizerEnabled,
- abi,
- bytecode,
- runtime_bytecode: runtimeBytecode,
- updated_at,
- source_map: sourceMap,
- source_map_runtime: sourceMapRuntime,
- sources,
- };
-
- let newArtifact: ContractArtifact;
- if (!_.isUndefined(currentArtifactIfExists)) {
- const currentArtifact = currentArtifactIfExists as ContractArtifact;
- newArtifact = {
- ...currentArtifact,
- networks: {
- ...currentArtifact.networks,
- [this._networkId]: contractNetworkData,
- },
- };
- } else {
- newArtifact = {
- contract_name: contractName,
- networks: {
- [this._networkId]: contractNetworkData,
- },
- };
- }
-
- const artifactString = utils.stringifyWithFormatting(newArtifact);
- const currentArtifactPath = `${this._artifactsDir}/${contractName}.json`;
- await fsWrapper.writeFileAsync(currentArtifactPath, artifactString);
- logUtils.log(`${contractName} artifact saved!`);
- }
- /**
- * Gets the source tree hash for a file and its dependencies.
- * @param fileName Name of contract file.
- */
- private _getSourceTreeHash(importPath: string): Buffer {
- const contractSource = this._resolver.resolve(importPath);
- const dependencies = parseDependencies(contractSource);
- const sourceHash = ethUtil.sha3(contractSource.source);
- if (dependencies.length === 0) {
- return sourceHash;
- } else {
- const dependencySourceTreeHashes = _.map(dependencies, (dependency: string) =>
- this._getSourceTreeHash(dependency),
- );
- const sourceTreeHashesBuffer = Buffer.concat([sourceHash, ...dependencySourceTreeHashes]);
- const sourceTreeHash = ethUtil.sha3(sourceTreeHashesBuffer);
- return sourceTreeHash;
- }
- }
-}
diff --git a/packages/deployer/src/deployer.ts b/packages/deployer/src/deployer.ts
deleted file mode 100644
index ad05417b1..000000000
--- a/packages/deployer/src/deployer.ts
+++ /dev/null
@@ -1,219 +0,0 @@
-import { AbiType, ConstructorAbi, ContractAbi, Provider, TxData } from '@0xproject/types';
-import { logUtils } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
-import * as _ from 'lodash';
-import * as Web3 from 'web3';
-
-import { Contract } from './utils/contract';
-import { encoder } from './utils/encoder';
-import { fsWrapper } from './utils/fs_wrapper';
-import {
- ContractArtifact,
- ContractNetworkData,
- DeployerOptions,
- ProviderDeployerOptions,
- UrlDeployerOptions,
-} from './utils/types';
-import { utils } from './utils/utils';
-
-// Gas added to gas estimate to make sure there is sufficient gas for deployment.
-const EXTRA_GAS = 200000;
-
-/**
- * The Deployer facilitates deploying Solidity smart contracts to the blockchain.
- * It can be used to build custom migration scripts.
- */
-export class Deployer {
- public web3Wrapper: Web3Wrapper;
- private _artifactsDir: string;
- private _networkId: number;
- private _defaults: Partial<TxData>;
-
- /**
- * Instantiate a new instance of the Deployer class.
- * @param opts Deployer options, including either an RPC url or Provider instance.
- * @returns A Deployer instance
- */
- constructor(opts: DeployerOptions) {
- this._artifactsDir = opts.artifactsDir;
- this._networkId = opts.networkId;
- this._defaults = opts.defaults;
- let provider: Provider;
- if (_.isUndefined((opts as ProviderDeployerOptions).provider)) {
- const jsonrpcUrl = (opts as UrlDeployerOptions).jsonrpcUrl;
- if (_.isUndefined(jsonrpcUrl)) {
- throw new Error(`Deployer options don't contain provider nor jsonrpcUrl. Please pass one of them`);
- }
- provider = new Web3.providers.HttpProvider(jsonrpcUrl);
- } else {
- provider = (opts as ProviderDeployerOptions).provider;
- }
- this.web3Wrapper = new Web3Wrapper(provider, this._defaults);
- }
- /**
- * Loads a contract's corresponding artifacts and deploys it with the supplied constructor arguments.
- * @param contractName Name of the contract to deploy. Must match name of an artifact in supplied artifacts directory.
- * @param args Array of contract constructor arguments.
- * @return Deployed contract instance.
- */
- public async deployAsync(contractName: string, args: any[] = []): Promise<Web3.ContractInstance> {
- const contractArtifactIfExists: ContractArtifact = this._loadContractArtifactIfExists(contractName);
- const contractNetworkDataIfExists: ContractNetworkData = this._getContractNetworkDataFromArtifactIfExists(
- contractArtifactIfExists,
- );
- const data = contractNetworkDataIfExists.bytecode;
- const from = await this._getFromAddressAsync();
- const gas = await this._getAllowableGasEstimateAsync(data);
- const txData = {
- gasPrice: this._defaults.gasPrice,
- from,
- data,
- gas,
- };
- const abi = contractNetworkDataIfExists.abi;
- const constructorAbi = _.find(abi, { type: AbiType.Constructor }) as ConstructorAbi;
- const constructorArgs = _.isUndefined(constructorAbi) ? [] : constructorAbi.inputs;
- if (constructorArgs.length !== args.length) {
- const constructorSignature = `constructor(${_.map(constructorArgs, arg => `${arg.type} ${arg.name}`).join(
- ', ',
- )})`;
- throw new Error(
- `${contractName} expects ${constructorArgs.length} constructor params: ${constructorSignature}. Got ${
- args.length
- }`,
- );
- }
- const web3ContractInstance = await this._deployFromAbiAsync(abi, args, txData);
- logUtils.log(`${contractName}.sol successfully deployed at ${web3ContractInstance.address}`);
- const contractInstance = new Contract(web3ContractInstance, this._defaults);
- return contractInstance;
- }
- /**
- * Loads a contract's artifact, deploys it with supplied constructor arguments, and saves the updated data
- * back to the artifact file.
- * @param contractName Name of the contract to deploy. Must match name of an artifact in artifacts directory.
- * @param args Array of contract constructor arguments.
- * @return Deployed contract instance.
- */
- public async deployAndSaveAsync(contractName: string, args: any[] = []): Promise<Web3.ContractInstance> {
- const contractInstance = await this.deployAsync(contractName, args);
- await this._saveContractDataToArtifactAsync(contractName, contractInstance.address, args);
- return contractInstance;
- }
- /**
- * Deploys a contract given its ABI, arguments, and transaction data.
- * @param abi ABI of contract to deploy.
- * @param args Constructor arguments to use in deployment.
- * @param txData Tx options used for deployment.
- * @return Promise that resolves to a web3 contract instance.
- */
- private async _deployFromAbiAsync(abi: ContractAbi, args: any[], txData: TxData): Promise<any> {
- const contract: Web3.Contract<Web3.ContractInstance> = this.web3Wrapper.getContractFromAbi(abi);
- const deployPromise = new Promise((resolve, reject) => {
- /**
- * Contract is inferred as 'any' because TypeScript
- * is not able to read 'new' from the Contract interface
- */
- (contract as any).new(...args, txData, (err: Error, res: any): any => {
- if (err) {
- reject(err);
- } else if (_.isUndefined(res.address) && !_.isUndefined(res.transactionHash)) {
- logUtils.log(`transactionHash: ${res.transactionHash}`);
- } else {
- resolve(res);
- }
- });
- });
- return deployPromise;
- }
- /**
- * Updates a contract artifact's address and encoded constructor arguments.
- * @param contractName Name of contract. Must match an existing artifact.
- * @param contractAddress Contract address to save to artifact.
- * @param args Contract constructor arguments that will be encoded and saved to artifact.
- */
- private async _saveContractDataToArtifactAsync(
- contractName: string,
- contractAddress: string,
- args: any[],
- ): Promise<void> {
- const contractArtifactIfExists: ContractArtifact = this._loadContractArtifactIfExists(contractName);
- const contractNetworkDataIfExists: ContractNetworkData = this._getContractNetworkDataFromArtifactIfExists(
- contractArtifactIfExists,
- );
- const abi = contractNetworkDataIfExists.abi;
- const encodedConstructorArgs = encoder.encodeConstructorArgsFromAbi(args, abi);
- const newContractData = {
- ...contractNetworkDataIfExists,
- address: contractAddress,
- constructor_args: encodedConstructorArgs,
- };
- const newArtifact = {
- ...contractArtifactIfExists,
- networks: {
- ...contractArtifactIfExists.networks,
- [this._networkId]: newContractData,
- },
- };
- const artifactString = utils.stringifyWithFormatting(newArtifact);
- const artifactPath = `${this._artifactsDir}/${contractName}.json`;
- await fsWrapper.writeFileAsync(artifactPath, artifactString);
- }
- /**
- * Loads a contract artifact, if it exists.
- * @param contractName Name of the contract, without the extension.
- * @return The contract artifact.
- */
- private _loadContractArtifactIfExists(contractName: string): ContractArtifact {
- const artifactPath = `${this._artifactsDir}/${contractName}.json`;
- try {
- const contractArtifact: ContractArtifact = require(artifactPath);
- return contractArtifact;
- } catch (err) {
- throw new Error(`Artifact not found for contract: ${contractName} at ${artifactPath}`);
- }
- }
- /**
- * Gets data for current networkId stored in artifact.
- * @param contractArtifact The contract artifact.
- * @return Network specific contract data.
- */
- private _getContractNetworkDataFromArtifactIfExists(contractArtifact: ContractArtifact): ContractNetworkData {
- const contractNetworkDataIfExists = contractArtifact.networks[this._networkId];
- if (_.isUndefined(contractNetworkDataIfExists)) {
- throw new Error(`Data not found in artifact for contract: ${contractArtifact.contract_name}`);
- }
- return contractNetworkDataIfExists;
- }
- /**
- * Gets the address to use for sending a transaction.
- * @return The default from address. If not specified, returns the first address accessible by web3.
- */
- private async _getFromAddressAsync(): Promise<string> {
- let from: string;
- if (_.isUndefined(this._defaults.from)) {
- const accounts = await this.web3Wrapper.getAvailableAddressesAsync();
- from = accounts[0];
- } else {
- from = this._defaults.from;
- }
- return from;
- }
- /**
- * Estimates the gas required for a transaction.
- * If gas would be over the block gas limit, the max allowable gas is returned instead.
- * @param data Bytecode to estimate gas for.
- * @return Gas estimate for transaction data.
- */
- private async _getAllowableGasEstimateAsync(data: string): Promise<number> {
- const block = await this.web3Wrapper.getBlockAsync('latest');
- let gas: number;
- try {
- const gasEstimate: number = await this.web3Wrapper.estimateGasAsync({ data });
- gas = Math.min(gasEstimate + EXTRA_GAS, block.gasLimit);
- } catch (err) {
- gas = block.gasLimit;
- }
- return gas;
- }
-}
diff --git a/packages/deployer/src/globals.d.ts b/packages/deployer/src/globals.d.ts
deleted file mode 100644
index 94e63a32d..000000000
--- a/packages/deployer/src/globals.d.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-declare module '*.json' {
- const json: any;
- /* tslint:disable */
- export default json;
- /* tslint:enable */
-}
diff --git a/packages/deployer/src/index.ts b/packages/deployer/src/index.ts
deleted file mode 100644
index 186d644ef..000000000
--- a/packages/deployer/src/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { Deployer } from './deployer';
-export { Compiler } from './compiler';
diff --git a/packages/deployer/src/monorepo_scripts/postpublish.ts b/packages/deployer/src/monorepo_scripts/postpublish.ts
deleted file mode 100644
index dcb99d0f7..000000000
--- a/packages/deployer/src/monorepo_scripts/postpublish.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { postpublishUtils } from '@0xproject/monorepo-scripts';
-
-import * as packageJSON from '../package.json';
-import * as tsConfigJSON from '../tsconfig.json';
-
-const cwd = `${__dirname}/..`;
-// tslint:disable-next-line:no-floating-promises
-postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/deployer/src/monorepo_scripts/stage_docs.ts b/packages/deployer/src/monorepo_scripts/stage_docs.ts
deleted file mode 100644
index e732ac8eb..000000000
--- a/packages/deployer/src/monorepo_scripts/stage_docs.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { postpublishUtils } from '@0xproject/monorepo-scripts';
-
-import * as packageJSON from '../package.json';
-import * as tsConfigJSON from '../tsconfig.json';
-
-const cwd = `${__dirname}/..`;
-// tslint:disable-next-line:no-floating-promises
-postpublishUtils.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/deployer/src/solc/bin_paths.ts b/packages/deployer/src/solc/bin_paths.ts
deleted file mode 100644
index 1b5e8c6f1..000000000
--- a/packages/deployer/src/solc/bin_paths.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-export interface BinaryPaths {
- [key: string]: string;
-}
-
-export const binPaths: BinaryPaths = {
- '0.4.10': 'soljson-v0.4.10+commit.f0d539ae.js',
- '0.4.11': 'soljson-v0.4.11+commit.68ef5810.js',
- '0.4.12': 'soljson-v0.4.12+commit.194ff033.js',
- '0.4.13': 'soljson-v0.4.13+commit.fb4cb1a.js',
- '0.4.14': 'soljson-v0.4.14+commit.c2215d46.js',
- '0.4.15': 'soljson-v0.4.15+commit.bbb8e64f.js',
- '0.4.16': 'soljson-v0.4.16+commit.d7661dd9.js',
- '0.4.17': 'soljson-v0.4.17+commit.bdeb9e52.js',
- '0.4.18': 'soljson-v0.4.18+commit.9cf6e910.js',
- '0.4.19': 'soljson-v0.4.19+commit.c4cbbb05.js',
- '0.4.20': 'soljson-v0.4.20+commit.3155dd80.js',
- '0.4.21': 'soljson-v0.4.21+commit.dfe3193c.js',
- '0.4.22': 'soljson-v0.4.22+commit.4cb486ee.js',
- '0.4.23': 'soljson-v0.4.23+commit.124ca40d.js',
-};
diff --git a/packages/deployer/src/utils/compiler.ts b/packages/deployer/src/utils/compiler.ts
deleted file mode 100644
index c571b2581..000000000
--- a/packages/deployer/src/utils/compiler.ts
+++ /dev/null
@@ -1,107 +0,0 @@
-import { ContractSource, ContractSources } from '@0xproject/sol-resolver';
-import { logUtils } from '@0xproject/utils';
-import * as _ from 'lodash';
-import * as path from 'path';
-import * as solc from 'solc';
-
-import { constants } from './constants';
-import { fsWrapper } from './fs_wrapper';
-import { ContractArtifact } from './types';
-
-/**
- * Gets contract data on network or returns if an artifact does not exist.
- * @param artifactsDir Path to the artifacts directory.
- * @param contractName Name of contract.
- * @return Contract data on network or undefined.
- */
-export async function getContractArtifactIfExistsAsync(
- artifactsDir: string,
- contractName: string,
-): Promise<ContractArtifact | void> {
- let contractArtifact;
- const currentArtifactPath = `${artifactsDir}/${contractName}.json`;
- try {
- const opts = {
- encoding: 'utf8',
- };
- const contractArtifactString = await fsWrapper.readFileAsync(currentArtifactPath, opts);
- contractArtifact = JSON.parse(contractArtifactString);
- return contractArtifact;
- } catch (err) {
- logUtils.log(`Artifact for ${contractName} does not exist`);
- return undefined;
- }
-}
-
-/**
- * Creates a directory if it does not already exist.
- * @param artifactsDir Path to the directory.
- */
-export async function createDirIfDoesNotExistAsync(dirPath: string): Promise<void> {
- if (!fsWrapper.doesPathExistSync(dirPath)) {
- logUtils.log(`Creating directory at ${dirPath}...`);
- await fsWrapper.mkdirAsync(dirPath);
- }
-}
-
-/**
- * Searches Solidity source code for compiler version range.
- * @param source Source code of contract.
- * @return Solc compiler version range.
- */
-export function parseSolidityVersionRange(source: string): string {
- const SOLIDITY_VERSION_RANGE_REGEX = /pragma\s+solidity\s+(.*);/;
- const solcVersionRangeMatch = source.match(SOLIDITY_VERSION_RANGE_REGEX);
- if (_.isNull(solcVersionRangeMatch)) {
- throw new Error('Could not find Solidity version range in source');
- }
- const solcVersionRange = solcVersionRangeMatch[1];
- return solcVersionRange;
-}
-
-/**
- * Normalizes the path found in the error message.
- * Example: converts 'base/Token.sol:6:46: Warning: Unused local variable'
- * to 'Token.sol:6:46: Warning: Unused local variable'
- * This is used to prevent logging the same error multiple times.
- * @param errMsg An error message from the compiled output.
- * @return The error message with directories truncated from the contract path.
- */
-export function getNormalizedErrMsg(errMsg: string): string {
- const SOLIDITY_FILE_EXTENSION_REGEX = /(.*\.sol)/;
- const errPathMatch = errMsg.match(SOLIDITY_FILE_EXTENSION_REGEX);
- if (_.isNull(errPathMatch)) {
- throw new Error('Could not find a path in error message');
- }
- const errPath = errPathMatch[0];
- const baseContract = path.basename(errPath);
- const normalizedErrMsg = errMsg.replace(errPath, baseContract);
- return normalizedErrMsg;
-}
-
-/**
- * Parses the contract source code and extracts the dendencies
- * @param source Contract source code
- * @return List of dependendencies
- */
-export function parseDependencies(contractSource: ContractSource): string[] {
- // TODO: Use a proper parser
- const source = contractSource.source;
- const IMPORT_REGEX = /(import\s)/;
- const DEPENDENCY_PATH_REGEX = /"([^"]+)"/; // Source: https://github.com/BlockChainCompany/soljitsu/blob/master/lib/shared.js
- const dependencies: string[] = [];
- const lines = source.split('\n');
- _.forEach(lines, line => {
- if (!_.isNull(line.match(IMPORT_REGEX))) {
- const dependencyMatch = line.match(DEPENDENCY_PATH_REGEX);
- if (!_.isNull(dependencyMatch)) {
- let dependencyPath = dependencyMatch[1];
- if (dependencyPath.startsWith('.')) {
- dependencyPath = path.join(path.dirname(contractSource.path), dependencyPath);
- }
- dependencies.push(dependencyPath);
- }
- }
- });
- return dependencies;
-}
diff --git a/packages/deployer/src/utils/constants.ts b/packages/deployer/src/utils/constants.ts
deleted file mode 100644
index 6f9dfb994..000000000
--- a/packages/deployer/src/utils/constants.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export const constants = {
- SOLIDITY_FILE_EXTENSION: '.sol',
- BASE_COMPILER_URL: 'https://ethereum.github.io/solc-bin/bin/',
-};
diff --git a/packages/deployer/src/utils/contract.ts b/packages/deployer/src/utils/contract.ts
deleted file mode 100644
index e8dd5218a..000000000
--- a/packages/deployer/src/utils/contract.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-import { schemas, SchemaValidator } from '@0xproject/json-schemas';
-import { AbiType, ContractAbi, EventAbi, FunctionAbi, MethodAbi, TxData } from '@0xproject/types';
-import { promisify } from '@0xproject/utils';
-import * as _ from 'lodash';
-import * as Web3 from 'web3';
-
-export class Contract implements Web3.ContractInstance {
- public address: string;
- public abi: ContractAbi;
- private _contract: Web3.ContractInstance;
- private _defaults: Partial<TxData>;
- private _validator: SchemaValidator;
- // This class instance is going to be populated with functions and events depending on the ABI
- // and we don't know their types in advance
- [name: string]: any;
- constructor(web3ContractInstance: Web3.ContractInstance, defaults: Partial<TxData>) {
- this._contract = web3ContractInstance;
- this.address = web3ContractInstance.address;
- this.abi = web3ContractInstance.abi;
- this._defaults = defaults;
- this._populateEvents();
- this._populateFunctions();
- this._validator = new SchemaValidator();
- }
- private _populateFunctions(): void {
- const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Function) as FunctionAbi[];
- _.forEach(functionsAbi, (functionAbi: MethodAbi) => {
- if (functionAbi.constant) {
- const cbStyleCallFunction = this._contract[functionAbi.name].call;
- this[functionAbi.name] = promisify(cbStyleCallFunction, this._contract);
- this[functionAbi.name].call = promisify(cbStyleCallFunction, this._contract);
- } else {
- const cbStyleFunction = this._contract[functionAbi.name];
- const cbStyleCallFunction = this._contract[functionAbi.name].call;
- const cbStyleEstimateGasFunction = this._contract[functionAbi.name].estimateGas;
- this[functionAbi.name] = this._promisifyWithDefaultParams(cbStyleFunction);
- this[functionAbi.name].estimateGasAsync = promisify(cbStyleEstimateGasFunction);
- this[functionAbi.name].sendTransactionAsync = this._promisifyWithDefaultParams(cbStyleFunction);
- this[functionAbi.name].call = promisify(cbStyleCallFunction, this._contract);
- }
- });
- }
- private _populateEvents(): void {
- const eventsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Event) as EventAbi[];
- _.forEach(eventsAbi, (eventAbi: EventAbi) => {
- this[eventAbi.name] = this._contract[eventAbi.name];
- });
- }
- private _promisifyWithDefaultParams(fn: (...args: any[]) => void): (...args: any[]) => Promise<any> {
- const promisifiedWithDefaultParams = async (...args: any[]) => {
- const promise = new Promise((resolve, reject) => {
- const lastArg = args[args.length - 1];
- let txData: Partial<TxData> = {};
- if (this._isTxData(lastArg)) {
- txData = args.pop();
- }
- txData = {
- ...this._defaults,
- ...txData,
- };
- const callback = (err: Error, data: any) => {
- if (_.isNull(err)) {
- resolve(data);
- } else {
- reject(err);
- }
- };
- args.push(txData);
- args.push(callback);
- fn.apply(this._contract, args);
- });
- return promise;
- };
- return promisifiedWithDefaultParams;
- }
- private _isTxData(lastArg: any): boolean {
- const isValid = this._validator.isValid(lastArg, schemas.txDataSchema);
- return isValid;
- }
-}
diff --git a/packages/deployer/src/utils/encoder.ts b/packages/deployer/src/utils/encoder.ts
deleted file mode 100644
index 806efbbca..000000000
--- a/packages/deployer/src/utils/encoder.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { AbiDefinition, AbiType, ContractAbi, DataItem } from '@0xproject/types';
-import * as _ from 'lodash';
-import * as web3Abi from 'web3-eth-abi';
-
-export const encoder = {
- encodeConstructorArgsFromAbi(args: any[], abi: ContractAbi): string {
- const constructorTypes: string[] = [];
- _.each(abi, (element: AbiDefinition) => {
- if (element.type === AbiType.Constructor) {
- _.each(element.inputs, (input: DataItem) => {
- constructorTypes.push(input.type);
- });
- }
- });
- const encodedParameters = web3Abi.encodeParameters(constructorTypes, args);
- return encodedParameters;
- },
-};
diff --git a/packages/deployer/src/utils/error_reporter.ts b/packages/deployer/src/utils/error_reporter.ts
deleted file mode 100644
index 4e73307f0..000000000
--- a/packages/deployer/src/utils/error_reporter.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { logUtils } from '@0xproject/utils';
-
-/**
- * Makes an async function no-throw printing errors to the console
- * @param asyncFn async function to wrap
- * @return Wrapped version of the passed function
- */
-export function consoleReporter<T>(asyncFn: (arg: T) => Promise<void>): (arg: T) => Promise<void> {
- const noThrowFnAsync = async (arg: T) => {
- try {
- const result = await asyncFn(arg);
- return result;
- } catch (err) {
- logUtils.log(`${err}`);
- }
- };
- return noThrowFnAsync;
-}
diff --git a/packages/deployer/src/utils/fs_wrapper.ts b/packages/deployer/src/utils/fs_wrapper.ts
deleted file mode 100644
index e02c83f27..000000000
--- a/packages/deployer/src/utils/fs_wrapper.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { promisify } from '@0xproject/utils';
-import * as fs from 'fs';
-
-export const fsWrapper = {
- readdirAsync: promisify<string[]>(fs.readdir),
- readFileAsync: promisify<string>(fs.readFile),
- writeFileAsync: promisify<undefined>(fs.writeFile),
- mkdirAsync: promisify<undefined>(fs.mkdir),
- doesPathExistSync: fs.existsSync,
- rmdirSync: fs.rmdirSync,
- removeFileAsync: promisify<undefined>(fs.unlink),
-};
diff --git a/packages/deployer/src/utils/types.ts b/packages/deployer/src/utils/types.ts
deleted file mode 100644
index a20d0f627..000000000
--- a/packages/deployer/src/utils/types.ts
+++ /dev/null
@@ -1,95 +0,0 @@
-import { ContractAbi, Provider, TxData } from '@0xproject/types';
-import * as Web3 from 'web3';
-import * as yargs from 'yargs';
-
-export enum AbiType {
- Function = 'function',
- Constructor = 'constructor',
- Event = 'event',
- Fallback = 'fallback',
-}
-
-export interface ContractArtifact {
- contract_name: string;
- networks: ContractNetworks;
-}
-
-export interface ContractNetworks {
- [key: number]: ContractNetworkData;
-}
-
-export interface ContractNetworkData {
- solc_version: string;
- optimizer_enabled: boolean;
- source_tree_hash: string;
- abi: ContractAbi;
- bytecode: string;
- runtime_bytecode: string;
- address?: string;
- constructor_args?: string;
- updated_at: number;
- source_map: string;
- source_map_runtime: string;
- sources: string[];
-}
-
-export interface SolcErrors {
- [key: string]: boolean;
-}
-
-export interface CliOptions extends yargs.Arguments {
- artifactsDir: string;
- contractsDir: string;
- jsonrpcUrl: string;
- networkId: number;
- shouldOptimize: boolean;
- gasPrice: string;
- account?: string;
- contract?: string;
- args?: string;
-}
-
-export interface CompilerOptions {
- contractsDir: string;
- networkId: number;
- optimizerEnabled: boolean;
- artifactsDir: string;
- specifiedContracts: Set<string>;
-}
-
-export interface BaseDeployerOptions {
- artifactsDir: string;
- networkId: number;
- defaults: Partial<TxData>;
-}
-
-export interface ProviderDeployerOptions extends BaseDeployerOptions {
- provider: Provider;
-}
-
-export interface UrlDeployerOptions extends BaseDeployerOptions {
- jsonrpcUrl: string;
-}
-
-export type DeployerOptions = UrlDeployerOptions | ProviderDeployerOptions;
-
-export interface ContractSourceData {
- [contractName: string]: ContractSpecificSourceData;
-}
-
-export interface ContractSpecificSourceData {
- solcVersionRange: string;
- sourceHash: Buffer;
- sourceTreeHash: Buffer;
-}
-
-export interface Token {
- address?: string;
- name: string;
- symbol: string;
- decimals: number;
- ipfsHash: string;
- swarmHash: string;
-}
-
-export type DoneCallback = (err?: Error) => void;
diff --git a/packages/deployer/src/utils/utils.ts b/packages/deployer/src/utils/utils.ts
deleted file mode 100644
index 9b1e59f9d..000000000
--- a/packages/deployer/src/utils/utils.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export const utils = {
- stringifyWithFormatting(obj: any): string {
- const jsonReplacer: null = null;
- const numberOfJsonSpaces = 4;
- const stringifiedObj = JSON.stringify(obj, jsonReplacer, numberOfJsonSpaces);
- return stringifiedObj;
- },
-};
diff --git a/packages/deployer/test/compiler_test.ts b/packages/deployer/test/compiler_test.ts
deleted file mode 100644
index b03ae7935..000000000
--- a/packages/deployer/test/compiler_test.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-import * as chai from 'chai';
-import 'mocha';
-
-import { Compiler } from '../src/compiler';
-import { fsWrapper } from '../src/utils/fs_wrapper';
-import { CompilerOptions, ContractArtifact, ContractNetworkData, DoneCallback } from '../src/utils/types';
-
-import { exchange_binary } from './fixtures/exchange_bin';
-import { constants } from './util/constants';
-
-const expect = chai.expect;
-
-describe('#Compiler', function() {
- this.timeout(constants.timeoutMs);
- const artifactsDir = `${__dirname}/fixtures/artifacts`;
- const contractsDir = `${__dirname}/fixtures/contracts`;
- const exchangeArtifactPath = `${artifactsDir}/Exchange.json`;
- const compilerOpts: CompilerOptions = {
- artifactsDir,
- contractsDir,
- networkId: constants.networkId,
- optimizerEnabled: constants.optimizerEnabled,
- specifiedContracts: new Set(constants.specifiedContracts),
- };
- const compiler = new Compiler(compilerOpts);
- beforeEach((done: DoneCallback) => {
- (async () => {
- if (fsWrapper.doesPathExistSync(exchangeArtifactPath)) {
- await fsWrapper.removeFileAsync(exchangeArtifactPath);
- }
- await compiler.compileAsync();
- done();
- })().catch(done);
- });
- it('should create an Exchange artifact with the correct unlinked binary', async () => {
- const opts = {
- encoding: 'utf8',
- };
- const exchangeArtifactString = await fsWrapper.readFileAsync(exchangeArtifactPath, opts);
- const exchangeArtifact: ContractArtifact = JSON.parse(exchangeArtifactString);
- const exchangeContractData: ContractNetworkData = exchangeArtifact.networks[constants.networkId];
- // The last 43 bytes of the binaries are metadata which may not be equivalent
- const unlinkedBinaryWithoutMetadata = exchangeContractData.bytecode.slice(0, -86);
- const exchangeBinaryWithoutMetadata = exchange_binary.slice(0, -86);
- expect(unlinkedBinaryWithoutMetadata).to.equal(exchangeBinaryWithoutMetadata);
- });
-});
diff --git a/packages/deployer/test/compiler_utils_test.ts b/packages/deployer/test/compiler_utils_test.ts
deleted file mode 100644
index 393f6d3f3..000000000
--- a/packages/deployer/test/compiler_utils_test.ts
+++ /dev/null
@@ -1,83 +0,0 @@
-import * as chai from 'chai';
-import * as dirtyChai from 'dirty-chai';
-import * as _ from 'lodash';
-import 'mocha';
-
-import {
- createDirIfDoesNotExistAsync,
- getNormalizedErrMsg,
- parseDependencies,
- parseSolidityVersionRange,
-} from '../src/utils/compiler';
-import { fsWrapper } from '../src/utils/fs_wrapper';
-
-chai.use(dirtyChai);
-const expect = chai.expect;
-
-describe('Compiler utils', () => {
- describe('#getNormalizedErrorMessage', () => {
- it('normalizes the error message', () => {
- const errMsg = 'base/Token.sol:6:46: Warning: Unused local variable';
- const normalizedErrMsg = getNormalizedErrMsg(errMsg);
- expect(normalizedErrMsg).to.be.equal('Token.sol:6:46: Warning: Unused local variable');
- });
- });
- describe('#createDirIfDoesNotExistAsync', () => {
- it('creates artifacts dir', async () => {
- const artifactsDir = `${__dirname}/artifacts`;
- expect(fsWrapper.doesPathExistSync(artifactsDir)).to.be.false();
- await createDirIfDoesNotExistAsync(artifactsDir);
- expect(fsWrapper.doesPathExistSync(artifactsDir)).to.be.true();
- fsWrapper.rmdirSync(artifactsDir);
- expect(fsWrapper.doesPathExistSync(artifactsDir)).to.be.false();
- });
- });
- describe('#parseSolidityVersionRange', () => {
- it('correctly parses the version range', () => {
- expect(parseSolidityVersionRange('pragma solidity ^0.0.1;')).to.be.equal('^0.0.1');
- expect(parseSolidityVersionRange('\npragma solidity 0.0.1;')).to.be.equal('0.0.1');
- expect(parseSolidityVersionRange('pragma solidity <=1.0.1;')).to.be.equal('<=1.0.1');
- expect(parseSolidityVersionRange('pragma solidity ~1.0.1;')).to.be.equal('~1.0.1');
- });
- // TODO: For now that doesn't work. This will work after we switch to a grammar-based parser
- it.skip('correctly parses the version range with comments', () => {
- expect(parseSolidityVersionRange('// pragma solidity ~1.0.1;\npragma solidity ~1.0.2;')).to.be.equal(
- '~1.0.2',
- );
- });
- });
- describe('#parseDependencies', () => {
- it('correctly parses Exchange dependencies', async () => {
- const path = `${__dirname}/fixtures/contracts/Exchange.sol`;
- const source = await fsWrapper.readFileAsync(path, {
- encoding: 'utf8',
- });
- const dependencies = parseDependencies({ source, path });
- const expectedDependencies = [
- 'zeppelin-solidity/contracts/token/ERC20/ERC20.sol',
- 'packages/deployer/lib/test/fixtures/contracts/TokenTransferProxy.sol',
- 'packages/deployer/lib/test/fixtures/contracts/base/SafeMath.sol',
- ];
- _.each(expectedDependencies, expectedDepdency => {
- const foundDependency = _.find(dependencies, dependency => _.endsWith(dependency, expectedDepdency));
- expect(foundDependency, `${expectedDepdency} not found`).to.not.be.undefined();
- });
- });
- it('correctly parses TokenTransferProxy dependencies', async () => {
- const path = `${__dirname}/fixtures/contracts/TokenTransferProxy.sol`;
- const source = await fsWrapper.readFileAsync(path, {
- encoding: 'utf8',
- });
- expect(parseDependencies({ source, path })).to.be.deep.equal([
- 'zeppelin-solidity/contracts/ownership/Ownable.sol',
- 'zeppelin-solidity/contracts/token/ERC20/ERC20.sol',
- ]);
- });
- // TODO: For now that doesn't work. This will work after we switch to a grammar-based parser
- it.skip('correctly parses commented out dependencies', async () => {
- const path = '';
- const source = `// import "./TokenTransferProxy.sol";`;
- expect(parseDependencies({ path, source })).to.be.deep.equal([]);
- });
- });
-});
diff --git a/packages/deployer/test/deployer_test.ts b/packages/deployer/test/deployer_test.ts
deleted file mode 100644
index 238624220..000000000
--- a/packages/deployer/test/deployer_test.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-import * as chai from 'chai';
-import 'mocha';
-
-import { Compiler } from '../src/compiler';
-import { Deployer } from '../src/deployer';
-import { fsWrapper } from '../src/utils/fs_wrapper';
-import { CompilerOptions, ContractArtifact, ContractNetworkData, DoneCallback } from '../src/utils/types';
-
-import { constructor_args, exchange_binary } from './fixtures/exchange_bin';
-import { constants } from './util/constants';
-import { provider } from './util/provider';
-
-const expect = chai.expect;
-
-describe('#Deployer', () => {
- const artifactsDir = `${__dirname}/fixtures/artifacts`;
- const contractsDir = `${__dirname}/fixtures/contracts`;
- const exchangeArtifactPath = `${artifactsDir}/Exchange.json`;
- const compilerOpts: CompilerOptions = {
- artifactsDir,
- contractsDir,
- networkId: constants.networkId,
- optimizerEnabled: constants.optimizerEnabled,
- specifiedContracts: new Set(constants.specifiedContracts),
- };
- const compiler = new Compiler(compilerOpts);
- const deployerOpts = {
- artifactsDir,
- networkId: constants.networkId,
- provider,
- defaults: {
- gasPrice: constants.gasPrice,
- },
- };
- const deployer = new Deployer(deployerOpts);
- beforeEach(function(done: DoneCallback) {
- this.timeout(constants.timeoutMs);
- (async () => {
- if (fsWrapper.doesPathExistSync(exchangeArtifactPath)) {
- await fsWrapper.removeFileAsync(exchangeArtifactPath);
- }
- await compiler.compileAsync();
- done();
- })().catch(done);
- });
- describe('#deployAsync', () => {
- it('should deploy the Exchange contract without updating the Exchange artifact', async () => {
- const exchangeConstructorArgs = [constants.zrxTokenAddress, constants.tokenTransferProxyAddress];
- const exchangeContractInstance = await deployer.deployAsync('Exchange', exchangeConstructorArgs);
- const opts = {
- encoding: 'utf8',
- };
- const exchangeArtifactString = await fsWrapper.readFileAsync(exchangeArtifactPath, opts);
- const exchangeArtifact: ContractArtifact = JSON.parse(exchangeArtifactString);
- const exchangeContractData: ContractNetworkData = exchangeArtifact.networks[constants.networkId];
- const exchangeAddress = exchangeContractInstance.address;
- expect(exchangeAddress).to.not.equal(undefined);
- expect(exchangeContractData.address).to.equal(undefined);
- expect(exchangeContractData.constructor_args).to.equal(undefined);
- });
- });
- describe('#deployAndSaveAsync', () => {
- it('should save the correct contract address and constructor arguments to the Exchange artifact', async () => {
- const exchangeConstructorArgs = [constants.zrxTokenAddress, constants.tokenTransferProxyAddress];
- const exchangeContractInstance = await deployer.deployAndSaveAsync('Exchange', exchangeConstructorArgs);
- const opts = {
- encoding: 'utf8',
- };
- const exchangeArtifactString = await fsWrapper.readFileAsync(exchangeArtifactPath, opts);
- const exchangeArtifact: ContractArtifact = JSON.parse(exchangeArtifactString);
- const exchangeContractData: ContractNetworkData = exchangeArtifact.networks[constants.networkId];
- const exchangeAddress = exchangeContractInstance.address;
- expect(exchangeAddress).to.be.equal(exchangeContractData.address);
- expect(constructor_args).to.be.equal(exchangeContractData.constructor_args);
- });
- });
-});
diff --git a/packages/deployer/test/fixtures/contracts/Exchange.sol b/packages/deployer/test/fixtures/contracts/Exchange.sol
deleted file mode 100644
index e3725335b..000000000
--- a/packages/deployer/test/fixtures/contracts/Exchange.sol
+++ /dev/null
@@ -1,603 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.4.14;
-
-import {ERC20 as Token} from "zeppelin-solidity/contracts/token/ERC20/ERC20.sol";
-
-import "./TokenTransferProxy.sol";
-import "./base/SafeMath.sol";
-
-/// @title Exchange - Facilitates exchange of ERC20 tokens.
-/// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com>
-contract Exchange is SafeMath {
-
- // Error Codes
- enum Errors {
- ORDER_EXPIRED, // Order has already expired
- ORDER_FULLY_FILLED_OR_CANCELLED, // Order has already been fully filled or cancelled
- ROUNDING_ERROR_TOO_LARGE, // Rounding error too large
- INSUFFICIENT_BALANCE_OR_ALLOWANCE // Insufficient balance or allowance for token transfer
- }
-
- string constant public VERSION = "1.0.0";
- uint16 constant public EXTERNAL_QUERY_GAS_LIMIT = 4999; // Changes to state require at least 5000 gas
-
- address public ZRX_TOKEN_CONTRACT;
- address public TOKEN_TRANSFER_PROXY_CONTRACT;
-
- // Mappings of orderHash => amounts of takerTokenAmount filled or cancelled.
- mapping (bytes32 => uint) public filled;
- mapping (bytes32 => uint) public cancelled;
-
- event LogFill(
- address indexed maker,
- address taker,
- address indexed feeRecipient,
- address makerToken,
- address takerToken,
- uint filledMakerTokenAmount,
- uint filledTakerTokenAmount,
- uint paidMakerFee,
- uint paidTakerFee,
- bytes32 indexed tokens, // keccak256(makerToken, takerToken), allows subscribing to a token pair
- bytes32 orderHash
- );
-
- event LogCancel(
- address indexed maker,
- address indexed feeRecipient,
- address makerToken,
- address takerToken,
- uint cancelledMakerTokenAmount,
- uint cancelledTakerTokenAmount,
- bytes32 indexed tokens,
- bytes32 orderHash
- );
-
- event LogError(uint8 indexed errorId, bytes32 indexed orderHash);
-
- struct Order {
- address maker;
- address taker;
- address makerToken;
- address takerToken;
- address feeRecipient;
- uint makerTokenAmount;
- uint takerTokenAmount;
- uint makerFee;
- uint takerFee;
- uint expirationTimestampInSec;
- bytes32 orderHash;
- }
-
- function Exchange(address _zrxToken, address _tokenTransferProxy) {
- ZRX_TOKEN_CONTRACT = _zrxToken;
- TOKEN_TRANSFER_PROXY_CONTRACT = _tokenTransferProxy;
- }
-
- /*
- * Core exchange functions
- */
-
- /// @dev Fills the input order.
- /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient.
- /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt.
- /// @param fillTakerTokenAmount Desired amount of takerToken to fill.
- /// @param shouldThrowOnInsufficientBalanceOrAllowance Test if transfer will fail before attempting.
- /// @param v ECDSA signature parameter v.
- /// @param r ECDSA signature parameters r.
- /// @param s ECDSA signature parameters s.
- /// @return Total amount of takerToken filled in trade.
- function fillOrder(
- address[5] orderAddresses,
- uint[6] orderValues,
- uint fillTakerTokenAmount,
- bool shouldThrowOnInsufficientBalanceOrAllowance,
- uint8 v,
- bytes32 r,
- bytes32 s)
- public
- returns (uint filledTakerTokenAmount)
- {
- Order memory order = Order({
- maker: orderAddresses[0],
- taker: orderAddresses[1],
- makerToken: orderAddresses[2],
- takerToken: orderAddresses[3],
- feeRecipient: orderAddresses[4],
- makerTokenAmount: orderValues[0],
- takerTokenAmount: orderValues[1],
- makerFee: orderValues[2],
- takerFee: orderValues[3],
- expirationTimestampInSec: orderValues[4],
- orderHash: getOrderHash(orderAddresses, orderValues)
- });
-
- require(order.taker == address(0) || order.taker == msg.sender);
- require(order.makerTokenAmount > 0 && order.takerTokenAmount > 0 && fillTakerTokenAmount > 0);
- require(isValidSignature(
- order.maker,
- order.orderHash,
- v,
- r,
- s
- ));
-
- if (block.timestamp >= order.expirationTimestampInSec) {
- LogError(uint8(Errors.ORDER_EXPIRED), order.orderHash);
- return 0;
- }
-
- uint remainingTakerTokenAmount = safeSub(order.takerTokenAmount, getUnavailableTakerTokenAmount(order.orderHash));
- filledTakerTokenAmount = min256(fillTakerTokenAmount, remainingTakerTokenAmount);
- if (filledTakerTokenAmount == 0) {
- LogError(uint8(Errors.ORDER_FULLY_FILLED_OR_CANCELLED), order.orderHash);
- return 0;
- }
-
- if (isRoundingError(filledTakerTokenAmount, order.takerTokenAmount, order.makerTokenAmount)) {
- LogError(uint8(Errors.ROUNDING_ERROR_TOO_LARGE), order.orderHash);
- return 0;
- }
-
- if (!shouldThrowOnInsufficientBalanceOrAllowance && !isTransferable(order, filledTakerTokenAmount)) {
- LogError(uint8(Errors.INSUFFICIENT_BALANCE_OR_ALLOWANCE), order.orderHash);
- return 0;
- }
-
- uint filledMakerTokenAmount = getPartialAmount(filledTakerTokenAmount, order.takerTokenAmount, order.makerTokenAmount);
- uint paidMakerFee;
- uint paidTakerFee;
- filled[order.orderHash] = safeAdd(filled[order.orderHash], filledTakerTokenAmount);
- require(transferViaTokenTransferProxy(
- order.makerToken,
- order.maker,
- msg.sender,
- filledMakerTokenAmount
- ));
- require(transferViaTokenTransferProxy(
- order.takerToken,
- msg.sender,
- order.maker,
- filledTakerTokenAmount
- ));
- if (order.feeRecipient != address(0)) {
- if (order.makerFee > 0) {
- paidMakerFee = getPartialAmount(filledTakerTokenAmount, order.takerTokenAmount, order.makerFee);
- require(transferViaTokenTransferProxy(
- ZRX_TOKEN_CONTRACT,
- order.maker,
- order.feeRecipient,
- paidMakerFee
- ));
- }
- if (order.takerFee > 0) {
- paidTakerFee = getPartialAmount(filledTakerTokenAmount, order.takerTokenAmount, order.takerFee);
- require(transferViaTokenTransferProxy(
- ZRX_TOKEN_CONTRACT,
- msg.sender,
- order.feeRecipient,
- paidTakerFee
- ));
- }
- }
-
- LogFill(
- order.maker,
- msg.sender,
- order.feeRecipient,
- order.makerToken,
- order.takerToken,
- filledMakerTokenAmount,
- filledTakerTokenAmount,
- paidMakerFee,
- paidTakerFee,
- keccak256(order.makerToken, order.takerToken),
- order.orderHash
- );
- return filledTakerTokenAmount;
- }
-
- /// @dev Cancels the input order.
- /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient.
- /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt.
- /// @param cancelTakerTokenAmount Desired amount of takerToken to cancel in order.
- /// @return Amount of takerToken cancelled.
- function cancelOrder(
- address[5] orderAddresses,
- uint[6] orderValues,
- uint cancelTakerTokenAmount)
- public
- returns (uint)
- {
- Order memory order = Order({
- maker: orderAddresses[0],
- taker: orderAddresses[1],
- makerToken: orderAddresses[2],
- takerToken: orderAddresses[3],
- feeRecipient: orderAddresses[4],
- makerTokenAmount: orderValues[0],
- takerTokenAmount: orderValues[1],
- makerFee: orderValues[2],
- takerFee: orderValues[3],
- expirationTimestampInSec: orderValues[4],
- orderHash: getOrderHash(orderAddresses, orderValues)
- });
-
- require(order.maker == msg.sender);
- require(order.makerTokenAmount > 0 && order.takerTokenAmount > 0 && cancelTakerTokenAmount > 0);
-
- if (block.timestamp >= order.expirationTimestampInSec) {
- LogError(uint8(Errors.ORDER_EXPIRED), order.orderHash);
- return 0;
- }
-
- uint remainingTakerTokenAmount = safeSub(order.takerTokenAmount, getUnavailableTakerTokenAmount(order.orderHash));
- uint cancelledTakerTokenAmount = min256(cancelTakerTokenAmount, remainingTakerTokenAmount);
- if (cancelledTakerTokenAmount == 0) {
- LogError(uint8(Errors.ORDER_FULLY_FILLED_OR_CANCELLED), order.orderHash);
- return 0;
- }
-
- cancelled[order.orderHash] = safeAdd(cancelled[order.orderHash], cancelledTakerTokenAmount);
-
- LogCancel(
- order.maker,
- order.feeRecipient,
- order.makerToken,
- order.takerToken,
- getPartialAmount(cancelledTakerTokenAmount, order.takerTokenAmount, order.makerTokenAmount),
- cancelledTakerTokenAmount,
- keccak256(order.makerToken, order.takerToken),
- order.orderHash
- );
- return cancelledTakerTokenAmount;
- }
-
- /*
- * Wrapper functions
- */
-
- /// @dev Fills an order with specified parameters and ECDSA signature, throws if specified amount not filled entirely.
- /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient.
- /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt.
- /// @param fillTakerTokenAmount Desired amount of takerToken to fill.
- /// @param v ECDSA signature parameter v.
- /// @param r ECDSA signature parameters r.
- /// @param s ECDSA signature parameters s.
- function fillOrKillOrder(
- address[5] orderAddresses,
- uint[6] orderValues,
- uint fillTakerTokenAmount,
- uint8 v,
- bytes32 r,
- bytes32 s)
- public
- {
- require(fillOrder(
- orderAddresses,
- orderValues,
- fillTakerTokenAmount,
- false,
- v,
- r,
- s
- ) == fillTakerTokenAmount);
- }
-
- /// @dev Synchronously executes multiple fill orders in a single transaction.
- /// @param orderAddresses Array of address arrays containing individual order addresses.
- /// @param orderValues Array of uint arrays containing individual order values.
- /// @param fillTakerTokenAmounts Array of desired amounts of takerToken to fill in orders.
- /// @param shouldThrowOnInsufficientBalanceOrAllowance Test if transfers will fail before attempting.
- /// @param v Array ECDSA signature v parameters.
- /// @param r Array of ECDSA signature r parameters.
- /// @param s Array of ECDSA signature s parameters.
- function batchFillOrders(
- address[5][] orderAddresses,
- uint[6][] orderValues,
- uint[] fillTakerTokenAmounts,
- bool shouldThrowOnInsufficientBalanceOrAllowance,
- uint8[] v,
- bytes32[] r,
- bytes32[] s)
- public
- {
- for (uint i = 0; i < orderAddresses.length; i++) {
- fillOrder(
- orderAddresses[i],
- orderValues[i],
- fillTakerTokenAmounts[i],
- shouldThrowOnInsufficientBalanceOrAllowance,
- v[i],
- r[i],
- s[i]
- );
- }
- }
-
- /// @dev Synchronously executes multiple fillOrKill orders in a single transaction.
- /// @param orderAddresses Array of address arrays containing individual order addresses.
- /// @param orderValues Array of uint arrays containing individual order values.
- /// @param fillTakerTokenAmounts Array of desired amounts of takerToken to fill in orders.
- /// @param v Array ECDSA signature v parameters.
- /// @param r Array of ECDSA signature r parameters.
- /// @param s Array of ECDSA signature s parameters.
- function batchFillOrKillOrders(
- address[5][] orderAddresses,
- uint[6][] orderValues,
- uint[] fillTakerTokenAmounts,
- uint8[] v,
- bytes32[] r,
- bytes32[] s)
- public
- {
- for (uint i = 0; i < orderAddresses.length; i++) {
- fillOrKillOrder(
- orderAddresses[i],
- orderValues[i],
- fillTakerTokenAmounts[i],
- v[i],
- r[i],
- s[i]
- );
- }
- }
-
- /// @dev Synchronously executes multiple fill orders in a single transaction until total fillTakerTokenAmount filled.
- /// @param orderAddresses Array of address arrays containing individual order addresses.
- /// @param orderValues Array of uint arrays containing individual order values.
- /// @param fillTakerTokenAmount Desired total amount of takerToken to fill in orders.
- /// @param shouldThrowOnInsufficientBalanceOrAllowance Test if transfers will fail before attempting.
- /// @param v Array ECDSA signature v parameters.
- /// @param r Array of ECDSA signature r parameters.
- /// @param s Array of ECDSA signature s parameters.
- /// @return Total amount of fillTakerTokenAmount filled in orders.
- function fillOrdersUpTo(
- address[5][] orderAddresses,
- uint[6][] orderValues,
- uint fillTakerTokenAmount,
- bool shouldThrowOnInsufficientBalanceOrAllowance,
- uint8[] v,
- bytes32[] r,
- bytes32[] s)
- public
- returns (uint)
- {
- uint filledTakerTokenAmount = 0;
- for (uint i = 0; i < orderAddresses.length; i++) {
- require(orderAddresses[i][3] == orderAddresses[0][3]); // takerToken must be the same for each order
- filledTakerTokenAmount = safeAdd(filledTakerTokenAmount, fillOrder(
- orderAddresses[i],
- orderValues[i],
- safeSub(fillTakerTokenAmount, filledTakerTokenAmount),
- shouldThrowOnInsufficientBalanceOrAllowance,
- v[i],
- r[i],
- s[i]
- ));
- if (filledTakerTokenAmount == fillTakerTokenAmount) break;
- }
- return filledTakerTokenAmount;
- }
-
- /// @dev Synchronously cancels multiple orders in a single transaction.
- /// @param orderAddresses Array of address arrays containing individual order addresses.
- /// @param orderValues Array of uint arrays containing individual order values.
- /// @param cancelTakerTokenAmounts Array of desired amounts of takerToken to cancel in orders.
- function batchCancelOrders(
- address[5][] orderAddresses,
- uint[6][] orderValues,
- uint[] cancelTakerTokenAmounts)
- public
- {
- for (uint i = 0; i < orderAddresses.length; i++) {
- cancelOrder(
- orderAddresses[i],
- orderValues[i],
- cancelTakerTokenAmounts[i]
- );
- }
- }
-
- /*
- * Constant public functions
- */
-
- /// @dev Calculates Keccak-256 hash of order with specified parameters.
- /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient.
- /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt.
- /// @return Keccak-256 hash of order.
- function getOrderHash(address[5] orderAddresses, uint[6] orderValues)
- public
- constant
- returns (bytes32)
- {
- return keccak256(
- address(this),
- orderAddresses[0], // maker
- orderAddresses[1], // taker
- orderAddresses[2], // makerToken
- orderAddresses[3], // takerToken
- orderAddresses[4], // feeRecipient
- orderValues[0], // makerTokenAmount
- orderValues[1], // takerTokenAmount
- orderValues[2], // makerFee
- orderValues[3], // takerFee
- orderValues[4], // expirationTimestampInSec
- orderValues[5] // salt
- );
- }
-
- /// @dev Verifies that an order signature is valid.
- /// @param signer address of signer.
- /// @param hash Signed Keccak-256 hash.
- /// @param v ECDSA signature parameter v.
- /// @param r ECDSA signature parameters r.
- /// @param s ECDSA signature parameters s.
- /// @return Validity of order signature.
- function isValidSignature(
- address signer,
- bytes32 hash,
- uint8 v,
- bytes32 r,
- bytes32 s)
- public
- constant
- returns (bool)
- {
- return signer == ecrecover(
- keccak256("\x19Ethereum Signed Message:\n32", hash),
- v,
- r,
- s
- );
- }
-
- /// @dev Checks if rounding error > 0.1%.
- /// @param numerator Numerator.
- /// @param denominator Denominator.
- /// @param target Value to multiply with numerator/denominator.
- /// @return Rounding error is present.
- function isRoundingError(uint numerator, uint denominator, uint target)
- public
- constant
- returns (bool)
- {
- uint remainder = mulmod(target, numerator, denominator);
- if (remainder == 0) return false; // No rounding error.
-
- uint errPercentageTimes1000000 = safeDiv(
- safeMul(remainder, 1000000),
- safeMul(numerator, target)
- );
- return errPercentageTimes1000000 > 1000;
- }
-
- /// @dev Calculates partial value given a numerator and denominator.
- /// @param numerator Numerator.
- /// @param denominator Denominator.
- /// @param target Value to calculate partial of.
- /// @return Partial value of target.
- function getPartialAmount(uint numerator, uint denominator, uint target)
- public
- constant
- returns (uint)
- {
- return safeDiv(safeMul(numerator, target), denominator);
- }
-
- /// @dev Calculates the sum of values already filled and cancelled for a given order.
- /// @param orderHash The Keccak-256 hash of the given order.
- /// @return Sum of values already filled and cancelled.
- function getUnavailableTakerTokenAmount(bytes32 orderHash)
- public
- constant
- returns (uint)
- {
- return safeAdd(filled[orderHash], cancelled[orderHash]);
- }
-
-
- /*
- * Internal functions
- */
-
- /// @dev Transfers a token using TokenTransferProxy transferFrom function.
- /// @param token Address of token to transferFrom.
- /// @param from Address transfering token.
- /// @param to Address receiving token.
- /// @param value Amount of token to transfer.
- /// @return Success of token transfer.
- function transferViaTokenTransferProxy(
- address token,
- address from,
- address to,
- uint value)
- internal
- returns (bool)
- {
- return TokenTransferProxy(TOKEN_TRANSFER_PROXY_CONTRACT).transferFrom(token, from, to, value);
- }
-
- /// @dev Checks if any order transfers will fail.
- /// @param order Order struct of params that will be checked.
- /// @param fillTakerTokenAmount Desired amount of takerToken to fill.
- /// @return Predicted result of transfers.
- function isTransferable(Order order, uint fillTakerTokenAmount)
- internal
- constant // The called token contracts may attempt to change state, but will not be able to due to gas limits on getBalance and getAllowance.
- returns (bool)
- {
- address taker = msg.sender;
- uint fillMakerTokenAmount = getPartialAmount(fillTakerTokenAmount, order.takerTokenAmount, order.makerTokenAmount);
-
- if (order.feeRecipient != address(0)) {
- bool isMakerTokenZRX = order.makerToken == ZRX_TOKEN_CONTRACT;
- bool isTakerTokenZRX = order.takerToken == ZRX_TOKEN_CONTRACT;
- uint paidMakerFee = getPartialAmount(fillTakerTokenAmount, order.takerTokenAmount, order.makerFee);
- uint paidTakerFee = getPartialAmount(fillTakerTokenAmount, order.takerTokenAmount, order.takerFee);
- uint requiredMakerZRX = isMakerTokenZRX ? safeAdd(fillMakerTokenAmount, paidMakerFee) : paidMakerFee;
- uint requiredTakerZRX = isTakerTokenZRX ? safeAdd(fillTakerTokenAmount, paidTakerFee) : paidTakerFee;
-
- if ( getBalance(ZRX_TOKEN_CONTRACT, order.maker) < requiredMakerZRX
- || getAllowance(ZRX_TOKEN_CONTRACT, order.maker) < requiredMakerZRX
- || getBalance(ZRX_TOKEN_CONTRACT, taker) < requiredTakerZRX
- || getAllowance(ZRX_TOKEN_CONTRACT, taker) < requiredTakerZRX
- ) return false;
-
- if (!isMakerTokenZRX && ( getBalance(order.makerToken, order.maker) < fillMakerTokenAmount // Don't double check makerToken if ZRX
- || getAllowance(order.makerToken, order.maker) < fillMakerTokenAmount)
- ) return false;
- if (!isTakerTokenZRX && ( getBalance(order.takerToken, taker) < fillTakerTokenAmount // Don't double check takerToken if ZRX
- || getAllowance(order.takerToken, taker) < fillTakerTokenAmount)
- ) return false;
- } else if ( getBalance(order.makerToken, order.maker) < fillMakerTokenAmount
- || getAllowance(order.makerToken, order.maker) < fillMakerTokenAmount
- || getBalance(order.takerToken, taker) < fillTakerTokenAmount
- || getAllowance(order.takerToken, taker) < fillTakerTokenAmount
- ) return false;
-
- return true;
- }
-
- /// @dev Get token balance of an address.
- /// @param token Address of token.
- /// @param owner Address of owner.
- /// @return Token balance of owner.
- function getBalance(address token, address owner)
- internal
- constant // The called token contract may attempt to change state, but will not be able to due to an added gas limit.
- returns (uint)
- {
- return Token(token).balanceOf.gas(EXTERNAL_QUERY_GAS_LIMIT)(owner); // Limit gas to prevent reentrancy
- }
-
- /// @dev Get allowance of token given to TokenTransferProxy by an address.
- /// @param token Address of token.
- /// @param owner Address of owner.
- /// @return Allowance of token given to TokenTransferProxy by owner.
- function getAllowance(address token, address owner)
- internal
- constant // The called token contract may attempt to change state, but will not be able to due to an added gas limit.
- returns (uint)
- {
- return Token(token).allowance.gas(EXTERNAL_QUERY_GAS_LIMIT)(owner, TOKEN_TRANSFER_PROXY_CONTRACT); // Limit gas to prevent reentrancy
- }
-}
diff --git a/packages/deployer/test/fixtures/contracts/TokenTransferProxy.sol b/packages/deployer/test/fixtures/contracts/TokenTransferProxy.sol
deleted file mode 100644
index 44570d459..000000000
--- a/packages/deployer/test/fixtures/contracts/TokenTransferProxy.sol
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.4.14;
-
-import { Ownable } from "zeppelin-solidity/contracts/ownership/Ownable.sol";
-import { ERC20 as Token } from "zeppelin-solidity/contracts/token/ERC20/ERC20.sol";
-
-/// @title TokenTransferProxy - Transfers tokens on behalf of contracts that have been approved via decentralized governance.
-/// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com>
-contract TokenTransferProxy is Ownable {
-
- /// @dev Only authorized addresses can invoke functions with this modifier.
- modifier onlyAuthorized {
- require(authorized[msg.sender]);
- _;
- }
-
- modifier targetAuthorized(address target) {
- require(authorized[target]);
- _;
- }
-
- modifier targetNotAuthorized(address target) {
- require(!authorized[target]);
- _;
- }
-
- mapping (address => bool) public authorized;
- address[] public authorities;
-
- event LogAuthorizedAddressAdded(address indexed target, address indexed caller);
- event LogAuthorizedAddressRemoved(address indexed target, address indexed caller);
-
- /*
- * Public functions
- */
-
- /// @dev Authorizes an address.
- /// @param target Address to authorize.
- function addAuthorizedAddress(address target)
- public
- onlyOwner
- targetNotAuthorized(target)
- {
- authorized[target] = true;
- authorities.push(target);
- LogAuthorizedAddressAdded(target, msg.sender);
- }
-
- /// @dev Removes authorizion of an address.
- /// @param target Address to remove authorization from.
- function removeAuthorizedAddress(address target)
- public
- onlyOwner
- targetAuthorized(target)
- {
- delete authorized[target];
- for (uint i = 0; i < authorities.length; i++) {
- if (authorities[i] == target) {
- authorities[i] = authorities[authorities.length - 1];
- authorities.length -= 1;
- break;
- }
- }
- LogAuthorizedAddressRemoved(target, msg.sender);
- }
-
- /// @dev Calls into ERC20 Token contract, invoking transferFrom.
- /// @param token Address of token to transfer.
- /// @param from Address to transfer token from.
- /// @param to Address to transfer token to.
- /// @param value Amount of token to transfer.
- /// @return Success of transfer.
- function transferFrom(
- address token,
- address from,
- address to,
- uint value)
- public
- onlyAuthorized
- returns (bool)
- {
- return Token(token).transferFrom(from, to, value);
- }
-
- /*
- * Public constant functions
- */
-
- /// @dev Gets all authorized addresses.
- /// @return Array of authorized addresses.
- function getAuthorizedAddresses()
- public
- constant
- returns (address[])
- {
- return authorities;
- }
-}
diff --git a/packages/deployer/test/fixtures/contracts/base/SafeMath.sol b/packages/deployer/test/fixtures/contracts/base/SafeMath.sol
deleted file mode 100644
index 92ce11cde..000000000
--- a/packages/deployer/test/fixtures/contracts/base/SafeMath.sol
+++ /dev/null
@@ -1,41 +0,0 @@
-pragma solidity ^0.4.14;
-
-contract SafeMath {
- function safeMul(uint a, uint b) internal constant returns (uint256) {
- uint c = a * b;
- assert(a == 0 || c / a == b);
- return c;
- }
-
- function safeDiv(uint a, uint b) internal constant returns (uint256) {
- uint c = a / b;
- return c;
- }
-
- function safeSub(uint a, uint b) internal constant returns (uint256) {
- assert(b <= a);
- return a - b;
- }
-
- function safeAdd(uint a, uint b) internal constant returns (uint256) {
- uint c = a + b;
- assert(c >= a);
- return c;
- }
-
- function max64(uint64 a, uint64 b) internal constant returns (uint64) {
- return a >= b ? a : b;
- }
-
- function min64(uint64 a, uint64 b) internal constant returns (uint64) {
- return a < b ? a : b;
- }
-
- function max256(uint256 a, uint256 b) internal constant returns (uint256) {
- return a >= b ? a : b;
- }
-
- function min256(uint256 a, uint256 b) internal constant returns (uint256) {
- return a < b ? a : b;
- }
-}
diff --git a/packages/deployer/test/fixtures/contracts/base/Token.sol b/packages/deployer/test/fixtures/contracts/base/Token.sol
deleted file mode 100644
index 483010d7d..000000000
--- a/packages/deployer/test/fixtures/contracts/base/Token.sol
+++ /dev/null
@@ -1,38 +0,0 @@
-pragma solidity ^0.4.14;
-
-contract Token {
-
- /// @return total amount of tokens
- function totalSupply() constant returns (uint supply) {}
-
- /// @param _owner The address from which the balance will be retrieved
- /// @return The balance
- function balanceOf(address _owner) constant returns (uint balance) {}
-
- /// @notice send `_value` token to `_to` from `msg.sender`
- /// @param _to The address of the recipient
- /// @param _value The amount of token to be transferred
- /// @return Whether the transfer was successful or not
- function transfer(address _to, uint _value) returns (bool success) {}
-
- /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
- /// @param _from The address of the sender
- /// @param _to The address of the recipient
- /// @param _value The amount of token to be transferred
- /// @return Whether the transfer was successful or not
- function transferFrom(address _from, address _to, uint _value) returns (bool success) {}
-
- /// @notice `msg.sender` approves `_addr` to spend `_value` tokens
- /// @param _spender The address of the account able to transfer the tokens
- /// @param _value The amount of wei to be approved for transfer
- /// @return Whether the approval was successful or not
- function approve(address _spender, uint _value) returns (bool success) {}
-
- /// @param _owner The address of the account owning tokens
- /// @param _spender The address of the account able to transfer the tokens
- /// @return Amount of remaining tokens allowed to spent
- function allowance(address _owner, address _spender) constant returns (uint remaining) {}
-
- event Transfer(address indexed _from, address indexed _to, uint _value);
- event Approval(address indexed _owner, address indexed _spender, uint _value);
-}
diff --git a/packages/deployer/test/fixtures/exchange_bin.ts b/packages/deployer/test/fixtures/exchange_bin.ts
deleted file mode 100644
index 9fbf9bf95..000000000
--- a/packages/deployer/test/fixtures/exchange_bin.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export const constructor_args =
- '0x000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f4980000000000000000000000008da0d80f5007ef1e431dd2127178d224e32c2ef4';
-export const exchange_binary =
- '0x608060405234801561001057600080fd5b50604051604080612d998339810180604052810190808051906020019092919080519060200190929190505050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050612cca806100cf6000396000f3006080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806314df96ee14610101578063288cdc911461015a5780632ac126221461019f578063363349be146101e4578063394c21e7146103f85780633b30ba59146104975780634f150787146104ee578063741bcc931461071b5780637e9abb50146107cf5780638163681e1461081457806398024a8b146108a6578063add1cbc5146108fb578063b7b2c7d614610952578063baa0181d14610b8b578063bc61394a14610cef578063cfc4d0ec14610dc3578063f06bbf7514610e60578063ffa1ad7414610e93575b600080fd5b34801561010d57600080fd5b50610140600480360381019080803590602001909291908035906020019092919080359060200190929190505050610f23565b604051808215151515815260200191505060405180910390f35b34801561016657600080fd5b506101896004803603810190808035600019169060200190929190505050610f7b565b6040518082815260200191505060405180910390f35b3480156101ab57600080fd5b506101ce6004803603810190808035600019169060200190929190505050610f93565b6040518082815260200191505060405180910390f35b3480156101f057600080fd5b506103e260048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561027257848483905060a00201600580602002604051908101604052809291908260056020028082843782019150505050508152602001906001019061022d565b5050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156102f157848483905060c0020160068060200260405190810160405280929190826006602002808284378201915050505050815260200190600101906102ac565b5050505050919291929080359060200190929190803515159060200190929190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610fab565b6040518082815260200191505060405180910390f35b34801561040457600080fd5b506104816004803603810190808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091929192908060c0019060068060200260405190810160405280929190826006602002808284378201915050505050919291929080359060200190929190505050611110565b6040518082815260200191505060405180910390f35b3480156104a357600080fd5b506104ac6115f8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104fa57600080fd5b5061071960048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561057c57848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610537565b5050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156105fb57848483905060c0020160068060200260405190810160405280929190826006602002808284378201915050505050815260200190600101906105b6565b505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929050505061161d565b005b34801561072757600080fd5b506107cd6004803603810190808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091929192908060c0019060068060200260405190810160405280929190826006602002808284378201915050505050919291929080359060200190929190803560ff169060200190929190803560001916906020019092919080356000191690602001909291905050506116da565b005b3480156107db57600080fd5b506107fe60048036038101908080356000191690602001909291905050506116ff565b6040518082815260200191505060405180910390f35b34801561082057600080fd5b5061088c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035600019169060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050611748565b604051808215151515815260200191505060405180910390f35b3480156108b257600080fd5b506108e5600480360381019080803590602001909291908035906020019092919080359060200190929190505050611849565b6040518082815260200191505060405180910390f35b34801561090757600080fd5b50610910611867565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561095e57600080fd5b50610b8960048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156109e057848483905060a00201600580602002604051908101604052809291908260056020028082843782019150505050508152602001906001019061099b565b5050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610a5f57848483905060c002016006806020026040519081016040528092919082600660200280828437820191505050505081526020019060010190610a1a565b505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080351515906020019092919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929050505061188d565b005b348015610b9757600080fd5b50610ced60048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610c1957848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610bd4565b5050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610c9857848483905060c002016006806020026040519081016040528092919082600660200280828437820191505050505081526020019060010190610c53565b505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929050505061194d565b005b348015610cfb57600080fd5b50610dad6004803603810190808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091929192908060c0019060068060200260405190810160405280929190826006602002808284378201915050505050919291929080359060200190929190803515159060200190929190803560ff169060200190929190803560001916906020019092919080356000191690602001909291905050506119c0565b6040518082815260200191505060405180910390f35b348015610dcf57600080fd5b50610e426004803603810190808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091929192908060c00190600680602002604051908101604052809291908260066020028082843782019150505050509192919290505050612160565b60405180826000191660001916815260200191505060405180910390f35b348015610e6c57600080fd5b50610e7561240b565b604051808261ffff1661ffff16815260200191505060405180910390f35b348015610e9f57600080fd5b50610ea8612411565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610ee8578082015181840152602081019050610ecd565b50505050905090810190601f168015610f155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600080600084801515610f3257fe5b86850991506000821415610f495760009250610f72565b610f68610f5983620f424061244a565b610f63888761244a565b61247d565b90506103e8811192505b50509392505050565b60026020528060005260406000206000915090505481565b60036020528060005260406000206000915090505481565b6000806000809150600090505b895181101561110057896000815181101515610fd057fe5b906020019060200201516003600581101515610fe857fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168a8281518110151561101157fe5b90602001906020020151600360058110151561102957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1614151561105057600080fd5b6110e4826110df8c8481518110151561106557fe5b906020019060200201518c8581518110151561107d57fe5b906020019060200201516110918d88612498565b8c8c888151811015156110a057fe5b906020019060200201518c898151811015156110b857fe5b906020019060200201518c8a8151811015156110d057fe5b906020019060200201516119c0565b6124b1565b9150878214156110f357611100565b8080600101915050610fb8565b8192505050979650505050505050565b600061111a612bd2565b6000806101606040519081016040528088600060058110151561113957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600160058110151561116857fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600260058110151561119757fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860036005811015156111c657fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860046005811015156111f557fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200187600060068110151561122457fe5b6020020151815260200187600160068110151561123d57fe5b6020020151815260200187600260068110151561125657fe5b6020020151815260200187600360068110151561126f57fe5b6020020151815260200187600460068110151561128857fe5b6020020151815260200161129c8989612160565b6000191681525092503373ffffffffffffffffffffffffffffffffffffffff16836000015173ffffffffffffffffffffffffffffffffffffffff161415156112e357600080fd5b60008360a001511180156112fb575060008360c00151115b80156113075750600085115b151561131257600080fd5b8261012001514210151561136f57826101400151600019166000600381111561133757fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506115ee565b61138a8360c001516113858561014001516116ff565b612498565b915061139685836124cf565b905060008114156113f05782610140015160001916600160038111156113b857fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506115ee565b61141a600360008561014001516000191660001916815260200190815260200160002054826124b1565b60036000856101400151600019166000191681526020019081526020016000208190555082604001518360600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916836080015173ffffffffffffffffffffffffffffffffffffffff16846000015173ffffffffffffffffffffffffffffffffffffffff167f67d66f160bc93d925d05dae1794c90d2d6d6688b29b84ff069398a9b0458713186604001518760600151611552878a60c001518b60a00151611849565b878a6101400151604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183815260200182600019166000191681526020019550505050505060405180910390a48093505b5050509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b86518110156116d1576116c4878281518110151561163d57fe5b90602001906020020151878381518110151561165557fe5b90602001906020020151878481518110151561166d57fe5b90602001906020020151878581518110151561168557fe5b90602001906020020151878681518110151561169d57fe5b9060200190602002015187878151811015156116b557fe5b906020019060200201516116da565b8080600101915050611623565b50505050505050565b836116eb87878760008888886119c0565b1415156116f757600080fd5b505050505050565b600061174160026000846000191660001916815260200190815260200160002054600360008560001916600019168152602001908152602001600020546124b1565b9050919050565b600060018560405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020858585604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015611806573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614905095945050505050565b600061185e611858858461244a565b8461247d565b90509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b87518110156119435761193588828151811015156118ad57fe5b9060200190602002015188838151811015156118c557fe5b9060200190602002015188848151811015156118dd57fe5b906020019060200201518888868151811015156118f657fe5b90602001906020020151888781518110151561190e57fe5b90602001906020020151888881518110151561192657fe5b906020019060200201516119c0565b508080600101915050611893565b5050505050505050565b60008090505b83518110156119ba576119ac848281518110151561196d57fe5b90602001906020020151848381518110151561198557fe5b90602001906020020151848481518110151561199d57fe5b90602001906020020151611110565b508080600101915050611953565b50505050565b60006119ca612bd2565b600080600080610160604051908101604052808e60006005811015156119ec57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e6001600581101515611a1b57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e6002600581101515611a4a57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e6003600581101515611a7957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e6004600581101515611aa857fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018d6000600681101515611ad757fe5b602002015181526020018d6001600681101515611af057fe5b602002015181526020018d6002600681101515611b0957fe5b602002015181526020018d6003600681101515611b2257fe5b602002015181526020018d6004600681101515611b3b57fe5b60200201518152602001611b4f8f8f612160565b600019168152509450600073ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff161480611bc657503373ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff16145b1515611bd157600080fd5b60008560a00151118015611be9575060008560c00151115b8015611bf5575060008b115b1515611c0057600080fd5b611c1685600001518661014001518b8b8b611748565b1515611c2157600080fd5b84610120015142101515611c7e578461014001516000191660006003811115611c4657fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612150565b611c998560c00151611c948761014001516116ff565b612498565b9350611ca58b856124cf565b95506000861415611cff578461014001516000191660016003811115611cc757fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612150565b611d12868660c001518760a00151610f23565b15611d66578461014001516000191660026003811115611d2e57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612150565b89158015611d7b5750611d7985876124e8565b155b15611dce5784610140015160001916600380811115611d9657fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612150565b611de1868660c001518760a00151611849565b9250611e0d600260008761014001516000191660001916815260200190815260200160002054876124b1565b600260008761014001516000191660001916815260200190815260200160002081905550611e45856040015186600001513386612838565b1515611e5057600080fd5b611e64856060015133876000015189612838565b1515611e6f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16856080015173ffffffffffffffffffffffffffffffffffffffff16141515611f6e5760008560e001511115611f0c57611ec9868660c001518760e00151611849565b9150611f006000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168660000151876080015185612838565b1515611f0b57600080fd5b5b60008561010001511115611f6d57611f2e868660c00151876101000151611849565b9050611f616000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633876080015184612838565b1515611f6c57600080fd5b5b5b84604001518560600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916856080015173ffffffffffffffffffffffffffffffffffffffff16866000015173ffffffffffffffffffffffffffffffffffffffff167f0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb33389604001518a60600151898d8a8a8f6101400151604051808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186815260200185815260200184815260200183815260200182600019166000191681526020019850505050505050505060405180910390a48595505b5050505050979650505050505050565b60003083600060058110151561217257fe5b602002015184600160058110151561218657fe5b602002015185600260058110151561219a57fe5b60200201518660036005811015156121ae57fe5b60200201518760046005811015156121c257fe5b60200201518760006006811015156121d657fe5b60200201518860016006811015156121ea57fe5b60200201518960026006811015156121fe57fe5b60200201518a600360068110151561221257fe5b60200201518b600460068110151561222657fe5b60200201518c600560068110151561223a57fe5b6020020151604051808d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018781526020018681526020018581526020018481526020018381526020018281526020019c505050505050505050505050506040518091039020905092915050565b61138781565b6040805190810160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b6000808284029050600084148061246b575082848281151561246857fe5b04145b151561247357fe5b8091505092915050565b600080828481151561248b57fe5b0490508091505092915050565b60008282111515156124a657fe5b818303905092915050565b60008082840190508381101515156124c557fe5b8091505092915050565b60008183106124de57816124e0565b825b905092915050565b600080600080600080600080600033975061250c8a8c60c001518d60a00151611849565b9650600073ffffffffffffffffffffffffffffffffffffffff168b6080015173ffffffffffffffffffffffffffffffffffffffff161415156127b9576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6040015173ffffffffffffffffffffffffffffffffffffffff161495506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6060015173ffffffffffffffffffffffffffffffffffffffff161494506126078a8c60c001518d60e00151611849565b935061261d8a8c60c001518d6101000151611849565b92508561262a5783612635565b61263487856124b1565b5b915084612642578261264d565b61264c8a846124b1565b5b90508161267f6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d600001516129ac565b10806126b85750816126b66000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d60000151612a94565b105b806126ec5750806126ea6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a6129ac565b105b8061272057508061271e6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a612a94565b105b1561272e576000985061282a565b8515801561276757508661274a8c604001518d600001516129ac565b10806127665750866127648c604001518d60000151612a94565b105b5b15612775576000985061282a565b841580156127a657508961278d8c606001518a6129ac565b10806127a55750896127a38c606001518a612a94565b105b5b156127b4576000985061282a565b612825565b866127cc8c604001518d600001516129ac565b10806127e85750866127e68c604001518d60000151612a94565b105b806127ff5750896127fd8c606001518a6129ac565b105b806128165750896128148c606001518a612a94565b105b15612824576000985061282a565b5b600198505b505050505050505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166315dacbea868686866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050602060405180830381600087803b15801561296757600080fd5b505af115801561297b573d6000803e3d6000fd5b505050506040513d602081101561299157600080fd5b81019080805190602001909291905050509050949350505050565b60008273ffffffffffffffffffffffffffffffffffffffff166370a0823161138761ffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600088803b158015612a5057600080fd5b5087f1158015612a64573d6000803e3d6000fd5b50505050506040513d6020811015612a7b57600080fd5b8101908080519060200190929190505050905092915050565b60008273ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e61138761ffff1684600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600088803b158015612b8e57600080fd5b5087f1158015612ba2573d6000803e3d6000fd5b50505050506040513d6020811015612bb957600080fd5b8101908080519060200190929190505050905092915050565b61016060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000801916815250905600a165627a7a72305820f91599ebd80f85632ef190bb5e1a738e7288d68a2cf9dcc6b579d76b892dcf6f0029';
diff --git a/packages/deployer/test/util/constants.ts b/packages/deployer/test/util/constants.ts
deleted file mode 100644
index b93081a80..000000000
--- a/packages/deployer/test/util/constants.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { BigNumber } from '@0xproject/utils';
-
-export const constants = {
- networkId: 0,
- optimizerEnabled: false,
- gasPrice: new BigNumber(20000000000),
- timeoutMs: 30000,
- zrxTokenAddress: '0xe41d2489571d322189246dafa5ebde1f4699f498',
- tokenTransferProxyAddress: '0x8da0d80f5007ef1e431dd2127178d224e32c2ef4',
- specifiedContracts: '*',
-};
diff --git a/packages/deployer/test/util/provider.ts b/packages/deployer/test/util/provider.ts
deleted file mode 100644
index e0fcb362a..000000000
--- a/packages/deployer/test/util/provider.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { web3Factory } from '@0xproject/dev-utils';
-import { Provider } from '@0xproject/types';
-import * as Web3 from 'web3';
-
-const providerConfigs = { shouldUseInProcessGanache: true };
-const web3Instance = web3Factory.create(providerConfigs);
-const provider: Provider = web3Instance.currentProvider;
-
-export { provider };
diff --git a/packages/deployer/tsconfig.json b/packages/deployer/tsconfig.json
deleted file mode 100644
index 63cbc75c3..000000000
--- a/packages/deployer/tsconfig.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "extends": "../../tsconfig",
- "compilerOptions": {
- "outDir": "lib",
- "strictFunctionTypes": false
- },
- "include": ["./src/**/*", "./test/**/*"]
-}
diff --git a/packages/deployer/tslint.json b/packages/deployer/tslint.json
deleted file mode 100644
index ffaefe83a..000000000
--- a/packages/deployer/tslint.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "extends": ["@0xproject/tslint-config"]
-}