aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-04-17 02:47:28 +0800
committerGitHub <noreply@github.com>2018-04-17 02:47:28 +0800
commitd263f7783fabe89cc9714b596068eccdc5babc1c (patch)
tree54a5c8f0a88320f3df8330d95506aea96e808bd3
parent1fcf3c5dc44d10648e14d6b10c174930eecf27b1 (diff)
parentd8ef76fd5efe63ec8f6205a73494ce388e64391f (diff)
downloaddexon-sol-tools-d263f7783fabe89cc9714b596068eccdc5babc1c.tar
dexon-sol-tools-d263f7783fabe89cc9714b596068eccdc5babc1c.tar.gz
dexon-sol-tools-d263f7783fabe89cc9714b596068eccdc5babc1c.tar.bz2
dexon-sol-tools-d263f7783fabe89cc9714b596068eccdc5babc1c.tar.lz
dexon-sol-tools-d263f7783fabe89cc9714b596068eccdc5babc1c.tar.xz
dexon-sol-tools-d263f7783fabe89cc9714b596068eccdc5babc1c.tar.zst
dexon-sol-tools-d263f7783fabe89cc9714b596068eccdc5babc1c.zip
Merge pull request #512 from 0xProject/feature/resolver
Dependencies resolver for deployer
-rw-r--r--.circleci/config.yml7
-rw-r--r--.gitignore2
-rw-r--r--.prettierignore1
-rw-r--r--packages/contracts/package.json2
-rw-r--r--packages/deployer/package.json5
-rw-r--r--packages/deployer/src/cli.ts34
-rw-r--r--packages/deployer/src/compiler.ts276
-rw-r--r--packages/deployer/src/utils/compiler.ts87
-rw-r--r--packages/deployer/src/utils/types.ts27
-rw-r--r--packages/deployer/test/compiler_test.ts16
-rw-r--r--packages/deployer/test/compiler_utils_test.ts35
-rw-r--r--packages/deployer/test/deployer_test.ts16
-rw-r--r--packages/deployer/test/fixtures/contracts/Exchange.sol (renamed from packages/deployer/test/fixtures/contracts/main/Exchange.sol)7
-rw-r--r--packages/deployer/test/fixtures/contracts/TokenTransferProxy.sol (renamed from packages/deployer/test/fixtures/contracts/main/TokenTransferProxy.sol)6
-rw-r--r--packages/deployer/test/fixtures/contracts/base/Ownable.sol27
-rw-r--r--packages/deployer/test/fixtures/contracts/base/SafeMath.sol2
-rw-r--r--packages/deployer/test/fixtures/contracts/base/Token.sol2
-rw-r--r--packages/deployer/test/fixtures/exchange_bin.ts2
-rw-r--r--packages/dev-utils/src/coverage.ts4
-rw-r--r--packages/metacoin/artifacts/Metacoin.json169
-rw-r--r--packages/metacoin/package.json4
-rw-r--r--packages/sol-cov/package.json4
-rw-r--r--packages/sol-cov/src/collect_contract_data.ts28
-rw-r--r--packages/sol-cov/src/types.ts1
-rw-r--r--packages/sol-cov/test/collect_contracts_data_test.ts1
-rw-r--r--packages/sol-cov/test/collect_coverage_entries_test.ts4
-rw-r--r--packages/sol-cov/test/fixtures/artifacts/SimpleStorage.json64
-rw-r--r--packages/sol-cov/test/fixtures/artifacts/Simplest.json20
-rw-r--r--packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol2
-rw-r--r--packages/sol-resolver/package.json39
-rw-r--r--packages/sol-resolver/src/index.ts8
-rw-r--r--packages/sol-resolver/src/resolvers/enumerable_resolver.ts7
-rw-r--r--packages/sol-resolver/src/resolvers/fallthrough_resolver.ts21
-rw-r--r--packages/sol-resolver/src/resolvers/fs_resolver.ts19
-rw-r--r--packages/sol-resolver/src/resolvers/name_resolver.ts66
-rw-r--r--packages/sol-resolver/src/resolvers/npm_resolver.ts34
-rw-r--r--packages/sol-resolver/src/resolvers/resolver.ts14
-rw-r--r--packages/sol-resolver/src/resolvers/url_resolver.ts21
-rw-r--r--packages/sol-resolver/src/types.ts8
-rw-r--r--packages/sol-resolver/tsconfig.json7
-rw-r--r--packages/sol-resolver/tslint.json3
-rw-r--r--packages/typescript-typings/CHANGELOG.json9
-rw-r--r--packages/typescript-typings/types/solc/index.d.ts116
-rw-r--r--packages/utils/src/index.ts1
-rw-r--r--yarn.lock70
45 files changed, 635 insertions, 663 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 615980e88..0398705b0 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -124,6 +124,10 @@ jobs:
key: coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/sol-cov/coverage/lcov.info
+ - save_cache:
+ key: coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }}
+ paths:
+ - ~/repo/packages/metacoin/coverage/lcov.info
lint:
working_directory: ~/repo
docker:
@@ -177,6 +181,9 @@ jobs:
- restore_cache:
keys:
- coverage-0xjs-{{ .Environment.CIRCLE_SHA1 }}
+ - restore_cache:
+ keys:
+ - coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn report_coverage
workflows:
version: 2
diff --git a/.gitignore b/.gitignore
index 7ce855341..83538fdca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -74,6 +74,8 @@ packages/react-docs/example/public/bundle*
bin/
# generated contract artifacts
+packages/sol-cov/test/fixtures/artifacts
+packages/metacoin/artifacts
packages/0x.js/test/artifacts
packages/migrations/src/artifacts
diff --git a/.prettierignore b/.prettierignore
index b3e217fb0..024d0b548 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -2,5 +2,6 @@ lib
.nyc_output
/packages/contracts/src/artifacts
/packages/metacoin/artifacts
+/packages/migrations/src/artifacts
package.json
scripts/postpublish_utils.js
diff --git a/packages/contracts/package.json b/packages/contracts/package.json
index ad338bd5f..eb1701a18 100644
--- a/packages/contracts/package.json
+++ b/packages/contracts/package.json
@@ -16,7 +16,7 @@
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
"run_mocha": "mocha 'lib/test/**/*.js' --timeout 100000 --bail --exit",
"compile:comment": "Yarn workspaces do not link binaries correctly so we need to reference them directly https://github.com/yarnpkg/yarn/issues/3846",
- "compile": "node ../deployer/lib/src/cli.js compile --contracts ${npm_package_config_contracts} --contract-dirs src/contracts --artifacts-dir ../migrations/src/artifacts",
+ "compile": "node ../deployer/lib/src/cli.js compile --contracts ${npm_package_config_contracts} --contracts-dir src/contracts --artifacts-dir ../migrations/src/artifacts",
"clean": "shx rm -rf ./lib",
"generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'",
"lint": "tslint --project . 'migrations/**/*.ts' 'test/**/*.ts' 'util/**/*.ts' 'deploy/**/*.ts'",
diff --git a/packages/deployer/package.json b/packages/deployer/package.json
index 6afaa13b3..d529382ac 100644
--- a/packages/deployer/package.json
+++ b/packages/deployer/package.json
@@ -64,15 +64,18 @@
"typedoc": "0xProject/typedoc",
"types-bn": "^0.0.1",
"typescript": "2.7.1",
- "web3-typescript-typings": "^0.10.2"
+ "web3-typescript-typings": "^0.10.2",
+ "zeppelin-solidity": "1.8.0"
},
"dependencies": {
+ "@0xproject/sol-resolver": "^0.0.1",
"@0xproject/json-schemas": "^0.7.20",
"@0xproject/types": "^0.6.0",
"@0xproject/typescript-typings": "^0.1.0",
"@0xproject/utils": "^0.5.1",
"@0xproject/web3-wrapper": "^0.6.0",
"@types/yargs": "^11.0.0",
+ "chalk": "^2.3.0",
"ethereumjs-util": "^5.1.1",
"isomorphic-fetch": "^2.2.1",
"lodash": "^4.17.4",
diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts
index 7b32187c4..7f1ae708a 100644
--- a/packages/deployer/src/cli.ts
+++ b/packages/deployer/src/cli.ts
@@ -11,7 +11,7 @@ import * as yargs from 'yargs';
import { commands } from './commands';
import { constants } from './utils/constants';
import { consoleReporter } from './utils/error_reporter';
-import { CliOptions, CompilerOptions, ContractDirectory, DeployerOptions } from './utils/types';
+import { CliOptions, CompilerOptions, DeployerOptions } from './utils/types';
const DEFAULT_OPTIMIZER_ENABLED = false;
const DEFAULT_CONTRACTS_DIR = path.resolve('src/contracts');
@@ -27,7 +27,7 @@ const DEFAULT_CONTRACTS_LIST = '*';
*/
async function onCompileCommandAsync(argv: CliOptions): Promise<void> {
const opts: CompilerOptions = {
- contractDirs: getContractDirectoriesFromList(argv.contractDirs),
+ contractsDir: argv.contractsDir,
networkId: argv.networkId,
optimizerEnabled: argv.shouldOptimize,
artifactsDir: argv.artifactsDir,
@@ -45,7 +45,7 @@ async function onDeployCommandAsync(argv: CliOptions): Promise<void> {
const web3Wrapper = new Web3Wrapper(provider);
const networkId = await web3Wrapper.getNetworkIdAsync();
const compilerOpts: CompilerOptions = {
- contractDirs: getContractDirectoriesFromList(argv.contractDirs),
+ contractsDir: argv.contractsDir,
networkId,
optimizerEnabled: argv.shouldOptimize,
artifactsDir: argv.artifactsDir,
@@ -69,29 +69,6 @@ async function onDeployCommandAsync(argv: CliOptions): Promise<void> {
}
/**
* Creates a set of contracts to compile.
- * @param contractDirectoriesList Comma separated list of contract directories
- * @return Set of contract directories
- */
-function getContractDirectoriesFromList(contractDirectoriesList: string): Set<ContractDirectory> {
- const directories = new Set();
- const possiblyNamespacedDirectories = contractDirectoriesList.split(',');
- _.forEach(possiblyNamespacedDirectories, namespacedDirectory => {
- const directoryComponents = namespacedDirectory.split(':');
- if (directoryComponents.length === 1) {
- const directory = { namespace: '', path: directoryComponents[0] };
- directories.add(directory);
- } else if (directoryComponents.length === 2) {
- const directory = { namespace: directoryComponents[0], path: directoryComponents[1] };
- directories.add(directory);
- } else {
- throw new Error(`Unable to parse contracts directory: '${namespacedDirectory}'`);
- }
- });
-
- return directories;
-}
-/**
- * Creates a set of contracts to compile.
* @param contracts Comma separated list of contracts to compile
*/
function getContractsSetFromList(contracts: string): Set<string> {
@@ -126,11 +103,10 @@ function deployCommandBuilder(yargsInstance: any) {
(() => {
const identityCommandBuilder = _.identity;
return yargs
- .option('contract-dirs', {
+ .option('contracts-dir', {
type: 'string',
default: DEFAULT_CONTRACTS_DIR,
- description:
- "comma separated list of contract directories.\nTo avoid filename clashes, directories should be prefixed with a namespace as follows: 'namespace:/path/to/dir'.",
+ description: 'path of contracts directory to compile',
})
.option('network-id', {
type: 'number',
diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts
index e3ecc6c72..a3c8004ec 100644
--- a/packages/deployer/src/compiler.ts
+++ b/packages/deployer/src/compiler.ts
@@ -1,5 +1,17 @@
-import { AbiType, ContractAbi, MethodAbi } from '@0xproject/types';
+import {
+ ContractSource,
+ ContractSources,
+ EnumerableResolver,
+ FallthroughResolver,
+ FSResolver,
+ NameResolver,
+ NPMResolver,
+ Resolver,
+ URLResolver,
+} from '@0xproject/sol-resolver';
+import { ContractAbi } from '@0xproject/types';
import { logUtils, promisify } from '@0xproject/utils';
+import chalk from 'chalk';
import * as ethUtil from 'ethereumjs-util';
import * as fs from 'fs';
import 'isomorphic-fetch';
@@ -11,10 +23,7 @@ import solc = require('solc');
import { binPaths } from './solc/bin_paths';
import {
- constructContractId,
- constructUniqueSourceFileId,
createDirIfDoesNotExistAsync,
- findImportIfExist,
getContractArtifactIfExistsAsync,
getNormalizedErrMsg,
parseDependencies,
@@ -25,14 +34,10 @@ import { fsWrapper } from './utils/fs_wrapper';
import {
CompilerOptions,
ContractArtifact,
- ContractDirectory,
- ContractIdToSourceFileId,
ContractNetworkData,
ContractNetworks,
- ContractSourceDataByFileId,
- ContractSources,
+ ContractSourceData,
ContractSpecificSourceData,
- FunctionNameToSeenCount,
} from './utils/types';
import { utils } from './utils/utils';
@@ -44,71 +49,32 @@ const SOLC_BIN_DIR = path.join(__dirname, '..', '..', 'solc_bin');
* to artifact files.
*/
export class Compiler {
- private _contractDirs: Set<ContractDirectory>;
+ private _resolver: Resolver;
+ private _nameResolver: NameResolver;
+ private _contractsDir: string;
private _networkId: number;
private _optimizerEnabled: boolean;
private _artifactsDir: string;
- // This get's set in the beggining of `compileAsync` function. It's not called from a constructor, but it's the only public method of that class and could as well be.
- private _contractSources!: ContractSources;
private _specifiedContracts: Set<string> = new Set();
- private _contractSourceDataByFileId: ContractSourceDataByFileId = {};
-
- /**
- * Recursively retrieves Solidity source code from directory.
- * @param dirPath Directory to search.
- * @param contractBaseDir Base contracts directory of search tree.
- * @return Mapping of sourceFilePath to the contract source.
- */
- private static async _getContractSourcesAsync(dirPath: string, contractBaseDir: 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 fileName of dirContents) {
- const contentPath = `${dirPath}/${fileName}`;
- if (path.extname(fileName) === constants.SOLIDITY_FILE_EXTENSION) {
- try {
- const opts = {
- encoding: 'utf8',
- };
- const source = await fsWrapper.readFileAsync(contentPath, opts);
- if (!_.startsWith(contentPath, contractBaseDir)) {
- throw new Error(`Expected content path '${contentPath}' to begin with '${contractBaseDir}'`);
- }
- const sourceFilePath = contentPath.slice(contractBaseDir.length);
- sources[sourceFilePath] = source;
- logUtils.log(`Reading ${sourceFilePath} source...`);
- } catch (err) {
- logUtils.log(`Could not find file at ${contentPath}`);
- }
- } else {
- try {
- const nestedSources = await Compiler._getContractSourcesAsync(contentPath, contractBaseDir);
- sources = {
- ...sources,
- ...nestedSources,
- };
- } catch (err) {
- logUtils.log(`${contentPath} is not a directory or ${constants.SOLIDITY_FILE_EXTENSION} file`);
- }
- }
- }
- return sources;
- }
/**
* 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._contractDirs = opts.contractDirs;
+ this._contractsDir = opts.contractsDir;
this._networkId = opts.networkId;
this._optimizerEnabled = opts.optimizerEnabled;
this._artifactsDir = opts.artifactsDir;
this._specifiedContracts = opts.specifiedContracts;
+ this._nameResolver = new NameResolver(path.resolve(this._contractsDir));
+ const resolver = new FallthroughResolver();
+ resolver.appendResolver(new URLResolver());
+ const packagePath = path.resolve('');
+ resolver.appendResolver(new NPMResolver(packagePath));
+ resolver.appendResolver(new FSResolver());
+ resolver.appendResolver(this._nameResolver);
+ this._resolver = resolver;
}
/**
* Compiles selected Solidity files found in `contractsDir` and writes JSON artifacts to `artifactsDir`.
@@ -116,51 +82,27 @@ export class Compiler {
public async compileAsync(): Promise<void> {
await createDirIfDoesNotExistAsync(this._artifactsDir);
await createDirIfDoesNotExistAsync(SOLC_BIN_DIR);
- this._contractSources = {};
- const contractIdToSourceFileId: ContractIdToSourceFileId = {};
- const contractDirs = Array.from(this._contractDirs.values());
- for (const contractDir of contractDirs) {
- const sources = await Compiler._getContractSourcesAsync(contractDir.path, contractDir.path);
- _.forIn(sources, (source, sourceFilePath) => {
- const sourceFileId = constructUniqueSourceFileId(contractDir.namespace, sourceFilePath);
- // Record the file's source and data
- if (!_.isUndefined(this._contractSources[sourceFileId])) {
- throw new Error(`Found duplicate source files with ID '${sourceFileId}'`);
- }
- this._contractSources[sourceFileId] = source;
- // Create a mapping between the contract id and its source file id
- const contractId = constructContractId(contractDir.namespace, sourceFilePath);
- if (!_.isUndefined(contractIdToSourceFileId[contractId])) {
- throw new Error(`Found duplicate contract with ID '${contractId}'`);
- }
- contractIdToSourceFileId[contractId] = sourceFileId;
- });
+ let contractNamesToCompile: string[] = [];
+ if (this._specifiedContracts.has(ALL_CONTRACTS_IDENTIFIER)) {
+ const allContracts = this._nameResolver.getAll();
+ contractNamesToCompile = _.map(allContracts, contractSource =>
+ path.basename(contractSource.path, constants.SOLIDITY_FILE_EXTENSION),
+ );
+ } else {
+ contractNamesToCompile = Array.from(this._specifiedContracts.values());
+ }
+ for (const contractNameToCompile of contractNamesToCompile) {
+ await this._compileContractAsync(contractNameToCompile);
}
- _.forIn(this._contractSources, this._setContractSpecificSourceData.bind(this));
- const specifiedContractIds = this._specifiedContracts.has(ALL_CONTRACTS_IDENTIFIER)
- ? _.keys(contractIdToSourceFileId)
- : Array.from(this._specifiedContracts.values());
- await Promise.all(
- _.map(specifiedContractIds, async contractId =>
- this._compileContractAsync(contractIdToSourceFileId[contractId]),
- ),
- );
}
/**
* Compiles contract and saves artifact to artifactsDir.
- * @param sourceFileId Unique ID of the source file.
+ * @param fileName Name of contract with '.sol' extension.
*/
- private async _compileContractAsync(sourceFileId: string): Promise<void> {
- if (_.isUndefined(this._contractSources)) {
- throw new Error('Contract sources not yet initialized');
- }
- if (_.isUndefined(this._contractSourceDataByFileId[sourceFileId])) {
- throw new Error(`Contract source for ${sourceFileId} not yet initialized`);
- }
- const contractSpecificSourceData = this._contractSourceDataByFileId[sourceFileId];
- const currentArtifactIfExists = await getContractArtifactIfExistsAsync(this._artifactsDir, sourceFileId);
- const sourceHash = `0x${contractSpecificSourceData.sourceHash.toString('hex')}`;
- const sourceTreeHash = `0x${contractSpecificSourceData.sourceTreeHash.toString('hex')}`;
+ private async _compileContractAsync(contractName: string): Promise<void> {
+ const contractSource = this._resolver.resolve(contractName);
+ const currentArtifactIfExists = await getContractArtifactIfExistsAsync(this._artifactsDir, contractName);
+ const sourceTreeHashHex = `0x${this._getSourceTreeHash(contractSource.path).toString('hex')}`;
let shouldCompile = false;
if (_.isUndefined(currentArtifactIfExists)) {
@@ -169,16 +111,14 @@ export class Compiler {
const currentArtifact = currentArtifactIfExists as ContractArtifact;
shouldCompile =
currentArtifact.networks[this._networkId].optimizer_enabled !== this._optimizerEnabled ||
- currentArtifact.networks[this._networkId].source_tree_hash !== sourceTreeHash;
+ currentArtifact.networks[this._networkId].source_tree_hash !== sourceTreeHashHex;
}
if (!shouldCompile) {
return;
}
+ const solcVersionRange = parseSolidityVersionRange(contractSource.source);
const availableCompilerVersions = _.keys(binPaths);
- const solcVersion = semver.maxSatisfying(
- availableCompilerVersions,
- contractSpecificSourceData.solcVersionRange,
- );
+ const solcVersion = semver.maxSatisfying(availableCompilerVersions, solcVersionRange);
const fullSolcVersion = binPaths[solcVersion];
const compilerBinFilename = path.join(SOLC_BIN_DIR, fullSolcVersion);
let solcjs: string;
@@ -197,57 +137,77 @@ export class Compiler {
}
const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename));
- logUtils.log(`Compiling ${sourceFileId} with Solidity v${solcVersion}...`);
- const source = this._contractSources[sourceFileId];
- const input = {
- [sourceFileId]: source,
- };
- const sourcesToCompile = {
- sources: input,
+ logUtils.log(`Compiling ${contractName} with Solidity v${solcVersion}...`);
+ const source = contractSource.source;
+ const absoluteFilePath = contractSource.path;
+ const standardInput: solc.StandardInput = {
+ language: 'Solidity',
+ sources: {
+ [absoluteFilePath]: {
+ urls: [`file://${absoluteFilePath}`],
+ },
+ },
+ settings: {
+ optimizer: {
+ enabled: this._optimizerEnabled,
+ },
+ outputSelection: {
+ '*': {
+ '*': [
+ 'abi',
+ 'evm.bytecode.object',
+ 'evm.bytecode.sourceMap',
+ 'evm.deployedBytecode.object',
+ 'evm.deployedBytecode.sourceMap',
+ ],
+ },
+ },
+ },
};
-
- const compiled = solcInstance.compile(sourcesToCompile, Number(this._optimizerEnabled), importPath =>
- findImportIfExist(this._contractSources, sourceFileId, importPath),
+ 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_PREFIX = 'Warning';
- const isError = (errorOrWarning: string) => !errorOrWarning.includes(SOLIDITY_WARNING_PREFIX);
- const isWarning = (errorOrWarning: string) => errorOrWarning.includes(SOLIDITY_WARNING_PREFIX);
- const errors = _.filter(compiled.errors, isError);
- const warnings = _.filter(compiled.errors, isWarning);
+ 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(errMsg => {
- const normalizedErrMsg = getNormalizedErrMsg(errMsg);
- logUtils.log(normalizedErrMsg);
+ errors.forEach(error => {
+ const normalizedErrMsg = getNormalizedErrMsg(error.formattedMessage || error.message);
+ logUtils.log(chalk.red(normalizedErrMsg));
});
process.exit(1);
} else {
- warnings.forEach(errMsg => {
- const normalizedErrMsg = getNormalizedErrMsg(errMsg);
- logUtils.log(normalizedErrMsg);
+ warnings.forEach(warning => {
+ const normalizedWarningMsg = getNormalizedErrMsg(warning.formattedMessage || warning.message);
+ logUtils.log(chalk.yellow(normalizedWarningMsg));
});
}
}
- const contractName = path.basename(sourceFileId, constants.SOLIDITY_FILE_EXTENSION);
- const contractIdentifier = `${sourceFileId}:${contractName}`;
- if (_.isUndefined(compiled.contracts[contractIdentifier])) {
+ const compiledData = compiled.contracts[absoluteFilePath][contractName];
+ if (_.isUndefined(compiledData)) {
throw new Error(
- `Contract ${contractName} not found in ${sourceFileId}. Please make sure your contract has the same name as it's file name`,
+ `Contract ${contractName} not found in ${absoluteFilePath}. Please make sure your contract has the same name as it's file name`,
);
}
- const abi: ContractAbi = JSON.parse(compiled.contracts[contractIdentifier].interface);
- const bytecode = `0x${compiled.contracts[contractIdentifier].bytecode}`;
- const runtimeBytecode = `0x${compiled.contracts[contractIdentifier].runtimeBytecode}`;
- const sourceMap = compiled.contracts[contractIdentifier].srcmap;
- const sourceMapRuntime = compiled.contracts[contractIdentifier].srcmapRuntime;
- const sources = _.keys(compiled.sources);
+ const abi: ContractAbi = compiledData.abi;
+ const bytecode = `0x${compiledData.evm.bytecode.object}`;
+ const runtimeBytecode = `0x${compiledData.evm.deployedBytecode.object}`;
+ const sourceMap = compiledData.evm.bytecode.sourceMap;
+ const sourceMapRuntime = compiledData.evm.deployedBytecode.sourceMap;
+ const unresolvedSourcePaths = _.keys(compiled.sources);
+ const sources = _.map(
+ unresolvedSourcePaths,
+ unresolvedSourcePath => this._resolver.resolve(unresolvedSourcePath).path,
+ );
const updated_at = Date.now();
-
const contractNetworkData: ContractNetworkData = {
solc_version: solcVersion,
- keccak256: sourceHash,
- source_tree_hash: sourceTreeHash,
+ source_tree_hash: sourceTreeHashHex,
optimizer_enabled: this._optimizerEnabled,
abi,
bytecode,
@@ -280,44 +240,22 @@ export class Compiler {
const artifactString = utils.stringifyWithFormatting(newArtifact);
const currentArtifactPath = `${this._artifactsDir}/${contractName}.json`;
await fsWrapper.writeFileAsync(currentArtifactPath, artifactString);
- logUtils.log(`${sourceFileId} artifact saved!`);
+ logUtils.log(`${contractName} artifact saved!`);
}
/**
- * Gets contract dependendencies and keccak256 hash from source.
- * @param source Source code of contract.
- * @param fileId FileId of the contract source file.
- * @return Object with contract dependencies and keccak256 hash of source.
- */
- private _setContractSpecificSourceData(source: string, fileId: string): void {
- if (!_.isUndefined(this._contractSourceDataByFileId[fileId])) {
- return;
- }
- const sourceHash = ethUtil.sha3(source);
- const solcVersionRange = parseSolidityVersionRange(source);
- const dependencies = parseDependencies(source, fileId);
- const sourceTreeHash = this._getSourceTreeHash(fileId, sourceHash, dependencies);
- this._contractSourceDataByFileId[fileId] = {
- dependencies,
- solcVersionRange,
- sourceHash,
- sourceTreeHash,
- };
- }
-
- /**
* Gets the source tree hash for a file and its dependencies.
* @param fileName Name of contract file.
*/
- private _getSourceTreeHash(fileName: string, sourceHash: Buffer, dependencies: string[]): Buffer {
+ 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 => {
- const source = this._contractSources[dependency];
- this._setContractSpecificSourceData(source, dependency);
- const sourceData = this._contractSourceDataByFileId[dependency];
- return this._getSourceTreeHash(dependency, sourceData.sourceHash, sourceData.dependencies);
- });
+ 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/utils/compiler.ts b/packages/deployer/src/utils/compiler.ts
index 600495693..c571b2581 100644
--- a/packages/deployer/src/utils/compiler.ts
+++ b/packages/deployer/src/utils/compiler.ts
@@ -1,4 +1,4 @@
-import { AbiType, ContractAbi, MethodAbi } from '@0xproject/types';
+import { ContractSource, ContractSources } from '@0xproject/sol-resolver';
import { logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import * as path from 'path';
@@ -6,60 +6,19 @@ import * as solc from 'solc';
import { constants } from './constants';
import { fsWrapper } from './fs_wrapper';
-import { ContractArtifact, ContractSources, FunctionNameToSeenCount } from './types';
+import { ContractArtifact } from './types';
/**
- * Constructs a system-wide unique identifier for a source file.
- * @param directoryNamespace Namespace of the source file's root contract directory.
- * @param sourceFilePath Path to a source file, relative to contractBaseDir.
- * @return sourceFileId A system-wide unique identifier for the source file.
- */
-export function constructUniqueSourceFileId(directoryNamespace: string, sourceFilePath: string): string {
- const namespacePrefix = !_.isEmpty(directoryNamespace) ? `/${directoryNamespace}` : '';
- const sourceFilePathNoLeadingSlash = sourceFilePath.replace(/^\/+/g, '');
- const sourceFileId = `${namespacePrefix}/${sourceFilePathNoLeadingSlash}`;
- return sourceFileId;
-}
-/**
- * Constructs a system-wide unique identifier for a dependency file.
- * @param dependencyFilePath Path from a sourceFile to a dependency.
- * @param contractBaseDir Base contracts directory of search tree.
- * @return sourceFileId A system-wide unique identifier for the source file.
- */
-export function constructDependencyFileId(dependencyFilePath: string, sourceFilePath: string): string {
- if (_.startsWith(dependencyFilePath, '/')) {
- // Path of the form /namespace/path/to/dependency.sol
- return dependencyFilePath;
- } else {
- // Dependency is relative to the source file: ./dependency.sol, ../../some/path/dependency.sol, etc.
- // Join the two paths to construct a valid source file id: /namespace/path/to/dependency.sol
- return path.join(path.dirname(sourceFilePath), dependencyFilePath);
- }
-}
-/**
- * Constructs a system-wide unique identifier for a contract.
- * @param directoryNamespace Namespace of the source file's root contract directory.
- * @param sourceFilePath Path to a source file, relative to contractBaseDir.
- * @return sourceFileId A system-wide unique identifier for contract.
- */
-export function constructContractId(directoryNamespace: string, sourceFilePath: string): string {
- const namespacePrefix = !_.isEmpty(directoryNamespace) ? `${directoryNamespace}:` : '';
- const sourceFileName = path.basename(sourceFilePath, constants.SOLIDITY_FILE_EXTENSION);
- const contractId = `${namespacePrefix}${sourceFileName}`;
- return contractId;
-}
-/**
* Gets contract data on network or returns if an artifact does not exist.
* @param artifactsDir Path to the artifacts directory.
- * @param fileName Name of contract file.
+ * @param contractName Name of contract.
* @return Contract data on network or undefined.
*/
export async function getContractArtifactIfExistsAsync(
artifactsDir: string,
- fileName: string,
+ contractName: string,
): Promise<ContractArtifact | void> {
let contractArtifact;
- const contractName = path.basename(fileName, constants.SOLIDITY_FILE_EXTENSION);
const currentArtifactPath = `${artifactsDir}/${contractName}.json`;
try {
const opts = {
@@ -69,7 +28,7 @@ export async function getContractArtifactIfExistsAsync(
contractArtifact = JSON.parse(contractArtifactString);
return contractArtifact;
} catch (err) {
- logUtils.log(`Artifact for ${fileName} does not exist`);
+ logUtils.log(`Artifact for ${contractName} does not exist`);
return undefined;
}
}
@@ -123,11 +82,11 @@ export function getNormalizedErrMsg(errMsg: string): string {
/**
* Parses the contract source code and extracts the dendencies
* @param source Contract source code
- * @param sourceFilePath File path of the source code.
* @return List of dependendencies
*/
-export function parseDependencies(source: string, sourceFileId: string): string[] {
+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[] = [];
@@ -136,35 +95,13 @@ export function parseDependencies(source: string, sourceFileId: string): string[
if (!_.isNull(line.match(IMPORT_REGEX))) {
const dependencyMatch = line.match(DEPENDENCY_PATH_REGEX);
if (!_.isNull(dependencyMatch)) {
- const dependencyPath = dependencyMatch[1];
- const dependencyId = constructDependencyFileId(dependencyPath, sourceFileId);
- dependencies.push(dependencyId);
+ let dependencyPath = dependencyMatch[1];
+ if (dependencyPath.startsWith('.')) {
+ dependencyPath = path.join(path.dirname(contractSource.path), dependencyPath);
+ }
+ dependencies.push(dependencyPath);
}
}
});
return dependencies;
}
-
-/**
- * Callback to resolve dependencies with `solc.compile`.
- * Throws error if contractSources not yet initialized.
- * @param contractSources Source codes of contracts.
- * @param sourceFileId ID of the source file.
- * @param importPath Path of dependency source file.
- * @return Import contents object containing source code of dependency.
- */
-export function findImportIfExist(
- contractSources: ContractSources,
- sourceFileId: string,
- importPath: string,
-): solc.ImportContents {
- const dependencyFileId = constructDependencyFileId(importPath, sourceFileId);
- const source = contractSources[dependencyFileId];
- if (_.isUndefined(source)) {
- throw new Error(`Contract source not found for ${dependencyFileId}`);
- }
- const importContents: solc.ImportContents = {
- contents: source,
- };
- return importContents;
-}
diff --git a/packages/deployer/src/utils/types.ts b/packages/deployer/src/utils/types.ts
index 1a866b873..a20d0f627 100644
--- a/packages/deployer/src/utils/types.ts
+++ b/packages/deployer/src/utils/types.ts
@@ -18,15 +18,9 @@ export interface ContractNetworks {
[key: number]: ContractNetworkData;
}
-export interface ContractDirectory {
- path: string;
- namespace: string;
-}
-
export interface ContractNetworkData {
solc_version: string;
optimizer_enabled: boolean;
- keccak256: string;
source_tree_hash: string;
abi: ContractAbi;
bytecode: string;
@@ -45,7 +39,7 @@ export interface SolcErrors {
export interface CliOptions extends yargs.Arguments {
artifactsDir: string;
- contractDirs: string;
+ contractsDir: string;
jsonrpcUrl: string;
networkId: number;
shouldOptimize: boolean;
@@ -56,7 +50,7 @@ export interface CliOptions extends yargs.Arguments {
}
export interface CompilerOptions {
- contractDirs: Set<ContractDirectory>;
+ contractsDir: string;
networkId: number;
optimizerEnabled: boolean;
artifactsDir: string;
@@ -79,20 +73,11 @@ export interface UrlDeployerOptions extends BaseDeployerOptions {
export type DeployerOptions = UrlDeployerOptions | ProviderDeployerOptions;
-export interface ContractSources {
- [key: string]: string;
-}
-
-export interface ContractIdToSourceFileId {
- [key: string]: string;
-}
-
-export interface ContractSourceDataByFileId {
- [key: string]: ContractSpecificSourceData;
+export interface ContractSourceData {
+ [contractName: string]: ContractSpecificSourceData;
}
export interface ContractSpecificSourceData {
- dependencies: string[];
solcVersionRange: string;
sourceHash: Buffer;
sourceTreeHash: Buffer;
@@ -107,8 +92,4 @@ export interface Token {
swarmHash: string;
}
-export interface FunctionNameToSeenCount {
- [key: string]: number;
-}
-
export type DoneCallback = (err?: Error) => void;
diff --git a/packages/deployer/test/compiler_test.ts b/packages/deployer/test/compiler_test.ts
index 817a3b3f9..b03ae7935 100644
--- a/packages/deployer/test/compiler_test.ts
+++ b/packages/deployer/test/compiler_test.ts
@@ -3,13 +3,7 @@ import 'mocha';
import { Compiler } from '../src/compiler';
import { fsWrapper } from '../src/utils/fs_wrapper';
-import {
- CompilerOptions,
- ContractArtifact,
- ContractDirectory,
- ContractNetworkData,
- DoneCallback,
-} from '../src/utils/types';
+import { CompilerOptions, ContractArtifact, ContractNetworkData, DoneCallback } from '../src/utils/types';
import { exchange_binary } from './fixtures/exchange_bin';
import { constants } from './util/constants';
@@ -19,15 +13,11 @@ const expect = chai.expect;
describe('#Compiler', function() {
this.timeout(constants.timeoutMs);
const artifactsDir = `${__dirname}/fixtures/artifacts`;
- const mainContractDir: ContractDirectory = { path: `${__dirname}/fixtures/contracts/main`, namespace: 'main' };
- const baseContractDir: ContractDirectory = { path: `${__dirname}/fixtures/contracts/base`, namespace: 'base' };
- const contractDirs: Set<ContractDirectory> = new Set();
- contractDirs.add(mainContractDir);
- contractDirs.add(baseContractDir);
+ const contractsDir = `${__dirname}/fixtures/contracts`;
const exchangeArtifactPath = `${artifactsDir}/Exchange.json`;
const compilerOpts: CompilerOptions = {
artifactsDir,
- contractDirs,
+ contractsDir,
networkId: constants.networkId,
optimizerEnabled: constants.optimizerEnabled,
specifiedContracts: new Set(constants.specifiedContracts),
diff --git a/packages/deployer/test/compiler_utils_test.ts b/packages/deployer/test/compiler_utils_test.ts
index 5377d3308..e2b95f289 100644
--- a/packages/deployer/test/compiler_utils_test.ts
+++ b/packages/deployer/test/compiler_utils_test.ts
@@ -47,34 +47,31 @@ describe('Compiler utils', () => {
});
describe('#parseDependencies', () => {
it('correctly parses Exchange dependencies', async () => {
- const exchangeSource = await fsWrapper.readFileAsync(`${__dirname}/fixtures/contracts/main/Exchange.sol`, {
+ const path = `${__dirname}/fixtures/contracts/Exchange.sol`;
+ const source = await fsWrapper.readFileAsync(path, {
encoding: 'utf8',
});
- const sourceFileId = '/main/Exchange.sol';
- expect(parseDependencies(exchangeSource, sourceFileId)).to.be.deep.equal([
- '/main/TokenTransferProxy.sol',
- '/base/Token.sol',
- '/base/SafeMath.sol',
+ expect(parseDependencies({ source, path })).to.be.deep.equal([
+ 'zeppelin-solidity/contracts/token/ERC20/ERC20.sol',
+ '/home/circleci/repo/packages/deployer/lib/test/fixtures/contracts/TokenTransferProxy.sol',
+ '/home/circleci/repo/packages/deployer/lib/test/fixtures/contracts/base/SafeMath.sol',
]);
});
it('correctly parses TokenTransferProxy dependencies', async () => {
- const exchangeSource = await fsWrapper.readFileAsync(
- `${__dirname}/fixtures/contracts/main/TokenTransferProxy.sol`,
- {
- encoding: 'utf8',
- },
- );
- const sourceFileId = '/main/TokenTransferProxy.sol';
- expect(parseDependencies(exchangeSource, sourceFileId)).to.be.deep.equal([
- '/base/Token.sol',
- '/base/Ownable.sol',
+ const path = `${__dirname}/fixtures/contracts/TokenTransferProxy.sol`;
+ const source = await fsWrapper.readFileAsync(path, {
+ encoding: 'utf8',
+ });
+ expect(parseDependencies({ source, path })).to.be.deep.equal([
+ 'zeppelin-solidity/contracts/ownership/Ownable.sol',
+ 'zeppelin-solidity/contracts/token/ERC20/ERC20.sol',
]);
});
// TODO: For now that doesn't work. This will work after we switch to a grammar-based parser
it.skip('correctly parses commented out dependencies', async () => {
- const contractWithCommentedOutDependencies = `// import "./TokenTransferProxy.sol";`;
- const sourceFileId = '/main/TokenTransferProxy.sol';
- expect(parseDependencies(contractWithCommentedOutDependencies, sourceFileId)).to.be.deep.equal([]);
+ const path = '';
+ const source = `// import "./TokenTransferProxy.sol";`;
+ expect(parseDependencies({ path, source })).to.be.deep.equal([]);
});
});
});
diff --git a/packages/deployer/test/deployer_test.ts b/packages/deployer/test/deployer_test.ts
index a213932f9..238624220 100644
--- a/packages/deployer/test/deployer_test.ts
+++ b/packages/deployer/test/deployer_test.ts
@@ -4,13 +4,7 @@ import 'mocha';
import { Compiler } from '../src/compiler';
import { Deployer } from '../src/deployer';
import { fsWrapper } from '../src/utils/fs_wrapper';
-import {
- CompilerOptions,
- ContractArtifact,
- ContractDirectory,
- ContractNetworkData,
- DoneCallback,
-} from '../src/utils/types';
+import { CompilerOptions, ContractArtifact, ContractNetworkData, DoneCallback } from '../src/utils/types';
import { constructor_args, exchange_binary } from './fixtures/exchange_bin';
import { constants } from './util/constants';
@@ -20,15 +14,11 @@ const expect = chai.expect;
describe('#Deployer', () => {
const artifactsDir = `${__dirname}/fixtures/artifacts`;
+ const contractsDir = `${__dirname}/fixtures/contracts`;
const exchangeArtifactPath = `${artifactsDir}/Exchange.json`;
- const mainContractDir: ContractDirectory = { path: `${__dirname}/fixtures/contracts/main`, namespace: '' };
- const baseContractDir: ContractDirectory = { path: `${__dirname}/fixtures/contracts/base`, namespace: 'base' };
- const contractDirs: Set<ContractDirectory> = new Set();
- contractDirs.add(mainContractDir);
- contractDirs.add(baseContractDir);
const compilerOpts: CompilerOptions = {
artifactsDir,
- contractDirs,
+ contractsDir,
networkId: constants.networkId,
optimizerEnabled: constants.optimizerEnabled,
specifiedContracts: new Set(constants.specifiedContracts),
diff --git a/packages/deployer/test/fixtures/contracts/main/Exchange.sol b/packages/deployer/test/fixtures/contracts/Exchange.sol
index ea9ca3afa..e3725335b 100644
--- a/packages/deployer/test/fixtures/contracts/main/Exchange.sol
+++ b/packages/deployer/test/fixtures/contracts/Exchange.sol
@@ -16,11 +16,12 @@
*/
-pragma solidity 0.4.14;
+pragma solidity ^0.4.14;
+
+import {ERC20 as Token} from "zeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "./TokenTransferProxy.sol";
-import "/base/Token.sol";
-import "/base/SafeMath.sol";
+import "./base/SafeMath.sol";
/// @title Exchange - Facilitates exchange of ERC20 tokens.
/// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com>
diff --git a/packages/deployer/test/fixtures/contracts/main/TokenTransferProxy.sol b/packages/deployer/test/fixtures/contracts/TokenTransferProxy.sol
index 99d16cb57..44570d459 100644
--- a/packages/deployer/test/fixtures/contracts/main/TokenTransferProxy.sol
+++ b/packages/deployer/test/fixtures/contracts/TokenTransferProxy.sol
@@ -16,10 +16,10 @@
*/
-pragma solidity 0.4.14;
+pragma solidity ^0.4.14;
-import "/base/Token.sol";
-import "/base/Ownable.sol";
+import { Ownable } from "zeppelin-solidity/contracts/ownership/Ownable.sol";
+import { ERC20 as Token } from "zeppelin-solidity/contracts/token/ERC20/ERC20.sol";
/// @title TokenTransferProxy - Transfers tokens on behalf of contracts that have been approved via decentralized governance.
/// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com>
diff --git a/packages/deployer/test/fixtures/contracts/base/Ownable.sol b/packages/deployer/test/fixtures/contracts/base/Ownable.sol
deleted file mode 100644
index 2a74c3717..000000000
--- a/packages/deployer/test/fixtures/contracts/base/Ownable.sol
+++ /dev/null
@@ -1,27 +0,0 @@
-pragma solidity 0.4.14;
-
-/*
- * Ownable
- *
- * Base contract with an owner.
- * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner.
- */
-
-contract Ownable {
- address public owner;
-
- function Ownable() {
- owner = msg.sender;
- }
-
- modifier onlyOwner() {
- require(msg.sender == owner);
- _;
- }
-
- function transferOwnership(address newOwner) onlyOwner {
- if (newOwner != address(0)) {
- owner = newOwner;
- }
- }
-}
diff --git a/packages/deployer/test/fixtures/contracts/base/SafeMath.sol b/packages/deployer/test/fixtures/contracts/base/SafeMath.sol
index 7414684a8..92ce11cde 100644
--- a/packages/deployer/test/fixtures/contracts/base/SafeMath.sol
+++ b/packages/deployer/test/fixtures/contracts/base/SafeMath.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.14;
+pragma solidity ^0.4.14;
contract SafeMath {
function safeMul(uint a, uint b) internal constant returns (uint256) {
diff --git a/packages/deployer/test/fixtures/contracts/base/Token.sol b/packages/deployer/test/fixtures/contracts/base/Token.sol
index c03f8c567..483010d7d 100644
--- a/packages/deployer/test/fixtures/contracts/base/Token.sol
+++ b/packages/deployer/test/fixtures/contracts/base/Token.sol
@@ -1,4 +1,4 @@
-pragma solidity 0.4.14;
+pragma solidity ^0.4.14;
contract Token {
diff --git a/packages/deployer/test/fixtures/exchange_bin.ts b/packages/deployer/test/fixtures/exchange_bin.ts
index a6eae515e..1bf1f3b38 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';
export const exchange_binary =
- '0x6060604052341561000f57600080fd5b604051604080612c4d833981016040528080519060200190919080519060200190919050505b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50505b612b84806100c96000396000f300606060405236156100fa576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806314df96ee146100ff578063288cdc911461014c5780632ac1262214610187578063363349be146101c2578063394c21e7146103bc5780633b30ba591461044b5780634f150787146104a0578063741bcc93146106b25780637e9abb50146107535780638163681e1461078e57806398024a8b14610812578063add1cbc51461085b578063b7b2c7d6146108b0578063baa0181d14610acd578063bc61394a14610c1f578063cfc4d0ec14610cdf578063f06bbf7514610d6d578063ffa1ad7414610d9e575b600080fd5b341561010a57600080fd5b6101326004808035906020019091908035906020019091908035906020019091905050610e2d565b604051808215151515815260200191505060405180910390f35b341561015757600080fd5b610171600480803560001916906020019091905050610e7c565b6040518082815260200191505060405180910390f35b341561019257600080fd5b6101ac600480803560001916906020019091905050610e94565b6040518082815260200191505060405180910390f35b34156101cd57600080fd5b6103a660048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561024857848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610203565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156102c457848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061027f565b5050505050919080359060200190919080351515906020019091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050610eac565b6040518082815260200191505060405180910390f35b34156103c757600080fd5b6104356004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091908035906020019091905050611013565b6040518082815260200191505060405180910390f35b341561045657600080fd5b61045e6114fb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104ab57600080fd5b6106b060048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561052657848483905060a0020160058060200260405190810160405280929190826005602002808284378201915050505050815260200190600101906104e1565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156105a257848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061055d565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611520565b005b34156106bd57600080fd5b6107516004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c00190600680602002604051908101604052809291908260066020028082843782019150505050509190803590602001909190803560ff1690602001909190803560001916906020019091908035600019169060200190919050506115df565b005b341561075e57600080fd5b610778600480803560001916906020019091905050611605565b6040518082815260200191505060405180910390f35b341561079957600080fd5b6107f8600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080356000191690602001909190803560ff16906020019091908035600019169060200190919080356000191690602001909190505061164f565b604051808215151515815260200191505060405180910390f35b341561081d57600080fd5b6108456004808035906020019091908035906020019091908035906020019091905050611757565b6040518082815260200191505060405180910390f35b341561086657600080fd5b61086e611776565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156108bb57600080fd5b610acb60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561093657848483905060a0020160058060200260405190810160405280929190826005602002808284378201915050505050815260200190600101906108f1565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156109b257848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061096d565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035151590602001909190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190505061179c565b005b3415610ad857600080fd5b610c1d60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610b5357848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610b0e565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610bcf57848483905060c002016006806020026040519081016040528092919082600660200280828437820191505050505081526020019060010190610b8a565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190505061185e565b005b3415610c2a57600080fd5b610cc96004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091908035906020019091908035151590602001909190803560ff1690602001909190803560001916906020019091908035600019169060200190919050506118d3565b6040518082815260200191505060405180910390f35b3415610cea57600080fd5b610d4f6004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091905050612073565b60405180826000191660001916815260200191505060405180910390f35b3415610d7857600080fd5b610d8061231f565b604051808261ffff1661ffff16815260200191505060405180910390f35b3415610da957600080fd5b610db1612325565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610df25780820151818401525b602081019050610dd6565b50505050905090810190601f168015610e1f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008060008486850991506000821415610e4a5760009250610e73565b610e69610e5a83620f424061235e565b610e64888761235e565b612392565b90506103e8811192505b50509392505050565b60026020528060005260406000206000915090505481565b60036020528060005260406000206000915090505481565b6000806000809150600090505b895181101561100257896000815181101515610ed157fe5b906020019060200201516003600581101515610ee957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168a82815181101515610f1257fe5b906020019060200201516003600581101515610f2a57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16141515610f5157600080fd5b610fe582610fe08c84815181101515610f6657fe5b906020019060200201518c85815181101515610f7e57fe5b90602001906020020151610f928d886123ae565b8c8c88815181101515610fa157fe5b906020019060200201518c89815181101515610fb957fe5b906020019060200201518c8a815181101515610fd157fe5b906020019060200201516118d3565b6123c8565b915087821415610ff457611002565b5b8080600101915050610eb9565b8192505b5050979650505050505050565b600061101d612a8c565b6000806101606040519081016040528088600060058110151561103c57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600160058110151561106b57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600260058110151561109a57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860036005811015156110c957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860046005811015156110f857fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200187600060068110151561112757fe5b6020020151815260200187600160068110151561114057fe5b6020020151815260200187600260068110151561115957fe5b6020020151815260200187600360068110151561117257fe5b6020020151815260200187600460068110151561118b57fe5b6020020151815260200161119f8989612073565b6000191681525092503373ffffffffffffffffffffffffffffffffffffffff16836000015173ffffffffffffffffffffffffffffffffffffffff161415156111e657600080fd5b60008360a001511180156111fe575060008360c00151115b801561120a5750600085115b151561121557600080fd5b8261012001514210151561127257826101400151600019166000600381111561123a57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506114f1565b61128d8360c00151611288856101400151611605565b6123ae565b915061129985836123e7565b905060008114156112f35782610140015160001916600160038111156112bb57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506114f1565b61131d600360008561014001516000191660001916815260200190815260200160002054826123c8565b60036000856101400151600019166000191681526020019081526020016000208190555082604001518360600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916836080015173ffffffffffffffffffffffffffffffffffffffff16846000015173ffffffffffffffffffffffffffffffffffffffff167f67d66f160bc93d925d05dae1794c90d2d6d6688b29b84ff069398a9b0458713186604001518760600151611455878a60c001518b60a00151611757565b878a6101400151604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183815260200182600019166000191681526020019550505050505060405180910390a48093505b5050509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b86518110156115d5576115c7878281518110151561154057fe5b90602001906020020151878381518110151561155857fe5b90602001906020020151878481518110151561157057fe5b90602001906020020151878581518110151561158857fe5b9060200190602002015187868151811015156115a057fe5b9060200190602002015187878151811015156115b857fe5b906020019060200201516115df565b5b8080600101915050611526565b5b50505050505050565b836115f087878760008888886118d3565b1415156115fc57600080fd5b5b505050505050565b600061164760026000846000191660001916815260200190815260200160002054600360008560001916600019168152602001908152602001600020546123c8565b90505b919050565b600060018560405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020858585604051600081526020016040526000604051602001526040518085600019166000191681526020018460ff1660ff16815260200183600019166000191681526020018260001916600019168152602001945050505050602060405160208103908084039060008661646e5a03f1151561171457600080fd5b50506020604051035173ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161490505b95945050505050565b600061176c611766858461235e565b84612392565b90505b9392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b87518110156118535761184488828151811015156117bc57fe5b9060200190602002015188838151811015156117d457fe5b9060200190602002015188848151811015156117ec57fe5b9060200190602002015188888681518110151561180557fe5b90602001906020020151888781518110151561181d57fe5b90602001906020020151888881518110151561183557fe5b906020019060200201516118d3565b505b80806001019150506117a2565b5b5050505050505050565b60008090505b83518110156118cc576118bd848281518110151561187e57fe5b90602001906020020151848381518110151561189657fe5b9060200190602002015184848151811015156118ae57fe5b90602001906020020151611013565b505b8080600101915050611864565b5b50505050565b60006118dd612a8c565b600080600080610160604051908101604052808e60006005811015156118ff57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600160058110151561192e57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600260058110151561195d57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600360058110151561198c57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e60046005811015156119bb57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018d60006006811015156119ea57fe5b602002015181526020018d6001600681101515611a0357fe5b602002015181526020018d6002600681101515611a1c57fe5b602002015181526020018d6003600681101515611a3557fe5b602002015181526020018d6004600681101515611a4e57fe5b60200201518152602001611a628f8f612073565b600019168152509450600073ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff161480611ad957503373ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff16145b1515611ae457600080fd5b60008560a00151118015611afc575060008560c00151115b8015611b08575060008b115b1515611b1357600080fd5b611b2985600001518661014001518b8b8b61164f565b1515611b3457600080fd5b84610120015142101515611b91578461014001516000191660006003811115611b5957fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b611bac8560c00151611ba7876101400151611605565b6123ae565b9350611bb88b856123e7565b95506000861415611c12578461014001516000191660016003811115611bda57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b611c25868660c001518760a00151610e2d565b15611c79578461014001516000191660026003811115611c4157fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b89158015611c8e5750611c8c8587612401565b155b15611ce15784610140015160001916600380811115611ca957fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b611cf4868660c001518760a00151611757565b9250611d20600260008761014001516000191660001916815260200190815260200160002054876123c8565b600260008761014001516000191660001916815260200190815260200160002081905550611d58856040015186600001513386612751565b1515611d6357600080fd5b611d77856060015133876000015189612751565b1515611d8257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16856080015173ffffffffffffffffffffffffffffffffffffffff16141515611e815760008560e001511115611e1f57611ddc868660c001518760e00151611757565b9150611e136000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168660000151876080015185612751565b1515611e1e57600080fd5b5b60008561010001511115611e8057611e41868660c00151876101000151611757565b9050611e746000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633876080015184612751565b1515611e7f57600080fd5b5b5b84604001518560600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916856080015173ffffffffffffffffffffffffffffffffffffffff16866000015173ffffffffffffffffffffffffffffffffffffffff167f0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb33389604001518a60600151898d8a8a8f6101400151604051808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186815260200185815260200184815260200183815260200182600019166000191681526020019850505050505050505060405180910390a48595505b5050505050979650505050505050565b60003083600060058110151561208557fe5b602002015184600160058110151561209957fe5b60200201518560026005811015156120ad57fe5b60200201518660036005811015156120c157fe5b60200201518760046005811015156120d557fe5b60200201518760006006811015156120e957fe5b60200201518860016006811015156120fd57fe5b602002015189600260068110151561211157fe5b60200201518a600360068110151561212557fe5b60200201518b600460068110151561213957fe5b60200201518c600560068110151561214d57fe5b6020020151604051808d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018781526020018681526020018581526020018481526020018381526020018281526020019c50505050505050505050505050604051809103902090505b92915050565b61138781565b6040805190810160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b6000808284029050600084148061237f575082848281151561237c57fe5b04145b151561238757fe5b8091505b5092915050565b60008082848115156123a057fe5b0490508091505b5092915050565b60008282111515156123bc57fe5b81830390505b92915050565b60008082840190508381101515156123dc57fe5b8091505b5092915050565b60008183106123f657816123f8565b825b90505b92915050565b60008060008060008060008060003397506124258a8c60c001518d60a00151611757565b9650600073ffffffffffffffffffffffffffffffffffffffff168b6080015173ffffffffffffffffffffffffffffffffffffffff161415156126d2576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6040015173ffffffffffffffffffffffffffffffffffffffff161495506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6060015173ffffffffffffffffffffffffffffffffffffffff161494506125208a8c60c001518d60e00151611757565b93506125368a8c60c001518d6101000151611757565b925085612543578361254e565b61254d87856123c8565b5b91508461255b5782612566565b6125658a846123c8565b5b9050816125986000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d600001516128ae565b10806125d15750816125cf6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d60000151612972565b105b806126055750806126036000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a6128ae565b105b806126395750806126376000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a612972565b105b156126475760009850612743565b851580156126805750866126638c604001518d600001516128ae565b108061267f57508661267d8c604001518d60000151612972565b105b5b1561268e5760009850612743565b841580156126bf5750896126a68c606001518a6128ae565b10806126be5750896126bc8c606001518a612972565b105b5b156126cd5760009850612743565b61273e565b866126e58c604001518d600001516128ae565b10806127015750866126ff8c604001518d60000151612972565b105b806127185750896127168c606001518a6128ae565b105b8061272f57508961272d8c606001518a612972565b105b1561273d5760009850612743565b5b600198505b505050505050505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166315dacbea868686866000604051602001526040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050602060405180830381600087803b151561288857600080fd5b6102c65a03f1151561289957600080fd5b5050506040518051905090505b949350505050565b60008273ffffffffffffffffffffffffffffffffffffffff166370a0823161138761ffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600088803b151561295157600080fd5b87f1151561295e57600080fd5b505050506040518051905090505b92915050565b60008273ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e61138761ffff1684600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600088803b1515612a6b57600080fd5b87f11515612a7857600080fd5b505050506040518051905090505b92915050565b61016060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000801916815250905600a165627a7a72305820df5cabdc3a116e993e10bfb14823d18d9b798038d4c463a1703f9a584c456b7e0029';
+ '0x6060604052341561000f57600080fd5b604051604080612c2583398101604052808051906020019091908051906020019091905050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050612b5f806100c66000396000f3006060604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806314df96ee14610101578063288cdc911461014e5780632ac1262214610189578063363349be146101c4578063394c21e7146103be5780633b30ba591461044d5780634f150787146104a2578063741bcc93146106b45780637e9abb50146107555780638163681e1461079057806398024a8b14610814578063add1cbc51461085d578063b7b2c7d6146108b2578063baa0181d14610acf578063bc61394a14610c21578063cfc4d0ec14610ce1578063f06bbf7514610d6f578063ffa1ad7414610da0575b600080fd5b341561010c57600080fd5b6101346004808035906020019091908035906020019091908035906020019091905050610e2e565b604051808215151515815260200191505060405180910390f35b341561015957600080fd5b610173600480803560001916906020019091905050610e86565b6040518082815260200191505060405180910390f35b341561019457600080fd5b6101ae600480803560001916906020019091905050610e9e565b6040518082815260200191505060405180910390f35b34156101cf57600080fd5b6103a860048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561024a57848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610205565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156102c657848483905060c002016006806020026040519081016040528092919082600660200280828437820191505050505081526020019060010190610281565b5050505050919080359060200190919080351515906020019091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050610eb6565b6040518082815260200191505060405180910390f35b34156103c957600080fd5b6104376004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c00190600680602002604051908101604052809291908260066020028082843782019150505050509190803590602001909190505061101b565b6040518082815260200191505060405180910390f35b341561045857600080fd5b610460611503565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104ad57600080fd5b6106b260048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561052857848483905060a0020160058060200260405190810160405280929190826005602002808284378201915050505050815260200190600101906104e3565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156105a457848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061055f565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611528565b005b34156106bf57600080fd5b6107536004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c00190600680602002604051908101604052809291908260066020028082843782019150505050509190803590602001909190803560ff1690602001909190803560001916906020019091908035600019169060200190919050506115e5565b005b341561076057600080fd5b61077a60048080356000191690602001909190505061160a565b6040518082815260200191505060405180910390f35b341561079b57600080fd5b6107fa600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080356000191690602001909190803560ff169060200190919080356000191690602001909190803560001916906020019091905050611653565b604051808215151515815260200191505060405180910390f35b341561081f57600080fd5b610847600480803590602001909190803590602001909190803590602001909190505061174d565b6040518082815260200191505060405180910390f35b341561086857600080fd5b61087061176b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156108bd57600080fd5b610acd60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561093857848483905060a0020160058060200260405190810160405280929190826005602002808284378201915050505050815260200190600101906108f3565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156109b457848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061096f565b505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080351515906020019091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611791565b005b3415610ada57600080fd5b610c1f60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610b5557848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610b10565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610bd157848483905060c002016006806020026040519081016040528092919082600660200280828437820191505050505081526020019060010190610b8c565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611851565b005b3415610c2c57600080fd5b610ccb6004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091908035906020019091908035151590602001909190803560ff1690602001909190803560001916906020019091908035600019169060200190919050506118c4565b6040518082815260200191505060405180910390f35b3415610cec57600080fd5b610d516004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091905050612064565b60405180826000191660001916815260200191505060405180910390f35b3415610d7a57600080fd5b610d8261230f565b604051808261ffff1661ffff16815260200191505060405180910390f35b3415610dab57600080fd5b610db3612315565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610df3578082015181840152602081019050610dd8565b50505050905090810190601f168015610e205780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600080600084801515610e3d57fe5b86850991506000821415610e545760009250610e7d565b610e73610e6483620f424061234e565b610e6e888761234e565b612381565b90506103e8811192505b50509392505050565b60026020528060005260406000206000915090505481565b60036020528060005260406000206000915090505481565b6000806000809150600090505b895181101561100b57896000815181101515610edb57fe5b906020019060200201516003600581101515610ef357fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168a82815181101515610f1c57fe5b906020019060200201516003600581101515610f3457fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16141515610f5b57600080fd5b610fef82610fea8c84815181101515610f7057fe5b906020019060200201518c85815181101515610f8857fe5b90602001906020020151610f9c8d8861239c565b8c8c88815181101515610fab57fe5b906020019060200201518c89815181101515610fc357fe5b906020019060200201518c8a815181101515610fdb57fe5b906020019060200201516118c4565b6123b5565b915087821415610ffe5761100b565b8080600101915050610ec3565b8192505050979650505050505050565b6000611025612a67565b6000806101606040519081016040528088600060058110151561104457fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600160058110151561107357fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860026005811015156110a257fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860036005811015156110d157fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600460058110151561110057fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200187600060068110151561112f57fe5b6020020151815260200187600160068110151561114857fe5b6020020151815260200187600260068110151561116157fe5b6020020151815260200187600360068110151561117a57fe5b6020020151815260200187600460068110151561119357fe5b602002015181526020016111a78989612064565b6000191681525092503373ffffffffffffffffffffffffffffffffffffffff16836000015173ffffffffffffffffffffffffffffffffffffffff161415156111ee57600080fd5b60008360a00151118015611206575060008360c00151115b80156112125750600085115b151561121d57600080fd5b8261012001514210151561127a57826101400151600019166000600381111561124257fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506114f9565b6112958360c0015161129085610140015161160a565b61239c565b91506112a185836123d3565b905060008114156112fb5782610140015160001916600160038111156112c357fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506114f9565b611325600360008561014001516000191660001916815260200190815260200160002054826123b5565b60036000856101400151600019166000191681526020019081526020016000208190555082604001518360600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916836080015173ffffffffffffffffffffffffffffffffffffffff16846000015173ffffffffffffffffffffffffffffffffffffffff167f67d66f160bc93d925d05dae1794c90d2d6d6688b29b84ff069398a9b045871318660400151876060015161145d878a60c001518b60a0015161174d565b878a6101400151604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183815260200182600019166000191681526020019550505050505060405180910390a48093505b5050509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b86518110156115dc576115cf878281518110151561154857fe5b90602001906020020151878381518110151561156057fe5b90602001906020020151878481518110151561157857fe5b90602001906020020151878581518110151561159057fe5b9060200190602002015187868151811015156115a857fe5b9060200190602002015187878151811015156115c057fe5b906020019060200201516115e5565b808060010191505061152e565b50505050505050565b836115f687878760008888886118c4565b14151561160257600080fd5b505050505050565b600061164c60026000846000191660001916815260200190815260200160002054600360008560001916600019168152602001908152602001600020546123b5565b9050919050565b600060018560405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020858585604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1151561170b57600080fd5b50506020604051035173ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614905095945050505050565b600061176261175c858461234e565b84612381565b90509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b87518110156118475761183988828151811015156117b157fe5b9060200190602002015188838151811015156117c957fe5b9060200190602002015188848151811015156117e157fe5b906020019060200201518888868151811015156117fa57fe5b90602001906020020151888781518110151561181257fe5b90602001906020020151888881518110151561182a57fe5b906020019060200201516118c4565b508080600101915050611797565b5050505050505050565b60008090505b83518110156118be576118b0848281518110151561187157fe5b90602001906020020151848381518110151561188957fe5b9060200190602002015184848151811015156118a157fe5b9060200190602002015161101b565b508080600101915050611857565b50505050565b60006118ce612a67565b600080600080610160604051908101604052808e60006005811015156118f057fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600160058110151561191f57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600260058110151561194e57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600360058110151561197d57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e60046005811015156119ac57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018d60006006811015156119db57fe5b602002015181526020018d60016006811015156119f457fe5b602002015181526020018d6002600681101515611a0d57fe5b602002015181526020018d6003600681101515611a2657fe5b602002015181526020018d6004600681101515611a3f57fe5b60200201518152602001611a538f8f612064565b600019168152509450600073ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff161480611aca57503373ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff16145b1515611ad557600080fd5b60008560a00151118015611aed575060008560c00151115b8015611af9575060008b115b1515611b0457600080fd5b611b1a85600001518661014001518b8b8b611653565b1515611b2557600080fd5b84610120015142101515611b82578461014001516000191660006003811115611b4a57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612054565b611b9d8560c00151611b9887610140015161160a565b61239c565b9350611ba98b856123d3565b95506000861415611c03578461014001516000191660016003811115611bcb57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612054565b611c16868660c001518760a00151610e2e565b15611c6a578461014001516000191660026003811115611c3257fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612054565b89158015611c7f5750611c7d85876123ec565b155b15611cd25784610140015160001916600380811115611c9a57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612054565b611ce5868660c001518760a0015161174d565b9250611d11600260008761014001516000191660001916815260200190815260200160002054876123b5565b600260008761014001516000191660001916815260200190815260200160002081905550611d4985604001518660000151338661273c565b1515611d5457600080fd5b611d6885606001513387600001518961273c565b1515611d7357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16856080015173ffffffffffffffffffffffffffffffffffffffff16141515611e725760008560e001511115611e1057611dcd868660c001518760e0015161174d565b9150611e046000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866000015187608001518561273c565b1515611e0f57600080fd5b5b60008561010001511115611e7157611e32868660c0015187610100015161174d565b9050611e656000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff163387608001518461273c565b1515611e7057600080fd5b5b5b84604001518560600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916856080015173ffffffffffffffffffffffffffffffffffffffff16866000015173ffffffffffffffffffffffffffffffffffffffff167f0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb33389604001518a60600151898d8a8a8f6101400151604051808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186815260200185815260200184815260200183815260200182600019166000191681526020019850505050505050505060405180910390a48595505b5050505050979650505050505050565b60003083600060058110151561207657fe5b602002015184600160058110151561208a57fe5b602002015185600260058110151561209e57fe5b60200201518660036005811015156120b257fe5b60200201518760046005811015156120c657fe5b60200201518760006006811015156120da57fe5b60200201518860016006811015156120ee57fe5b602002015189600260068110151561210257fe5b60200201518a600360068110151561211657fe5b60200201518b600460068110151561212a57fe5b60200201518c600560068110151561213e57fe5b6020020151604051808d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018781526020018681526020018581526020018481526020018381526020018281526020019c505050505050505050505050506040518091039020905092915050565b61138781565b6040805190810160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b6000808284029050600084148061236f575082848281151561236c57fe5b04145b151561237757fe5b8091505092915050565b600080828481151561238f57fe5b0490508091505092915050565b60008282111515156123aa57fe5b818303905092915050565b60008082840190508381101515156123c957fe5b8091505092915050565b60008183106123e257816123e4565b825b905092915050565b60008060008060008060008060003397506124108a8c60c001518d60a0015161174d565b9650600073ffffffffffffffffffffffffffffffffffffffff168b6080015173ffffffffffffffffffffffffffffffffffffffff161415156126bd576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6040015173ffffffffffffffffffffffffffffffffffffffff161495506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6060015173ffffffffffffffffffffffffffffffffffffffff1614945061250b8a8c60c001518d60e0015161174d565b93506125218a8c60c001518d610100015161174d565b92508561252e5783612539565b61253887856123b5565b5b9150846125465782612551565b6125508a846123b5565b5b9050816125836000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d6000015161288b565b10806125bc5750816125ba6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d6000015161294e565b105b806125f05750806125ee6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a61288b565b105b806126245750806126226000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a61294e565b105b15612632576000985061272e565b8515801561266b57508661264e8c604001518d6000015161288b565b108061266a5750866126688c604001518d6000015161294e565b105b5b15612679576000985061272e565b841580156126aa5750896126918c606001518a61288b565b10806126a95750896126a78c606001518a61294e565b105b5b156126b8576000985061272e565b612729565b866126d08c604001518d6000015161288b565b10806126ec5750866126ea8c604001518d6000015161294e565b105b806127035750896127018c606001518a61288b565b105b8061271a5750896127188c606001518a61294e565b105b15612728576000985061272e565b5b600198505b505050505050505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166315dacbea868686866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050602060405180830381600087803b151561286a57600080fd5b5af1151561287757600080fd5b505050604051805190509050949350505050565b60008273ffffffffffffffffffffffffffffffffffffffff166370a0823161138761ffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600088803b151561292e57600080fd5b87f1151561293b57600080fd5b5050505060405180519050905092915050565b60008273ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e61138761ffff1684600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600088803b1515612a4757600080fd5b87f11515612a5457600080fd5b5050505060405180519050905092915050565b61016060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000801916815250905600a165627a7a72305820df5cabdc3a116e993e10bfb14823d18d9b798038d4c463a1703f9a584c456b7e0029';
diff --git a/packages/dev-utils/src/coverage.ts b/packages/dev-utils/src/coverage.ts
index 40bb47e2d..67c87ec30 100644
--- a/packages/dev-utils/src/coverage.ts
+++ b/packages/dev-utils/src/coverage.ts
@@ -13,8 +13,8 @@ export const coverage = {
return coverageSubprovider;
},
_getCoverageSubprovider(): CoverageSubprovider {
- const artifactsPath = './src/artifacts';
- const contractsPath = './src/contracts';
+ const artifactsPath = '../migrations/src/artifacts';
+ const contractsPath = 'src/contracts';
const networkId = 50;
const defaultFromAddress = constants.TESTRPC_FIRST_ADDRESS;
return new CoverageSubprovider(artifactsPath, contractsPath, networkId, defaultFromAddress);
diff --git a/packages/metacoin/artifacts/Metacoin.json b/packages/metacoin/artifacts/Metacoin.json
deleted file mode 100644
index 69ec22cac..000000000
--- a/packages/metacoin/artifacts/Metacoin.json
+++ /dev/null
@@ -1,169 +0,0 @@
-{
- "contract_name": "Metacoin",
- "networks": {
- "50": {
- "solc_version": "0.4.21",
- "keccak256": "0x85fb29ea6c21adcf07f754b2ad06482dd6fcd62d31935e36041b4d064c6a038e",
- "source_tree_hash": "0x85fb29ea6c21adcf07f754b2ad06482dd6fcd62d31935e36041b4d064c6a038e",
- "optimizer_enabled": false,
- "abi": [
- {
- "constant": false,
- "inputs": [
- {
- "components": [
- {
- "components": [
- {
- "name": "to",
- "type": "address"
- },
- {
- "name": "amount",
- "type": "uint256"
- }
- ],
- "name": "transferData",
- "type": "tuple"
- },
- {
- "name": "callback",
- "type": "uint32"
- }
- ],
- "name": "nestedTransferData",
- "type": "tuple"
- }
- ],
- "name": "transfer",
- "outputs": [
- {
- "name": "",
- "type": "int256"
- }
- ],
- "payable": false,
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "constant": true,
- "inputs": [
- {
- "name": "",
- "type": "address"
- }
- ],
- "name": "balances",
- "outputs": [
- {
- "name": "",
- "type": "uint256"
- }
- ],
- "payable": false,
- "stateMutability": "view",
- "type": "function"
- },
- {
- "constant": false,
- "inputs": [
- {
- "components": [
- {
- "name": "to",
- "type": "address"
- },
- {
- "name": "amount",
- "type": "uint256"
- }
- ],
- "name": "transferData",
- "type": "tuple"
- }
- ],
- "name": "transfer",
- "outputs": [
- {
- "name": "success",
- "type": "bool"
- }
- ],
- "payable": false,
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "constant": false,
- "inputs": [
- {
- "components": [
- {
- "name": "to",
- "type": "address"
- },
- {
- "name": "amount",
- "type": "uint256"
- }
- ],
- "name": "transferData",
- "type": "tuple"
- },
- {
- "name": "callback",
- "type": "uint32"
- }
- ],
- "name": "transfer",
- "outputs": [
- {
- "name": "",
- "type": "int256"
- }
- ],
- "payable": false,
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [],
- "payable": false,
- "stateMutability": "nonpayable",
- "type": "constructor"
- },
- {
- "anonymous": false,
- "inputs": [
- {
- "indexed": true,
- "name": "_from",
- "type": "address"
- },
- {
- "indexed": true,
- "name": "_to",
- "type": "address"
- },
- {
- "indexed": false,
- "name": "_value",
- "type": "uint256"
- }
- ],
- "name": "Transfer",
- "type": "event"
- }
- ],
- "bytecode": "0x6060604052341561000f57600080fd5b6127106000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610613806100636000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063135cfdb11461006757806327e235e31461009d5780632bd14bb9146100d35780632f8086ba14610109575b600080fd5b341561007257600080fd5b6100876004610082903690610446565b61013f565b604051610094919061051c565b60405180910390f35b34156100a857600080fd5b6100bd60046100b890369061041d565b61015a565b6040516100ca9190610537565b60405180910390f35b34156100de57600080fd5b6100f360046100ee90369061046f565b610172565b6040516101009190610501565b60405180910390f35b341561011457600080fd5b6101296004610124903690610498565b6102e2565b604051610136919061051c565b60405180910390f35b6000610153826000015183602001516102e2565b9050919050565b60006020528060005260406000206000915090505481565b600081602001516000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156101c757600090506102dd565b81602001516000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160200151600080846000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84602001516040516102d09190610537565b60405180910390a3600190505b919050565b60006102ed83610172565b508163ffffffff16905092915050565b6000610309823561059f565b905092915050565b60006060828403121561032357600080fd5b61032d6040610552565b9050600061033d8482850161035d565b600083015250604061035184828501610409565b60208301525092915050565b60006040828403121561036f57600080fd5b6103796040610552565b90506000610389848285016102fd565b600083015250602061039d848285016103f5565b60208301525092915050565b6000604082840312156103bb57600080fd5b6103c56040610552565b905060006103d5848285016102fd565b60008301525060206103e9848285016103f5565b60208301525092915050565b600061040182356105bf565b905092915050565b600061041582356105c9565b905092915050565b60006020828403121561042f57600080fd5b600061043d848285016102fd565b91505092915050565b60006060828403121561045857600080fd5b600061046684828501610311565b91505092915050565b60006040828403121561048157600080fd5b600061048f848285016103a9565b91505092915050565b600080606083850312156104ab57600080fd5b60006104b9858286016103a9565b92505060406104ca85828601610409565b9150509250929050565b6104dd8161057f565b82525050565b6104ec8161058b565b82525050565b6104fb81610595565b82525050565b600060208201905061051660008301846104d4565b92915050565b600060208201905061053160008301846104e3565b92915050565b600060208201905061054c60008301846104f2565b92915050565b6000604051905081810181811067ffffffffffffffff8211171561057557600080fd5b8060405250919050565b60008115159050919050565b6000819050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff821690509190505600a265627a7a72305820716a74dd7e2a73c237481496756750895b57977fc4876b1c48aef9b71759bf836c6578706572696d656e74616cf50037",
- "runtime_bytecode": "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063135cfdb11461006757806327e235e31461009d5780632bd14bb9146100d35780632f8086ba14610109575b600080fd5b341561007257600080fd5b6100876004610082903690610446565b61013f565b604051610094919061051c565b60405180910390f35b34156100a857600080fd5b6100bd60046100b890369061041d565b61015a565b6040516100ca9190610537565b60405180910390f35b34156100de57600080fd5b6100f360046100ee90369061046f565b610172565b6040516101009190610501565b60405180910390f35b341561011457600080fd5b6101296004610124903690610498565b6102e2565b604051610136919061051c565b60405180910390f35b6000610153826000015183602001516102e2565b9050919050565b60006020528060005260406000206000915090505481565b600081602001516000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156101c757600090506102dd565b81602001516000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160200151600080846000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84602001516040516102d09190610537565b60405180910390a3600190505b919050565b60006102ed83610172565b508163ffffffff16905092915050565b6000610309823561059f565b905092915050565b60006060828403121561032357600080fd5b61032d6040610552565b9050600061033d8482850161035d565b600083015250604061035184828501610409565b60208301525092915050565b60006040828403121561036f57600080fd5b6103796040610552565b90506000610389848285016102fd565b600083015250602061039d848285016103f5565b60208301525092915050565b6000604082840312156103bb57600080fd5b6103c56040610552565b905060006103d5848285016102fd565b60008301525060206103e9848285016103f5565b60208301525092915050565b600061040182356105bf565b905092915050565b600061041582356105c9565b905092915050565b60006020828403121561042f57600080fd5b600061043d848285016102fd565b91505092915050565b60006060828403121561045857600080fd5b600061046684828501610311565b91505092915050565b60006040828403121561048157600080fd5b600061048f848285016103a9565b91505092915050565b600080606083850312156104ab57600080fd5b60006104b9858286016103a9565b92505060406104ca85828601610409565b9150509250929050565b6104dd8161057f565b82525050565b6104ec8161058b565b82525050565b6104fb81610595565b82525050565b600060208201905061051660008301846104d4565b92915050565b600060208201905061053160008301846104e3565b92915050565b600060208201905061054c60008301846104f2565b92915050565b6000604051905081810181811067ffffffffffffffff8211171561057557600080fd5b8060405250919050565b60008115159050919050565b6000819050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff821690509190505600a265627a7a72305820716a74dd7e2a73c237481496756750895b57977fc4876b1c48aef9b71759bf836c6578706572696d656e74616cf50037",
- "updated_at": 1522966321930,
- "source_map": "60:1093:0:-;;;389:72;;;;;;;;449:5;426:8;:20;435:10;426:20;;;;;;;;;;;;;;;:28;;;;60:1093;;;;;;",
- "source_map_runtime": "60:1093:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;978:172;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;84:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;467:352;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;825:147;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;978:172;1051:3;1073:70;1082:18;:31;;;1115:18;:27;;;1073:8;:70::i;:::-;1066:77;;978:172;;;:::o;84:41::-;;;;;;;;;;;;;;;;;:::o;467:352::-;528:12;579;:19;;;556:8;:20;565:10;556:20;;;;;;;;;;;;;;;;:42;552:60;;;607:5;600:12;;;;552:60;646:12;:19;;;622:8;:20;631:10;622:20;;;;;;;;;;;;;;;;:43;;;;;;;;;;;704:12;:19;;;675:8;:25;684:12;:15;;;675:25;;;;;;;;;;;;;;;;:48;;;;;;;;;;;754:12;:15;;;733:58;;742:10;733:58;;;771:12;:19;;;733:58;;;;;;;;;;;;;;;808:4;801:11;;467:352;;;;:::o;825:147::-;903:3;918:22;927:12;918:8;:22::i;:::-;;957:8;950:15;;;;825:147;;;;:::o;5:118:-1:-;;72:46;110:6;97:20;72:46;;;63:55;;57:66;;;;;171:510;;294:4;282:9;277:3;273:19;269:30;266:2;;;312:1;309;302:12;266:2;330:20;345:4;330:20;;;321:29;;408:1;439:73;508:3;499:6;488:9;484:22;439:73;;;433:3;426:5;422:15;415:98;360:164;578:2;611:48;655:3;646:6;635:9;631:22;611:48;;;604:4;597:5;593:16;586:74;534:137;260:421;;;;;723:465;;836:4;824:9;819:3;815:19;811:30;808:2;;;854:1;851;844:12;808:2;872:20;887:4;872:20;;;863:29;;940:1;971:49;1016:3;1007:6;996:9;992:22;971:49;;;965:3;958:5;954:15;947:74;902:130;1084:2;1117:49;1162:3;1153:6;1142:9;1138:22;1117:49;;;1110:4;1103:5;1099:16;1092:75;1042:136;802:386;;;;;1230:469;;1347:4;1335:9;1330:3;1326:19;1322:30;1319:2;;;1365:1;1362;1355:12;1319:2;1383:20;1398:4;1383:20;;;1374:29;;1451:1;1482:49;1527:3;1518:6;1507:9;1503:22;1482:49;;;1476:3;1469:5;1465:15;1458:74;1413:130;1595:2;1628:49;1673:3;1664:6;1653:9;1649:22;1628:49;;;1621:4;1614:5;1610:16;1603:75;1553:136;1313:386;;;;;1706:118;;1773:46;1811:6;1798:20;1773:46;;;1764:55;;1758:66;;;;;1831:116;;1897:45;1934:6;1921:20;1897:45;;;1888:54;;1882:65;;;;;1954:241;;2058:2;2046:9;2037:7;2033:23;2029:32;2026:2;;;2074:1;2071;2064:12;2026:2;2109:1;2126:53;2171:7;2162:6;2151:9;2147:22;2126:53;;;2116:63;;2088:97;2020:175;;;;;2202:309;;2340:2;2328:9;2319:7;2315:23;2311:32;2308:2;;;2356:1;2353;2346:12;2308:2;2391:1;2408:87;2487:7;2478:6;2467:9;2463:22;2408:87;;;2398:97;;2370:131;2302:209;;;;;2518:297;;2650:2;2638:9;2629:7;2625:23;2621:32;2618:2;;;2666:1;2663;2656:12;2618:2;2701:1;2718:81;2791:7;2782:6;2771:9;2767:22;2718:81;;;2708:91;;2680:125;2612:203;;;;;2822:420;;;2970:2;2958:9;2949:7;2945:23;2941:32;2938:2;;;2986:1;2983;2976:12;2938:2;3021:1;3038:81;3111:7;3102:6;3091:9;3087:22;3038:81;;;3028:91;;3000:125;3156:2;3174:52;3218:7;3209:6;3198:9;3194:22;3174:52;;;3164:62;;3135:97;2932:310;;;;;;3249:101;3316:28;3338:5;3316:28;;;3311:3;3304:41;3298:52;;;3357:107;3428:30;3452:5;3428:30;;;3423:3;3416:43;3410:54;;;3471:110;3544:31;3569:5;3544:31;;;3539:3;3532:44;3526:55;;;3588:181;;3690:2;3679:9;3675:18;3667:26;;3704:55;3756:1;3745:9;3741:17;3732:6;3704:55;;;3661:108;;;;;3776:189;;3882:2;3871:9;3867:18;3859:26;;3896:59;3952:1;3941:9;3937:17;3928:6;3896:59;;;3853:112;;;;;3972:193;;4080:2;4069:9;4065:18;4057:26;;4094:61;4152:1;4141:9;4137:17;4128:6;4094:61;;;4051:114;;;;;4172:256;;4234:2;4228:9;4218:19;;4272:4;4264:6;4260:17;4371:6;4359:10;4356:22;4335:18;4323:10;4320:34;4317:62;4314:2;;;4392:1;4389;4382:12;4314:2;4412:10;4408:2;4401:22;4212:216;;;;;4435:92;;4515:5;4508:13;4501:21;4490:32;;4484:43;;;;4534:78;;4602:5;4591:16;;4585:27;;;;4619:79;;4688:5;4677:16;;4671:27;;;;4705:128;;4785:42;4778:5;4774:54;4763:65;;4757:76;;;;4840:79;;4909:5;4898:16;;4892:27;;;;4926:95;;5005:10;4998:5;4994:22;4983:33;;4977:44;;;",
- "sources": [
- "/Metacoin.sol"
- ]
- }
- }
-} \ No newline at end of file
diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json
index f181f5233..150a1bd51 100644
--- a/packages/metacoin/package.json
+++ b/packages/metacoin/package.json
@@ -7,7 +7,7 @@
"build:watch": "tsc -w",
"lint": "tslint --project .",
"clean": "shx rm -rf lib",
- "prebuild": "run-s clean generate_contract_wrappers copy_artifacts",
+ "prebuild": "run-s clean compile generate_contract_wrappers copy_artifacts",
"copy_artifacts": "copyfiles './artifacts/**/*' './contracts/**/*' ./lib",
"build": "tsc",
"test": "run-s build run_mocha",
@@ -18,7 +18,7 @@
"coverage:report:html": "istanbul report html && open coverage/index.html",
"coverage:report:lcov": "istanbul report lcov",
"test:circleci": "yarn test:coverage",
- "compile": "node ../deployer/lib/src/cli.js compile --contracts Metacoin --contract-dirs contracts --artifacts-dir artifacts"
+ "compile": "node ../deployer/lib/src/cli.js compile --contracts Metacoin --contracts-dir contracts --artifacts-dir artifacts"
},
"author": "",
"license": "Apache-2.0",
diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json
index f92850db5..277f40130 100644
--- a/packages/sol-cov/package.json
+++ b/packages/sol-cov/package.json
@@ -7,13 +7,14 @@
"scripts": {
"build:watch": "tsc -w",
"lint": "tslint --project . 'src/**/*.ts'",
- "test": "run-s clean build run_mocha",
+ "test": "run-s clean build compile_test run_mocha",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"test:circleci": "yarn test:coverage",
"run_mocha": "mocha lib/test/**/*_test.js --exit",
"clean": "shx rm -rf lib scripts",
"build": "copyfiles 'test/fixtures/**/*' ./lib && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
+ "compile_test": "node ../deployer/lib/src/cli.js compile --contracts SimpleStorage --contracts-dir test/fixtures/contracts --artifacts-dir test/fixtures/artifacts",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
"docs:stage": "yarn build && node ./scripts/stage_docs.js",
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
@@ -53,6 +54,7 @@
"solidity-parser-antlr": "^0.2.8"
},
"devDependencies": {
+ "@0xproject/deployer": "^0.3.5",
"@0xproject/monorepo-scripts": "^0.1.17",
"@0xproject/tslint-config": "^0.4.15",
"@types/istanbul": "^0.4.29",
diff --git a/packages/sol-cov/src/collect_contract_data.ts b/packages/sol-cov/src/collect_contract_data.ts
index a0ce2640f..1d8bc7178 100644
--- a/packages/sol-cov/src/collect_contract_data.ts
+++ b/packages/sol-cov/src/collect_contract_data.ts
@@ -6,30 +6,18 @@ import * as path from 'path';
import { ContractData } from './types';
export const collectContractsData = (artifactsPath: string, sourcesPath: string, networkId: number) => {
- const sourcesGlob = `${sourcesPath}/**/*.sol`;
- const sourceFileNames = glob.sync(sourcesGlob, { absolute: true });
- const contractsDataIfExists: Array<ContractData | {}> = _.map(sourceFileNames, sourceFileName => {
- const baseName = path.basename(sourceFileName, '.sol');
- const artifactFileName = path.join(artifactsPath, `${baseName}.json`);
- if (!fs.existsSync(artifactFileName)) {
- // If the contract isn't directly compiled, but is imported as the part of the other contract - we don't
- // have an artifact for it and therefore can't do anything useful with it
- return {};
- }
+ const artifactsGlob = `${artifactsPath}/**/*.json`;
+ const artifactFileNames = glob.sync(artifactsGlob, { absolute: true });
+ const contractsDataIfExists: Array<ContractData | {}> = _.map(artifactFileNames, artifactFileName => {
const artifact = JSON.parse(fs.readFileSync(artifactFileName).toString());
- const sources = _.map(artifact.networks[networkId].sources, source => {
- const includedFileName = glob.sync(`${sourcesPath}/**/${source}`, { absolute: true })[0];
- return includedFileName;
- });
- const sourceCodes = _.map(sources, source => {
- const includedSourceCode = fs.readFileSync(source).toString();
- return includedSourceCode;
- });
+ const sources = artifact.networks[networkId].sources;
+ const contractName = artifact.contract_name;
+ // We don't compute coverage for dependencies
+ const sourceCodes = _.map(sources, (source: string) => fs.readFileSync(source).toString());
if (_.isUndefined(artifact.networks[networkId])) {
- throw new Error(`No ${baseName} artifacts found for networkId ${networkId}`);
+ throw new Error(`No ${contractName} artifacts found for networkId ${networkId}`);
}
const contractData = {
- baseName,
sourceCodes,
sources,
sourceMap: artifact.networks[networkId].source_map,
diff --git a/packages/sol-cov/src/types.ts b/packages/sol-cov/src/types.ts
index d6491100b..01359d858 100644
--- a/packages/sol-cov/src/types.ts
+++ b/packages/sol-cov/src/types.ts
@@ -79,7 +79,6 @@ export interface ContractData {
runtimeBytecode: string;
sourceMapRuntime: string;
sourceCodes: string[];
- baseName: string;
sources: string[];
}
diff --git a/packages/sol-cov/test/collect_contracts_data_test.ts b/packages/sol-cov/test/collect_contracts_data_test.ts
index e793085e3..943a4a878 100644
--- a/packages/sol-cov/test/collect_contracts_data_test.ts
+++ b/packages/sol-cov/test/collect_contracts_data_test.ts
@@ -16,7 +16,6 @@ describe('Collect contracts data', () => {
const contractsData = collectContractsData(artifactsPath, sourcesPath, networkId);
_.forEach(contractsData, contractData => {
expect(contractData).to.have.keys([
- 'baseName',
'sourceCodes',
'sources',
'sourceMap',
diff --git a/packages/sol-cov/test/collect_coverage_entries_test.ts b/packages/sol-cov/test/collect_coverage_entries_test.ts
index c7bc45bbf..c7b9d44b1 100644
--- a/packages/sol-cov/test/collect_coverage_entries_test.ts
+++ b/packages/sol-cov/test/collect_coverage_entries_test.ts
@@ -39,13 +39,13 @@ describe('Collect coverage entries', () => {
const coverageEntries = collectCoverageEntries(simpleStorageContract);
const fnIds = _.keys(coverageEntries.fnMap);
expect(coverageEntries.fnMap[fnIds[0]].name).to.be.equal('set');
- expect(coverageEntries.fnMap[fnIds[0]].line).to.be.equal(3);
+ expect(coverageEntries.fnMap[fnIds[0]].line).to.be.equal(5);
const setFunction = `function set(uint x) {
storedData = x;
}`;
expect(getRange(simpleStorageContract, coverageEntries.fnMap[fnIds[0]].loc)).to.be.equal(setFunction);
expect(coverageEntries.fnMap[fnIds[1]].name).to.be.equal('get');
- expect(coverageEntries.fnMap[fnIds[1]].line).to.be.equal(6);
+ expect(coverageEntries.fnMap[fnIds[1]].line).to.be.equal(8);
const getFunction = `function get() constant returns (uint retVal) {
return storedData;
}`;
diff --git a/packages/sol-cov/test/fixtures/artifacts/SimpleStorage.json b/packages/sol-cov/test/fixtures/artifacts/SimpleStorage.json
deleted file mode 100644
index 416170ef2..000000000
--- a/packages/sol-cov/test/fixtures/artifacts/SimpleStorage.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
- "contract_name": "SimpleStorage",
- "networks": {
- "50": {
- "solc_version": "0.4.21",
- "keccak256": "0x18dc5b5a0e813c17e49936d2f2f7c07c51f050c09ba5e7206f17c855f23f4b6a",
- "source_tree_hash": "0x18dc5b5a0e813c17e49936d2f2f7c07c51f050c09ba5e7206f17c855f23f4b6a",
- "optimizer_enabled": 0,
- "abi": [
- {
- "constant": true,
- "inputs": [],
- "name": "storedData",
- "outputs": [
- {
- "name": "",
- "type": "uint256"
- }
- ],
- "payable": false,
- "stateMutability": "view",
- "type": "function"
- },
- {
- "constant": false,
- "inputs": [
- {
- "name": "x",
- "type": "uint256"
- }
- ],
- "name": "set",
- "outputs": [],
- "payable": false,
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "constant": true,
- "inputs": [],
- "name": "get",
- "outputs": [
- {
- "name": "retVal",
- "type": "uint256"
- }
- ],
- "payable": false,
- "stateMutability": "view",
- "type": "function"
- }
- ],
- "bytecode":
- "0x6060604052341561000f57600080fd5b6101098061001e6000396000f3006060604052600436106053576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605857806360fe47b114607e5780636d4ce63c14609e575b600080fd5b3415606257600080fd5b606860c4565b6040518082815260200191505060405180910390f35b3415608857600080fd5b609c600480803590602001909190505060ca565b005b341560a857600080fd5b60ae60d4565b6040518082815260200191505060405180910390f35b60005481565b8060008190555050565b600080549050905600a165627a7a723058207f743855fd0c71699620424a21a257cd197ed05032d6768eb9b874e4898f44c60029",
- "runtime_bytecode":
- "0x6060604052600436106053576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605857806360fe47b114607e5780636d4ce63c14609e575b600080fd5b3415606257600080fd5b606860c4565b6040518082815260200191505060405180910390f35b3415608857600080fd5b609c600480803590602001909190505060ca565b005b341560a857600080fd5b60ae60d4565b6040518082815260200191505060405180910390f35b60005481565b8060008190555050565b600080549050905600a165627a7a723058207f743855fd0c71699620424a21a257cd197ed05032d6768eb9b874e4898f44c60029",
- "updated_at": 1521118350895,
- "source_map": "26:196:0:-;;;;;;;;;;;;;;;;;",
- "source_map_runtime":
- "26:196:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;55:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;83:52;;;;;;;;;;;;;;;;;;;;;;;;;;140:80;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;55:22;;;;:::o;83:52::-;127:1;114:10;:14;;;;83:52;:::o;140:80::-;173:11;203:10;;196:17;;140:80;:::o",
- "sources": ["SimpleStorage.sol"]
- }
- }
-}
diff --git a/packages/sol-cov/test/fixtures/artifacts/Simplest.json b/packages/sol-cov/test/fixtures/artifacts/Simplest.json
deleted file mode 100644
index 8de60e481..000000000
--- a/packages/sol-cov/test/fixtures/artifacts/Simplest.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "contract_name": "Simplest",
- "networks": {
- "50": {
- "solc_version": "0.4.21",
- "keccak256": "0x8e7d62e19c7c7b8bf9a4a43749e111605950cc877574fb9640a1a07d1c3749f9",
- "source_tree_hash": "0x8e7d62e19c7c7b8bf9a4a43749e111605950cc877574fb9640a1a07d1c3749f9",
- "optimizer_enabled": 0,
- "abi": [],
- "bytecode":
- "0x60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a7230582097cfe05b4d18d6ffb3a8d8fab0570cf09640d3131b9677ddb9be4e9fbcb65f010029",
- "runtime_bytecode":
- "0x6060604052600080fd00a165627a7a7230582097cfe05b4d18d6ffb3a8d8fab0570cf09640d3131b9677ddb9be4e9fbcb65f010029",
- "updated_at": 1521118525393,
- "source_map": "26:21:0:-;;;;;;;;;;;;;;;;;",
- "source_map_runtime": "26:21:0:-;;;;;",
- "sources": ["Simplest.sol"]
- }
- }
-}
diff --git a/packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol b/packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol
index 178a52318..e4b4ac246 100644
--- a/packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol
+++ b/packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol
@@ -1,3 +1,5 @@
+pragma solidity ^0.4.21;
+
contract SimpleStorage {
uint public storedData;
function set(uint x) {
diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json
new file mode 100644
index 000000000..ae1a94f3e
--- /dev/null
+++ b/packages/sol-resolver/package.json
@@ -0,0 +1,39 @@
+{
+ "name": "@0xproject/sol-resolver",
+ "version": "0.0.1",
+ "description": "Import resolver for smart contracts dependencies",
+ "main": "lib/index.js",
+ "types": "lib/index.d.ts",
+ "scripts": {
+ "build:watch": "tsc -w",
+ "build": "yarn clean && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
+ "clean": "shx rm -rf lib scripts",
+ "lint": "tslint --project .",
+ "manual:postpublish": "yarn build; node ./scripts/postpublish.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/packages/resolver/README.md",
+ "devDependencies": {
+ "@0xproject/monorepo-scripts": "^0.1.16",
+ "@0xproject/tslint-config": "^0.4.14",
+ "copyfiles": "^1.2.0",
+ "shx": "^0.2.2",
+ "tslint": "5.8.0",
+ "typescript": "2.7.1"
+ },
+ "dependencies": {
+ "@0xproject/typescript-typings": "^0.0.3",
+ "@0xproject/types": "^0.6.0",
+ "lodash": "^4.17.4"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/packages/sol-resolver/src/index.ts b/packages/sol-resolver/src/index.ts
new file mode 100644
index 000000000..cd6ec42ec
--- /dev/null
+++ b/packages/sol-resolver/src/index.ts
@@ -0,0 +1,8 @@
+export { ContractSource, ContractSources } from './types';
+export { FallthroughResolver } from './resolvers/fallthrough_resolver';
+export { URLResolver } from './resolvers/url_resolver';
+export { NPMResolver } from './resolvers/npm_resolver';
+export { FSResolver } from './resolvers/fs_resolver';
+export { NameResolver } from './resolvers/name_resolver';
+export { EnumerableResolver } from './resolvers/enumerable_resolver';
+export { Resolver } from './resolvers/resolver';
diff --git a/packages/sol-resolver/src/resolvers/enumerable_resolver.ts b/packages/sol-resolver/src/resolvers/enumerable_resolver.ts
new file mode 100644
index 000000000..0efa43e7c
--- /dev/null
+++ b/packages/sol-resolver/src/resolvers/enumerable_resolver.ts
@@ -0,0 +1,7 @@
+import { ContractSource } from '../types';
+
+import { Resolver } from './resolver';
+
+export abstract class EnumerableResolver extends Resolver {
+ public abstract getAll(): ContractSource[];
+}
diff --git a/packages/sol-resolver/src/resolvers/fallthrough_resolver.ts b/packages/sol-resolver/src/resolvers/fallthrough_resolver.ts
new file mode 100644
index 000000000..8f6af9be0
--- /dev/null
+++ b/packages/sol-resolver/src/resolvers/fallthrough_resolver.ts
@@ -0,0 +1,21 @@
+import * as _ from 'lodash';
+
+import { ContractSource } from '../types';
+
+import { Resolver } from './resolver';
+
+export class FallthroughResolver extends Resolver {
+ private _resolvers: Resolver[] = [];
+ public appendResolver(resolver: Resolver): void {
+ this._resolvers.push(resolver);
+ }
+ public resolveIfExists(importPath: string): ContractSource | undefined {
+ for (const resolver of this._resolvers) {
+ const contractSourceIfExists = resolver.resolveIfExists(importPath);
+ if (!_.isUndefined(contractSourceIfExists)) {
+ return contractSourceIfExists;
+ }
+ }
+ return undefined;
+ }
+}
diff --git a/packages/sol-resolver/src/resolvers/fs_resolver.ts b/packages/sol-resolver/src/resolvers/fs_resolver.ts
new file mode 100644
index 000000000..4f05fba88
--- /dev/null
+++ b/packages/sol-resolver/src/resolvers/fs_resolver.ts
@@ -0,0 +1,19 @@
+import * as fs from 'fs';
+
+import { ContractSource } from '../types';
+
+import { Resolver } from './resolver';
+
+export class FSResolver extends Resolver {
+ // tslint:disable-next-line:prefer-function-over-method
+ public resolveIfExists(importPath: string): ContractSource | undefined {
+ if (fs.existsSync(importPath)) {
+ const fileContent = fs.readFileSync(importPath).toString();
+ return {
+ source: fileContent,
+ path: importPath,
+ };
+ }
+ return undefined;
+ }
+}
diff --git a/packages/sol-resolver/src/resolvers/name_resolver.ts b/packages/sol-resolver/src/resolvers/name_resolver.ts
new file mode 100644
index 000000000..6849b7610
--- /dev/null
+++ b/packages/sol-resolver/src/resolvers/name_resolver.ts
@@ -0,0 +1,66 @@
+import * as fs from 'fs';
+import * as _ from 'lodash';
+import * as path from 'path';
+
+import { ContractSource } from '../types';
+
+import { EnumerableResolver } from './enumerable_resolver';
+
+export class NameResolver extends EnumerableResolver {
+ private _contractsDir: string;
+ constructor(contractsDir: string) {
+ super();
+ this._contractsDir = contractsDir;
+ }
+ public resolveIfExists(lookupContractName: string): ContractSource | undefined {
+ const SOLIDITY_FILE_EXTENSION = '.sol';
+ let contractSource: ContractSource | undefined;
+ const onFile = (filePath: string) => {
+ const contractName = path.basename(filePath, SOLIDITY_FILE_EXTENSION);
+ if (contractName === lookupContractName) {
+ const source = fs.readFileSync(filePath).toString();
+ contractSource = {
+ source,
+ path: filePath,
+ };
+ return true;
+ }
+ return undefined;
+ };
+ this._traverseContractsDir(this._contractsDir, onFile);
+ return contractSource;
+ }
+ public getAll(): ContractSource[] {
+ const SOLIDITY_FILE_EXTENSION = '.sol';
+ const contractSources: ContractSource[] = [];
+ const onFile = (filePath: string) => {
+ const contractName = path.basename(filePath, SOLIDITY_FILE_EXTENSION);
+ const source = fs.readFileSync(filePath).toString();
+ const contractSource = {
+ source,
+ path: filePath,
+ };
+ contractSources.push(contractSource);
+ };
+ this._traverseContractsDir(this._contractsDir, onFile);
+ return contractSources;
+ }
+ // tslint:disable-next-line:prefer-function-over-method
+ private _traverseContractsDir(dirPath: string, onFile: (filePath: string) => true | void): boolean {
+ let dirContents: string[] = [];
+ try {
+ dirContents = fs.readdirSync(dirPath);
+ } catch (err) {
+ throw new Error(`No directory found at ${dirPath}`);
+ }
+ for (const fileName of dirContents) {
+ const entryPath = path.join(dirPath, fileName);
+ const isDirectory = fs.lstatSync(entryPath).isDirectory();
+ const isComplete = isDirectory ? this._traverseContractsDir(entryPath, onFile) : onFile(entryPath);
+ if (isComplete) {
+ return isComplete;
+ }
+ }
+ return false;
+ }
+}
diff --git a/packages/sol-resolver/src/resolvers/npm_resolver.ts b/packages/sol-resolver/src/resolvers/npm_resolver.ts
new file mode 100644
index 000000000..2c0a44aad
--- /dev/null
+++ b/packages/sol-resolver/src/resolvers/npm_resolver.ts
@@ -0,0 +1,34 @@
+import * as fs from 'fs';
+import * as path from 'path';
+
+import { ContractSource } from '../types';
+
+import { Resolver } from './resolver';
+
+export class NPMResolver extends Resolver {
+ private _packagePath: string;
+ constructor(packagePath: string) {
+ super();
+ this._packagePath = packagePath;
+ }
+ public resolveIfExists(importPath: string): ContractSource | undefined {
+ if (!importPath.startsWith('/')) {
+ const [packageName, ...other] = importPath.split('/');
+ const pathWithinPackage = path.join(...other);
+ let currentPath = this._packagePath;
+ const ROOT_PATH = '/';
+ while (currentPath !== ROOT_PATH) {
+ const lookupPath = path.join(currentPath, 'node_modules', packageName, pathWithinPackage);
+ if (fs.existsSync(lookupPath)) {
+ const fileContent = fs.readFileSync(lookupPath).toString();
+ return {
+ source: fileContent,
+ path: lookupPath,
+ };
+ }
+ currentPath = path.dirname(currentPath);
+ }
+ }
+ return undefined;
+ }
+}
diff --git a/packages/sol-resolver/src/resolvers/resolver.ts b/packages/sol-resolver/src/resolvers/resolver.ts
new file mode 100644
index 000000000..7edc9a85d
--- /dev/null
+++ b/packages/sol-resolver/src/resolvers/resolver.ts
@@ -0,0 +1,14 @@
+import * as _ from 'lodash';
+
+import { ContractSource } from '../types';
+
+export abstract class Resolver {
+ public abstract resolveIfExists(importPath: string): ContractSource | undefined;
+ public resolve(importPath: string): ContractSource {
+ const contractSourceIfExists = this.resolveIfExists(importPath);
+ if (_.isUndefined(contractSourceIfExists)) {
+ throw new Error(`Failed to resolve ${importPath}`);
+ }
+ return contractSourceIfExists;
+ }
+}
diff --git a/packages/sol-resolver/src/resolvers/url_resolver.ts b/packages/sol-resolver/src/resolvers/url_resolver.ts
new file mode 100644
index 000000000..180b0c9f6
--- /dev/null
+++ b/packages/sol-resolver/src/resolvers/url_resolver.ts
@@ -0,0 +1,21 @@
+import * as fs from 'fs';
+
+import { ContractSource } from '../types';
+
+import { Resolver } from './resolver';
+
+export class URLResolver extends Resolver {
+ // tslint:disable-next-line:prefer-function-over-method
+ public resolveIfExists(importPath: string): ContractSource | undefined {
+ const FILE_URL_PREXIF = 'file://';
+ if (importPath.startsWith(FILE_URL_PREXIF)) {
+ const filePath = importPath.substr(FILE_URL_PREXIF.length);
+ const fileContent = fs.readFileSync(filePath).toString();
+ return {
+ source: fileContent,
+ path: importPath,
+ };
+ }
+ return undefined;
+ }
+}
diff --git a/packages/sol-resolver/src/types.ts b/packages/sol-resolver/src/types.ts
new file mode 100644
index 000000000..41492622d
--- /dev/null
+++ b/packages/sol-resolver/src/types.ts
@@ -0,0 +1,8 @@
+export interface ContractSource {
+ source: string;
+ path: string;
+}
+
+export interface ContractSources {
+ [key: string]: ContractSource;
+}
diff --git a/packages/sol-resolver/tsconfig.json b/packages/sol-resolver/tsconfig.json
new file mode 100644
index 000000000..f5f4b37c2
--- /dev/null
+++ b/packages/sol-resolver/tsconfig.json
@@ -0,0 +1,7 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib"
+ },
+ "include": ["src/**/*"]
+}
diff --git a/packages/sol-resolver/tslint.json b/packages/sol-resolver/tslint.json
new file mode 100644
index 000000000..ffaefe83a
--- /dev/null
+++ b/packages/sol-resolver/tslint.json
@@ -0,0 +1,3 @@
+{
+ "extends": ["@0xproject/tslint-config"]
+}
diff --git a/packages/typescript-typings/CHANGELOG.json b/packages/typescript-typings/CHANGELOG.json
index 2ea5ff0ec..289422b97 100644
--- a/packages/typescript-typings/CHANGELOG.json
+++ b/packages/typescript-typings/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "0.2.0",
+ "changes": [
+ {
+ "note": "Add types for `solc.compileStandardWrapper`",
+ "pr": 509
+ }
+ ]
+ },
+ {
"version": "0.1.0",
"changes": [
{
diff --git a/packages/typescript-typings/types/solc/index.d.ts b/packages/typescript-typings/types/solc/index.d.ts
index fcef24b9f..b20f9b2ff 100644
--- a/packages/typescript-typings/types/solc/index.d.ts
+++ b/packages/typescript-typings/types/solc/index.d.ts
@@ -26,12 +26,128 @@ declare module 'solc' {
[fileName: string]: string;
};
}
+ export interface BaseSource {
+ keccak256?: string;
+ }
+ export interface InMemorySource extends BaseSource {
+ content: string;
+ }
+ export interface UrlSource extends BaseSource {
+ urls: string[];
+ }
+ export type Source = UrlSource | InMemorySource;
+ export type OutputField =
+ | '*'
+ | 'ast'
+ | 'legacyAST'
+ | 'abi'
+ | 'devdoc'
+ | 'userdoc'
+ | 'metadata'
+ | 'ir'
+ | 'evm.assembly'
+ | 'evm.legacyAssembly'
+ | 'evm.bytecode.object'
+ | 'evm.bytecode.opcodes'
+ | 'evm.bytecode.sourceMap'
+ | 'evm.bytecode.linkReferences'
+ | 'evm.deployedBytecode.object'
+ | 'evm.deployedBytecode.opcodes'
+ | 'evm.deployedBytecode.sourceMap'
+ | 'evm.deployedBytecode.linkReferences'
+ | 'evm.methodIdentifiers'
+ | 'evm.gasEstimates'
+ | 'ewasm.wast'
+ | 'ewasm.wasm';
+ export interface StandardInput {
+ language: 'Solidity' | 'serpent' | 'lll' | 'assembly';
+ sources: {
+ [fileName: string]: Source;
+ };
+ settings: {
+ remappings?: string[];
+ optimizer?: {
+ enabled: boolean;
+ runs?: number;
+ };
+ evmVersion?: 'homestead' | 'tangerineWhistle' | 'spuriousDragon' | 'byzantium' | 'constantinople';
+ metadata?: {
+ useLiteralContent: true;
+ };
+ libraries?: {
+ [fileName: string]: {
+ [libName: string]: string;
+ };
+ };
+ outputSelection: {
+ [fileName: string]: {
+ [contractName: string]: OutputField[];
+ };
+ };
+ };
+ }
+ export type ErrorType =
+ | 'JSONError'
+ | 'IOError'
+ | 'ParserError'
+ | 'DocstringParsingError'
+ | 'SyntaxError'
+ | 'DeclarationError'
+ | 'TypeError'
+ | 'UnimplementedFeatureError'
+ | 'InternalCompilerError'
+ | 'Exception'
+ | 'CompilerError'
+ | 'FatalError'
+ | 'Warning';
+ export type ErrorSeverity = 'error' | 'warning';
+ export interface Error {
+ sourceLocation?: {
+ file: string;
+ start: number;
+ end: number;
+ };
+ type: ErrorType;
+ component: 'general' | 'ewasm';
+ severity: ErrorSeverity;
+ message: string;
+ formattedMessage?: string;
+ }
+ import { ContractAbi } from '@0xproject/types';
+ export interface StandardOutput {
+ errors: Error[];
+ sources: {
+ [fileName: string]: {
+ id: number;
+ ast?: object;
+ legacyAST?: object;
+ };
+ };
+ contracts: {
+ [fileName: string]: {
+ [contractName: string]: {
+ abi: ContractAbi;
+ evm: {
+ bytecode: {
+ object: string;
+ sourceMap: string;
+ };
+ deployedBytecode: {
+ object: string;
+ sourceMap: string;
+ };
+ };
+ };
+ };
+ };
+ }
export interface SolcInstance {
compile(
sources: InputSources,
optimizerEnabled: number,
findImports: (importPath: string) => ImportContents,
): CompilationResult;
+ compileStandardWrapper(input: string, findImports: (importPath: string) => ImportContents): string;
}
export function loadRemoteVersion(versionName: string, cb: (err: Error | null, res?: SolcInstance) => void): void;
export function setupMethods(solcBin: any): SolcInstance;
diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts
index 75c096ee6..709ec93b2 100644
--- a/packages/utils/src/index.ts
+++ b/packages/utils/src/index.ts
@@ -6,5 +6,4 @@ export { BigNumber } from './configured_bignumber';
export { AbiDecoder } from './abi_decoder';
export { logUtils } from './log_utils';
export { abiUtils } from './abi_utils';
-
export { NULL_BYTES } from './constants';
diff --git a/yarn.lock b/yarn.lock
index 265b194e3..5bb47293f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6,6 +6,25 @@
version "0.3.9"
resolved "https://registry.yarnpkg.com/8fold-marked/-/8fold-marked-0.3.9.tgz#bb89c645612f8ccfaffac1ca6e3c11f168c9cf59"
+"@0xproject/deployer@^0.3.5":
+ version "0.3.5"
+ resolved "https://registry.yarnpkg.com/@0xproject/deployer/-/deployer-0.3.5.tgz#3b4144ac62cfbbe4fc7174cbf92f29594f411973"
+ dependencies:
+ "@0xproject/json-schemas" "^0.7.19"
+ "@0xproject/types" "^0.5.0"
+ "@0xproject/typescript-typings" "^0.0.3"
+ "@0xproject/utils" "^0.5.0"
+ "@0xproject/web3-wrapper" "^0.5.0"
+ ethereumjs-util "^5.1.1"
+ isomorphic-fetch "^2.2.1"
+ lodash "^4.17.4"
+ require-from-string "^2.0.1"
+ semver "^5.5.0"
+ solc "^0.4.18"
+ web3 "^0.20.0"
+ web3-eth-abi "^1.0.0-beta.24"
+ yargs "^10.0.3"
+
"@0xproject/tslint-config@0.4.13":
version "0.4.13"
resolved "https://registry.yarnpkg.com/@0xproject/tslint-config/-/tslint-config-0.4.13.tgz#98c71c5ae5e80315a23eda0134cc9f6f4438cac2"
@@ -15,6 +34,30 @@
tslint-eslint-rules "^4.1.1"
tslint-react "^3.2.0"
+"@0xproject/types@^0.5.0":
+ version "0.5.0"
+ resolved "https://registry.yarnpkg.com/@0xproject/types/-/types-0.5.0.tgz#ba3cfbc11a8c6344b57c9680aa7df2ea84b9bf05"
+ dependencies:
+ bignumber.js "~4.1.0"
+
+"@0xproject/typescript-typings@^0.0.3":
+ version "0.0.3"
+ resolved "https://registry.yarnpkg.com/@0xproject/typescript-typings/-/typescript-typings-0.0.3.tgz#3272080bde00ade0a970b0d236686b483b08a1d0"
+ dependencies:
+ "@0xproject/types" "^0.5.0"
+ bignumber.js "~4.1.0"
+
+"@0xproject/web3-wrapper@^0.5.0":
+ version "0.5.0"
+ resolved "https://registry.yarnpkg.com/@0xproject/web3-wrapper/-/web3-wrapper-0.5.0.tgz#99a1acea60a5c3163ac0be28f4c0577c3d43dec4"
+ dependencies:
+ "@0xproject/types" "^0.5.0"
+ "@0xproject/typescript-typings" "^0.0.3"
+ "@0xproject/utils" "^0.5.0"
+ ethers-contracts "^2.2.1"
+ lodash "^4.17.4"
+ web3 "^0.20.0"
+
"@ledgerhq/hw-app-eth@^4.3.0":
version "4.7.3"
resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-eth/-/hw-app-eth-4.7.3.tgz#d352e19658ae296532e522c53c8ec2a1a77b64e5"
@@ -55,6 +98,12 @@
version "1.0.2"
resolved "https://registry.yarnpkg.com/@types/bintrees/-/bintrees-1.0.2.tgz#0dfdce4eeebdf90427bd35b0e79dc248b3d157a6"
+"@types/bip39@^2.4.0":
+ version "2.4.0"
+ resolved "https://registry.yarnpkg.com/@types/bip39/-/bip39-2.4.0.tgz#eee31a14abc8ebbb41a1ff14575c447b18346cbc"
+ dependencies:
+ "@types/node" "*"
+
"@types/body-parser@*", "@types/body-parser@^1.16.1":
version "1.16.8"
resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.16.8.tgz#687ec34140624a3bec2b1a8ea9268478ae8f3be3"
@@ -1402,7 +1451,7 @@ bintrees@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/bintrees/-/bintrees-1.0.2.tgz#49f896d6e858a4a499df85c38fb399b9aff840f8"
-bip39@^2.2.0:
+bip39@^2.2.0, bip39@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/bip39/-/bip39-2.5.0.tgz#51cbd5179460504a63ea3c000db3f787ca051235"
dependencies:
@@ -3185,6 +3234,10 @@ dot-prop@^4.1.0:
dependencies:
is-obj "^1.0.0"
+dotenv@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-4.0.0.tgz#864ef1379aced55ce6f95debecdce179f7a0cd1d"
+
drbg.js@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/drbg.js/-/drbg.js-1.0.1.tgz#3e36b6c42b37043823cdbc332d58f31e2445480b"
@@ -3647,6 +3700,14 @@ ethjs-abi@0.1.8:
js-sha3 "0.5.5"
number-to-bn "1.7.0"
+ethjs-abi@^0.2.1:
+ version "0.2.1"
+ resolved "https://registry.yarnpkg.com/ethjs-abi/-/ethjs-abi-0.2.1.tgz#e0a7a93a7e81163a94477bad56ede524ab6de533"
+ dependencies:
+ bn.js "4.11.6"
+ js-sha3 "0.5.5"
+ number-to-bn "1.7.0"
+
ethjs-unit@0.1.6:
version "0.1.6"
resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699"
@@ -11872,3 +11933,10 @@ yauzl@^2.4.2:
dependencies:
buffer-crc32 "~0.2.3"
fd-slicer "~1.0.1"
+
+zeppelin-solidity@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/zeppelin-solidity/-/zeppelin-solidity-1.8.0.tgz#049fcde7daea9fc85210f8c6db9f8cd1ab8a853a"
+ dependencies:
+ dotenv "^4.0.0"
+ ethjs-abi "^0.2.1"