Merge pull request #512 from 0xProject/feature/resolver
Dependencies resolver for deployer
This commit is contained in:
@@ -124,6 +124,10 @@ jobs:
|
|||||||
key: coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
|
key: coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
paths:
|
paths:
|
||||||
- ~/repo/packages/sol-cov/coverage/lcov.info
|
- ~/repo/packages/sol-cov/coverage/lcov.info
|
||||||
|
- save_cache:
|
||||||
|
key: coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
|
paths:
|
||||||
|
- ~/repo/packages/metacoin/coverage/lcov.info
|
||||||
lint:
|
lint:
|
||||||
working_directory: ~/repo
|
working_directory: ~/repo
|
||||||
docker:
|
docker:
|
||||||
@@ -177,6 +181,9 @@ jobs:
|
|||||||
- restore_cache:
|
- restore_cache:
|
||||||
keys:
|
keys:
|
||||||
- coverage-0xjs-{{ .Environment.CIRCLE_SHA1 }}
|
- coverage-0xjs-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
- coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
- run: yarn report_coverage
|
- run: yarn report_coverage
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -74,6 +74,8 @@ packages/react-docs/example/public/bundle*
|
|||||||
bin/
|
bin/
|
||||||
|
|
||||||
# generated contract artifacts
|
# generated contract artifacts
|
||||||
|
packages/sol-cov/test/fixtures/artifacts
|
||||||
|
packages/metacoin/artifacts
|
||||||
packages/0x.js/test/artifacts
|
packages/0x.js/test/artifacts
|
||||||
packages/migrations/src/artifacts
|
packages/migrations/src/artifacts
|
||||||
|
|
||||||
|
@@ -2,5 +2,6 @@ lib
|
|||||||
.nyc_output
|
.nyc_output
|
||||||
/packages/contracts/src/artifacts
|
/packages/contracts/src/artifacts
|
||||||
/packages/metacoin/artifacts
|
/packages/metacoin/artifacts
|
||||||
|
/packages/migrations/src/artifacts
|
||||||
package.json
|
package.json
|
||||||
scripts/postpublish_utils.js
|
scripts/postpublish_utils.js
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
|
"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",
|
"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: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",
|
"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'",
|
"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'",
|
"lint": "tslint --project . 'migrations/**/*.ts' 'test/**/*.ts' 'util/**/*.ts' 'deploy/**/*.ts'",
|
||||||
|
@@ -64,15 +64,18 @@
|
|||||||
"typedoc": "0xProject/typedoc",
|
"typedoc": "0xProject/typedoc",
|
||||||
"types-bn": "^0.0.1",
|
"types-bn": "^0.0.1",
|
||||||
"typescript": "2.7.1",
|
"typescript": "2.7.1",
|
||||||
"web3-typescript-typings": "^0.10.2"
|
"web3-typescript-typings": "^0.10.2",
|
||||||
|
"zeppelin-solidity": "1.8.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@0xproject/sol-resolver": "^0.0.1",
|
||||||
"@0xproject/json-schemas": "^0.7.20",
|
"@0xproject/json-schemas": "^0.7.20",
|
||||||
"@0xproject/types": "^0.6.0",
|
"@0xproject/types": "^0.6.0",
|
||||||
"@0xproject/typescript-typings": "^0.1.0",
|
"@0xproject/typescript-typings": "^0.1.0",
|
||||||
"@0xproject/utils": "^0.5.1",
|
"@0xproject/utils": "^0.5.1",
|
||||||
"@0xproject/web3-wrapper": "^0.6.0",
|
"@0xproject/web3-wrapper": "^0.6.0",
|
||||||
"@types/yargs": "^11.0.0",
|
"@types/yargs": "^11.0.0",
|
||||||
|
"chalk": "^2.3.0",
|
||||||
"ethereumjs-util": "^5.1.1",
|
"ethereumjs-util": "^5.1.1",
|
||||||
"isomorphic-fetch": "^2.2.1",
|
"isomorphic-fetch": "^2.2.1",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
|
@@ -11,7 +11,7 @@ import * as yargs from 'yargs';
|
|||||||
import { commands } from './commands';
|
import { commands } from './commands';
|
||||||
import { constants } from './utils/constants';
|
import { constants } from './utils/constants';
|
||||||
import { consoleReporter } from './utils/error_reporter';
|
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_OPTIMIZER_ENABLED = false;
|
||||||
const DEFAULT_CONTRACTS_DIR = path.resolve('src/contracts');
|
const DEFAULT_CONTRACTS_DIR = path.resolve('src/contracts');
|
||||||
@@ -27,7 +27,7 @@ const DEFAULT_CONTRACTS_LIST = '*';
|
|||||||
*/
|
*/
|
||||||
async function onCompileCommandAsync(argv: CliOptions): Promise<void> {
|
async function onCompileCommandAsync(argv: CliOptions): Promise<void> {
|
||||||
const opts: CompilerOptions = {
|
const opts: CompilerOptions = {
|
||||||
contractDirs: getContractDirectoriesFromList(argv.contractDirs),
|
contractsDir: argv.contractsDir,
|
||||||
networkId: argv.networkId,
|
networkId: argv.networkId,
|
||||||
optimizerEnabled: argv.shouldOptimize,
|
optimizerEnabled: argv.shouldOptimize,
|
||||||
artifactsDir: argv.artifactsDir,
|
artifactsDir: argv.artifactsDir,
|
||||||
@@ -45,7 +45,7 @@ async function onDeployCommandAsync(argv: CliOptions): Promise<void> {
|
|||||||
const web3Wrapper = new Web3Wrapper(provider);
|
const web3Wrapper = new Web3Wrapper(provider);
|
||||||
const networkId = await web3Wrapper.getNetworkIdAsync();
|
const networkId = await web3Wrapper.getNetworkIdAsync();
|
||||||
const compilerOpts: CompilerOptions = {
|
const compilerOpts: CompilerOptions = {
|
||||||
contractDirs: getContractDirectoriesFromList(argv.contractDirs),
|
contractsDir: argv.contractsDir,
|
||||||
networkId,
|
networkId,
|
||||||
optimizerEnabled: argv.shouldOptimize,
|
optimizerEnabled: argv.shouldOptimize,
|
||||||
artifactsDir: argv.artifactsDir,
|
artifactsDir: argv.artifactsDir,
|
||||||
@@ -67,29 +67,6 @@ async function onDeployCommandAsync(argv: CliOptions): Promise<void> {
|
|||||||
const deployerArgs = deployerArgsString.split(',');
|
const deployerArgs = deployerArgsString.split(',');
|
||||||
await commands.deployAsync(argv.contract as string, deployerArgs, deployerOpts);
|
await commands.deployAsync(argv.contract as string, deployerArgs, deployerOpts);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 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.
|
* Creates a set of contracts to compile.
|
||||||
* @param contracts Comma separated list of contracts to compile
|
* @param contracts Comma separated list of contracts to compile
|
||||||
@@ -126,11 +103,10 @@ function deployCommandBuilder(yargsInstance: any) {
|
|||||||
(() => {
|
(() => {
|
||||||
const identityCommandBuilder = _.identity;
|
const identityCommandBuilder = _.identity;
|
||||||
return yargs
|
return yargs
|
||||||
.option('contract-dirs', {
|
.option('contracts-dir', {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: DEFAULT_CONTRACTS_DIR,
|
default: DEFAULT_CONTRACTS_DIR,
|
||||||
description:
|
description: 'path of contracts directory to compile',
|
||||||
"comma separated list of contract directories.\nTo avoid filename clashes, directories should be prefixed with a namespace as follows: 'namespace:/path/to/dir'.",
|
|
||||||
})
|
})
|
||||||
.option('network-id', {
|
.option('network-id', {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
@@ -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 { logUtils, promisify } from '@0xproject/utils';
|
||||||
|
import chalk from 'chalk';
|
||||||
import * as ethUtil from 'ethereumjs-util';
|
import * as ethUtil from 'ethereumjs-util';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import 'isomorphic-fetch';
|
import 'isomorphic-fetch';
|
||||||
@@ -11,10 +23,7 @@ import solc = require('solc');
|
|||||||
|
|
||||||
import { binPaths } from './solc/bin_paths';
|
import { binPaths } from './solc/bin_paths';
|
||||||
import {
|
import {
|
||||||
constructContractId,
|
|
||||||
constructUniqueSourceFileId,
|
|
||||||
createDirIfDoesNotExistAsync,
|
createDirIfDoesNotExistAsync,
|
||||||
findImportIfExist,
|
|
||||||
getContractArtifactIfExistsAsync,
|
getContractArtifactIfExistsAsync,
|
||||||
getNormalizedErrMsg,
|
getNormalizedErrMsg,
|
||||||
parseDependencies,
|
parseDependencies,
|
||||||
@@ -25,14 +34,10 @@ import { fsWrapper } from './utils/fs_wrapper';
|
|||||||
import {
|
import {
|
||||||
CompilerOptions,
|
CompilerOptions,
|
||||||
ContractArtifact,
|
ContractArtifact,
|
||||||
ContractDirectory,
|
|
||||||
ContractIdToSourceFileId,
|
|
||||||
ContractNetworkData,
|
ContractNetworkData,
|
||||||
ContractNetworks,
|
ContractNetworks,
|
||||||
ContractSourceDataByFileId,
|
ContractSourceData,
|
||||||
ContractSources,
|
|
||||||
ContractSpecificSourceData,
|
ContractSpecificSourceData,
|
||||||
FunctionNameToSeenCount,
|
|
||||||
} from './utils/types';
|
} from './utils/types';
|
||||||
import { utils } from './utils/utils';
|
import { utils } from './utils/utils';
|
||||||
|
|
||||||
@@ -44,71 +49,32 @@ const SOLC_BIN_DIR = path.join(__dirname, '..', '..', 'solc_bin');
|
|||||||
* to artifact files.
|
* to artifact files.
|
||||||
*/
|
*/
|
||||||
export class Compiler {
|
export class Compiler {
|
||||||
private _contractDirs: Set<ContractDirectory>;
|
private _resolver: Resolver;
|
||||||
|
private _nameResolver: NameResolver;
|
||||||
|
private _contractsDir: string;
|
||||||
private _networkId: number;
|
private _networkId: number;
|
||||||
private _optimizerEnabled: boolean;
|
private _optimizerEnabled: boolean;
|
||||||
private _artifactsDir: string;
|
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 _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.
|
* Instantiates a new instance of the Compiler class.
|
||||||
* @param opts Options specifying directories, network, and optimization settings.
|
* @param opts Options specifying directories, network, and optimization settings.
|
||||||
* @return An instance of the Compiler class.
|
* @return An instance of the Compiler class.
|
||||||
*/
|
*/
|
||||||
constructor(opts: CompilerOptions) {
|
constructor(opts: CompilerOptions) {
|
||||||
this._contractDirs = opts.contractDirs;
|
this._contractsDir = opts.contractsDir;
|
||||||
this._networkId = opts.networkId;
|
this._networkId = opts.networkId;
|
||||||
this._optimizerEnabled = opts.optimizerEnabled;
|
this._optimizerEnabled = opts.optimizerEnabled;
|
||||||
this._artifactsDir = opts.artifactsDir;
|
this._artifactsDir = opts.artifactsDir;
|
||||||
this._specifiedContracts = opts.specifiedContracts;
|
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`.
|
* 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> {
|
public async compileAsync(): Promise<void> {
|
||||||
await createDirIfDoesNotExistAsync(this._artifactsDir);
|
await createDirIfDoesNotExistAsync(this._artifactsDir);
|
||||||
await createDirIfDoesNotExistAsync(SOLC_BIN_DIR);
|
await createDirIfDoesNotExistAsync(SOLC_BIN_DIR);
|
||||||
this._contractSources = {};
|
let contractNamesToCompile: string[] = [];
|
||||||
const contractIdToSourceFileId: ContractIdToSourceFileId = {};
|
if (this._specifiedContracts.has(ALL_CONTRACTS_IDENTIFIER)) {
|
||||||
const contractDirs = Array.from(this._contractDirs.values());
|
const allContracts = this._nameResolver.getAll();
|
||||||
for (const contractDir of contractDirs) {
|
contractNamesToCompile = _.map(allContracts, contractSource =>
|
||||||
const sources = await Compiler._getContractSourcesAsync(contractDir.path, contractDir.path);
|
path.basename(contractSource.path, constants.SOLIDITY_FILE_EXTENSION),
|
||||||
_.forIn(sources, (source, sourceFilePath) => {
|
);
|
||||||
const sourceFileId = constructUniqueSourceFileId(contractDir.namespace, sourceFilePath);
|
} else {
|
||||||
// Record the file's source and data
|
contractNamesToCompile = Array.from(this._specifiedContracts.values());
|
||||||
if (!_.isUndefined(this._contractSources[sourceFileId])) {
|
}
|
||||||
throw new Error(`Found duplicate source files with ID '${sourceFileId}'`);
|
for (const contractNameToCompile of contractNamesToCompile) {
|
||||||
}
|
await this._compileContractAsync(contractNameToCompile);
|
||||||
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;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
_.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.
|
* 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> {
|
private async _compileContractAsync(contractName: string): Promise<void> {
|
||||||
if (_.isUndefined(this._contractSources)) {
|
const contractSource = this._resolver.resolve(contractName);
|
||||||
throw new Error('Contract sources not yet initialized');
|
const currentArtifactIfExists = await getContractArtifactIfExistsAsync(this._artifactsDir, contractName);
|
||||||
}
|
const sourceTreeHashHex = `0x${this._getSourceTreeHash(contractSource.path).toString('hex')}`;
|
||||||
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')}`;
|
|
||||||
|
|
||||||
let shouldCompile = false;
|
let shouldCompile = false;
|
||||||
if (_.isUndefined(currentArtifactIfExists)) {
|
if (_.isUndefined(currentArtifactIfExists)) {
|
||||||
@@ -169,16 +111,14 @@ export class Compiler {
|
|||||||
const currentArtifact = currentArtifactIfExists as ContractArtifact;
|
const currentArtifact = currentArtifactIfExists as ContractArtifact;
|
||||||
shouldCompile =
|
shouldCompile =
|
||||||
currentArtifact.networks[this._networkId].optimizer_enabled !== this._optimizerEnabled ||
|
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) {
|
if (!shouldCompile) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const solcVersionRange = parseSolidityVersionRange(contractSource.source);
|
||||||
const availableCompilerVersions = _.keys(binPaths);
|
const availableCompilerVersions = _.keys(binPaths);
|
||||||
const solcVersion = semver.maxSatisfying(
|
const solcVersion = semver.maxSatisfying(availableCompilerVersions, solcVersionRange);
|
||||||
availableCompilerVersions,
|
|
||||||
contractSpecificSourceData.solcVersionRange,
|
|
||||||
);
|
|
||||||
const fullSolcVersion = binPaths[solcVersion];
|
const fullSolcVersion = binPaths[solcVersion];
|
||||||
const compilerBinFilename = path.join(SOLC_BIN_DIR, fullSolcVersion);
|
const compilerBinFilename = path.join(SOLC_BIN_DIR, fullSolcVersion);
|
||||||
let solcjs: string;
|
let solcjs: string;
|
||||||
@@ -197,57 +137,77 @@ export class Compiler {
|
|||||||
}
|
}
|
||||||
const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename));
|
const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename));
|
||||||
|
|
||||||
logUtils.log(`Compiling ${sourceFileId} with Solidity v${solcVersion}...`);
|
logUtils.log(`Compiling ${contractName} with Solidity v${solcVersion}...`);
|
||||||
const source = this._contractSources[sourceFileId];
|
const source = contractSource.source;
|
||||||
const input = {
|
const absoluteFilePath = contractSource.path;
|
||||||
[sourceFileId]: source,
|
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 sourcesToCompile = {
|
const compiled: solc.StandardOutput = JSON.parse(
|
||||||
sources: input,
|
solcInstance.compileStandardWrapper(JSON.stringify(standardInput), importPath => {
|
||||||
};
|
const sourceCodeIfExists = this._resolver.resolve(importPath);
|
||||||
|
return { contents: sourceCodeIfExists.source };
|
||||||
const compiled = solcInstance.compile(sourcesToCompile, Number(this._optimizerEnabled), importPath =>
|
}),
|
||||||
findImportIfExist(this._contractSources, sourceFileId, importPath),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!_.isUndefined(compiled.errors)) {
|
if (!_.isUndefined(compiled.errors)) {
|
||||||
const SOLIDITY_WARNING_PREFIX = 'Warning';
|
const SOLIDITY_WARNING = 'warning';
|
||||||
const isError = (errorOrWarning: string) => !errorOrWarning.includes(SOLIDITY_WARNING_PREFIX);
|
const errors = _.filter(compiled.errors, entry => entry.severity !== SOLIDITY_WARNING);
|
||||||
const isWarning = (errorOrWarning: string) => errorOrWarning.includes(SOLIDITY_WARNING_PREFIX);
|
const warnings = _.filter(compiled.errors, entry => entry.severity === SOLIDITY_WARNING);
|
||||||
const errors = _.filter(compiled.errors, isError);
|
|
||||||
const warnings = _.filter(compiled.errors, isWarning);
|
|
||||||
if (!_.isEmpty(errors)) {
|
if (!_.isEmpty(errors)) {
|
||||||
errors.forEach(errMsg => {
|
errors.forEach(error => {
|
||||||
const normalizedErrMsg = getNormalizedErrMsg(errMsg);
|
const normalizedErrMsg = getNormalizedErrMsg(error.formattedMessage || error.message);
|
||||||
logUtils.log(normalizedErrMsg);
|
logUtils.log(chalk.red(normalizedErrMsg));
|
||||||
});
|
});
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
} else {
|
} else {
|
||||||
warnings.forEach(errMsg => {
|
warnings.forEach(warning => {
|
||||||
const normalizedErrMsg = getNormalizedErrMsg(errMsg);
|
const normalizedWarningMsg = getNormalizedErrMsg(warning.formattedMessage || warning.message);
|
||||||
logUtils.log(normalizedErrMsg);
|
logUtils.log(chalk.yellow(normalizedWarningMsg));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const contractName = path.basename(sourceFileId, constants.SOLIDITY_FILE_EXTENSION);
|
const compiledData = compiled.contracts[absoluteFilePath][contractName];
|
||||||
const contractIdentifier = `${sourceFileId}:${contractName}`;
|
if (_.isUndefined(compiledData)) {
|
||||||
if (_.isUndefined(compiled.contracts[contractIdentifier])) {
|
|
||||||
throw new Error(
|
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 abi: ContractAbi = compiledData.abi;
|
||||||
const bytecode = `0x${compiled.contracts[contractIdentifier].bytecode}`;
|
const bytecode = `0x${compiledData.evm.bytecode.object}`;
|
||||||
const runtimeBytecode = `0x${compiled.contracts[contractIdentifier].runtimeBytecode}`;
|
const runtimeBytecode = `0x${compiledData.evm.deployedBytecode.object}`;
|
||||||
const sourceMap = compiled.contracts[contractIdentifier].srcmap;
|
const sourceMap = compiledData.evm.bytecode.sourceMap;
|
||||||
const sourceMapRuntime = compiled.contracts[contractIdentifier].srcmapRuntime;
|
const sourceMapRuntime = compiledData.evm.deployedBytecode.sourceMap;
|
||||||
const sources = _.keys(compiled.sources);
|
const unresolvedSourcePaths = _.keys(compiled.sources);
|
||||||
|
const sources = _.map(
|
||||||
|
unresolvedSourcePaths,
|
||||||
|
unresolvedSourcePath => this._resolver.resolve(unresolvedSourcePath).path,
|
||||||
|
);
|
||||||
const updated_at = Date.now();
|
const updated_at = Date.now();
|
||||||
|
|
||||||
const contractNetworkData: ContractNetworkData = {
|
const contractNetworkData: ContractNetworkData = {
|
||||||
solc_version: solcVersion,
|
solc_version: solcVersion,
|
||||||
keccak256: sourceHash,
|
source_tree_hash: sourceTreeHashHex,
|
||||||
source_tree_hash: sourceTreeHash,
|
|
||||||
optimizer_enabled: this._optimizerEnabled,
|
optimizer_enabled: this._optimizerEnabled,
|
||||||
abi,
|
abi,
|
||||||
bytecode,
|
bytecode,
|
||||||
@@ -280,44 +240,22 @@ export class Compiler {
|
|||||||
const artifactString = utils.stringifyWithFormatting(newArtifact);
|
const artifactString = utils.stringifyWithFormatting(newArtifact);
|
||||||
const currentArtifactPath = `${this._artifactsDir}/${contractName}.json`;
|
const currentArtifactPath = `${this._artifactsDir}/${contractName}.json`;
|
||||||
await fsWrapper.writeFileAsync(currentArtifactPath, artifactString);
|
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.
|
* Gets the source tree hash for a file and its dependencies.
|
||||||
* @param fileName Name of contract file.
|
* @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) {
|
if (dependencies.length === 0) {
|
||||||
return sourceHash;
|
return sourceHash;
|
||||||
} else {
|
} else {
|
||||||
const dependencySourceTreeHashes = _.map(dependencies, dependency => {
|
const dependencySourceTreeHashes = _.map(dependencies, (dependency: string) =>
|
||||||
const source = this._contractSources[dependency];
|
this._getSourceTreeHash(dependency),
|
||||||
this._setContractSpecificSourceData(source, dependency);
|
);
|
||||||
const sourceData = this._contractSourceDataByFileId[dependency];
|
|
||||||
return this._getSourceTreeHash(dependency, sourceData.sourceHash, sourceData.dependencies);
|
|
||||||
});
|
|
||||||
const sourceTreeHashesBuffer = Buffer.concat([sourceHash, ...dependencySourceTreeHashes]);
|
const sourceTreeHashesBuffer = Buffer.concat([sourceHash, ...dependencySourceTreeHashes]);
|
||||||
const sourceTreeHash = ethUtil.sha3(sourceTreeHashesBuffer);
|
const sourceTreeHash = ethUtil.sha3(sourceTreeHashesBuffer);
|
||||||
return sourceTreeHash;
|
return sourceTreeHash;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { AbiType, ContractAbi, MethodAbi } from '@0xproject/types';
|
import { ContractSource, ContractSources } from '@0xproject/sol-resolver';
|
||||||
import { logUtils } from '@0xproject/utils';
|
import { logUtils } from '@0xproject/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
@@ -6,60 +6,19 @@ import * as solc from 'solc';
|
|||||||
|
|
||||||
import { constants } from './constants';
|
import { constants } from './constants';
|
||||||
import { fsWrapper } from './fs_wrapper';
|
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.
|
* Gets contract data on network or returns if an artifact does not exist.
|
||||||
* @param artifactsDir Path to the artifacts directory.
|
* @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.
|
* @return Contract data on network or undefined.
|
||||||
*/
|
*/
|
||||||
export async function getContractArtifactIfExistsAsync(
|
export async function getContractArtifactIfExistsAsync(
|
||||||
artifactsDir: string,
|
artifactsDir: string,
|
||||||
fileName: string,
|
contractName: string,
|
||||||
): Promise<ContractArtifact | void> {
|
): Promise<ContractArtifact | void> {
|
||||||
let contractArtifact;
|
let contractArtifact;
|
||||||
const contractName = path.basename(fileName, constants.SOLIDITY_FILE_EXTENSION);
|
|
||||||
const currentArtifactPath = `${artifactsDir}/${contractName}.json`;
|
const currentArtifactPath = `${artifactsDir}/${contractName}.json`;
|
||||||
try {
|
try {
|
||||||
const opts = {
|
const opts = {
|
||||||
@@ -69,7 +28,7 @@ export async function getContractArtifactIfExistsAsync(
|
|||||||
contractArtifact = JSON.parse(contractArtifactString);
|
contractArtifact = JSON.parse(contractArtifactString);
|
||||||
return contractArtifact;
|
return contractArtifact;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logUtils.log(`Artifact for ${fileName} does not exist`);
|
logUtils.log(`Artifact for ${contractName} does not exist`);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,11 +82,11 @@ export function getNormalizedErrMsg(errMsg: string): string {
|
|||||||
/**
|
/**
|
||||||
* Parses the contract source code and extracts the dendencies
|
* Parses the contract source code and extracts the dendencies
|
||||||
* @param source Contract source code
|
* @param source Contract source code
|
||||||
* @param sourceFilePath File path of the source code.
|
|
||||||
* @return List of dependendencies
|
* @return List of dependendencies
|
||||||
*/
|
*/
|
||||||
export function parseDependencies(source: string, sourceFileId: string): string[] {
|
export function parseDependencies(contractSource: ContractSource): string[] {
|
||||||
// TODO: Use a proper parser
|
// TODO: Use a proper parser
|
||||||
|
const source = contractSource.source;
|
||||||
const IMPORT_REGEX = /(import\s)/;
|
const IMPORT_REGEX = /(import\s)/;
|
||||||
const DEPENDENCY_PATH_REGEX = /"([^"]+)"/; // Source: https://github.com/BlockChainCompany/soljitsu/blob/master/lib/shared.js
|
const DEPENDENCY_PATH_REGEX = /"([^"]+)"/; // Source: https://github.com/BlockChainCompany/soljitsu/blob/master/lib/shared.js
|
||||||
const dependencies: string[] = [];
|
const dependencies: string[] = [];
|
||||||
@@ -136,35 +95,13 @@ export function parseDependencies(source: string, sourceFileId: string): string[
|
|||||||
if (!_.isNull(line.match(IMPORT_REGEX))) {
|
if (!_.isNull(line.match(IMPORT_REGEX))) {
|
||||||
const dependencyMatch = line.match(DEPENDENCY_PATH_REGEX);
|
const dependencyMatch = line.match(DEPENDENCY_PATH_REGEX);
|
||||||
if (!_.isNull(dependencyMatch)) {
|
if (!_.isNull(dependencyMatch)) {
|
||||||
const dependencyPath = dependencyMatch[1];
|
let dependencyPath = dependencyMatch[1];
|
||||||
const dependencyId = constructDependencyFileId(dependencyPath, sourceFileId);
|
if (dependencyPath.startsWith('.')) {
|
||||||
dependencies.push(dependencyId);
|
dependencyPath = path.join(path.dirname(contractSource.path), dependencyPath);
|
||||||
|
}
|
||||||
|
dependencies.push(dependencyPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return dependencies;
|
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;
|
|
||||||
}
|
|
||||||
|
@@ -18,15 +18,9 @@ export interface ContractNetworks {
|
|||||||
[key: number]: ContractNetworkData;
|
[key: number]: ContractNetworkData;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ContractDirectory {
|
|
||||||
path: string;
|
|
||||||
namespace: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ContractNetworkData {
|
export interface ContractNetworkData {
|
||||||
solc_version: string;
|
solc_version: string;
|
||||||
optimizer_enabled: boolean;
|
optimizer_enabled: boolean;
|
||||||
keccak256: string;
|
|
||||||
source_tree_hash: string;
|
source_tree_hash: string;
|
||||||
abi: ContractAbi;
|
abi: ContractAbi;
|
||||||
bytecode: string;
|
bytecode: string;
|
||||||
@@ -45,7 +39,7 @@ export interface SolcErrors {
|
|||||||
|
|
||||||
export interface CliOptions extends yargs.Arguments {
|
export interface CliOptions extends yargs.Arguments {
|
||||||
artifactsDir: string;
|
artifactsDir: string;
|
||||||
contractDirs: string;
|
contractsDir: string;
|
||||||
jsonrpcUrl: string;
|
jsonrpcUrl: string;
|
||||||
networkId: number;
|
networkId: number;
|
||||||
shouldOptimize: boolean;
|
shouldOptimize: boolean;
|
||||||
@@ -56,7 +50,7 @@ export interface CliOptions extends yargs.Arguments {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface CompilerOptions {
|
export interface CompilerOptions {
|
||||||
contractDirs: Set<ContractDirectory>;
|
contractsDir: string;
|
||||||
networkId: number;
|
networkId: number;
|
||||||
optimizerEnabled: boolean;
|
optimizerEnabled: boolean;
|
||||||
artifactsDir: string;
|
artifactsDir: string;
|
||||||
@@ -79,20 +73,11 @@ export interface UrlDeployerOptions extends BaseDeployerOptions {
|
|||||||
|
|
||||||
export type DeployerOptions = UrlDeployerOptions | ProviderDeployerOptions;
|
export type DeployerOptions = UrlDeployerOptions | ProviderDeployerOptions;
|
||||||
|
|
||||||
export interface ContractSources {
|
export interface ContractSourceData {
|
||||||
[key: string]: string;
|
[contractName: string]: ContractSpecificSourceData;
|
||||||
}
|
|
||||||
|
|
||||||
export interface ContractIdToSourceFileId {
|
|
||||||
[key: string]: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ContractSourceDataByFileId {
|
|
||||||
[key: string]: ContractSpecificSourceData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ContractSpecificSourceData {
|
export interface ContractSpecificSourceData {
|
||||||
dependencies: string[];
|
|
||||||
solcVersionRange: string;
|
solcVersionRange: string;
|
||||||
sourceHash: Buffer;
|
sourceHash: Buffer;
|
||||||
sourceTreeHash: Buffer;
|
sourceTreeHash: Buffer;
|
||||||
@@ -107,8 +92,4 @@ export interface Token {
|
|||||||
swarmHash: string;
|
swarmHash: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FunctionNameToSeenCount {
|
|
||||||
[key: string]: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type DoneCallback = (err?: Error) => void;
|
export type DoneCallback = (err?: Error) => void;
|
||||||
|
@@ -3,13 +3,7 @@ import 'mocha';
|
|||||||
|
|
||||||
import { Compiler } from '../src/compiler';
|
import { Compiler } from '../src/compiler';
|
||||||
import { fsWrapper } from '../src/utils/fs_wrapper';
|
import { fsWrapper } from '../src/utils/fs_wrapper';
|
||||||
import {
|
import { CompilerOptions, ContractArtifact, ContractNetworkData, DoneCallback } from '../src/utils/types';
|
||||||
CompilerOptions,
|
|
||||||
ContractArtifact,
|
|
||||||
ContractDirectory,
|
|
||||||
ContractNetworkData,
|
|
||||||
DoneCallback,
|
|
||||||
} from '../src/utils/types';
|
|
||||||
|
|
||||||
import { exchange_binary } from './fixtures/exchange_bin';
|
import { exchange_binary } from './fixtures/exchange_bin';
|
||||||
import { constants } from './util/constants';
|
import { constants } from './util/constants';
|
||||||
@@ -19,15 +13,11 @@ const expect = chai.expect;
|
|||||||
describe('#Compiler', function() {
|
describe('#Compiler', function() {
|
||||||
this.timeout(constants.timeoutMs);
|
this.timeout(constants.timeoutMs);
|
||||||
const artifactsDir = `${__dirname}/fixtures/artifacts`;
|
const artifactsDir = `${__dirname}/fixtures/artifacts`;
|
||||||
const mainContractDir: ContractDirectory = { path: `${__dirname}/fixtures/contracts/main`, namespace: 'main' };
|
const contractsDir = `${__dirname}/fixtures/contracts`;
|
||||||
const baseContractDir: ContractDirectory = { path: `${__dirname}/fixtures/contracts/base`, namespace: 'base' };
|
|
||||||
const contractDirs: Set<ContractDirectory> = new Set();
|
|
||||||
contractDirs.add(mainContractDir);
|
|
||||||
contractDirs.add(baseContractDir);
|
|
||||||
const exchangeArtifactPath = `${artifactsDir}/Exchange.json`;
|
const exchangeArtifactPath = `${artifactsDir}/Exchange.json`;
|
||||||
const compilerOpts: CompilerOptions = {
|
const compilerOpts: CompilerOptions = {
|
||||||
artifactsDir,
|
artifactsDir,
|
||||||
contractDirs,
|
contractsDir,
|
||||||
networkId: constants.networkId,
|
networkId: constants.networkId,
|
||||||
optimizerEnabled: constants.optimizerEnabled,
|
optimizerEnabled: constants.optimizerEnabled,
|
||||||
specifiedContracts: new Set(constants.specifiedContracts),
|
specifiedContracts: new Set(constants.specifiedContracts),
|
||||||
|
@@ -47,34 +47,31 @@ describe('Compiler utils', () => {
|
|||||||
});
|
});
|
||||||
describe('#parseDependencies', () => {
|
describe('#parseDependencies', () => {
|
||||||
it('correctly parses Exchange dependencies', async () => {
|
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',
|
encoding: 'utf8',
|
||||||
});
|
});
|
||||||
const sourceFileId = '/main/Exchange.sol';
|
expect(parseDependencies({ source, path })).to.be.deep.equal([
|
||||||
expect(parseDependencies(exchangeSource, sourceFileId)).to.be.deep.equal([
|
'zeppelin-solidity/contracts/token/ERC20/ERC20.sol',
|
||||||
'/main/TokenTransferProxy.sol',
|
'/home/circleci/repo/packages/deployer/lib/test/fixtures/contracts/TokenTransferProxy.sol',
|
||||||
'/base/Token.sol',
|
'/home/circleci/repo/packages/deployer/lib/test/fixtures/contracts/base/SafeMath.sol',
|
||||||
'/base/SafeMath.sol',
|
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
it('correctly parses TokenTransferProxy dependencies', async () => {
|
it('correctly parses TokenTransferProxy dependencies', async () => {
|
||||||
const exchangeSource = await fsWrapper.readFileAsync(
|
const path = `${__dirname}/fixtures/contracts/TokenTransferProxy.sol`;
|
||||||
`${__dirname}/fixtures/contracts/main/TokenTransferProxy.sol`,
|
const source = await fsWrapper.readFileAsync(path, {
|
||||||
{
|
encoding: 'utf8',
|
||||||
encoding: 'utf8',
|
});
|
||||||
},
|
expect(parseDependencies({ source, path })).to.be.deep.equal([
|
||||||
);
|
'zeppelin-solidity/contracts/ownership/Ownable.sol',
|
||||||
const sourceFileId = '/main/TokenTransferProxy.sol';
|
'zeppelin-solidity/contracts/token/ERC20/ERC20.sol',
|
||||||
expect(parseDependencies(exchangeSource, sourceFileId)).to.be.deep.equal([
|
|
||||||
'/base/Token.sol',
|
|
||||||
'/base/Ownable.sol',
|
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
// TODO: For now that doesn't work. This will work after we switch to a grammar-based parser
|
// 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 () => {
|
it.skip('correctly parses commented out dependencies', async () => {
|
||||||
const contractWithCommentedOutDependencies = `// import "./TokenTransferProxy.sol";`;
|
const path = '';
|
||||||
const sourceFileId = '/main/TokenTransferProxy.sol';
|
const source = `// import "./TokenTransferProxy.sol";`;
|
||||||
expect(parseDependencies(contractWithCommentedOutDependencies, sourceFileId)).to.be.deep.equal([]);
|
expect(parseDependencies({ path, source })).to.be.deep.equal([]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -4,13 +4,7 @@ import 'mocha';
|
|||||||
import { Compiler } from '../src/compiler';
|
import { Compiler } from '../src/compiler';
|
||||||
import { Deployer } from '../src/deployer';
|
import { Deployer } from '../src/deployer';
|
||||||
import { fsWrapper } from '../src/utils/fs_wrapper';
|
import { fsWrapper } from '../src/utils/fs_wrapper';
|
||||||
import {
|
import { CompilerOptions, ContractArtifact, ContractNetworkData, DoneCallback } from '../src/utils/types';
|
||||||
CompilerOptions,
|
|
||||||
ContractArtifact,
|
|
||||||
ContractDirectory,
|
|
||||||
ContractNetworkData,
|
|
||||||
DoneCallback,
|
|
||||||
} from '../src/utils/types';
|
|
||||||
|
|
||||||
import { constructor_args, exchange_binary } from './fixtures/exchange_bin';
|
import { constructor_args, exchange_binary } from './fixtures/exchange_bin';
|
||||||
import { constants } from './util/constants';
|
import { constants } from './util/constants';
|
||||||
@@ -20,15 +14,11 @@ const expect = chai.expect;
|
|||||||
|
|
||||||
describe('#Deployer', () => {
|
describe('#Deployer', () => {
|
||||||
const artifactsDir = `${__dirname}/fixtures/artifacts`;
|
const artifactsDir = `${__dirname}/fixtures/artifacts`;
|
||||||
|
const contractsDir = `${__dirname}/fixtures/contracts`;
|
||||||
const exchangeArtifactPath = `${artifactsDir}/Exchange.json`;
|
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 = {
|
const compilerOpts: CompilerOptions = {
|
||||||
artifactsDir,
|
artifactsDir,
|
||||||
contractDirs,
|
contractsDir,
|
||||||
networkId: constants.networkId,
|
networkId: constants.networkId,
|
||||||
optimizerEnabled: constants.optimizerEnabled,
|
optimizerEnabled: constants.optimizerEnabled,
|
||||||
specifiedContracts: new Set(constants.specifiedContracts),
|
specifiedContracts: new Set(constants.specifiedContracts),
|
||||||
|
@@ -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 "./TokenTransferProxy.sol";
|
||||||
import "/base/Token.sol";
|
import "./base/SafeMath.sol";
|
||||||
import "/base/SafeMath.sol";
|
|
||||||
|
|
||||||
/// @title Exchange - Facilitates exchange of ERC20 tokens.
|
/// @title Exchange - Facilitates exchange of ERC20 tokens.
|
||||||
/// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com>
|
/// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com>
|
@@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pragma solidity 0.4.14;
|
pragma solidity ^0.4.14;
|
||||||
|
|
||||||
import "/base/Token.sol";
|
import { Ownable } from "zeppelin-solidity/contracts/ownership/Ownable.sol";
|
||||||
import "/base/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.
|
/// @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>
|
/// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com>
|
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,4 +1,4 @@
|
|||||||
pragma solidity 0.4.14;
|
pragma solidity ^0.4.14;
|
||||||
|
|
||||||
contract SafeMath {
|
contract SafeMath {
|
||||||
function safeMul(uint a, uint b) internal constant returns (uint256) {
|
function safeMul(uint a, uint b) internal constant returns (uint256) {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
pragma solidity 0.4.14;
|
pragma solidity ^0.4.14;
|
||||||
|
|
||||||
contract Token {
|
contract Token {
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@@ -13,8 +13,8 @@ export const coverage = {
|
|||||||
return coverageSubprovider;
|
return coverageSubprovider;
|
||||||
},
|
},
|
||||||
_getCoverageSubprovider(): CoverageSubprovider {
|
_getCoverageSubprovider(): CoverageSubprovider {
|
||||||
const artifactsPath = './src/artifacts';
|
const artifactsPath = '../migrations/src/artifacts';
|
||||||
const contractsPath = './src/contracts';
|
const contractsPath = 'src/contracts';
|
||||||
const networkId = 50;
|
const networkId = 50;
|
||||||
const defaultFromAddress = constants.TESTRPC_FIRST_ADDRESS;
|
const defaultFromAddress = constants.TESTRPC_FIRST_ADDRESS;
|
||||||
return new CoverageSubprovider(artifactsPath, contractsPath, networkId, defaultFromAddress);
|
return new CoverageSubprovider(artifactsPath, contractsPath, networkId, defaultFromAddress);
|
||||||
|
@@ -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"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -7,7 +7,7 @@
|
|||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"lint": "tslint --project .",
|
"lint": "tslint --project .",
|
||||||
"clean": "shx rm -rf lib",
|
"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",
|
"copy_artifacts": "copyfiles './artifacts/**/*' './contracts/**/*' ./lib",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"test": "run-s build run_mocha",
|
"test": "run-s build run_mocha",
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||||
"coverage:report:lcov": "istanbul report lcov",
|
"coverage:report:lcov": "istanbul report lcov",
|
||||||
"test:circleci": "yarn test:coverage",
|
"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": "",
|
"author": "",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
@@ -7,13 +7,14 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"lint": "tslint --project . 'src/**/*.ts'",
|
"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",
|
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||||
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
||||||
"test:circleci": "yarn test:coverage",
|
"test:circleci": "yarn test:coverage",
|
||||||
"run_mocha": "mocha lib/test/**/*_test.js --exit",
|
"run_mocha": "mocha lib/test/**/*_test.js --exit",
|
||||||
"clean": "shx rm -rf lib scripts",
|
"clean": "shx rm -rf lib scripts",
|
||||||
"build": "copyfiles 'test/fixtures/**/*' ./lib && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./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",
|
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
|
||||||
"docs:stage": "yarn build && node ./scripts/stage_docs.js",
|
"docs:stage": "yarn build && node ./scripts/stage_docs.js",
|
||||||
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
|
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
|
||||||
@@ -53,6 +54,7 @@
|
|||||||
"solidity-parser-antlr": "^0.2.8"
|
"solidity-parser-antlr": "^0.2.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@0xproject/deployer": "^0.3.5",
|
||||||
"@0xproject/monorepo-scripts": "^0.1.17",
|
"@0xproject/monorepo-scripts": "^0.1.17",
|
||||||
"@0xproject/tslint-config": "^0.4.15",
|
"@0xproject/tslint-config": "^0.4.15",
|
||||||
"@types/istanbul": "^0.4.29",
|
"@types/istanbul": "^0.4.29",
|
||||||
|
@@ -6,30 +6,18 @@ import * as path from 'path';
|
|||||||
import { ContractData } from './types';
|
import { ContractData } from './types';
|
||||||
|
|
||||||
export const collectContractsData = (artifactsPath: string, sourcesPath: string, networkId: number) => {
|
export const collectContractsData = (artifactsPath: string, sourcesPath: string, networkId: number) => {
|
||||||
const sourcesGlob = `${sourcesPath}/**/*.sol`;
|
const artifactsGlob = `${artifactsPath}/**/*.json`;
|
||||||
const sourceFileNames = glob.sync(sourcesGlob, { absolute: true });
|
const artifactFileNames = glob.sync(artifactsGlob, { absolute: true });
|
||||||
const contractsDataIfExists: Array<ContractData | {}> = _.map(sourceFileNames, sourceFileName => {
|
const contractsDataIfExists: Array<ContractData | {}> = _.map(artifactFileNames, artifactFileName => {
|
||||||
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 artifact = JSON.parse(fs.readFileSync(artifactFileName).toString());
|
const artifact = JSON.parse(fs.readFileSync(artifactFileName).toString());
|
||||||
const sources = _.map(artifact.networks[networkId].sources, source => {
|
const sources = artifact.networks[networkId].sources;
|
||||||
const includedFileName = glob.sync(`${sourcesPath}/**/${source}`, { absolute: true })[0];
|
const contractName = artifact.contract_name;
|
||||||
return includedFileName;
|
// We don't compute coverage for dependencies
|
||||||
});
|
const sourceCodes = _.map(sources, (source: string) => fs.readFileSync(source).toString());
|
||||||
const sourceCodes = _.map(sources, source => {
|
|
||||||
const includedSourceCode = fs.readFileSync(source).toString();
|
|
||||||
return includedSourceCode;
|
|
||||||
});
|
|
||||||
if (_.isUndefined(artifact.networks[networkId])) {
|
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 = {
|
const contractData = {
|
||||||
baseName,
|
|
||||||
sourceCodes,
|
sourceCodes,
|
||||||
sources,
|
sources,
|
||||||
sourceMap: artifact.networks[networkId].source_map,
|
sourceMap: artifact.networks[networkId].source_map,
|
||||||
|
@@ -79,7 +79,6 @@ export interface ContractData {
|
|||||||
runtimeBytecode: string;
|
runtimeBytecode: string;
|
||||||
sourceMapRuntime: string;
|
sourceMapRuntime: string;
|
||||||
sourceCodes: string[];
|
sourceCodes: string[];
|
||||||
baseName: string;
|
|
||||||
sources: string[];
|
sources: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,7 +16,6 @@ describe('Collect contracts data', () => {
|
|||||||
const contractsData = collectContractsData(artifactsPath, sourcesPath, networkId);
|
const contractsData = collectContractsData(artifactsPath, sourcesPath, networkId);
|
||||||
_.forEach(contractsData, contractData => {
|
_.forEach(contractsData, contractData => {
|
||||||
expect(contractData).to.have.keys([
|
expect(contractData).to.have.keys([
|
||||||
'baseName',
|
|
||||||
'sourceCodes',
|
'sourceCodes',
|
||||||
'sources',
|
'sources',
|
||||||
'sourceMap',
|
'sourceMap',
|
||||||
|
@@ -39,13 +39,13 @@ describe('Collect coverage entries', () => {
|
|||||||
const coverageEntries = collectCoverageEntries(simpleStorageContract);
|
const coverageEntries = collectCoverageEntries(simpleStorageContract);
|
||||||
const fnIds = _.keys(coverageEntries.fnMap);
|
const fnIds = _.keys(coverageEntries.fnMap);
|
||||||
expect(coverageEntries.fnMap[fnIds[0]].name).to.be.equal('set');
|
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) {
|
const setFunction = `function set(uint x) {
|
||||||
storedData = x;
|
storedData = x;
|
||||||
}`;
|
}`;
|
||||||
expect(getRange(simpleStorageContract, coverageEntries.fnMap[fnIds[0]].loc)).to.be.equal(setFunction);
|
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]].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) {
|
const getFunction = `function get() constant returns (uint retVal) {
|
||||||
return storedData;
|
return storedData;
|
||||||
}`;
|
}`;
|
||||||
|
@@ -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"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -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"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,3 +1,5 @@
|
|||||||
|
pragma solidity ^0.4.21;
|
||||||
|
|
||||||
contract SimpleStorage {
|
contract SimpleStorage {
|
||||||
uint public storedData;
|
uint public storedData;
|
||||||
function set(uint x) {
|
function set(uint x) {
|
||||||
|
39
packages/sol-resolver/package.json
Normal file
39
packages/sol-resolver/package.json
Normal file
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
8
packages/sol-resolver/src/index.ts
Normal file
8
packages/sol-resolver/src/index.ts
Normal file
@@ -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';
|
@@ -0,0 +1,7 @@
|
|||||||
|
import { ContractSource } from '../types';
|
||||||
|
|
||||||
|
import { Resolver } from './resolver';
|
||||||
|
|
||||||
|
export abstract class EnumerableResolver extends Resolver {
|
||||||
|
public abstract getAll(): ContractSource[];
|
||||||
|
}
|
21
packages/sol-resolver/src/resolvers/fallthrough_resolver.ts
Normal file
21
packages/sol-resolver/src/resolvers/fallthrough_resolver.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
19
packages/sol-resolver/src/resolvers/fs_resolver.ts
Normal file
19
packages/sol-resolver/src/resolvers/fs_resolver.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
66
packages/sol-resolver/src/resolvers/name_resolver.ts
Normal file
66
packages/sol-resolver/src/resolvers/name_resolver.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
34
packages/sol-resolver/src/resolvers/npm_resolver.ts
Normal file
34
packages/sol-resolver/src/resolvers/npm_resolver.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
14
packages/sol-resolver/src/resolvers/resolver.ts
Normal file
14
packages/sol-resolver/src/resolvers/resolver.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
21
packages/sol-resolver/src/resolvers/url_resolver.ts
Normal file
21
packages/sol-resolver/src/resolvers/url_resolver.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
8
packages/sol-resolver/src/types.ts
Normal file
8
packages/sol-resolver/src/types.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
export interface ContractSource {
|
||||||
|
source: string;
|
||||||
|
path: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ContractSources {
|
||||||
|
[key: string]: ContractSource;
|
||||||
|
}
|
7
packages/sol-resolver/tsconfig.json
Normal file
7
packages/sol-resolver/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
|
"include": ["src/**/*"]
|
||||||
|
}
|
3
packages/sol-resolver/tslint.json
Normal file
3
packages/sol-resolver/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": ["@0xproject/tslint-config"]
|
||||||
|
}
|
@@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Add types for `solc.compileStandardWrapper`",
|
||||||
|
"pr": 509
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
116
packages/typescript-typings/types/solc/index.d.ts
vendored
116
packages/typescript-typings/types/solc/index.d.ts
vendored
@@ -26,12 +26,128 @@ declare module 'solc' {
|
|||||||
[fileName: string]: string;
|
[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 {
|
export interface SolcInstance {
|
||||||
compile(
|
compile(
|
||||||
sources: InputSources,
|
sources: InputSources,
|
||||||
optimizerEnabled: number,
|
optimizerEnabled: number,
|
||||||
findImports: (importPath: string) => ImportContents,
|
findImports: (importPath: string) => ImportContents,
|
||||||
): CompilationResult;
|
): CompilationResult;
|
||||||
|
compileStandardWrapper(input: string, findImports: (importPath: string) => ImportContents): string;
|
||||||
}
|
}
|
||||||
export function loadRemoteVersion(versionName: string, cb: (err: Error | null, res?: SolcInstance) => void): void;
|
export function loadRemoteVersion(versionName: string, cb: (err: Error | null, res?: SolcInstance) => void): void;
|
||||||
export function setupMethods(solcBin: any): SolcInstance;
|
export function setupMethods(solcBin: any): SolcInstance;
|
||||||
|
@@ -6,5 +6,4 @@ export { BigNumber } from './configured_bignumber';
|
|||||||
export { AbiDecoder } from './abi_decoder';
|
export { AbiDecoder } from './abi_decoder';
|
||||||
export { logUtils } from './log_utils';
|
export { logUtils } from './log_utils';
|
||||||
export { abiUtils } from './abi_utils';
|
export { abiUtils } from './abi_utils';
|
||||||
|
|
||||||
export { NULL_BYTES } from './constants';
|
export { NULL_BYTES } from './constants';
|
||||||
|
70
yarn.lock
70
yarn.lock
@@ -6,6 +6,25 @@
|
|||||||
version "0.3.9"
|
version "0.3.9"
|
||||||
resolved "https://registry.yarnpkg.com/8fold-marked/-/8fold-marked-0.3.9.tgz#bb89c645612f8ccfaffac1ca6e3c11f168c9cf59"
|
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":
|
"@0xproject/tslint-config@0.4.13":
|
||||||
version "0.4.13"
|
version "0.4.13"
|
||||||
resolved "https://registry.yarnpkg.com/@0xproject/tslint-config/-/tslint-config-0.4.13.tgz#98c71c5ae5e80315a23eda0134cc9f6f4438cac2"
|
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-eslint-rules "^4.1.1"
|
||||||
tslint-react "^3.2.0"
|
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":
|
"@ledgerhq/hw-app-eth@^4.3.0":
|
||||||
version "4.7.3"
|
version "4.7.3"
|
||||||
resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-eth/-/hw-app-eth-4.7.3.tgz#d352e19658ae296532e522c53c8ec2a1a77b64e5"
|
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"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/@types/bintrees/-/bintrees-1.0.2.tgz#0dfdce4eeebdf90427bd35b0e79dc248b3d157a6"
|
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":
|
"@types/body-parser@*", "@types/body-parser@^1.16.1":
|
||||||
version "1.16.8"
|
version "1.16.8"
|
||||||
resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.16.8.tgz#687ec34140624a3bec2b1a8ea9268478ae8f3be3"
|
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"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/bintrees/-/bintrees-1.0.2.tgz#49f896d6e858a4a499df85c38fb399b9aff840f8"
|
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"
|
version "2.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/bip39/-/bip39-2.5.0.tgz#51cbd5179460504a63ea3c000db3f787ca051235"
|
resolved "https://registry.yarnpkg.com/bip39/-/bip39-2.5.0.tgz#51cbd5179460504a63ea3c000db3f787ca051235"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -3185,6 +3234,10 @@ dot-prop@^4.1.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
is-obj "^1.0.0"
|
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:
|
drbg.js@^1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/drbg.js/-/drbg.js-1.0.1.tgz#3e36b6c42b37043823cdbc332d58f31e2445480b"
|
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"
|
js-sha3 "0.5.5"
|
||||||
number-to-bn "1.7.0"
|
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:
|
ethjs-unit@0.1.6:
|
||||||
version "0.1.6"
|
version "0.1.6"
|
||||||
resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699"
|
resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699"
|
||||||
@@ -11872,3 +11933,10 @@ yauzl@^2.4.2:
|
|||||||
dependencies:
|
dependencies:
|
||||||
buffer-crc32 "~0.2.3"
|
buffer-crc32 "~0.2.3"
|
||||||
fd-slicer "~1.0.1"
|
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"
|
||||||
|
Reference in New Issue
Block a user