aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer
diff options
context:
space:
mode:
Diffstat (limited to 'packages/deployer')
-rw-r--r--packages/deployer/package.json82
-rw-r--r--packages/deployer/src/cli.ts218
-rw-r--r--packages/deployer/src/commands.ts24
-rw-r--r--packages/deployer/src/compiler.ts450
-rw-r--r--packages/deployer/src/deployer.ts326
-rw-r--r--packages/deployer/src/globals.d.ts6
-rw-r--r--packages/deployer/src/migrations/config/multisig_sample.ts10
-rw-r--r--packages/deployer/src/migrations/config/token_info.ts70
-rw-r--r--packages/deployer/src/migrations/migrate.ts154
-rw-r--r--packages/deployer/src/solc/bin_paths.ts20
-rw-r--r--packages/deployer/src/types.ts24
-rw-r--r--packages/deployer/src/utils/constants.ts2
-rw-r--r--packages/deployer/src/utils/contract.ts144
-rw-r--r--packages/deployer/src/utils/encoder.ts24
-rw-r--r--packages/deployer/src/utils/fs_wrapper.ts12
-rw-r--r--packages/deployer/src/utils/types.ts110
-rw-r--r--packages/deployer/src/utils/utils.ts22
-rw-r--r--packages/deployer/test/deploy_test.ts122
-rw-r--r--packages/deployer/test/fixtures/exchange_bin.ts4
-rw-r--r--packages/deployer/test/util/constants.ts14
-rw-r--r--packages/deployer/tsconfig.json28
21 files changed, 933 insertions, 933 deletions
diff --git a/packages/deployer/package.json b/packages/deployer/package.json
index 423d3bad8..f78f49497 100644
--- a/packages/deployer/package.json
+++ b/packages/deployer/package.json
@@ -1,43 +1,43 @@
{
- "name": "@0xproject/deployer",
- "version": "0.0.3",
- "description": "Smart contract deployer of 0x protocol",
- "main": "lib/src/cli.js",
- "scripts": {
- "build": "yarn clean && copyfiles 'test/fixtures/contracts/**/*' src/solc/solc_bin/* ./lib && tsc",
- "test": "npm run build; mocha lib/test/*_test.js",
- "compile": "npm run build; node lib/src/cli.js compile",
- "clean": "rm -rf ./lib",
- "migrate": "npm run build; node lib/src/cli.js migrate",
- "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
- "test:circleci": "yarn test"
- },
- "bin": {
- "0x-deployer": "lib/src/cli.js"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/0xProject/0x.js.git"
- },
- "author": "Amir Bandeali",
- "license": "Apache-2.0",
- "bugs": {
- "url": "https://github.com/0xProject/0x.js/issues"
- },
- "homepage": "https://github.com/0xProject/0x.js/packages/deployer/README.md",
- "devDependencies": {
- "copyfiles": "^1.2.0",
- "types-bn": "^0.0.1",
- "typescript": "~2.6.1",
- "web3-typescript-typings": "^0.9.6"
- },
- "dependencies": {
- "@0xproject/utils": "^0.1.3",
- "@0xproject/web3-wrapper": "^0.1.7",
- "lodash": "^4.17.4",
- "solc": "^0.4.18",
- "web3": "^0.20.0",
- "web3-eth-abi": "^1.0.0-beta.24",
- "yargs": "^10.0.3"
- }
+ "name": "@0xproject/deployer",
+ "version": "0.0.3",
+ "description": "Smart contract deployer of 0x protocol",
+ "main": "lib/src/cli.js",
+ "scripts": {
+ "build": "yarn clean && copyfiles 'test/fixtures/contracts/**/*' src/solc/solc_bin/* ./lib && tsc",
+ "test": "npm run build; mocha lib/test/*_test.js",
+ "compile": "npm run build; node lib/src/cli.js compile",
+ "clean": "rm -rf ./lib",
+ "migrate": "npm run build; node lib/src/cli.js migrate",
+ "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
+ "test:circleci": "yarn test"
+ },
+ "bin": {
+ "0x-deployer": "lib/src/cli.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x.js.git"
+ },
+ "author": "Amir Bandeali",
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x.js/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x.js/packages/deployer/README.md",
+ "devDependencies": {
+ "copyfiles": "^1.2.0",
+ "types-bn": "^0.0.1",
+ "typescript": "~2.6.1",
+ "web3-typescript-typings": "^0.9.6"
+ },
+ "dependencies": {
+ "@0xproject/utils": "^0.1.3",
+ "@0xproject/web3-wrapper": "^0.1.7",
+ "lodash": "^4.17.4",
+ "solc": "^0.4.18",
+ "web3": "^0.20.0",
+ "web3-eth-abi": "^1.0.0-beta.24",
+ "yargs": "^10.0.3"
+ }
}
diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts
index decb37fdc..f4241b1cc 100644
--- a/packages/deployer/src/cli.ts
+++ b/packages/deployer/src/cli.ts
@@ -20,13 +20,13 @@ const DEFAULT_GAS_PRICE = (10 ** 9 * 2).toString();
* @param argv Instance of process.argv provided by yargs.
*/
async function onCompileCommand(argv: CliOptions): Promise<void> {
- const opts: CompilerOptions = {
- contractsDir: argv.contractsDir,
- networkId: argv.networkId,
- optimizerEnabled: argv.shouldOptimize ? 1 : 0,
- artifactsDir: argv.artifactsDir,
- };
- await commands.compileAsync(opts);
+ const opts: CompilerOptions = {
+ contractsDir: argv.contractsDir,
+ networkId: argv.networkId,
+ optimizerEnabled: argv.shouldOptimize ? 1 : 0,
+ artifactsDir: argv.artifactsDir,
+ };
+ await commands.compileAsync(opts);
}
/**
* Compiles all contracts and runs migration script with options passed in through CLI.
@@ -34,123 +34,123 @@ async function onCompileCommand(argv: CliOptions): Promise<void> {
* @param argv Instance of process.argv provided by yargs.
*/
async function onMigrateCommand(argv: CliOptions): Promise<void> {
- const url = `http://localhost:${argv.jsonrpcPort}`;
- const web3Provider = new Web3.providers.HttpProvider(url);
- const web3Wrapper = new Web3Wrapper(web3Provider);
- const networkId = await web3Wrapper.getNetworkIdAsync();
- const compilerOpts: CompilerOptions = {
- contractsDir: argv.contractsDir,
- networkId,
- optimizerEnabled: argv.shouldOptimize ? 1 : 0,
- artifactsDir: argv.artifactsDir,
- };
- await commands.compileAsync(compilerOpts);
+ const url = `http://localhost:${argv.jsonrpcPort}`;
+ const web3Provider = new Web3.providers.HttpProvider(url);
+ const web3Wrapper = new Web3Wrapper(web3Provider);
+ const networkId = await web3Wrapper.getNetworkIdAsync();
+ const compilerOpts: CompilerOptions = {
+ contractsDir: argv.contractsDir,
+ networkId,
+ optimizerEnabled: argv.shouldOptimize ? 1 : 0,
+ artifactsDir: argv.artifactsDir,
+ };
+ await commands.compileAsync(compilerOpts);
- const defaults = {
- gasPrice: new BigNumber(argv.gasPrice),
- from: argv.account,
- };
- const deployerOpts = {
- artifactsDir: argv.artifactsDir,
- jsonrpcPort: argv.jsonrpcPort,
- networkId,
- defaults,
- };
- await commands.migrateAsync(deployerOpts);
+ const defaults = {
+ gasPrice: new BigNumber(argv.gasPrice),
+ from: argv.account,
+ };
+ const deployerOpts = {
+ artifactsDir: argv.artifactsDir,
+ jsonrpcPort: argv.jsonrpcPort,
+ networkId,
+ defaults,
+ };
+ await commands.migrateAsync(deployerOpts);
}
/**
* Deploys a single contract with provided name and args.
* @param argv Instance of process.argv provided by yargs.
*/
async function onDeployCommand(argv: CliOptions): Promise<void> {
- const url = `http://localhost:${argv.jsonrpcPort}`;
- const web3Provider = new Web3.providers.HttpProvider(url);
- const web3Wrapper = new Web3Wrapper(web3Provider);
- const networkId = await web3Wrapper.getNetworkIdAsync();
- const compilerOpts: CompilerOptions = {
- contractsDir: argv.contractsDir,
- networkId,
- optimizerEnabled: argv.shouldOptimize ? 1 : 0,
- artifactsDir: argv.artifactsDir,
- };
- await commands.compileAsync(compilerOpts);
+ const url = `http://localhost:${argv.jsonrpcPort}`;
+ const web3Provider = new Web3.providers.HttpProvider(url);
+ const web3Wrapper = new Web3Wrapper(web3Provider);
+ const networkId = await web3Wrapper.getNetworkIdAsync();
+ const compilerOpts: CompilerOptions = {
+ contractsDir: argv.contractsDir,
+ networkId,
+ optimizerEnabled: argv.shouldOptimize ? 1 : 0,
+ artifactsDir: argv.artifactsDir,
+ };
+ await commands.compileAsync(compilerOpts);
- const defaults = {
- gasPrice: new BigNumber(argv.gasPrice),
- from: argv.account,
- };
- const deployerOpts: DeployerOptions = {
- artifactsDir: argv.artifactsDir,
- jsonrpcPort: argv.jsonrpcPort,
- networkId,
- defaults,
- };
- const deployerArgsString = argv.args;
- const deployerArgs = deployerArgsString.split(',');
- await commands.deployAsync(argv.contract, deployerArgs, deployerOpts);
+ const defaults = {
+ gasPrice: new BigNumber(argv.gasPrice),
+ from: argv.account,
+ };
+ const deployerOpts: DeployerOptions = {
+ artifactsDir: argv.artifactsDir,
+ jsonrpcPort: argv.jsonrpcPort,
+ networkId,
+ defaults,
+ };
+ const deployerArgsString = argv.args;
+ const deployerArgs = deployerArgsString.split(',');
+ await commands.deployAsync(argv.contract, deployerArgs, deployerOpts);
}
/**
* 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;
+ 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-port', {
- type: 'number',
- default: DEFAULT_JSONRPC_PORT,
- description: 'port connected to 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',
- })
- .command('compile', 'compile contracts', identityCommandBuilder, onCompileCommand)
- .command(
- 'migrate',
- 'compile and deploy contracts using migration scripts',
- identityCommandBuilder,
- onMigrateCommand,
- )
- .command('deploy', 'deploy a single contract with provided arguments', deployCommandBuilder, onDeployCommand)
- .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-port', {
+ type: 'number',
+ default: DEFAULT_JSONRPC_PORT,
+ description: 'port connected to 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',
+ })
+ .command('compile', 'compile contracts', identityCommandBuilder, onCompileCommand)
+ .command(
+ 'migrate',
+ 'compile and deploy contracts using migration scripts',
+ identityCommandBuilder,
+ onMigrateCommand,
+ )
+ .command('deploy', 'deploy a single contract with provided arguments', deployCommandBuilder, onDeployCommand)
+ .help().argv;
})();
diff --git a/packages/deployer/src/commands.ts b/packages/deployer/src/commands.ts
index 2acef8e8f..63e75685e 100644
--- a/packages/deployer/src/commands.ts
+++ b/packages/deployer/src/commands.ts
@@ -4,16 +4,16 @@ 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.compileAllAsync();
- },
- async migrateAsync(opts: DeployerOptions): Promise<void> {
- const deployer = new Deployer(opts);
- await migrator.runMigrationsAsync(deployer);
- },
- async deployAsync(contractName: string, args: any[], opts: DeployerOptions): Promise<void> {
- const deployer = new Deployer(opts);
- await deployer.deployAndSaveAsync(contractName, args);
- },
+ async compileAsync(opts: CompilerOptions): Promise<void> {
+ const compiler = new Compiler(opts);
+ await compiler.compileAllAsync();
+ },
+ async migrateAsync(opts: DeployerOptions): Promise<void> {
+ const deployer = new Deployer(opts);
+ await migrator.runMigrationsAsync(deployer);
+ },
+ 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
index 63db6c865..bc003149c 100644
--- a/packages/deployer/src/compiler.ts
+++ b/packages/deployer/src/compiler.ts
@@ -7,245 +7,245 @@ import * as Web3 from 'web3';
import { binPaths } from './solc/bin_paths';
import { fsWrapper } from './utils/fs_wrapper';
import {
- CompilerOptions,
- ContractArtifact,
- ContractData,
- ContractNetworks,
- ContractSources,
- ImportContents,
+ CompilerOptions,
+ ContractArtifact,
+ ContractData,
+ ContractNetworks,
+ ContractSources,
+ ImportContents,
} from './utils/types';
import { utils } from './utils/utils';
const SOLIDITY_FILE_EXTENSION = '.sol';
export class Compiler {
- private _contractsDir: string;
- private _networkId: number;
- private _optimizerEnabled: number;
- private _artifactsDir: string;
- private _contractSourcesIfExists?: ContractSources;
- private _solcErrors: Set<string>;
- /**
- * Recursively retrieves Solidity source code from directory.
- * @param dirPath Directory to search.
- * @return Mapping of contract name to contract source.
- */
- private static async _getContractSourcesAsync(dirPath: string): Promise<ContractSources> {
- let dirContents: string[] = [];
- try {
- dirContents = await fsWrapper.readdirAsync(dirPath);
- } catch (err) {
- throw new Error(`No directory found at ${dirPath}`);
- }
- let sources: ContractSources = {};
- for (const name of dirContents) {
- const contentPath = `${dirPath}/${name}`;
- if (path.extname(name) === SOLIDITY_FILE_EXTENSION) {
- try {
- const opts = {
- encoding: 'utf8',
- };
- sources[name] = await fsWrapper.readFileAsync(contentPath, opts);
- utils.consoleLog(`Reading ${name} source...`);
- } catch (err) {
- utils.consoleLog(`Could not find file at ${contentPath}`);
- }
- } else {
- try {
- const nestedSources = await Compiler._getContractSourcesAsync(contentPath);
- sources = {
- ...sources,
- ...nestedSources,
- };
- } catch (err) {
- utils.consoleLog(`${contentPath} is not a directory or ${SOLIDITY_FILE_EXTENSION} file`);
- }
- }
- }
- return sources;
- }
- /**
- * Searches Solidity source code for compiler version.
- * @param source Source code of contract.
- * @return Solc compiler version.
- */
- private static _parseSolidityVersion(source: string): string {
- const solcVersionMatch = source.match(/(?:solidity\s\^?)([0-9]{1,2}[.][0-9]{1,2}[.][0-9]{1,2})/);
- if (_.isNull(solcVersionMatch)) {
- throw new Error('Could not find Solidity version in source');
- }
- const solcVersion = solcVersionMatch[1];
- return solcVersion;
- }
- /**
- * 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.
- */
- private static _getNormalizedErrMsg(errMsg: string): string {
- const errPathMatch = errMsg.match(/(.*\.sol)/);
- 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;
- }
- /**
- * 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._solcErrors = new Set();
- }
- /**
- * Compiles all Solidity files found in contractsDir and writes JSON artifacts to artifactsDir.
- */
- public async compileAllAsync(): Promise<void> {
- await this._createArtifactsDirIfDoesNotExistAsync();
- this._contractSourcesIfExists = await Compiler._getContractSourcesAsync(this._contractsDir);
- const contractBaseNames = _.keys(this._contractSourcesIfExists);
- const compiledContractPromises = _.map(contractBaseNames, async (contractBaseName: string): Promise<void> => {
- return this._compileContractAsync(contractBaseName);
- });
- await Promise.all(compiledContractPromises);
+ private _contractsDir: string;
+ private _networkId: number;
+ private _optimizerEnabled: number;
+ private _artifactsDir: string;
+ private _contractSourcesIfExists?: ContractSources;
+ private _solcErrors: Set<string>;
+ /**
+ * Recursively retrieves Solidity source code from directory.
+ * @param dirPath Directory to search.
+ * @return Mapping of contract name to contract source.
+ */
+ private static async _getContractSourcesAsync(dirPath: string): Promise<ContractSources> {
+ let dirContents: string[] = [];
+ try {
+ dirContents = await fsWrapper.readdirAsync(dirPath);
+ } catch (err) {
+ throw new Error(`No directory found at ${dirPath}`);
+ }
+ let sources: ContractSources = {};
+ for (const name of dirContents) {
+ const contentPath = `${dirPath}/${name}`;
+ if (path.extname(name) === SOLIDITY_FILE_EXTENSION) {
+ try {
+ const opts = {
+ encoding: 'utf8',
+ };
+ sources[name] = await fsWrapper.readFileAsync(contentPath, opts);
+ utils.consoleLog(`Reading ${name} source...`);
+ } catch (err) {
+ utils.consoleLog(`Could not find file at ${contentPath}`);
+ }
+ } else {
+ try {
+ const nestedSources = await Compiler._getContractSourcesAsync(contentPath);
+ sources = {
+ ...sources,
+ ...nestedSources,
+ };
+ } catch (err) {
+ utils.consoleLog(`${contentPath} is not a directory or ${SOLIDITY_FILE_EXTENSION} file`);
+ }
+ }
+ }
+ return sources;
+ }
+ /**
+ * Searches Solidity source code for compiler version.
+ * @param source Source code of contract.
+ * @return Solc compiler version.
+ */
+ private static _parseSolidityVersion(source: string): string {
+ const solcVersionMatch = source.match(/(?:solidity\s\^?)([0-9]{1,2}[.][0-9]{1,2}[.][0-9]{1,2})/);
+ if (_.isNull(solcVersionMatch)) {
+ throw new Error('Could not find Solidity version in source');
+ }
+ const solcVersion = solcVersionMatch[1];
+ return solcVersion;
+ }
+ /**
+ * 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.
+ */
+ private static _getNormalizedErrMsg(errMsg: string): string {
+ const errPathMatch = errMsg.match(/(.*\.sol)/);
+ 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;
+ }
+ /**
+ * 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._solcErrors = new Set();
+ }
+ /**
+ * Compiles all Solidity files found in contractsDir and writes JSON artifacts to artifactsDir.
+ */
+ public async compileAllAsync(): Promise<void> {
+ await this._createArtifactsDirIfDoesNotExistAsync();
+ this._contractSourcesIfExists = await Compiler._getContractSourcesAsync(this._contractsDir);
+ const contractBaseNames = _.keys(this._contractSourcesIfExists);
+ const compiledContractPromises = _.map(contractBaseNames, async (contractBaseName: string): Promise<void> => {
+ return this._compileContractAsync(contractBaseName);
+ });
+ await Promise.all(compiledContractPromises);
- this._solcErrors.forEach(errMsg => {
- utils.consoleLog(errMsg);
- });
- }
- /**
- * Compiles contract and saves artifact to artifactsDir.
- * @param contractBaseName Name of contract with '.sol' extension.
- */
- private async _compileContractAsync(contractBaseName: string): Promise<void> {
- if (_.isUndefined(this._contractSourcesIfExists)) {
- throw new Error('Contract sources not yet initialized');
- }
+ this._solcErrors.forEach(errMsg => {
+ utils.consoleLog(errMsg);
+ });
+ }
+ /**
+ * Compiles contract and saves artifact to artifactsDir.
+ * @param contractBaseName Name of contract with '.sol' extension.
+ */
+ private async _compileContractAsync(contractBaseName: string): Promise<void> {
+ if (_.isUndefined(this._contractSourcesIfExists)) {
+ throw new Error('Contract sources not yet initialized');
+ }
- const source = this._contractSourcesIfExists[contractBaseName];
- const contractName = path.basename(contractBaseName, SOLIDITY_FILE_EXTENSION);
- const currentArtifactPath = `${this._artifactsDir}/${contractName}.json`;
- const sourceHash = `0x${ethUtil.sha3(source).toString('hex')}`;
+ const source = this._contractSourcesIfExists[contractBaseName];
+ const contractName = path.basename(contractBaseName, SOLIDITY_FILE_EXTENSION);
+ const currentArtifactPath = `${this._artifactsDir}/${contractName}.json`;
+ const sourceHash = `0x${ethUtil.sha3(source).toString('hex')}`;
- let currentArtifactString: string;
- let currentArtifact: ContractArtifact;
- let oldNetworks: ContractNetworks;
- let shouldCompile: boolean;
- try {
- const opts = {
- encoding: 'utf8',
- };
- currentArtifactString = await fsWrapper.readFileAsync(currentArtifactPath, opts);
- currentArtifact = JSON.parse(currentArtifactString);
- oldNetworks = currentArtifact.networks;
- const oldNetwork: ContractData = oldNetworks[this._networkId];
- shouldCompile =
- _.isUndefined(oldNetwork) ||
- oldNetwork.keccak256 !== sourceHash ||
- oldNetwork.optimizer_enabled !== this._optimizerEnabled;
- } catch (err) {
- shouldCompile = true;
- }
+ let currentArtifactString: string;
+ let currentArtifact: ContractArtifact;
+ let oldNetworks: ContractNetworks;
+ let shouldCompile: boolean;
+ try {
+ const opts = {
+ encoding: 'utf8',
+ };
+ currentArtifactString = await fsWrapper.readFileAsync(currentArtifactPath, opts);
+ currentArtifact = JSON.parse(currentArtifactString);
+ oldNetworks = currentArtifact.networks;
+ const oldNetwork: ContractData = oldNetworks[this._networkId];
+ shouldCompile =
+ _.isUndefined(oldNetwork) ||
+ oldNetwork.keccak256 !== sourceHash ||
+ oldNetwork.optimizer_enabled !== this._optimizerEnabled;
+ } catch (err) {
+ shouldCompile = true;
+ }
- if (!shouldCompile) {
- return;
- }
+ if (!shouldCompile) {
+ return;
+ }
- const input = {
- [contractBaseName]: source,
- };
- const solcVersion = Compiler._parseSolidityVersion(source);
- const fullSolcVersion = binPaths[solcVersion];
- const solcBinPath = `./solc/solc_bin/${fullSolcVersion}`;
- const solcBin = require(solcBinPath);
- const solcInstance = solc.setupMethods(solcBin);
+ const input = {
+ [contractBaseName]: source,
+ };
+ const solcVersion = Compiler._parseSolidityVersion(source);
+ const fullSolcVersion = binPaths[solcVersion];
+ const solcBinPath = `./solc/solc_bin/${fullSolcVersion}`;
+ const solcBin = require(solcBinPath);
+ const solcInstance = solc.setupMethods(solcBin);
- utils.consoleLog(`Compiling ${contractBaseName}...`);
- const sourcesToCompile = {
- sources: input,
- };
- const compiled = solcInstance.compile(
- sourcesToCompile,
- this._optimizerEnabled,
- this._findImportsIfSourcesExist.bind(this),
- );
+ utils.consoleLog(`Compiling ${contractBaseName}...`);
+ const sourcesToCompile = {
+ sources: input,
+ };
+ const compiled = solcInstance.compile(
+ sourcesToCompile,
+ this._optimizerEnabled,
+ this._findImportsIfSourcesExist.bind(this),
+ );
- if (!_.isUndefined(compiled.errors)) {
- _.each(compiled.errors, errMsg => {
- const normalizedErrMsg = Compiler._getNormalizedErrMsg(errMsg);
- this._solcErrors.add(normalizedErrMsg);
- });
- }
+ if (!_.isUndefined(compiled.errors)) {
+ _.each(compiled.errors, errMsg => {
+ const normalizedErrMsg = Compiler._getNormalizedErrMsg(errMsg);
+ this._solcErrors.add(normalizedErrMsg);
+ });
+ }
- const contractIdentifier = `${contractBaseName}:${contractName}`;
- const abi: Web3.ContractAbi = JSON.parse(compiled.contracts[contractIdentifier].interface);
- const unlinked_binary = `0x${compiled.contracts[contractIdentifier].bytecode}`;
- const updated_at = Date.now();
- const contractData: ContractData = {
- solc_version: solcVersion,
- keccak256: sourceHash,
- optimizer_enabled: this._optimizerEnabled,
- abi,
- unlinked_binary,
- updated_at,
- };
+ const contractIdentifier = `${contractBaseName}:${contractName}`;
+ const abi: Web3.ContractAbi = JSON.parse(compiled.contracts[contractIdentifier].interface);
+ const unlinked_binary = `0x${compiled.contracts[contractIdentifier].bytecode}`;
+ const updated_at = Date.now();
+ const contractData: ContractData = {
+ solc_version: solcVersion,
+ keccak256: sourceHash,
+ optimizer_enabled: this._optimizerEnabled,
+ abi,
+ unlinked_binary,
+ updated_at,
+ };
- let newArtifact: ContractArtifact;
- if (!_.isUndefined(currentArtifactString)) {
- newArtifact = {
- ...currentArtifact,
- networks: {
- ...oldNetworks,
- [this._networkId]: contractData,
- },
- };
- } else {
- newArtifact = {
- contract_name: contractName,
- networks: {
- [this._networkId]: contractData,
- },
- };
- }
+ let newArtifact: ContractArtifact;
+ if (!_.isUndefined(currentArtifactString)) {
+ newArtifact = {
+ ...currentArtifact,
+ networks: {
+ ...oldNetworks,
+ [this._networkId]: contractData,
+ },
+ };
+ } else {
+ newArtifact = {
+ contract_name: contractName,
+ networks: {
+ [this._networkId]: contractData,
+ },
+ };
+ }
- const artifactString = utils.stringifyWithFormatting(newArtifact);
- await fsWrapper.writeFileAsync(currentArtifactPath, artifactString);
- utils.consoleLog(`${contractBaseName} artifact saved!`);
- }
- /**
- * Callback to resolve dependencies with `solc.compile`.
- * Throws error if contractSources not yet initialized.
- * @param importPath Path to an imported dependency.
- * @return Import contents object containing source code of dependency.
- */
- private _findImportsIfSourcesExist(importPath: string): ImportContents {
- if (_.isUndefined(this._contractSourcesIfExists)) {
- throw new Error('Contract sources not yet initialized');
- }
- const contractBaseName = path.basename(importPath);
- const source = this._contractSourcesIfExists[contractBaseName];
- const importContents: ImportContents = {
- contents: source,
- };
- return importContents;
- }
- /**
- * Creates the artifacts directory if it does not already exist.
- */
- private async _createArtifactsDirIfDoesNotExistAsync(): Promise<void> {
- if (!fsWrapper.doesPathExistSync(this._artifactsDir)) {
- utils.consoleLog('Creating artifacts directory...');
- await fsWrapper.mkdirAsync(this._artifactsDir);
- }
- }
+ const artifactString = utils.stringifyWithFormatting(newArtifact);
+ await fsWrapper.writeFileAsync(currentArtifactPath, artifactString);
+ utils.consoleLog(`${contractBaseName} artifact saved!`);
+ }
+ /**
+ * Callback to resolve dependencies with `solc.compile`.
+ * Throws error if contractSources not yet initialized.
+ * @param importPath Path to an imported dependency.
+ * @return Import contents object containing source code of dependency.
+ */
+ private _findImportsIfSourcesExist(importPath: string): ImportContents {
+ if (_.isUndefined(this._contractSourcesIfExists)) {
+ throw new Error('Contract sources not yet initialized');
+ }
+ const contractBaseName = path.basename(importPath);
+ const source = this._contractSourcesIfExists[contractBaseName];
+ const importContents: ImportContents = {
+ contents: source,
+ };
+ return importContents;
+ }
+ /**
+ * Creates the artifacts directory if it does not already exist.
+ */
+ private async _createArtifactsDirIfDoesNotExistAsync(): Promise<void> {
+ if (!fsWrapper.doesPathExistSync(this._artifactsDir)) {
+ utils.consoleLog('Creating artifacts directory...');
+ await fsWrapper.mkdirAsync(this._artifactsDir);
+ }
+ }
}
diff --git a/packages/deployer/src/deployer.ts b/packages/deployer/src/deployer.ts
index 6f03581e8..34e20a197 100644
--- a/packages/deployer/src/deployer.ts
+++ b/packages/deployer/src/deployer.ts
@@ -13,168 +13,168 @@ import { utils } from './utils/utils';
const EXTRA_GAS = 200000;
export class Deployer {
- public web3Wrapper: Web3Wrapper;
- private _artifactsDir: string;
- private _jsonrpcPort: number;
- private _networkId: number;
- private _defaults: Partial<TxData>;
+ public web3Wrapper: Web3Wrapper;
+ private _artifactsDir: string;
+ private _jsonrpcPort: number;
+ private _networkId: number;
+ private _defaults: Partial<TxData>;
- constructor(opts: DeployerOptions) {
- this._artifactsDir = opts.artifactsDir;
- this._jsonrpcPort = opts.jsonrpcPort;
- this._networkId = opts.networkId;
- const jsonrpcUrl = `http://localhost:${this._jsonrpcPort}`;
- const web3Provider = new Web3.providers.HttpProvider(jsonrpcUrl);
- this._defaults = opts.defaults;
- this.web3Wrapper = new Web3Wrapper(web3Provider, this._defaults);
- }
- /**
- * Loads contract artifact and deploys contract with given arguments.
- * @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 deployAsync(contractName: string, args: any[] = []): Promise<Web3.ContractInstance> {
- const contractArtifact: ContractArtifact = this._loadContractArtifactIfExists(contractName);
- const contractData: ContractData = this._getContractDataFromArtifactIfExists(contractArtifact);
- const data = contractData.unlinked_binary;
- const from = await this._getFromAddressAsync();
- const gas = await this._getAllowableGasEstimateAsync(data);
- const txData = {
- gasPrice: this._defaults.gasPrice,
- from,
- data,
- gas,
- };
- const abi = contractData.abi;
- const web3ContractInstance = await this._deployFromAbiAsync(abi, args, txData);
- utils.consoleLog(`${contractName}.sol successfully deployed at ${web3ContractInstance.address}`);
- const contractInstance = new Contract(web3ContractInstance, this._defaults);
- return contractInstance;
- }
- /**
- * Loads contract artifact, deploys with given arguments, and saves updated data to artifact.
- * @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: Web3.ContractAbi, args: any[], txData: Web3.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)) {
- utils.consoleLog(`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 contractArtifact: ContractArtifact = this._loadContractArtifactIfExists(contractName);
- const contractData: ContractData = this._getContractDataFromArtifactIfExists(contractArtifact);
- const abi = contractData.abi;
- const encodedConstructorArgs = encoder.encodeConstructorArgsFromAbi(args, abi);
- const newContractData = {
- ...contractData,
- address: contractAddress,
- constructor_args: encodedConstructorArgs,
- };
- const newArtifact = {
- ...contractArtifact,
- networks: {
- ...contractArtifact.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}`);
- }
- }
- /**
- * Gets data for current networkId stored in artifact.
- * @param contractArtifact The contract artifact.
- * @return Network specific contract data.
- */
- private _getContractDataFromArtifactIfExists(contractArtifact: ContractArtifact): ContractData {
- const contractData = contractArtifact.networks[this._networkId];
- if (_.isUndefined(contractData)) {
- throw new Error(`Data not found in artifact for contract: ${contractArtifact.contract_name}`);
- }
- return contractData;
- }
- /**
- * 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;
- }
+ constructor(opts: DeployerOptions) {
+ this._artifactsDir = opts.artifactsDir;
+ this._jsonrpcPort = opts.jsonrpcPort;
+ this._networkId = opts.networkId;
+ const jsonrpcUrl = `http://localhost:${this._jsonrpcPort}`;
+ const web3Provider = new Web3.providers.HttpProvider(jsonrpcUrl);
+ this._defaults = opts.defaults;
+ this.web3Wrapper = new Web3Wrapper(web3Provider, this._defaults);
+ }
+ /**
+ * Loads contract artifact and deploys contract with given arguments.
+ * @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 deployAsync(contractName: string, args: any[] = []): Promise<Web3.ContractInstance> {
+ const contractArtifact: ContractArtifact = this._loadContractArtifactIfExists(contractName);
+ const contractData: ContractData = this._getContractDataFromArtifactIfExists(contractArtifact);
+ const data = contractData.unlinked_binary;
+ const from = await this._getFromAddressAsync();
+ const gas = await this._getAllowableGasEstimateAsync(data);
+ const txData = {
+ gasPrice: this._defaults.gasPrice,
+ from,
+ data,
+ gas,
+ };
+ const abi = contractData.abi;
+ const web3ContractInstance = await this._deployFromAbiAsync(abi, args, txData);
+ utils.consoleLog(`${contractName}.sol successfully deployed at ${web3ContractInstance.address}`);
+ const contractInstance = new Contract(web3ContractInstance, this._defaults);
+ return contractInstance;
+ }
+ /**
+ * Loads contract artifact, deploys with given arguments, and saves updated data to artifact.
+ * @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: Web3.ContractAbi, args: any[], txData: Web3.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)) {
+ utils.consoleLog(`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 contractArtifact: ContractArtifact = this._loadContractArtifactIfExists(contractName);
+ const contractData: ContractData = this._getContractDataFromArtifactIfExists(contractArtifact);
+ const abi = contractData.abi;
+ const encodedConstructorArgs = encoder.encodeConstructorArgsFromAbi(args, abi);
+ const newContractData = {
+ ...contractData,
+ address: contractAddress,
+ constructor_args: encodedConstructorArgs,
+ };
+ const newArtifact = {
+ ...contractArtifact,
+ networks: {
+ ...contractArtifact.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}`);
+ }
+ }
+ /**
+ * Gets data for current networkId stored in artifact.
+ * @param contractArtifact The contract artifact.
+ * @return Network specific contract data.
+ */
+ private _getContractDataFromArtifactIfExists(contractArtifact: ContractArtifact): ContractData {
+ const contractData = contractArtifact.networks[this._networkId];
+ if (_.isUndefined(contractData)) {
+ throw new Error(`Data not found in artifact for contract: ${contractArtifact.contract_name}`);
+ }
+ return contractData;
+ }
+ /**
+ * 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
index 0a35002da..d61f54870 100644
--- a/packages/deployer/src/globals.d.ts
+++ b/packages/deployer/src/globals.d.ts
@@ -1,8 +1,8 @@
declare module 'solc' {
- export function compile(sources: any, optimizerEnabled: number, findImports: (importPath: string) => any): any;
- export function setupMethods(solcBin: any): any;
+ export function compile(sources: any, optimizerEnabled: number, findImports: (importPath: string) => any): any;
+ export function setupMethods(solcBin: any): any;
}
declare module 'web3-eth-abi' {
- export function encodeParameters(typesArray: string[], parameters: any[]): string;
+ export function encodeParameters(typesArray: string[], parameters: any[]): string;
}
diff --git a/packages/deployer/src/migrations/config/multisig_sample.ts b/packages/deployer/src/migrations/config/multisig_sample.ts
index dabeb7a4f..d65ab06d2 100644
--- a/packages/deployer/src/migrations/config/multisig_sample.ts
+++ b/packages/deployer/src/migrations/config/multisig_sample.ts
@@ -2,9 +2,9 @@ import { MultiSigConfigByNetwork } from '../../types';
// Make a copy of this file named `multisig.js` and input custom params as needed
export const multiSig: MultiSigConfigByNetwork = {
- kovan: {
- owners: [],
- confirmationsRequired: 0,
- secondsRequired: 0,
- },
+ kovan: {
+ owners: [],
+ confirmationsRequired: 0,
+ secondsRequired: 0,
+ },
};
diff --git a/packages/deployer/src/migrations/config/token_info.ts b/packages/deployer/src/migrations/config/token_info.ts
index 7e822fc3b..ebcd3f796 100644
--- a/packages/deployer/src/migrations/config/token_info.ts
+++ b/packages/deployer/src/migrations/config/token_info.ts
@@ -2,39 +2,39 @@ import { constants } from '../../utils/constants';
import { Token } from '../../types';
export const tokenInfo: Token[] = [
- {
- name: 'Augur Reputation Token',
- symbol: 'REP',
- decimals: 18,
- ipfsHash: constants.NULL_BYTES,
- swarmHash: constants.NULL_BYTES,
- },
- {
- name: 'Digix DAO Token',
- symbol: 'DGD',
- decimals: 18,
- ipfsHash: constants.NULL_BYTES,
- swarmHash: constants.NULL_BYTES,
- },
- {
- name: 'Golem Network Token',
- symbol: 'GNT',
- decimals: 18,
- ipfsHash: constants.NULL_BYTES,
- swarmHash: constants.NULL_BYTES,
- },
- {
- name: 'MakerDAO',
- symbol: 'MKR',
- decimals: 18,
- ipfsHash: constants.NULL_BYTES,
- swarmHash: constants.NULL_BYTES,
- },
- {
- name: 'Melon Token',
- symbol: 'MLN',
- decimals: 18,
- ipfsHash: constants.NULL_BYTES,
- swarmHash: constants.NULL_BYTES,
- },
+ {
+ name: 'Augur Reputation Token',
+ symbol: 'REP',
+ decimals: 18,
+ ipfsHash: constants.NULL_BYTES,
+ swarmHash: constants.NULL_BYTES,
+ },
+ {
+ name: 'Digix DAO Token',
+ symbol: 'DGD',
+ decimals: 18,
+ ipfsHash: constants.NULL_BYTES,
+ swarmHash: constants.NULL_BYTES,
+ },
+ {
+ name: 'Golem Network Token',
+ symbol: 'GNT',
+ decimals: 18,
+ ipfsHash: constants.NULL_BYTES,
+ swarmHash: constants.NULL_BYTES,
+ },
+ {
+ name: 'MakerDAO',
+ symbol: 'MKR',
+ decimals: 18,
+ ipfsHash: constants.NULL_BYTES,
+ swarmHash: constants.NULL_BYTES,
+ },
+ {
+ name: 'Melon Token',
+ symbol: 'MLN',
+ decimals: 18,
+ ipfsHash: constants.NULL_BYTES,
+ swarmHash: constants.NULL_BYTES,
+ },
];
diff --git a/packages/deployer/src/migrations/migrate.ts b/packages/deployer/src/migrations/migrate.ts
index 393806b45..48cf93000 100644
--- a/packages/deployer/src/migrations/migrate.ts
+++ b/packages/deployer/src/migrations/migrate.ts
@@ -7,84 +7,84 @@ import { constants } from '../utils/constants';
import { tokenInfo } from './config/token_info';
export const migrator = {
- /**
- * Custom migrations should be defined in this function. This will be called with the CLI 'migrate' command.
- * Some operations might be completed in parallel, but we don't do that on purpose.
- * That way the addresses are deterministic.
- * @param deployer Deployer instance.
- */
- async runMigrationsAsync(deployer: Deployer): Promise<void> {
- const web3Wrapper: Web3Wrapper = deployer.web3Wrapper;
- const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync();
+ /**
+ * Custom migrations should be defined in this function. This will be called with the CLI 'migrate' command.
+ * Some operations might be completed in parallel, but we don't do that on purpose.
+ * That way the addresses are deterministic.
+ * @param deployer Deployer instance.
+ */
+ async runMigrationsAsync(deployer: Deployer): Promise<void> {
+ const web3Wrapper: Web3Wrapper = deployer.web3Wrapper;
+ const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync();
- const tokenTransferProxy = await deployer.deployAndSaveAsync('TokenTransferProxy');
- const zrxToken = await deployer.deployAndSaveAsync('ZRXToken');
- const etherToken = await deployer.deployAndSaveAsync('WETH9');
- const tokenReg = await deployer.deployAndSaveAsync('TokenRegistry');
+ const tokenTransferProxy = await deployer.deployAndSaveAsync('TokenTransferProxy');
+ const zrxToken = await deployer.deployAndSaveAsync('ZRXToken');
+ const etherToken = await deployer.deployAndSaveAsync('WETH9');
+ const tokenReg = await deployer.deployAndSaveAsync('TokenRegistry');
- const exchangeArgs = [zrxToken.address, tokenTransferProxy.address];
- const owners = [accounts[0], accounts[1]];
- const confirmationsRequired = new BigNumber(2);
- const secondsRequired = new BigNumber(0);
- const multiSigArgs = [owners, confirmationsRequired, secondsRequired, tokenTransferProxy.address];
- const exchange = await deployer.deployAndSaveAsync('Exchange', exchangeArgs);
- const multiSig = await deployer.deployAndSaveAsync(
- 'MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress',
- multiSigArgs,
- );
+ const exchangeArgs = [zrxToken.address, tokenTransferProxy.address];
+ const owners = [accounts[0], accounts[1]];
+ const confirmationsRequired = new BigNumber(2);
+ const secondsRequired = new BigNumber(0);
+ const multiSigArgs = [owners, confirmationsRequired, secondsRequired, tokenTransferProxy.address];
+ const exchange = await deployer.deployAndSaveAsync('Exchange', exchangeArgs);
+ const multiSig = await deployer.deployAndSaveAsync(
+ 'MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress',
+ multiSigArgs,
+ );
- const owner = accounts[0];
- await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner });
- await tokenTransferProxy.transferOwnership.sendTransactionAsync(multiSig.address, { from: owner });
- const addTokenGasEstimate = await tokenReg.addToken.estimateGasAsync(
- zrxToken.address,
- tokenInfo[0].name,
- tokenInfo[0].symbol,
- tokenInfo[0].decimals,
- tokenInfo[0].ipfsHash,
- tokenInfo[0].swarmHash,
- { from: owner },
- );
- await tokenReg.addToken.sendTransactionAsync(
- zrxToken.address,
- '0x Protocol Token',
- 'ZRX',
- 18,
- constants.NULL_BYTES,
- constants.NULL_BYTES,
- {
- from: owner,
- gas: addTokenGasEstimate,
- },
- );
- await tokenReg.addToken.sendTransactionAsync(
- etherToken.address,
- 'Ether Token',
- 'WETH',
- 18,
- constants.NULL_BYTES,
- constants.NULL_BYTES,
- {
- from: owner,
- gas: addTokenGasEstimate,
- },
- );
- for (const token of tokenInfo) {
- const totalSupply = new BigNumber(0);
- const args = [token.name, token.symbol, token.decimals, totalSupply];
- const dummyToken = await deployer.deployAsync('DummyToken', args);
- await tokenReg.addToken.sendTransactionAsync(
- dummyToken.address,
- token.name,
- token.symbol,
- token.decimals,
- token.ipfsHash,
- token.swarmHash,
- {
- from: owner,
- gas: addTokenGasEstimate,
- },
- );
- }
- },
+ const owner = accounts[0];
+ await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner });
+ await tokenTransferProxy.transferOwnership.sendTransactionAsync(multiSig.address, { from: owner });
+ const addTokenGasEstimate = await tokenReg.addToken.estimateGasAsync(
+ zrxToken.address,
+ tokenInfo[0].name,
+ tokenInfo[0].symbol,
+ tokenInfo[0].decimals,
+ tokenInfo[0].ipfsHash,
+ tokenInfo[0].swarmHash,
+ { from: owner },
+ );
+ await tokenReg.addToken.sendTransactionAsync(
+ zrxToken.address,
+ '0x Protocol Token',
+ 'ZRX',
+ 18,
+ constants.NULL_BYTES,
+ constants.NULL_BYTES,
+ {
+ from: owner,
+ gas: addTokenGasEstimate,
+ },
+ );
+ await tokenReg.addToken.sendTransactionAsync(
+ etherToken.address,
+ 'Ether Token',
+ 'WETH',
+ 18,
+ constants.NULL_BYTES,
+ constants.NULL_BYTES,
+ {
+ from: owner,
+ gas: addTokenGasEstimate,
+ },
+ );
+ for (const token of tokenInfo) {
+ const totalSupply = new BigNumber(0);
+ const args = [token.name, token.symbol, token.decimals, totalSupply];
+ const dummyToken = await deployer.deployAsync('DummyToken', args);
+ await tokenReg.addToken.sendTransactionAsync(
+ dummyToken.address,
+ token.name,
+ token.symbol,
+ token.decimals,
+ token.ipfsHash,
+ token.swarmHash,
+ {
+ from: owner,
+ gas: addTokenGasEstimate,
+ },
+ );
+ }
+ },
};
diff --git a/packages/deployer/src/solc/bin_paths.ts b/packages/deployer/src/solc/bin_paths.ts
index e5b107101..7a22f911a 100644
--- a/packages/deployer/src/solc/bin_paths.ts
+++ b/packages/deployer/src/solc/bin_paths.ts
@@ -1,15 +1,15 @@
export interface BinaryPaths {
- [key: string]: string;
+ [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.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',
};
diff --git a/packages/deployer/src/types.ts b/packages/deployer/src/types.ts
index 58d1e5b4f..aeff39d46 100644
--- a/packages/deployer/src/types.ts
+++ b/packages/deployer/src/types.ts
@@ -1,23 +1,23 @@
export interface MultiSigConfig {
- owners: string[];
- confirmationsRequired: number;
- secondsRequired: number;
+ owners: string[];
+ confirmationsRequired: number;
+ secondsRequired: number;
}
export interface MultiSigConfigByNetwork {
- [networkName: string]: MultiSigConfig;
+ [networkName: string]: MultiSigConfig;
}
export interface Token {
- address?: string;
- name: string;
- symbol: string;
- decimals: number;
- ipfsHash: string;
- swarmHash: string;
+ address?: string;
+ name: string;
+ symbol: string;
+ decimals: number;
+ ipfsHash: string;
+ swarmHash: string;
}
export interface TokenInfoByNetwork {
- development: Token[];
- live: Token[];
+ development: Token[];
+ live: Token[];
}
diff --git a/packages/deployer/src/utils/constants.ts b/packages/deployer/src/utils/constants.ts
index 8871a470d..9f22114e7 100644
--- a/packages/deployer/src/utils/constants.ts
+++ b/packages/deployer/src/utils/constants.ts
@@ -1,3 +1,3 @@
export const constants = {
- NULL_BYTES: '0x',
+ NULL_BYTES: '0x',
};
diff --git a/packages/deployer/src/utils/contract.ts b/packages/deployer/src/utils/contract.ts
index 546e82dfb..473ca95c8 100644
--- a/packages/deployer/src/utils/contract.ts
+++ b/packages/deployer/src/utils/contract.ts
@@ -6,76 +6,76 @@ import * as Web3 from 'web3';
import { AbiType } from './types';
export class Contract implements Web3.ContractInstance {
- public address: string;
- public abi: Web3.ContractAbi;
- private _contract: Web3.ContractInstance;
- private _defaults: Partial<Web3.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<Web3.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 Web3.FunctionAbi[];
- _.forEach(functionsAbi, (functionAbi: Web3.MethodAbi) => {
- if (functionAbi.constant) {
- const cbStyleCallFunction = this._contract[functionAbi.name].call;
- this[functionAbi.name] = {
- callAsync: promisify(cbStyleCallFunction, this._contract),
- };
- } else {
- const cbStyleFunction = this._contract[functionAbi.name];
- const cbStyleEstimateGasFunction = this._contract[functionAbi.name].estimateGas;
- this[functionAbi.name] = {
- estimateGasAsync: promisify(cbStyleEstimateGasFunction, this._contract),
- sendTransactionAsync: this._promisifyWithDefaultParams(cbStyleFunction),
- };
- }
- });
- }
- private _populateEvents(): void {
- const eventsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Event) as Web3.EventAbi[];
- _.forEach(eventsAbi, (eventAbi: Web3.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<Web3.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;
- }
+ public address: string;
+ public abi: Web3.ContractAbi;
+ private _contract: Web3.ContractInstance;
+ private _defaults: Partial<Web3.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<Web3.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 Web3.FunctionAbi[];
+ _.forEach(functionsAbi, (functionAbi: Web3.MethodAbi) => {
+ if (functionAbi.constant) {
+ const cbStyleCallFunction = this._contract[functionAbi.name].call;
+ this[functionAbi.name] = {
+ callAsync: promisify(cbStyleCallFunction, this._contract),
+ };
+ } else {
+ const cbStyleFunction = this._contract[functionAbi.name];
+ const cbStyleEstimateGasFunction = this._contract[functionAbi.name].estimateGas;
+ this[functionAbi.name] = {
+ estimateGasAsync: promisify(cbStyleEstimateGasFunction, this._contract),
+ sendTransactionAsync: this._promisifyWithDefaultParams(cbStyleFunction),
+ };
+ }
+ });
+ }
+ private _populateEvents(): void {
+ const eventsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Event) as Web3.EventAbi[];
+ _.forEach(eventsAbi, (eventAbi: Web3.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<Web3.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
index d5f807774..30772b4bc 100644
--- a/packages/deployer/src/utils/encoder.ts
+++ b/packages/deployer/src/utils/encoder.ts
@@ -5,16 +5,16 @@ import * as web3Abi from 'web3-eth-abi';
import { AbiType } from './types';
export const encoder = {
- encodeConstructorArgsFromAbi(args: any[], abi: Web3.ContractAbi): string {
- const constructorTypes: string[] = [];
- _.each(abi, (element: Web3.AbiDefinition) => {
- if (element.type === AbiType.Constructor) {
- _.each(element.inputs, (input: Web3.FunctionParameter) => {
- constructorTypes.push(input.type);
- });
- }
- });
- const encodedParameters = web3Abi.encodeParameters(constructorTypes, args);
- return encodedParameters;
- },
+ encodeConstructorArgsFromAbi(args: any[], abi: Web3.ContractAbi): string {
+ const constructorTypes: string[] = [];
+ _.each(abi, (element: Web3.AbiDefinition) => {
+ if (element.type === AbiType.Constructor) {
+ _.each(element.inputs, (input: Web3.FunctionParameter) => {
+ constructorTypes.push(input.type);
+ });
+ }
+ });
+ const encodedParameters = web3Abi.encodeParameters(constructorTypes, args);
+ return encodedParameters;
+ },
};
diff --git a/packages/deployer/src/utils/fs_wrapper.ts b/packages/deployer/src/utils/fs_wrapper.ts
index 34c7caa0e..42bdc9969 100644
--- a/packages/deployer/src/utils/fs_wrapper.ts
+++ b/packages/deployer/src/utils/fs_wrapper.ts
@@ -2,10 +2,10 @@ 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,
- removeFileAsync: promisify<undefined>(fs.unlink),
+ readdirAsync: promisify<string[]>(fs.readdir),
+ readFileAsync: promisify<string>(fs.readFile),
+ writeFileAsync: promisify<undefined>(fs.writeFile),
+ mkdirAsync: promisify<undefined>(fs.mkdir),
+ doesPathExistSync: fs.existsSync,
+ removeFileAsync: promisify<undefined>(fs.unlink),
};
diff --git a/packages/deployer/src/utils/types.ts b/packages/deployer/src/utils/types.ts
index e054b9cc2..9e1378e24 100644
--- a/packages/deployer/src/utils/types.ts
+++ b/packages/deployer/src/utils/types.ts
@@ -3,95 +3,95 @@ import * as Web3 from 'web3';
import * as yargs from 'yargs';
export enum AbiType {
- Function = 'function',
- Constructor = 'constructor',
- Event = 'event',
- Fallback = 'fallback',
+ Function = 'function',
+ Constructor = 'constructor',
+ Event = 'event',
+ Fallback = 'fallback',
}
export interface ContractArtifact {
- contract_name: string;
- networks: ContractNetworks;
+ contract_name: string;
+ networks: ContractNetworks;
}
export interface ContractNetworks {
- [key: number]: ContractData;
+ [key: number]: ContractData;
}
export interface ContractData {
- solc_version: string;
- optimizer_enabled: number;
- keccak256: string;
- abi: Web3.ContractAbi;
- unlinked_binary: string;
- address?: string;
- constructor_args?: string;
- updated_at: number;
+ solc_version: string;
+ optimizer_enabled: number;
+ keccak256: string;
+ abi: Web3.ContractAbi;
+ unlinked_binary: string;
+ address?: string;
+ constructor_args?: string;
+ updated_at: number;
}
export interface SolcErrors {
- [key: string]: boolean;
+ [key: string]: boolean;
}
export interface CliOptions extends yargs.Arguments {
- artifactsDir: string;
- contractsDir: string;
- jsonrpcPort: number;
- networkId: number;
- shouldOptimize: boolean;
- gasPrice: string;
- account?: string;
- contract?: string;
- args?: string;
+ artifactsDir: string;
+ contractsDir: string;
+ jsonrpcPort: number;
+ networkId: number;
+ shouldOptimize: boolean;
+ gasPrice: string;
+ account?: string;
+ contract?: string;
+ args?: string;
}
export interface CompilerOptions {
- contractsDir: string;
- networkId: number;
- optimizerEnabled: number;
- artifactsDir: string;
+ contractsDir: string;
+ networkId: number;
+ optimizerEnabled: number;
+ artifactsDir: string;
}
export interface DeployerOptions {
- artifactsDir: string;
- jsonrpcPort: number;
- networkId: number;
- defaults: Partial<TxData>;
+ artifactsDir: string;
+ jsonrpcPort: number;
+ networkId: number;
+ defaults: Partial<TxData>;
}
export interface ContractSources {
- [key: string]: string;
+ [key: string]: string;
}
export interface ImportContents {
- contents: string;
+ contents: string;
}
// TODO: Consolidate with 0x.js definitions once types are moved into a separate package.
export enum ZeroExError {
- ContractDoesNotExist = 'CONTRACT_DOES_NOT_EXIST',
- ExchangeContractDoesNotExist = 'EXCHANGE_CONTRACT_DOES_NOT_EXIST',
- UnhandledError = 'UNHANDLED_ERROR',
- UserHasNoAssociatedAddress = 'USER_HAS_NO_ASSOCIATED_ADDRESSES',
- InvalidSignature = 'INVALID_SIGNATURE',
- ContractNotDeployedOnNetwork = 'CONTRACT_NOT_DEPLOYED_ON_NETWORK',
- InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER',
- InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER',
- InsufficientEthBalanceForDeposit = 'INSUFFICIENT_ETH_BALANCE_FOR_DEPOSIT',
- InsufficientWEthBalanceForWithdrawal = 'INSUFFICIENT_WETH_BALANCE_FOR_WITHDRAWAL',
- InvalidJump = 'INVALID_JUMP',
- OutOfGas = 'OUT_OF_GAS',
- NoNetworkId = 'NO_NETWORK_ID',
- SubscriptionNotFound = 'SUBSCRIPTION_NOT_FOUND',
+ ContractDoesNotExist = 'CONTRACT_DOES_NOT_EXIST',
+ ExchangeContractDoesNotExist = 'EXCHANGE_CONTRACT_DOES_NOT_EXIST',
+ UnhandledError = 'UNHANDLED_ERROR',
+ UserHasNoAssociatedAddress = 'USER_HAS_NO_ASSOCIATED_ADDRESSES',
+ InvalidSignature = 'INVALID_SIGNATURE',
+ ContractNotDeployedOnNetwork = 'CONTRACT_NOT_DEPLOYED_ON_NETWORK',
+ InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER',
+ InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER',
+ InsufficientEthBalanceForDeposit = 'INSUFFICIENT_ETH_BALANCE_FOR_DEPOSIT',
+ InsufficientWEthBalanceForWithdrawal = 'INSUFFICIENT_WETH_BALANCE_FOR_WITHDRAWAL',
+ InvalidJump = 'INVALID_JUMP',
+ OutOfGas = 'OUT_OF_GAS',
+ NoNetworkId = 'NO_NETWORK_ID',
+ SubscriptionNotFound = 'SUBSCRIPTION_NOT_FOUND',
}
export interface Token {
- address?: string;
- name: string;
- symbol: string;
- decimals: number;
- ipfsHash: string;
- swarmHash: string;
+ 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
index 4390d8813..931ad6f73 100644
--- a/packages/deployer/src/utils/utils.ts
+++ b/packages/deployer/src/utils/utils.ts
@@ -1,13 +1,13 @@
export const utils = {
- consoleLog(message: string): void {
- /* tslint:disable */
- console.log(message);
- /* tslint:enable */
- },
- stringifyWithFormatting(obj: any): string {
- const jsonReplacer: null = null;
- const numberOfJsonSpaces = 4;
- const stringifiedObj = JSON.stringify(obj, jsonReplacer, numberOfJsonSpaces);
- return stringifiedObj;
- },
+ consoleLog(message: string): void {
+ /* tslint:disable */
+ console.log(message);
+ /* tslint:enable */
+ },
+ 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/deploy_test.ts b/packages/deployer/test/deploy_test.ts
index 5df729a04..583601154 100644
--- a/packages/deployer/test/deploy_test.ts
+++ b/packages/deployer/test/deploy_test.ts
@@ -13,79 +13,79 @@ 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,
+ artifactsDir,
+ contractsDir,
+ networkId: constants.networkId,
+ optimizerEnabled: constants.optimizerEnabled,
};
const compiler = new Compiler(compilerOpts);
const deployerOpts = {
- artifactsDir,
- networkId: constants.networkId,
- jsonrpcPort: constants.jsonrpcPort,
- defaults: {
- gasPrice: constants.gasPrice,
- },
+ artifactsDir,
+ networkId: constants.networkId,
+ jsonrpcPort: constants.jsonrpcPort,
+ defaults: {
+ gasPrice: constants.gasPrice,
+ },
};
const deployer = new Deployer(deployerOpts);
/* tslint:disable */
beforeEach(function(done: DoneCallback) {
- this.timeout(constants.timeoutMs);
- (async () => {
- if (fsWrapper.doesPathExistSync(exchangeArtifactPath)) {
- await fsWrapper.removeFileAsync(exchangeArtifactPath);
- }
- await compiler.compileAllAsync();
- done();
- })().catch(done);
+ this.timeout(constants.timeoutMs);
+ (async () => {
+ if (fsWrapper.doesPathExistSync(exchangeArtifactPath)) {
+ await fsWrapper.removeFileAsync(exchangeArtifactPath);
+ }
+ await compiler.compileAllAsync();
+ done();
+ })().catch(done);
});
/* tslint:enable */
describe('#Compiler', () => {
- 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: ContractData = exchangeArtifact.networks[constants.networkId];
- // The last 43 bytes of the binaries are metadata which may not be equivalent
- const unlinkedBinaryWithoutMetadata = exchangeContractData.unlinked_binary.slice(0, -86);
- const exchangeBinaryWithoutMetadata = exchange_binary.slice(0, -86);
- expect(unlinkedBinaryWithoutMetadata).to.equal(exchangeBinaryWithoutMetadata);
- });
+ 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: ContractData = exchangeArtifact.networks[constants.networkId];
+ // The last 43 bytes of the binaries are metadata which may not be equivalent
+ const unlinkedBinaryWithoutMetadata = exchangeContractData.unlinked_binary.slice(0, -86);
+ const exchangeBinaryWithoutMetadata = exchange_binary.slice(0, -86);
+ expect(unlinkedBinaryWithoutMetadata).to.equal(exchangeBinaryWithoutMetadata);
+ });
});
describe('#Deployer', () => {
- 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: ContractData = 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: ContractData = exchangeArtifact.networks[constants.networkId];
- const exchangeAddress = exchangeContractInstance.address;
- expect(exchangeAddress).to.be.equal(exchangeContractData.address);
- expect(constructor_args).to.be.equal(exchangeContractData.constructor_args);
- });
- });
+ 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: ContractData = 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: ContractData = 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/exchange_bin.ts b/packages/deployer/test/fixtures/exchange_bin.ts
index a6eae515e..9c58b5e02 100644
--- a/packages/deployer/test/fixtures/exchange_bin.ts
+++ b/packages/deployer/test/fixtures/exchange_bin.ts
@@ -1,4 +1,4 @@
export const constructor_args =
- '0x000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f4980000000000000000000000008da0d80f5007ef1e431dd2127178d224e32c2ef4';
+ '0x000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f4980000000000000000000000008da0d80f5007ef1e431dd2127178d224e32c2ef4';
export const exchange_binary =
- '0x6060604052341561000f57600080fd5b604051604080612c4d833981016040528080519060200190919080519060200190919050505b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50505b612b84806100c96000396000f300606060405236156100fa576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806314df96ee146100ff578063288cdc911461014c5780632ac1262214610187578063363349be146101c2578063394c21e7146103bc5780633b30ba591461044b5780634f150787146104a0578063741bcc93146106b25780637e9abb50146107535780638163681e1461078e57806398024a8b14610812578063add1cbc51461085b578063b7b2c7d6146108b0578063baa0181d14610acd578063bc61394a14610c1f578063cfc4d0ec14610cdf578063f06bbf7514610d6d578063ffa1ad7414610d9e575b600080fd5b341561010a57600080fd5b6101326004808035906020019091908035906020019091908035906020019091905050610e2d565b604051808215151515815260200191505060405180910390f35b341561015757600080fd5b610171600480803560001916906020019091905050610e7c565b6040518082815260200191505060405180910390f35b341561019257600080fd5b6101ac600480803560001916906020019091905050610e94565b6040518082815260200191505060405180910390f35b34156101cd57600080fd5b6103a660048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561024857848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610203565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156102c457848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061027f565b5050505050919080359060200190919080351515906020019091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050610eac565b6040518082815260200191505060405180910390f35b34156103c757600080fd5b6104356004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091908035906020019091905050611013565b6040518082815260200191505060405180910390f35b341561045657600080fd5b61045e6114fb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104ab57600080fd5b6106b060048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561052657848483905060a0020160058060200260405190810160405280929190826005602002808284378201915050505050815260200190600101906104e1565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156105a257848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061055d565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611520565b005b34156106bd57600080fd5b6107516004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c00190600680602002604051908101604052809291908260066020028082843782019150505050509190803590602001909190803560ff1690602001909190803560001916906020019091908035600019169060200190919050506115df565b005b341561075e57600080fd5b610778600480803560001916906020019091905050611605565b6040518082815260200191505060405180910390f35b341561079957600080fd5b6107f8600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080356000191690602001909190803560ff16906020019091908035600019169060200190919080356000191690602001909190505061164f565b604051808215151515815260200191505060405180910390f35b341561081d57600080fd5b6108456004808035906020019091908035906020019091908035906020019091905050611757565b6040518082815260200191505060405180910390f35b341561086657600080fd5b61086e611776565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156108bb57600080fd5b610acb60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561093657848483905060a0020160058060200260405190810160405280929190826005602002808284378201915050505050815260200190600101906108f1565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156109b257848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061096d565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035151590602001909190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190505061179c565b005b3415610ad857600080fd5b610c1d60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610b5357848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610b0e565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610bcf57848483905060c002016006806020026040519081016040528092919082600660200280828437820191505050505081526020019060010190610b8a565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190505061185e565b005b3415610c2a57600080fd5b610cc96004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091908035906020019091908035151590602001909190803560ff1690602001909190803560001916906020019091908035600019169060200190919050506118d3565b6040518082815260200191505060405180910390f35b3415610cea57600080fd5b610d4f6004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091905050612073565b60405180826000191660001916815260200191505060405180910390f35b3415610d7857600080fd5b610d8061231f565b604051808261ffff1661ffff16815260200191505060405180910390f35b3415610da957600080fd5b610db1612325565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610df25780820151818401525b602081019050610dd6565b50505050905090810190601f168015610e1f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008060008486850991506000821415610e4a5760009250610e73565b610e69610e5a83620f424061235e565b610e64888761235e565b612392565b90506103e8811192505b50509392505050565b60026020528060005260406000206000915090505481565b60036020528060005260406000206000915090505481565b6000806000809150600090505b895181101561100257896000815181101515610ed157fe5b906020019060200201516003600581101515610ee957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168a82815181101515610f1257fe5b906020019060200201516003600581101515610f2a57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16141515610f5157600080fd5b610fe582610fe08c84815181101515610f6657fe5b906020019060200201518c85815181101515610f7e57fe5b90602001906020020151610f928d886123ae565b8c8c88815181101515610fa157fe5b906020019060200201518c89815181101515610fb957fe5b906020019060200201518c8a815181101515610fd157fe5b906020019060200201516118d3565b6123c8565b915087821415610ff457611002565b5b8080600101915050610eb9565b8192505b5050979650505050505050565b600061101d612a8c565b6000806101606040519081016040528088600060058110151561103c57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600160058110151561106b57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600260058110151561109a57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860036005811015156110c957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860046005811015156110f857fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200187600060068110151561112757fe5b6020020151815260200187600160068110151561114057fe5b6020020151815260200187600260068110151561115957fe5b6020020151815260200187600360068110151561117257fe5b6020020151815260200187600460068110151561118b57fe5b6020020151815260200161119f8989612073565b6000191681525092503373ffffffffffffffffffffffffffffffffffffffff16836000015173ffffffffffffffffffffffffffffffffffffffff161415156111e657600080fd5b60008360a001511180156111fe575060008360c00151115b801561120a5750600085115b151561121557600080fd5b8261012001514210151561127257826101400151600019166000600381111561123a57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506114f1565b61128d8360c00151611288856101400151611605565b6123ae565b915061129985836123e7565b905060008114156112f35782610140015160001916600160038111156112bb57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506114f1565b61131d600360008561014001516000191660001916815260200190815260200160002054826123c8565b60036000856101400151600019166000191681526020019081526020016000208190555082604001518360600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916836080015173ffffffffffffffffffffffffffffffffffffffff16846000015173ffffffffffffffffffffffffffffffffffffffff167f67d66f160bc93d925d05dae1794c90d2d6d6688b29b84ff069398a9b0458713186604001518760600151611455878a60c001518b60a00151611757565b878a6101400151604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183815260200182600019166000191681526020019550505050505060405180910390a48093505b5050509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b86518110156115d5576115c7878281518110151561154057fe5b90602001906020020151878381518110151561155857fe5b90602001906020020151878481518110151561157057fe5b90602001906020020151878581518110151561158857fe5b9060200190602002015187868151811015156115a057fe5b9060200190602002015187878151811015156115b857fe5b906020019060200201516115df565b5b8080600101915050611526565b5b50505050505050565b836115f087878760008888886118d3565b1415156115fc57600080fd5b5b505050505050565b600061164760026000846000191660001916815260200190815260200160002054600360008560001916600019168152602001908152602001600020546123c8565b90505b919050565b600060018560405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020858585604051600081526020016040526000604051602001526040518085600019166000191681526020018460ff1660ff16815260200183600019166000191681526020018260001916600019168152602001945050505050602060405160208103908084039060008661646e5a03f1151561171457600080fd5b50506020604051035173ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161490505b95945050505050565b600061176c611766858461235e565b84612392565b90505b9392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b87518110156118535761184488828151811015156117bc57fe5b9060200190602002015188838151811015156117d457fe5b9060200190602002015188848151811015156117ec57fe5b9060200190602002015188888681518110151561180557fe5b90602001906020020151888781518110151561181d57fe5b90602001906020020151888881518110151561183557fe5b906020019060200201516118d3565b505b80806001019150506117a2565b5b5050505050505050565b60008090505b83518110156118cc576118bd848281518110151561187e57fe5b90602001906020020151848381518110151561189657fe5b9060200190602002015184848151811015156118ae57fe5b90602001906020020151611013565b505b8080600101915050611864565b5b50505050565b60006118dd612a8c565b600080600080610160604051908101604052808e60006005811015156118ff57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600160058110151561192e57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600260058110151561195d57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600360058110151561198c57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e60046005811015156119bb57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018d60006006811015156119ea57fe5b602002015181526020018d6001600681101515611a0357fe5b602002015181526020018d6002600681101515611a1c57fe5b602002015181526020018d6003600681101515611a3557fe5b602002015181526020018d6004600681101515611a4e57fe5b60200201518152602001611a628f8f612073565b600019168152509450600073ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff161480611ad957503373ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff16145b1515611ae457600080fd5b60008560a00151118015611afc575060008560c00151115b8015611b08575060008b115b1515611b1357600080fd5b611b2985600001518661014001518b8b8b61164f565b1515611b3457600080fd5b84610120015142101515611b91578461014001516000191660006003811115611b5957fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b611bac8560c00151611ba7876101400151611605565b6123ae565b9350611bb88b856123e7565b95506000861415611c12578461014001516000191660016003811115611bda57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b611c25868660c001518760a00151610e2d565b15611c79578461014001516000191660026003811115611c4157fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b89158015611c8e5750611c8c8587612401565b155b15611ce15784610140015160001916600380811115611ca957fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b611cf4868660c001518760a00151611757565b9250611d20600260008761014001516000191660001916815260200190815260200160002054876123c8565b600260008761014001516000191660001916815260200190815260200160002081905550611d58856040015186600001513386612751565b1515611d6357600080fd5b611d77856060015133876000015189612751565b1515611d8257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16856080015173ffffffffffffffffffffffffffffffffffffffff16141515611e815760008560e001511115611e1f57611ddc868660c001518760e00151611757565b9150611e136000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168660000151876080015185612751565b1515611e1e57600080fd5b5b60008561010001511115611e8057611e41868660c00151876101000151611757565b9050611e746000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633876080015184612751565b1515611e7f57600080fd5b5b5b84604001518560600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916856080015173ffffffffffffffffffffffffffffffffffffffff16866000015173ffffffffffffffffffffffffffffffffffffffff167f0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb33389604001518a60600151898d8a8a8f6101400151604051808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186815260200185815260200184815260200183815260200182600019166000191681526020019850505050505050505060405180910390a48595505b5050505050979650505050505050565b60003083600060058110151561208557fe5b602002015184600160058110151561209957fe5b60200201518560026005811015156120ad57fe5b60200201518660036005811015156120c157fe5b60200201518760046005811015156120d557fe5b60200201518760006006811015156120e957fe5b60200201518860016006811015156120fd57fe5b602002015189600260068110151561211157fe5b60200201518a600360068110151561212557fe5b60200201518b600460068110151561213957fe5b60200201518c600560068110151561214d57fe5b6020020151604051808d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018781526020018681526020018581526020018481526020018381526020018281526020019c50505050505050505050505050604051809103902090505b92915050565b61138781565b6040805190810160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b6000808284029050600084148061237f575082848281151561237c57fe5b04145b151561238757fe5b8091505b5092915050565b60008082848115156123a057fe5b0490508091505b5092915050565b60008282111515156123bc57fe5b81830390505b92915050565b60008082840190508381101515156123dc57fe5b8091505b5092915050565b60008183106123f657816123f8565b825b90505b92915050565b60008060008060008060008060003397506124258a8c60c001518d60a00151611757565b9650600073ffffffffffffffffffffffffffffffffffffffff168b6080015173ffffffffffffffffffffffffffffffffffffffff161415156126d2576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6040015173ffffffffffffffffffffffffffffffffffffffff161495506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6060015173ffffffffffffffffffffffffffffffffffffffff161494506125208a8c60c001518d60e00151611757565b93506125368a8c60c001518d6101000151611757565b925085612543578361254e565b61254d87856123c8565b5b91508461255b5782612566565b6125658a846123c8565b5b9050816125986000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d600001516128ae565b10806125d15750816125cf6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d60000151612972565b105b806126055750806126036000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a6128ae565b105b806126395750806126376000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a612972565b105b156126475760009850612743565b851580156126805750866126638c604001518d600001516128ae565b108061267f57508661267d8c604001518d60000151612972565b105b5b1561268e5760009850612743565b841580156126bf5750896126a68c606001518a6128ae565b10806126be5750896126bc8c606001518a612972565b105b5b156126cd5760009850612743565b61273e565b866126e58c604001518d600001516128ae565b10806127015750866126ff8c604001518d60000151612972565b105b806127185750896127168c606001518a6128ae565b105b8061272f57508961272d8c606001518a612972565b105b1561273d5760009850612743565b5b600198505b505050505050505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166315dacbea868686866000604051602001526040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050602060405180830381600087803b151561288857600080fd5b6102c65a03f1151561289957600080fd5b5050506040518051905090505b949350505050565b60008273ffffffffffffffffffffffffffffffffffffffff166370a0823161138761ffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600088803b151561295157600080fd5b87f1151561295e57600080fd5b505050506040518051905090505b92915050565b60008273ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e61138761ffff1684600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600088803b1515612a6b57600080fd5b87f11515612a7857600080fd5b505050506040518051905090505b92915050565b61016060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000801916815250905600a165627a7a72305820df5cabdc3a116e993e10bfb14823d18d9b798038d4c463a1703f9a584c456b7e0029';
+ '0x6060604052341561000f57600080fd5b604051604080612c4d833981016040528080519060200190919080519060200190919050505b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50505b612b84806100c96000396000f300606060405236156100fa576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806314df96ee146100ff578063288cdc911461014c5780632ac1262214610187578063363349be146101c2578063394c21e7146103bc5780633b30ba591461044b5780634f150787146104a0578063741bcc93146106b25780637e9abb50146107535780638163681e1461078e57806398024a8b14610812578063add1cbc51461085b578063b7b2c7d6146108b0578063baa0181d14610acd578063bc61394a14610c1f578063cfc4d0ec14610cdf578063f06bbf7514610d6d578063ffa1ad7414610d9e575b600080fd5b341561010a57600080fd5b6101326004808035906020019091908035906020019091908035906020019091905050610e2d565b604051808215151515815260200191505060405180910390f35b341561015757600080fd5b610171600480803560001916906020019091905050610e7c565b6040518082815260200191505060405180910390f35b341561019257600080fd5b6101ac600480803560001916906020019091905050610e94565b6040518082815260200191505060405180910390f35b34156101cd57600080fd5b6103a660048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561024857848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610203565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156102c457848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061027f565b5050505050919080359060200190919080351515906020019091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050610eac565b6040518082815260200191505060405180910390f35b34156103c757600080fd5b6104356004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091908035906020019091905050611013565b6040518082815260200191505060405180910390f35b341561045657600080fd5b61045e6114fb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104ab57600080fd5b6106b060048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561052657848483905060a0020160058060200260405190810160405280929190826005602002808284378201915050505050815260200190600101906104e1565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156105a257848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061055d565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611520565b005b34156106bd57600080fd5b6107516004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c00190600680602002604051908101604052809291908260066020028082843782019150505050509190803590602001909190803560ff1690602001909190803560001916906020019091908035600019169060200190919050506115df565b005b341561075e57600080fd5b610778600480803560001916906020019091905050611605565b6040518082815260200191505060405180910390f35b341561079957600080fd5b6107f8600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080356000191690602001909190803560ff16906020019091908035600019169060200190919080356000191690602001909190505061164f565b604051808215151515815260200191505060405180910390f35b341561081d57600080fd5b6108456004808035906020019091908035906020019091908035906020019091905050611757565b6040518082815260200191505060405180910390f35b341561086657600080fd5b61086e611776565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156108bb57600080fd5b610acb60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561093657848483905060a0020160058060200260405190810160405280929190826005602002808284378201915050505050815260200190600101906108f1565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156109b257848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061096d565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035151590602001909190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190505061179c565b005b3415610ad857600080fd5b610c1d60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610b5357848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610b0e565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610bcf57848483905060c002016006806020026040519081016040528092919082600660200280828437820191505050505081526020019060010190610b8a565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190505061185e565b005b3415610c2a57600080fd5b610cc96004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091908035906020019091908035151590602001909190803560ff1690602001909190803560001916906020019091908035600019169060200190919050506118d3565b6040518082815260200191505060405180910390f35b3415610cea57600080fd5b610d4f6004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091905050612073565b60405180826000191660001916815260200191505060405180910390f35b3415610d7857600080fd5b610d8061231f565b604051808261ffff1661ffff16815260200191505060405180910390f35b3415610da957600080fd5b610db1612325565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610df25780820151818401525b602081019050610dd6565b50505050905090810190601f168015610e1f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008060008486850991506000821415610e4a5760009250610e73565b610e69610e5a83620f424061235e565b610e64888761235e565b612392565b90506103e8811192505b50509392505050565b60026020528060005260406000206000915090505481565b60036020528060005260406000206000915090505481565b6000806000809150600090505b895181101561100257896000815181101515610ed157fe5b906020019060200201516003600581101515610ee957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168a82815181101515610f1257fe5b906020019060200201516003600581101515610f2a57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16141515610f5157600080fd5b610fe582610fe08c84815181101515610f6657fe5b906020019060200201518c85815181101515610f7e57fe5b90602001906020020151610f928d886123ae565b8c8c88815181101515610fa157fe5b906020019060200201518c89815181101515610fb957fe5b906020019060200201518c8a815181101515610fd157fe5b906020019060200201516118d3565b6123c8565b915087821415610ff457611002565b5b8080600101915050610eb9565b8192505b5050979650505050505050565b600061101d612a8c565b6000806101606040519081016040528088600060058110151561103c57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600160058110151561106b57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600260058110151561109a57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860036005811015156110c957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860046005811015156110f857fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200187600060068110151561112757fe5b6020020151815260200187600160068110151561114057fe5b6020020151815260200187600260068110151561115957fe5b6020020151815260200187600360068110151561117257fe5b6020020151815260200187600460068110151561118b57fe5b6020020151815260200161119f8989612073565b6000191681525092503373ffffffffffffffffffffffffffffffffffffffff16836000015173ffffffffffffffffffffffffffffffffffffffff161415156111e657600080fd5b60008360a001511180156111fe575060008360c00151115b801561120a5750600085115b151561121557600080fd5b8261012001514210151561127257826101400151600019166000600381111561123a57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506114f1565b61128d8360c00151611288856101400151611605565b6123ae565b915061129985836123e7565b905060008114156112f35782610140015160001916600160038111156112bb57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506114f1565b61131d600360008561014001516000191660001916815260200190815260200160002054826123c8565b60036000856101400151600019166000191681526020019081526020016000208190555082604001518360600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916836080015173ffffffffffffffffffffffffffffffffffffffff16846000015173ffffffffffffffffffffffffffffffffffffffff167f67d66f160bc93d925d05dae1794c90d2d6d6688b29b84ff069398a9b0458713186604001518760600151611455878a60c001518b60a00151611757565b878a6101400151604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183815260200182600019166000191681526020019550505050505060405180910390a48093505b5050509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b86518110156115d5576115c7878281518110151561154057fe5b90602001906020020151878381518110151561155857fe5b90602001906020020151878481518110151561157057fe5b90602001906020020151878581518110151561158857fe5b9060200190602002015187868151811015156115a057fe5b9060200190602002015187878151811015156115b857fe5b906020019060200201516115df565b5b8080600101915050611526565b5b50505050505050565b836115f087878760008888886118d3565b1415156115fc57600080fd5b5b505050505050565b600061164760026000846000191660001916815260200190815260200160002054600360008560001916600019168152602001908152602001600020546123c8565b90505b919050565b600060018560405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020858585604051600081526020016040526000604051602001526040518085600019166000191681526020018460ff1660ff16815260200183600019166000191681526020018260001916600019168152602001945050505050602060405160208103908084039060008661646e5a03f1151561171457600080fd5b50506020604051035173ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161490505b95945050505050565b600061176c611766858461235e565b84612392565b90505b9392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b87518110156118535761184488828151811015156117bc57fe5b9060200190602002015188838151811015156117d457fe5b9060200190602002015188848151811015156117ec57fe5b9060200190602002015188888681518110151561180557fe5b90602001906020020151888781518110151561181d57fe5b90602001906020020151888881518110151561183557fe5b906020019060200201516118d3565b505b80806001019150506117a2565b5b5050505050505050565b60008090505b83518110156118cc576118bd848281518110151561187e57fe5b90602001906020020151848381518110151561189657fe5b9060200190602002015184848151811015156118ae57fe5b90602001906020020151611013565b505b8080600101915050611864565b5b50505050565b60006118dd612a8c565b600080600080610160604051908101604052808e60006005811015156118ff57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600160058110151561192e57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600260058110151561195d57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600360058110151561198c57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e60046005811015156119bb57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018d60006006811015156119ea57fe5b602002015181526020018d6001600681101515611a0357fe5b602002015181526020018d6002600681101515611a1c57fe5b602002015181526020018d6003600681101515611a3557fe5b602002015181526020018d6004600681101515611a4e57fe5b60200201518152602001611a628f8f612073565b600019168152509450600073ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff161480611ad957503373ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff16145b1515611ae457600080fd5b60008560a00151118015611afc575060008560c00151115b8015611b08575060008b115b1515611b1357600080fd5b611b2985600001518661014001518b8b8b61164f565b1515611b3457600080fd5b84610120015142101515611b91578461014001516000191660006003811115611b5957fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b611bac8560c00151611ba7876101400151611605565b6123ae565b9350611bb88b856123e7565b95506000861415611c12578461014001516000191660016003811115611bda57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b611c25868660c001518760a00151610e2d565b15611c79578461014001516000191660026003811115611c4157fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b89158015611c8e5750611c8c8587612401565b155b15611ce15784610140015160001916600380811115611ca957fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b611cf4868660c001518760a00151611757565b9250611d20600260008761014001516000191660001916815260200190815260200160002054876123c8565b600260008761014001516000191660001916815260200190815260200160002081905550611d58856040015186600001513386612751565b1515611d6357600080fd5b611d77856060015133876000015189612751565b1515611d8257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16856080015173ffffffffffffffffffffffffffffffffffffffff16141515611e815760008560e001511115611e1f57611ddc868660c001518760e00151611757565b9150611e136000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168660000151876080015185612751565b1515611e1e57600080fd5b5b60008561010001511115611e8057611e41868660c00151876101000151611757565b9050611e746000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633876080015184612751565b1515611e7f57600080fd5b5b5b84604001518560600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916856080015173ffffffffffffffffffffffffffffffffffffffff16866000015173ffffffffffffffffffffffffffffffffffffffff167f0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb33389604001518a60600151898d8a8a8f6101400151604051808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186815260200185815260200184815260200183815260200182600019166000191681526020019850505050505050505060405180910390a48595505b5050505050979650505050505050565b60003083600060058110151561208557fe5b602002015184600160058110151561209957fe5b60200201518560026005811015156120ad57fe5b60200201518660036005811015156120c157fe5b60200201518760046005811015156120d557fe5b60200201518760006006811015156120e957fe5b60200201518860016006811015156120fd57fe5b602002015189600260068110151561211157fe5b60200201518a600360068110151561212557fe5b60200201518b600460068110151561213957fe5b60200201518c600560068110151561214d57fe5b6020020151604051808d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018781526020018681526020018581526020018481526020018381526020018281526020019c50505050505050505050505050604051809103902090505b92915050565b61138781565b6040805190810160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b6000808284029050600084148061237f575082848281151561237c57fe5b04145b151561238757fe5b8091505b5092915050565b60008082848115156123a057fe5b0490508091505b5092915050565b60008282111515156123bc57fe5b81830390505b92915050565b60008082840190508381101515156123dc57fe5b8091505b5092915050565b60008183106123f657816123f8565b825b90505b92915050565b60008060008060008060008060003397506124258a8c60c001518d60a00151611757565b9650600073ffffffffffffffffffffffffffffffffffffffff168b6080015173ffffffffffffffffffffffffffffffffffffffff161415156126d2576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6040015173ffffffffffffffffffffffffffffffffffffffff161495506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6060015173ffffffffffffffffffffffffffffffffffffffff161494506125208a8c60c001518d60e00151611757565b93506125368a8c60c001518d6101000151611757565b925085612543578361254e565b61254d87856123c8565b5b91508461255b5782612566565b6125658a846123c8565b5b9050816125986000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d600001516128ae565b10806125d15750816125cf6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d60000151612972565b105b806126055750806126036000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a6128ae565b105b806126395750806126376000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a612972565b105b156126475760009850612743565b851580156126805750866126638c604001518d600001516128ae565b108061267f57508661267d8c604001518d60000151612972565b105b5b1561268e5760009850612743565b841580156126bf5750896126a68c606001518a6128ae565b10806126be5750896126bc8c606001518a612972565b105b5b156126cd5760009850612743565b61273e565b866126e58c604001518d600001516128ae565b10806127015750866126ff8c604001518d60000151612972565b105b806127185750896127168c606001518a6128ae565b105b8061272f57508961272d8c606001518a612972565b105b1561273d5760009850612743565b5b600198505b505050505050505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166315dacbea868686866000604051602001526040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050602060405180830381600087803b151561288857600080fd5b6102c65a03f1151561289957600080fd5b5050506040518051905090505b949350505050565b60008273ffffffffffffffffffffffffffffffffffffffff166370a0823161138761ffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600088803b151561295157600080fd5b87f1151561295e57600080fd5b505050506040518051905090505b92915050565b60008273ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e61138761ffff1684600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600088803b1515612a6b57600080fd5b87f11515612a7857600080fd5b505050506040518051905090505b92915050565b61016060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000801916815250905600a165627a7a72305820df5cabdc3a116e993e10bfb14823d18d9b798038d4c463a1703f9a584c456b7e0029';
diff --git a/packages/deployer/test/util/constants.ts b/packages/deployer/test/util/constants.ts
index d52076607..d69ce5385 100644
--- a/packages/deployer/test/util/constants.ts
+++ b/packages/deployer/test/util/constants.ts
@@ -1,11 +1,11 @@
import { BigNumber } from '@0xproject/utils';
export const constants = {
- networkId: 0,
- jsonrpcPort: 8545,
- optimizerEnabled: 0,
- gasPrice: new BigNumber(20000000000),
- timeoutMs: 20000,
- zrxTokenAddress: '0xe41d2489571d322189246dafa5ebde1f4699f498',
- tokenTransferProxyAddress: '0x8da0d80f5007ef1e431dd2127178d224e32c2ef4',
+ networkId: 0,
+ jsonrpcPort: 8545,
+ optimizerEnabled: 0,
+ gasPrice: new BigNumber(20000000000),
+ timeoutMs: 20000,
+ zrxTokenAddress: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ tokenTransferProxyAddress: '0x8da0d80f5007ef1e431dd2127178d224e32c2ef4',
};
diff --git a/packages/deployer/tsconfig.json b/packages/deployer/tsconfig.json
index 4e1edb510..f11c9245e 100644
--- a/packages/deployer/tsconfig.json
+++ b/packages/deployer/tsconfig.json
@@ -1,16 +1,16 @@
{
- "extends": "../../tsconfig",
- "compilerOptions": {
- "outDir": "lib",
- "strictFunctionTypes": false,
- "strictNullChecks": false
- },
- "include": [
- "./src/**/*",
- "./test/**/*",
- "../../node_modules/types-bn/index.d.ts",
- "../../node_modules/types-ethereumjs-util/index.d.ts",
- "../../node_modules/chai-typescript-typings/index.d.ts",
- "../../node_modules/web3-typescript-typings/index.d.ts"
- ]
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "strictFunctionTypes": false,
+ "strictNullChecks": false
+ },
+ "include": [
+ "./src/**/*",
+ "./test/**/*",
+ "../../node_modules/types-bn/index.d.ts",
+ "../../node_modules/types-ethereumjs-util/index.d.ts",
+ "../../node_modules/chai-typescript-typings/index.d.ts",
+ "../../node_modules/web3-typescript-typings/index.d.ts"
+ ]
}