aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-05-08 21:42:07 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-05-10 23:47:38 +0800
commita6f72de09d7b2c9738b78d2097baa9906838fbe9 (patch)
tree17126a5b45dabf2c7410d25668c68ce3d78284f0 /packages/deployer/src
parent96037aed5231aa9344e5037aa6cff3d01f4abdae (diff)
downloaddexon-0x-contracts-a6f72de09d7b2c9738b78d2097baa9906838fbe9.tar
dexon-0x-contracts-a6f72de09d7b2c9738b78d2097baa9906838fbe9.tar.gz
dexon-0x-contracts-a6f72de09d7b2c9738b78d2097baa9906838fbe9.tar.bz2
dexon-0x-contracts-a6f72de09d7b2c9738b78d2097baa9906838fbe9.tar.lz
dexon-0x-contracts-a6f72de09d7b2c9738b78d2097baa9906838fbe9.tar.xz
dexon-0x-contracts-a6f72de09d7b2c9738b78d2097baa9906838fbe9.tar.zst
dexon-0x-contracts-a6f72de09d7b2c9738b78d2097baa9906838fbe9.zip
Rename deployer to sol-compiler
Diffstat (limited to 'packages/deployer/src')
-rw-r--r--packages/deployer/src/cli.ts41
-rw-r--r--packages/deployer/src/compiler.ts276
-rw-r--r--packages/deployer/src/globals.d.ts6
-rw-r--r--packages/deployer/src/index.ts2
-rw-r--r--packages/deployer/src/monorepo_scripts/postpublish.ts8
-rw-r--r--packages/deployer/src/monorepo_scripts/stage_docs.ts8
-rw-r--r--packages/deployer/src/solc/bin_paths.ts20
-rw-r--r--packages/deployer/src/utils/compiler.ts107
-rw-r--r--packages/deployer/src/utils/constants.ts5
-rw-r--r--packages/deployer/src/utils/encoder.ts18
-rw-r--r--packages/deployer/src/utils/fs_wrapper.ts12
-rw-r--r--packages/deployer/src/utils/types.ts79
-rw-r--r--packages/deployer/src/utils/utils.ts8
13 files changed, 0 insertions, 590 deletions
diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts
deleted file mode 100644
index 2412b8d34..000000000
--- a/packages/deployer/src/cli.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env node
-// We need the above pragma since this script will be run as a command-line tool.
-
-import { BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
-import * as _ from 'lodash';
-import * as path from 'path';
-import * as Web3 from 'web3';
-import * as yargs from 'yargs';
-
-import { Compiler } from './compiler';
-import { constants } from './utils/constants';
-import { CompilerOptions } from './utils/types';
-
-const DEFAULT_CONTRACTS_LIST = '*';
-const SEPARATOR = ',';
-
-(async () => {
- const argv = yargs
- .option('contracts-dir', {
- type: 'string',
- description: 'path of contracts directory to compile',
- })
- .option('artifacts-dir', {
- type: 'string',
- description: 'path to write contracts artifacts to',
- })
- .option('contracts', {
- type: 'string',
- default: DEFAULT_CONTRACTS_LIST,
- description: 'comma separated list of contracts to compile',
- })
- .help().argv;
- const opts: CompilerOptions = {
- contractsDir: argv.contractsDir,
- artifactsDir: argv.artifactsDir,
- contracts: argv.contracts === DEFAULT_CONTRACTS_LIST ? DEFAULT_CONTRACTS_LIST : argv.contracts.split(SEPARATOR),
- };
- const compiler = new Compiler(opts);
- await compiler.compileAsync();
-})();
diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts
deleted file mode 100644
index efb30091b..000000000
--- a/packages/deployer/src/compiler.ts
+++ /dev/null
@@ -1,276 +0,0 @@
-import {
- ContractSource,
- ContractSources,
- EnumerableResolver,
- FallthroughResolver,
- FSResolver,
- NameResolver,
- NPMResolver,
- RelativeFSResolver,
- Resolver,
- URLResolver,
-} from '@0xproject/sol-resolver';
-import { ContractAbi } from '@0xproject/types';
-import { logUtils, promisify } from '@0xproject/utils';
-import chalk from 'chalk';
-import * as ethUtil from 'ethereumjs-util';
-import * as fs from 'fs';
-import 'isomorphic-fetch';
-import * as _ from 'lodash';
-import * as path from 'path';
-import * as requireFromString from 'require-from-string';
-import * as semver from 'semver';
-import solc = require('solc');
-
-import { binPaths } from './solc/bin_paths';
-import {
- createDirIfDoesNotExistAsync,
- getContractArtifactIfExistsAsync,
- getNormalizedErrMsg,
- parseDependencies,
- parseSolidityVersionRange,
-} from './utils/compiler';
-import { constants } from './utils/constants';
-import { fsWrapper } from './utils/fs_wrapper';
-import {
- CompilerOptions,
- ContractArtifact,
- ContractNetworkData,
- ContractNetworks,
- ContractSourceData,
- ContractSpecificSourceData,
- ContractVersionData,
-} from './utils/types';
-import { utils } from './utils/utils';
-
-type TYPE_ALL_FILES_IDENTIFIER = '*';
-const ALL_CONTRACTS_IDENTIFIER = '*';
-const ALL_FILES_IDENTIFIER = '*';
-const SOLC_BIN_DIR = path.join(__dirname, '..', '..', 'solc_bin');
-const DEFAULT_CONTRACTS_DIR = path.resolve('contracts');
-const DEFAULT_ARTIFACTS_DIR = path.resolve('artifacts');
-// Solc compiler settings cannot be configured from the commandline.
-// If you need this configured, please create a `compiler.json` config file
-// with your desired configurations.
-const DEFAULT_COMPILER_SETTINGS: solc.CompilerSettings = {
- optimizer: {
- enabled: false,
- },
- outputSelection: {
- [ALL_FILES_IDENTIFIER]: {
- [ALL_CONTRACTS_IDENTIFIER]: ['abi', 'evm.bytecode.object'],
- },
- },
-};
-const CONFIG_FILE = 'compiler.json';
-
-/**
- * The Compiler facilitates compiling Solidity smart contracts and saves the results
- * to artifact files.
- */
-export class Compiler {
- private _resolver: Resolver;
- private _nameResolver: NameResolver;
- private _contractsDir: string;
- private _compilerSettings: solc.CompilerSettings;
- private _artifactsDir: string;
- private _specifiedContracts: string[] | TYPE_ALL_FILES_IDENTIFIER;
- /**
- * Instantiates a new instance of the Compiler class.
- * @return An instance of the Compiler class.
- */
- constructor(opts: CompilerOptions) {
- // TODO: Look for config file in parent directories if not found in current directory
- const config: CompilerOptions = fs.existsSync(CONFIG_FILE)
- ? JSON.parse(fs.readFileSync(CONFIG_FILE).toString())
- : {};
- this._contractsDir = opts.contractsDir || config.contractsDir || DEFAULT_CONTRACTS_DIR;
- this._compilerSettings = opts.compilerSettings || config.compilerSettings || DEFAULT_COMPILER_SETTINGS;
- this._artifactsDir = opts.artifactsDir || config.artifactsDir || DEFAULT_ARTIFACTS_DIR;
- this._specifiedContracts = opts.contracts || config.contracts || ALL_CONTRACTS_IDENTIFIER;
- this._nameResolver = new NameResolver(path.resolve(this._contractsDir));
- const resolver = new FallthroughResolver();
- resolver.appendResolver(new URLResolver());
- const packagePath = path.resolve('');
- resolver.appendResolver(new NPMResolver(packagePath));
- resolver.appendResolver(new RelativeFSResolver(this._contractsDir));
- resolver.appendResolver(new FSResolver());
- resolver.appendResolver(this._nameResolver);
- this._resolver = resolver;
- }
- /**
- * Compiles selected Solidity files found in `contractsDir` and writes JSON artifacts to `artifactsDir`.
- */
- public async compileAsync(): Promise<void> {
- await createDirIfDoesNotExistAsync(this._artifactsDir);
- await createDirIfDoesNotExistAsync(SOLC_BIN_DIR);
- let contractNamesToCompile: string[] = [];
- if (this._specifiedContracts === ALL_CONTRACTS_IDENTIFIER) {
- const allContracts = this._nameResolver.getAll();
- contractNamesToCompile = _.map(allContracts, contractSource =>
- path.basename(contractSource.path, constants.SOLIDITY_FILE_EXTENSION),
- );
- } else {
- contractNamesToCompile = this._specifiedContracts;
- }
- for (const contractNameToCompile of contractNamesToCompile) {
- await this._compileContractAsync(contractNameToCompile);
- }
- }
- /**
- * Compiles contract and saves artifact to artifactsDir.
- * @param fileName Name of contract with '.sol' extension.
- */
- private async _compileContractAsync(contractName: string): Promise<void> {
- const contractSource = this._resolver.resolve(contractName);
- const absoluteContractPath = path.join(this._contractsDir, contractSource.path);
- const currentArtifactIfExists = await getContractArtifactIfExistsAsync(this._artifactsDir, contractName);
- const sourceTreeHashHex = `0x${this._getSourceTreeHash(absoluteContractPath).toString('hex')}`;
- let shouldCompile = false;
- if (_.isUndefined(currentArtifactIfExists)) {
- shouldCompile = true;
- } else {
- const currentArtifact = currentArtifactIfExists as ContractArtifact;
- const isUserOnLatestVersion = currentArtifact.schemaVersion === constants.LATEST_ARTIFACT_VERSION;
- const didCompilerSettingsChange = !_.isEqual(currentArtifact.compiler.settings, this._compilerSettings);
- const didSourceChange = currentArtifact.sourceTreeHashHex !== sourceTreeHashHex;
- shouldCompile = !isUserOnLatestVersion || didCompilerSettingsChange || didSourceChange;
- }
- if (!shouldCompile) {
- return;
- }
- const solcVersionRange = parseSolidityVersionRange(contractSource.source);
- const availableCompilerVersions = _.keys(binPaths);
- const solcVersion = semver.maxSatisfying(availableCompilerVersions, solcVersionRange);
- const fullSolcVersion = binPaths[solcVersion];
- const compilerBinFilename = path.join(SOLC_BIN_DIR, fullSolcVersion);
- let solcjs: string;
- const isCompilerAvailableLocally = fs.existsSync(compilerBinFilename);
- if (isCompilerAvailableLocally) {
- solcjs = fs.readFileSync(compilerBinFilename).toString();
- } else {
- logUtils.log(`Downloading ${fullSolcVersion}...`);
- const url = `${constants.BASE_COMPILER_URL}${fullSolcVersion}`;
- const response = await fetch(url);
- if (response.status !== 200) {
- throw new Error(`Failed to load ${fullSolcVersion}`);
- }
- solcjs = await response.text();
- fs.writeFileSync(compilerBinFilename, solcjs);
- }
- const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename));
-
- logUtils.log(`Compiling ${contractName} with Solidity v${solcVersion}...`);
- const source = contractSource.source;
- const standardInput: solc.StandardInput = {
- language: 'Solidity',
- sources: {
- [contractSource.path]: {
- content: contractSource.source,
- },
- },
- settings: this._compilerSettings,
- };
- const compiled: solc.StandardOutput = JSON.parse(
- solcInstance.compileStandardWrapper(JSON.stringify(standardInput), importPath => {
- const sourceCodeIfExists = this._resolver.resolve(importPath);
- return { contents: sourceCodeIfExists.source };
- }),
- );
-
- if (!_.isUndefined(compiled.errors)) {
- const SOLIDITY_WARNING = 'warning';
- const errors = _.filter(compiled.errors, entry => entry.severity !== SOLIDITY_WARNING);
- const warnings = _.filter(compiled.errors, entry => entry.severity === SOLIDITY_WARNING);
- if (!_.isEmpty(errors)) {
- errors.forEach(error => {
- const normalizedErrMsg = getNormalizedErrMsg(error.formattedMessage || error.message);
- logUtils.log(chalk.red(normalizedErrMsg));
- });
- process.exit(1);
- } else {
- warnings.forEach(warning => {
- const normalizedWarningMsg = getNormalizedErrMsg(warning.formattedMessage || warning.message);
- logUtils.log(chalk.yellow(normalizedWarningMsg));
- });
- }
- }
- const compiledData = compiled.contracts[contractSource.path][contractName];
- if (_.isUndefined(compiledData)) {
- throw new Error(
- `Contract ${contractName} not found in ${
- contractSource.path
- }. Please make sure your contract has the same name as it's file name`,
- );
- }
- if (!_.isUndefined(compiledData.evm)) {
- if (!_.isUndefined(compiledData.evm.bytecode) && !_.isUndefined(compiledData.evm.bytecode.object)) {
- compiledData.evm.bytecode.object = ethUtil.addHexPrefix(compiledData.evm.bytecode.object);
- }
- if (
- !_.isUndefined(compiledData.evm.deployedBytecode) &&
- !_.isUndefined(compiledData.evm.deployedBytecode.object)
- ) {
- compiledData.evm.deployedBytecode.object = ethUtil.addHexPrefix(
- compiledData.evm.deployedBytecode.object,
- );
- }
- }
-
- const sourceCodes = _.mapValues(
- compiled.sources,
- (_1, sourceFilePath) => this._resolver.resolve(sourceFilePath).source,
- );
- const contractVersion: ContractVersionData = {
- compilerOutput: compiledData,
- sources: compiled.sources,
- sourceCodes,
- sourceTreeHashHex,
- compiler: {
- name: 'solc',
- version: solcVersion,
- settings: this._compilerSettings,
- },
- };
-
- let newArtifact: ContractArtifact;
- if (!_.isUndefined(currentArtifactIfExists)) {
- const currentArtifact = currentArtifactIfExists as ContractArtifact;
- newArtifact = {
- ...currentArtifact,
- ...contractVersion,
- };
- } else {
- newArtifact = {
- schemaVersion: constants.LATEST_ARTIFACT_VERSION,
- contractName,
- ...contractVersion,
- networks: {},
- };
- }
-
- const artifactString = utils.stringifyWithFormatting(newArtifact);
- const currentArtifactPath = `${this._artifactsDir}/${contractName}.json`;
- await fsWrapper.writeFileAsync(currentArtifactPath, artifactString);
- logUtils.log(`${contractName} artifact saved!`);
- }
- /**
- * Gets the source tree hash for a file and its dependencies.
- * @param fileName Name of contract file.
- */
- private _getSourceTreeHash(importPath: string): Buffer {
- const contractSource = this._resolver.resolve(importPath);
- const dependencies = parseDependencies(contractSource);
- const sourceHash = ethUtil.sha3(contractSource.source);
- if (dependencies.length === 0) {
- return sourceHash;
- } else {
- const dependencySourceTreeHashes = _.map(dependencies, (dependency: string) =>
- this._getSourceTreeHash(dependency),
- );
- const sourceTreeHashesBuffer = Buffer.concat([sourceHash, ...dependencySourceTreeHashes]);
- const sourceTreeHash = ethUtil.sha3(sourceTreeHashesBuffer);
- return sourceTreeHash;
- }
- }
-}
diff --git a/packages/deployer/src/globals.d.ts b/packages/deployer/src/globals.d.ts
deleted file mode 100644
index 94e63a32d..000000000
--- a/packages/deployer/src/globals.d.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-declare module '*.json' {
- const json: any;
- /* tslint:disable */
- export default json;
- /* tslint:enable */
-}
diff --git a/packages/deployer/src/index.ts b/packages/deployer/src/index.ts
deleted file mode 100644
index 4b4c51de2..000000000
--- a/packages/deployer/src/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { Compiler } from './compiler';
-export { ContractArtifact, ContractNetworks } from './utils/types';
diff --git a/packages/deployer/src/monorepo_scripts/postpublish.ts b/packages/deployer/src/monorepo_scripts/postpublish.ts
deleted file mode 100644
index dcb99d0f7..000000000
--- a/packages/deployer/src/monorepo_scripts/postpublish.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { postpublishUtils } from '@0xproject/monorepo-scripts';
-
-import * as packageJSON from '../package.json';
-import * as tsConfigJSON from '../tsconfig.json';
-
-const cwd = `${__dirname}/..`;
-// tslint:disable-next-line:no-floating-promises
-postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/deployer/src/monorepo_scripts/stage_docs.ts b/packages/deployer/src/monorepo_scripts/stage_docs.ts
deleted file mode 100644
index e732ac8eb..000000000
--- a/packages/deployer/src/monorepo_scripts/stage_docs.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { postpublishUtils } from '@0xproject/monorepo-scripts';
-
-import * as packageJSON from '../package.json';
-import * as tsConfigJSON from '../tsconfig.json';
-
-const cwd = `${__dirname}/..`;
-// tslint:disable-next-line:no-floating-promises
-postpublishUtils.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/deployer/src/solc/bin_paths.ts b/packages/deployer/src/solc/bin_paths.ts
deleted file mode 100644
index 1b5e8c6f1..000000000
--- a/packages/deployer/src/solc/bin_paths.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-export interface BinaryPaths {
- [key: string]: string;
-}
-
-export const binPaths: BinaryPaths = {
- '0.4.10': 'soljson-v0.4.10+commit.f0d539ae.js',
- '0.4.11': 'soljson-v0.4.11+commit.68ef5810.js',
- '0.4.12': 'soljson-v0.4.12+commit.194ff033.js',
- '0.4.13': 'soljson-v0.4.13+commit.fb4cb1a.js',
- '0.4.14': 'soljson-v0.4.14+commit.c2215d46.js',
- '0.4.15': 'soljson-v0.4.15+commit.bbb8e64f.js',
- '0.4.16': 'soljson-v0.4.16+commit.d7661dd9.js',
- '0.4.17': 'soljson-v0.4.17+commit.bdeb9e52.js',
- '0.4.18': 'soljson-v0.4.18+commit.9cf6e910.js',
- '0.4.19': 'soljson-v0.4.19+commit.c4cbbb05.js',
- '0.4.20': 'soljson-v0.4.20+commit.3155dd80.js',
- '0.4.21': 'soljson-v0.4.21+commit.dfe3193c.js',
- '0.4.22': 'soljson-v0.4.22+commit.4cb486ee.js',
- '0.4.23': 'soljson-v0.4.23+commit.124ca40d.js',
-};
diff --git a/packages/deployer/src/utils/compiler.ts b/packages/deployer/src/utils/compiler.ts
deleted file mode 100644
index c571b2581..000000000
--- a/packages/deployer/src/utils/compiler.ts
+++ /dev/null
@@ -1,107 +0,0 @@
-import { ContractSource, ContractSources } from '@0xproject/sol-resolver';
-import { logUtils } from '@0xproject/utils';
-import * as _ from 'lodash';
-import * as path from 'path';
-import * as solc from 'solc';
-
-import { constants } from './constants';
-import { fsWrapper } from './fs_wrapper';
-import { ContractArtifact } from './types';
-
-/**
- * Gets contract data on network or returns if an artifact does not exist.
- * @param artifactsDir Path to the artifacts directory.
- * @param contractName Name of contract.
- * @return Contract data on network or undefined.
- */
-export async function getContractArtifactIfExistsAsync(
- artifactsDir: string,
- contractName: string,
-): Promise<ContractArtifact | void> {
- let contractArtifact;
- const currentArtifactPath = `${artifactsDir}/${contractName}.json`;
- try {
- const opts = {
- encoding: 'utf8',
- };
- const contractArtifactString = await fsWrapper.readFileAsync(currentArtifactPath, opts);
- contractArtifact = JSON.parse(contractArtifactString);
- return contractArtifact;
- } catch (err) {
- logUtils.log(`Artifact for ${contractName} does not exist`);
- return undefined;
- }
-}
-
-/**
- * Creates a directory if it does not already exist.
- * @param artifactsDir Path to the directory.
- */
-export async function createDirIfDoesNotExistAsync(dirPath: string): Promise<void> {
- if (!fsWrapper.doesPathExistSync(dirPath)) {
- logUtils.log(`Creating directory at ${dirPath}...`);
- await fsWrapper.mkdirAsync(dirPath);
- }
-}
-
-/**
- * Searches Solidity source code for compiler version range.
- * @param source Source code of contract.
- * @return Solc compiler version range.
- */
-export function parseSolidityVersionRange(source: string): string {
- const SOLIDITY_VERSION_RANGE_REGEX = /pragma\s+solidity\s+(.*);/;
- const solcVersionRangeMatch = source.match(SOLIDITY_VERSION_RANGE_REGEX);
- if (_.isNull(solcVersionRangeMatch)) {
- throw new Error('Could not find Solidity version range in source');
- }
- const solcVersionRange = solcVersionRangeMatch[1];
- return solcVersionRange;
-}
-
-/**
- * Normalizes the path found in the error message.
- * Example: converts 'base/Token.sol:6:46: Warning: Unused local variable'
- * to 'Token.sol:6:46: Warning: Unused local variable'
- * This is used to prevent logging the same error multiple times.
- * @param errMsg An error message from the compiled output.
- * @return The error message with directories truncated from the contract path.
- */
-export function getNormalizedErrMsg(errMsg: string): string {
- const SOLIDITY_FILE_EXTENSION_REGEX = /(.*\.sol)/;
- const errPathMatch = errMsg.match(SOLIDITY_FILE_EXTENSION_REGEX);
- if (_.isNull(errPathMatch)) {
- throw new Error('Could not find a path in error message');
- }
- const errPath = errPathMatch[0];
- const baseContract = path.basename(errPath);
- const normalizedErrMsg = errMsg.replace(errPath, baseContract);
- return normalizedErrMsg;
-}
-
-/**
- * Parses the contract source code and extracts the dendencies
- * @param source Contract source code
- * @return List of dependendencies
- */
-export function parseDependencies(contractSource: ContractSource): string[] {
- // TODO: Use a proper parser
- const source = contractSource.source;
- const IMPORT_REGEX = /(import\s)/;
- const DEPENDENCY_PATH_REGEX = /"([^"]+)"/; // Source: https://github.com/BlockChainCompany/soljitsu/blob/master/lib/shared.js
- const dependencies: string[] = [];
- const lines = source.split('\n');
- _.forEach(lines, line => {
- if (!_.isNull(line.match(IMPORT_REGEX))) {
- const dependencyMatch = line.match(DEPENDENCY_PATH_REGEX);
- if (!_.isNull(dependencyMatch)) {
- let dependencyPath = dependencyMatch[1];
- if (dependencyPath.startsWith('.')) {
- dependencyPath = path.join(path.dirname(contractSource.path), dependencyPath);
- }
- dependencies.push(dependencyPath);
- }
- }
- });
- return dependencies;
-}
diff --git a/packages/deployer/src/utils/constants.ts b/packages/deployer/src/utils/constants.ts
deleted file mode 100644
index df2ddb3b2..000000000
--- a/packages/deployer/src/utils/constants.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export const constants = {
- SOLIDITY_FILE_EXTENSION: '.sol',
- BASE_COMPILER_URL: 'https://ethereum.github.io/solc-bin/bin/',
- LATEST_ARTIFACT_VERSION: '2.0.0',
-};
diff --git a/packages/deployer/src/utils/encoder.ts b/packages/deployer/src/utils/encoder.ts
deleted file mode 100644
index 806efbbca..000000000
--- a/packages/deployer/src/utils/encoder.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { AbiDefinition, AbiType, ContractAbi, DataItem } from '@0xproject/types';
-import * as _ from 'lodash';
-import * as web3Abi from 'web3-eth-abi';
-
-export const encoder = {
- encodeConstructorArgsFromAbi(args: any[], abi: ContractAbi): string {
- const constructorTypes: string[] = [];
- _.each(abi, (element: AbiDefinition) => {
- if (element.type === AbiType.Constructor) {
- _.each(element.inputs, (input: DataItem) => {
- constructorTypes.push(input.type);
- });
- }
- });
- const encodedParameters = web3Abi.encodeParameters(constructorTypes, args);
- return encodedParameters;
- },
-};
diff --git a/packages/deployer/src/utils/fs_wrapper.ts b/packages/deployer/src/utils/fs_wrapper.ts
deleted file mode 100644
index e02c83f27..000000000
--- a/packages/deployer/src/utils/fs_wrapper.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { promisify } from '@0xproject/utils';
-import * as fs from 'fs';
-
-export const fsWrapper = {
- readdirAsync: promisify<string[]>(fs.readdir),
- readFileAsync: promisify<string>(fs.readFile),
- writeFileAsync: promisify<undefined>(fs.writeFile),
- mkdirAsync: promisify<undefined>(fs.mkdir),
- doesPathExistSync: fs.existsSync,
- rmdirSync: fs.rmdirSync,
- removeFileAsync: promisify<undefined>(fs.unlink),
-};
diff --git a/packages/deployer/src/utils/types.ts b/packages/deployer/src/utils/types.ts
deleted file mode 100644
index b12a11b79..000000000
--- a/packages/deployer/src/utils/types.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import { ContractAbi, Provider, TxData } from '@0xproject/types';
-import * as solc from 'solc';
-import * as Web3 from 'web3';
-import * as yargs from 'yargs';
-
-export enum AbiType {
- Function = 'function',
- Constructor = 'constructor',
- Event = 'event',
- Fallback = 'fallback',
-}
-
-export interface ContractArtifact extends ContractVersionData {
- schemaVersion: string;
- contractName: string;
- networks: ContractNetworks;
-}
-
-export interface ContractVersionData {
- compiler: {
- name: 'solc';
- version: string;
- settings: solc.CompilerSettings;
- };
- sources: {
- [sourceName: string]: {
- id: number;
- };
- };
- sourceCodes: {
- [sourceName: string]: string;
- };
- sourceTreeHashHex: string;
- compilerOutput: solc.StandardContractOutput;
-}
-
-export interface ContractNetworks {
- [networkId: number]: ContractNetworkData;
-}
-
-export interface ContractNetworkData {
- address: string;
- links: {
- [linkName: string]: string;
- };
- constructorArgs: string;
-}
-
-export interface SolcErrors {
- [key: string]: boolean;
-}
-
-export interface CompilerOptions {
- contractsDir?: string;
- artifactsDir?: string;
- compilerSettings?: solc.CompilerSettings;
- contracts?: string[] | '*';
-}
-
-export interface ContractSourceData {
- [contractName: string]: ContractSpecificSourceData;
-}
-
-export interface ContractSpecificSourceData {
- solcVersionRange: string;
- sourceHash: Buffer;
- sourceTreeHash: Buffer;
-}
-
-export interface Token {
- address?: string;
- name: string;
- symbol: string;
- decimals: number;
- ipfsHash: string;
- swarmHash: string;
-}
-
-export type DoneCallback = (err?: Error) => void;
diff --git a/packages/deployer/src/utils/utils.ts b/packages/deployer/src/utils/utils.ts
deleted file mode 100644
index 9b1e59f9d..000000000
--- a/packages/deployer/src/utils/utils.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export const utils = {
- stringifyWithFormatting(obj: any): string {
- const jsonReplacer: null = null;
- const numberOfJsonSpaces = 4;
- const stringifiedObj = JSON.stringify(obj, jsonReplacer, numberOfJsonSpaces);
- return stringifiedObj;
- },
-};