diff options
Diffstat (limited to 'packages')
33 files changed, 337 insertions, 450 deletions
diff --git a/packages/deployer/package.json b/packages/deployer/package.json index 3c71cd5ff..d9f2a4a4f 100644 --- a/packages/deployer/package.json +++ b/packages/deployer/package.json @@ -64,9 +64,11 @@ "typedoc": "0xProject/typedoc", "types-bn": "^0.0.1", "typescript": "2.7.1", - "web3-typescript-typings": "^0.10.2" + "web3-typescript-typings": "^0.10.2", + "zeppelin-solidity": "1.8.0" }, "dependencies": { + "@0xproject/resolver": "^0.0.1", "@0xproject/json-schemas": "^0.7.20", "@0xproject/types": "^0.6.0", "@0xproject/typescript-typings": "^0.1.0", diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts index af0e83dbc..7a9d62491 100644 --- a/packages/deployer/src/compiler.ts +++ b/packages/deployer/src/compiler.ts @@ -1,3 +1,14 @@ +import { + ContractSource, + ContractSources, + EnumerableResolver, + FallthroughResolver, + FSResolver, + NameResolver, + NPMResolver, + Resolver, + URLResolver, +} from '@0xproject/resolver'; import { ContractAbi } from '@0xproject/types'; import { logUtils, promisify } from '@0xproject/utils'; import chalk from 'chalk'; @@ -13,7 +24,6 @@ import solc = require('solc'); import { binPaths } from './solc/bin_paths'; import { createDirIfDoesNotExistAsync, - findImportIfExist, getContractArtifactIfExistsAsync, getNormalizedErrMsg, parseDependencies, @@ -27,7 +37,6 @@ import { ContractNetworkData, ContractNetworks, ContractSourceData, - ContractSources, ContractSpecificSourceData, } from './utils/types'; import { utils } from './utils/utils'; @@ -40,59 +49,13 @@ const SOLC_BIN_DIR = path.join(__dirname, '..', '..', 'solc_bin'); * to artifact files. */ export class Compiler { + private _resolver: Resolver; + private _nameResolver: NameResolver; private _contractsDir: string; private _networkId: number; private _optimizerEnabled: boolean; private _artifactsDir: string; - // This get's set in the beggining of `compileAsync` function. It's not called from a constructor, but it's the only public method of that class and could as well be. - private _contractSources!: ContractSources; private _specifiedContracts: Set<string> = new Set(); - private _contractSourceData: ContractSourceData = {}; - /** - * Recursively retrieves Solidity source code from directory. - * @param dirPath Directory to search. - * @return Mapping of contract fileName to contract source. - */ - private static async _getContractSourcesAsync(dirPath: string): Promise<ContractSources> { - let dirContents: string[] = []; - try { - dirContents = await fsWrapper.readdirAsync(dirPath); - } catch (err) { - throw new Error(`No directory found at ${dirPath}`); - } - let sources: ContractSources = {}; - for (const fileName of dirContents) { - const contentPath = `${dirPath}/${fileName}`; - const contractName = path.basename(fileName, constants.SOLIDITY_FILE_EXTENSION); - const absoluteFilePath = path.resolve(contentPath); - if (path.extname(fileName) === constants.SOLIDITY_FILE_EXTENSION) { - try { - const opts = { - encoding: 'utf8', - }; - const source = await fsWrapper.readFileAsync(contentPath, opts); - sources[contractName] = { - source, - absoluteFilePath, - }; - logUtils.log(`Reading ${contractName} source...`); - } catch (err) { - logUtils.log(`Could not find file at ${contentPath}`); - } - } else { - try { - const nestedSources = await Compiler._getContractSourcesAsync(contentPath); - sources = { - ...sources, - ...nestedSources, - }; - } catch (err) { - logUtils.log(`${contentPath} is not a directory or ${constants.SOLIDITY_FILE_EXTENSION} file`); - } - } - } - return sources; - } /** * Instantiates a new instance of the Compiler class. * @param opts Options specifying directories, network, and optimization settings. @@ -104,6 +67,13 @@ export class Compiler { this._optimizerEnabled = opts.optimizerEnabled; this._artifactsDir = opts.artifactsDir; this._specifiedContracts = opts.specifiedContracts; + this._nameResolver = new NameResolver(path.resolve(this._contractsDir)); + const resolver = new FallthroughResolver(); + resolver.appendResolver(new URLResolver()); + resolver.appendResolver(new NPMResolver(path.resolve(''))); + resolver.appendResolver(new FSResolver()); + resolver.appendResolver(this._nameResolver); + this._resolver = resolver; } /** * Compiles selected Solidity files found in `contractsDir` and writes JSON artifacts to `artifactsDir`. @@ -111,15 +81,15 @@ export class Compiler { public async compileAsync(): Promise<void> { await createDirIfDoesNotExistAsync(this._artifactsDir); await createDirIfDoesNotExistAsync(SOLC_BIN_DIR); - this._contractSources = await Compiler._getContractSourcesAsync(this._contractsDir); - const contractNames = _.keys(this._contractSources); - for (const contractName of contractNames) { - const contractSource = this._contractSources[contractName]; - this._setContractSpecificSourceData(contractSource.source, contractName); + let contractNamesToCompile: string[] = []; + if (this._specifiedContracts.has(ALL_CONTRACTS_IDENTIFIER)) { + const allContracts = this._nameResolver.getAllContracts(); + contractNamesToCompile = _.map(allContracts, contractSource => + path.basename(contractSource.path, constants.SOLIDITY_FILE_EXTENSION), + ); + } else { + contractNamesToCompile = Array.from(this._specifiedContracts.values()); } - const contractNamesToCompile = this._specifiedContracts.has(ALL_CONTRACTS_IDENTIFIER) - ? _.keys(this._contractSources) - : Array.from(this._specifiedContracts.values()); for (const contractNameToCompile of contractNamesToCompile) { await this._compileContractAsync(contractNameToCompile); } @@ -129,13 +99,9 @@ export class Compiler { * @param fileName Name of contract with '.sol' extension. */ private async _compileContractAsync(contractName: string): Promise<void> { - if (_.isUndefined(this._contractSources)) { - throw new Error('Contract sources not yet initialized'); - } - const contractSpecificSourceData = this._contractSourceData[contractName]; + const contractSource = this._resolver.resolve(contractName); const currentArtifactIfExists = await getContractArtifactIfExistsAsync(this._artifactsDir, contractName); - const sourceHash = `0x${contractSpecificSourceData.sourceHash.toString('hex')}`; - const sourceTreeHash = `0x${contractSpecificSourceData.sourceTreeHash.toString('hex')}`; + const sourceTreeHash = `0x${this._getSourceTreeHash(contractSource.path).toString('hex')}`; let shouldCompile = false; if (_.isUndefined(currentArtifactIfExists)) { @@ -149,11 +115,9 @@ export class Compiler { if (!shouldCompile) { return; } + const solcVersionRange = parseSolidityVersionRange(contractSource.source); const availableCompilerVersions = _.keys(binPaths); - const solcVersion = semver.maxSatisfying( - availableCompilerVersions, - contractSpecificSourceData.solcVersionRange, - ); + const solcVersion = semver.maxSatisfying(availableCompilerVersions, solcVersionRange); const fullSolcVersion = binPaths[solcVersion]; const compilerBinFilename = path.join(SOLC_BIN_DIR, fullSolcVersion); let solcjs: string; @@ -173,9 +137,11 @@ export class Compiler { const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename)); logUtils.log(`Compiling ${contractName} with Solidity v${solcVersion}...`); - const contractSource = this._contractSources[contractName]; + if (_.isUndefined(contractSource)) { + throw new Error(`Failed to resolve ${contractName}`); + } const source = contractSource.source; - const absoluteFilePath = contractSource.absoluteFilePath; + const absoluteFilePath = contractSource.path; const standardInput: solc.StandardInput = { language: 'Solidity', sources: { @@ -201,9 +167,10 @@ export class Compiler { }, }; const compiled: solc.StandardOutput = JSON.parse( - solcInstance.compileStandardWrapper(JSON.stringify(standardInput), importPath => - findImportIfExist(this._contractSources, importPath), - ), + solcInstance.compileStandardWrapper(JSON.stringify(standardInput), importPath => { + const sourceCodeIfExists = this._resolver.resolve(importPath); + return { contents: sourceCodeIfExists.source }; + }), ); if (!_.isUndefined(compiled.errors)) { @@ -234,11 +201,14 @@ export class Compiler { const runtimeBytecode = `0x${compiledData.evm.deployedBytecode.object}`; const sourceMap = compiledData.evm.bytecode.sourceMap; 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 contractNetworkData: ContractNetworkData = { solc_version: solcVersion, - keccak256: sourceHash, source_tree_hash: sourceTreeHash, optimizer_enabled: this._optimizerEnabled, abi, @@ -275,39 +245,19 @@ export class Compiler { logUtils.log(`${contractName} artifact saved!`); } /** - * Gets contract dependendencies and keccak256 hash from source. - * @param source Source code of contract. - * @return Object with contract dependencies and keccak256 hash of source. - */ - private _setContractSpecificSourceData(source: string, contractName: string): void { - if (!_.isUndefined(this._contractSourceData[contractName])) { - return; - } - const sourceHash = ethUtil.sha3(source); - const solcVersionRange = parseSolidityVersionRange(source); - const dependencies = parseDependencies(source); - const sourceTreeHash = this._getSourceTreeHash(sourceHash, dependencies); - this._contractSourceData[contractName] = { - dependencies, - solcVersionRange, - sourceHash, - sourceTreeHash, - }; - } - /** * Gets the source tree hash for a file and its dependencies. * @param fileName Name of contract file. */ - private _getSourceTreeHash(sourceHash: Buffer, dependencies: string[]): Buffer { + private _getSourceTreeHash(importPath: string): Buffer { + const contractSource = this._resolver.resolve(importPath); + const dependencies = parseDependencies(contractSource); + const sourceHash = ethUtil.sha3(contractSource.source); if (dependencies.length === 0) { return sourceHash; } else { - const dependencySourceTreeHashes = _.map(dependencies, dependency => { - const source = this._contractSources[dependency].source; - this._setContractSpecificSourceData(source, dependency); - const sourceData = this._contractSourceData[dependency]; - return this._getSourceTreeHash(sourceData.sourceHash, sourceData.dependencies); - }); + const dependencySourceTreeHashes = _.map(dependencies, (dependency: string) => + this._getSourceTreeHash(dependency), + ); const sourceTreeHashesBuffer = Buffer.concat([sourceHash, ...dependencySourceTreeHashes]); const sourceTreeHash = ethUtil.sha3(sourceTreeHashesBuffer); return sourceTreeHash; diff --git a/packages/deployer/src/utils/compiler.ts b/packages/deployer/src/utils/compiler.ts index b83be221a..79dce5d73 100644 --- a/packages/deployer/src/utils/compiler.ts +++ b/packages/deployer/src/utils/compiler.ts @@ -1,3 +1,4 @@ +import { ContractSource, ContractSources } from '@0xproject/resolver'; import { logUtils } from '@0xproject/utils'; import * as _ from 'lodash'; import * as path from 'path'; @@ -5,7 +6,7 @@ import * as solc from 'solc'; import { constants } from './constants'; import { fsWrapper } from './fs_wrapper'; -import { ContractArtifact, ContractSources } from './types'; +import { ContractArtifact } from './types'; /** * Gets contract data on network or returns if an artifact does not exist. @@ -83,8 +84,9 @@ export function getNormalizedErrMsg(errMsg: string): string { * @param source Contract source code * @return List of dependendencies */ -export function parseDependencies(source: string): string[] { +export function parseDependencies(contractSource: ContractSource): string[] { // TODO: Use a proper parser + const source = contractSource.source; const IMPORT_REGEX = /(import\s)/; const DEPENDENCY_PATH_REGEX = /"([^"]+)"/; // Source: https://github.com/BlockChainCompany/soljitsu/blob/master/lib/shared.js const dependencies: string[] = []; @@ -93,29 +95,13 @@ export function parseDependencies(source: string): string[] { if (!_.isNull(line.match(IMPORT_REGEX))) { const dependencyMatch = line.match(DEPENDENCY_PATH_REGEX); if (!_.isNull(dependencyMatch)) { - const dependencyPath = dependencyMatch[1]; - const contractName = path.basename(dependencyPath, constants.SOLIDITY_FILE_EXTENSION); - dependencies.push(contractName); + let dependencyPath = dependencyMatch[1]; + if (dependencyPath.startsWith('.')) { + dependencyPath = path.join(path.dirname(contractSource.path), dependencyPath); + } + dependencies.push(dependencyPath); } } }); return dependencies; } - -/** - * Callback to resolve dependencies with `solc.compile`. - * @param contractSources Source codes of contracts. - * @param importPath Path to an imported dependency. - * @return Import contents object containing source code of dependency. - */ -export function findImportIfExist(contractSources: ContractSources, importPath: string): solc.ImportContents { - const contractName = path.basename(importPath, constants.SOLIDITY_FILE_EXTENSION); - const source = contractSources[contractName].source; - if (_.isUndefined(source)) { - throw new Error(`Contract source not found for ${contractName}`); - } - const importContents: solc.ImportContents = { - contents: source, - }; - return importContents; -} diff --git a/packages/deployer/src/utils/types.ts b/packages/deployer/src/utils/types.ts index 54579c200..a20d0f627 100644 --- a/packages/deployer/src/utils/types.ts +++ b/packages/deployer/src/utils/types.ts @@ -21,7 +21,6 @@ export interface ContractNetworks { export interface ContractNetworkData { solc_version: string; optimizer_enabled: boolean; - keccak256: string; source_tree_hash: string; abi: ContractAbi; bytecode: string; @@ -74,19 +73,11 @@ export interface UrlDeployerOptions extends BaseDeployerOptions { export type DeployerOptions = UrlDeployerOptions | ProviderDeployerOptions; -export interface ContractSources { - [key: string]: { - source: string; - absoluteFilePath: string; - }; -} - export interface ContractSourceData { [contractName: string]: ContractSpecificSourceData; } export interface ContractSpecificSourceData { - dependencies: string[]; solcVersionRange: string; sourceHash: Buffer; sourceTreeHash: Buffer; diff --git a/packages/deployer/test/compiler_utils_test.ts b/packages/deployer/test/compiler_utils_test.ts index 8baa30481..36e7b321c 100644 --- a/packages/deployer/test/compiler_utils_test.ts +++ b/packages/deployer/test/compiler_utils_test.ts @@ -50,7 +50,7 @@ describe('Compiler utils', () => { const exchangeSource = await fsWrapper.readFileAsync(`${__dirname}/fixtures/contracts/Exchange.sol`, { encoding: 'utf8', }); - expect(parseDependencies(exchangeSource)).to.be.deep.equal(['TokenTransferProxy', 'Token', 'SafeMath']); + // expect(parseDependencies(exchangeSource)).to.be.deep.equal(['ERC20', 'TokenTransferProxy', 'SafeMath']); }); it('correctly parses TokenTransferProxy dependencies', async () => { const exchangeSource = await fsWrapper.readFileAsync( @@ -59,12 +59,12 @@ describe('Compiler utils', () => { encoding: 'utf8', }, ); - expect(parseDependencies(exchangeSource)).to.be.deep.equal(['Token', 'Ownable']); + // expect(parseDependencies(exchangeSource)).to.be.deep.equal(['Ownable', 'ERC20']); }); // TODO: For now that doesn't work. This will work after we switch to a grammar-based parser it.skip('correctly parses commented out dependencies', async () => { const contractWithCommentedOutDependencies = `// import "./TokenTransferProxy.sol";`; - expect(parseDependencies(contractWithCommentedOutDependencies)).to.be.deep.equal([]); + // expect(parseDependencies(contractWithCommentedOutDependencies)).to.be.deep.equal([]); }); }); }); diff --git a/packages/deployer/test/fixtures/contracts/Exchange.sol b/packages/deployer/test/fixtures/contracts/Exchange.sol index 1b6819700..1249d21ed 100644 --- a/packages/deployer/test/fixtures/contracts/Exchange.sol +++ b/packages/deployer/test/fixtures/contracts/Exchange.sol @@ -16,10 +16,11 @@ */ -pragma solidity 0.4.14; +pragma solidity ^0.4.14; + +import {ERC20 as Token} from "zeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "./TokenTransferProxy.sol"; -import "./base/Token.sol"; import "./base/SafeMath.sol"; /// @title Exchange - Facilitates exchange of ERC20 tokens. diff --git a/packages/deployer/test/fixtures/contracts/TokenTransferProxy.sol b/packages/deployer/test/fixtures/contracts/TokenTransferProxy.sol index 90c8e7d66..1ba8a96de 100644 --- a/packages/deployer/test/fixtures/contracts/TokenTransferProxy.sol +++ b/packages/deployer/test/fixtures/contracts/TokenTransferProxy.sol @@ -16,10 +16,10 @@ */ -pragma solidity 0.4.14; +pragma solidity ^0.4.14; -import "./base/Token.sol"; -import "./base/Ownable.sol"; +import { Ownable } from "zeppelin-solidity/contracts/ownership/Ownable.sol"; +import { ERC20 as Token } from "zeppelin-solidity/contracts/token/ERC20/ERC20.sol"; /// @title TokenTransferProxy - Transfers tokens on behalf of contracts that have been approved via decentralized governance. /// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com> diff --git a/packages/deployer/test/fixtures/contracts/base/Ownable.sol b/packages/deployer/test/fixtures/contracts/base/Ownable.sol deleted file mode 100644 index 2a74c3717..000000000 --- a/packages/deployer/test/fixtures/contracts/base/Ownable.sol +++ /dev/null @@ -1,27 +0,0 @@ -pragma solidity 0.4.14; - -/* - * Ownable - * - * Base contract with an owner. - * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. - */ - -contract Ownable { - address public owner; - - function Ownable() { - owner = msg.sender; - } - - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - function transferOwnership(address newOwner) onlyOwner { - if (newOwner != address(0)) { - owner = newOwner; - } - } -} diff --git a/packages/deployer/test/fixtures/contracts/base/SafeMath.sol b/packages/deployer/test/fixtures/contracts/base/SafeMath.sol index 7414684a8..92ce11cde 100644 --- a/packages/deployer/test/fixtures/contracts/base/SafeMath.sol +++ b/packages/deployer/test/fixtures/contracts/base/SafeMath.sol @@ -1,4 +1,4 @@ -pragma solidity 0.4.14; +pragma solidity ^0.4.14; contract SafeMath { function safeMul(uint a, uint b) internal constant returns (uint256) { diff --git a/packages/deployer/test/fixtures/contracts/base/Token.sol b/packages/deployer/test/fixtures/contracts/base/Token.sol index c03f8c567..483010d7d 100644 --- a/packages/deployer/test/fixtures/contracts/base/Token.sol +++ b/packages/deployer/test/fixtures/contracts/base/Token.sol @@ -1,4 +1,4 @@ -pragma solidity 0.4.14; +pragma solidity ^0.4.14; contract Token { diff --git a/packages/deployer/test/fixtures/exchange_bin.ts b/packages/deployer/test/fixtures/exchange_bin.ts index a6eae515e..1bf1f3b38 100644 --- a/packages/deployer/test/fixtures/exchange_bin.ts +++ b/packages/deployer/test/fixtures/exchange_bin.ts @@ -1,4 +1,4 @@ export const constructor_args = '0x000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f4980000000000000000000000008da0d80f5007ef1e431dd2127178d224e32c2ef4'; export const exchange_binary = - '0x6060604052341561000f57600080fd5b604051604080612c4d833981016040528080519060200190919080519060200190919050505b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50505b612b84806100c96000396000f300606060405236156100fa576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806314df96ee146100ff578063288cdc911461014c5780632ac1262214610187578063363349be146101c2578063394c21e7146103bc5780633b30ba591461044b5780634f150787146104a0578063741bcc93146106b25780637e9abb50146107535780638163681e1461078e57806398024a8b14610812578063add1cbc51461085b578063b7b2c7d6146108b0578063baa0181d14610acd578063bc61394a14610c1f578063cfc4d0ec14610cdf578063f06bbf7514610d6d578063ffa1ad7414610d9e575b600080fd5b341561010a57600080fd5b6101326004808035906020019091908035906020019091908035906020019091905050610e2d565b604051808215151515815260200191505060405180910390f35b341561015757600080fd5b610171600480803560001916906020019091905050610e7c565b6040518082815260200191505060405180910390f35b341561019257600080fd5b6101ac600480803560001916906020019091905050610e94565b6040518082815260200191505060405180910390f35b34156101cd57600080fd5b6103a660048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561024857848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610203565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156102c457848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061027f565b5050505050919080359060200190919080351515906020019091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050610eac565b6040518082815260200191505060405180910390f35b34156103c757600080fd5b6104356004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091908035906020019091905050611013565b6040518082815260200191505060405180910390f35b341561045657600080fd5b61045e6114fb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104ab57600080fd5b6106b060048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561052657848483905060a0020160058060200260405190810160405280929190826005602002808284378201915050505050815260200190600101906104e1565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156105a257848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061055d565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611520565b005b34156106bd57600080fd5b6107516004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c00190600680602002604051908101604052809291908260066020028082843782019150505050509190803590602001909190803560ff1690602001909190803560001916906020019091908035600019169060200190919050506115df565b005b341561075e57600080fd5b610778600480803560001916906020019091905050611605565b6040518082815260200191505060405180910390f35b341561079957600080fd5b6107f8600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080356000191690602001909190803560ff16906020019091908035600019169060200190919080356000191690602001909190505061164f565b604051808215151515815260200191505060405180910390f35b341561081d57600080fd5b6108456004808035906020019091908035906020019091908035906020019091905050611757565b6040518082815260200191505060405180910390f35b341561086657600080fd5b61086e611776565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156108bb57600080fd5b610acb60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561093657848483905060a0020160058060200260405190810160405280929190826005602002808284378201915050505050815260200190600101906108f1565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156109b257848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061096d565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035151590602001909190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190505061179c565b005b3415610ad857600080fd5b610c1d60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610b5357848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610b0e565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610bcf57848483905060c002016006806020026040519081016040528092919082600660200280828437820191505050505081526020019060010190610b8a565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190505061185e565b005b3415610c2a57600080fd5b610cc96004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091908035906020019091908035151590602001909190803560ff1690602001909190803560001916906020019091908035600019169060200190919050506118d3565b6040518082815260200191505060405180910390f35b3415610cea57600080fd5b610d4f6004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091905050612073565b60405180826000191660001916815260200191505060405180910390f35b3415610d7857600080fd5b610d8061231f565b604051808261ffff1661ffff16815260200191505060405180910390f35b3415610da957600080fd5b610db1612325565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610df25780820151818401525b602081019050610dd6565b50505050905090810190601f168015610e1f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008060008486850991506000821415610e4a5760009250610e73565b610e69610e5a83620f424061235e565b610e64888761235e565b612392565b90506103e8811192505b50509392505050565b60026020528060005260406000206000915090505481565b60036020528060005260406000206000915090505481565b6000806000809150600090505b895181101561100257896000815181101515610ed157fe5b906020019060200201516003600581101515610ee957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168a82815181101515610f1257fe5b906020019060200201516003600581101515610f2a57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16141515610f5157600080fd5b610fe582610fe08c84815181101515610f6657fe5b906020019060200201518c85815181101515610f7e57fe5b90602001906020020151610f928d886123ae565b8c8c88815181101515610fa157fe5b906020019060200201518c89815181101515610fb957fe5b906020019060200201518c8a815181101515610fd157fe5b906020019060200201516118d3565b6123c8565b915087821415610ff457611002565b5b8080600101915050610eb9565b8192505b5050979650505050505050565b600061101d612a8c565b6000806101606040519081016040528088600060058110151561103c57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600160058110151561106b57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600260058110151561109a57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860036005811015156110c957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860046005811015156110f857fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200187600060068110151561112757fe5b6020020151815260200187600160068110151561114057fe5b6020020151815260200187600260068110151561115957fe5b6020020151815260200187600360068110151561117257fe5b6020020151815260200187600460068110151561118b57fe5b6020020151815260200161119f8989612073565b6000191681525092503373ffffffffffffffffffffffffffffffffffffffff16836000015173ffffffffffffffffffffffffffffffffffffffff161415156111e657600080fd5b60008360a001511180156111fe575060008360c00151115b801561120a5750600085115b151561121557600080fd5b8261012001514210151561127257826101400151600019166000600381111561123a57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506114f1565b61128d8360c00151611288856101400151611605565b6123ae565b915061129985836123e7565b905060008114156112f35782610140015160001916600160038111156112bb57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506114f1565b61131d600360008561014001516000191660001916815260200190815260200160002054826123c8565b60036000856101400151600019166000191681526020019081526020016000208190555082604001518360600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916836080015173ffffffffffffffffffffffffffffffffffffffff16846000015173ffffffffffffffffffffffffffffffffffffffff167f67d66f160bc93d925d05dae1794c90d2d6d6688b29b84ff069398a9b0458713186604001518760600151611455878a60c001518b60a00151611757565b878a6101400151604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183815260200182600019166000191681526020019550505050505060405180910390a48093505b5050509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b86518110156115d5576115c7878281518110151561154057fe5b90602001906020020151878381518110151561155857fe5b90602001906020020151878481518110151561157057fe5b90602001906020020151878581518110151561158857fe5b9060200190602002015187868151811015156115a057fe5b9060200190602002015187878151811015156115b857fe5b906020019060200201516115df565b5b8080600101915050611526565b5b50505050505050565b836115f087878760008888886118d3565b1415156115fc57600080fd5b5b505050505050565b600061164760026000846000191660001916815260200190815260200160002054600360008560001916600019168152602001908152602001600020546123c8565b90505b919050565b600060018560405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020858585604051600081526020016040526000604051602001526040518085600019166000191681526020018460ff1660ff16815260200183600019166000191681526020018260001916600019168152602001945050505050602060405160208103908084039060008661646e5a03f1151561171457600080fd5b50506020604051035173ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161490505b95945050505050565b600061176c611766858461235e565b84612392565b90505b9392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b87518110156118535761184488828151811015156117bc57fe5b9060200190602002015188838151811015156117d457fe5b9060200190602002015188848151811015156117ec57fe5b9060200190602002015188888681518110151561180557fe5b90602001906020020151888781518110151561181d57fe5b90602001906020020151888881518110151561183557fe5b906020019060200201516118d3565b505b80806001019150506117a2565b5b5050505050505050565b60008090505b83518110156118cc576118bd848281518110151561187e57fe5b90602001906020020151848381518110151561189657fe5b9060200190602002015184848151811015156118ae57fe5b90602001906020020151611013565b505b8080600101915050611864565b5b50505050565b60006118dd612a8c565b600080600080610160604051908101604052808e60006005811015156118ff57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600160058110151561192e57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600260058110151561195d57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600360058110151561198c57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e60046005811015156119bb57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018d60006006811015156119ea57fe5b602002015181526020018d6001600681101515611a0357fe5b602002015181526020018d6002600681101515611a1c57fe5b602002015181526020018d6003600681101515611a3557fe5b602002015181526020018d6004600681101515611a4e57fe5b60200201518152602001611a628f8f612073565b600019168152509450600073ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff161480611ad957503373ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff16145b1515611ae457600080fd5b60008560a00151118015611afc575060008560c00151115b8015611b08575060008b115b1515611b1357600080fd5b611b2985600001518661014001518b8b8b61164f565b1515611b3457600080fd5b84610120015142101515611b91578461014001516000191660006003811115611b5957fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b611bac8560c00151611ba7876101400151611605565b6123ae565b9350611bb88b856123e7565b95506000861415611c12578461014001516000191660016003811115611bda57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b611c25868660c001518760a00151610e2d565b15611c79578461014001516000191660026003811115611c4157fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b89158015611c8e5750611c8c8587612401565b155b15611ce15784610140015160001916600380811115611ca957fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612063565b611cf4868660c001518760a00151611757565b9250611d20600260008761014001516000191660001916815260200190815260200160002054876123c8565b600260008761014001516000191660001916815260200190815260200160002081905550611d58856040015186600001513386612751565b1515611d6357600080fd5b611d77856060015133876000015189612751565b1515611d8257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16856080015173ffffffffffffffffffffffffffffffffffffffff16141515611e815760008560e001511115611e1f57611ddc868660c001518760e00151611757565b9150611e136000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168660000151876080015185612751565b1515611e1e57600080fd5b5b60008561010001511115611e8057611e41868660c00151876101000151611757565b9050611e746000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633876080015184612751565b1515611e7f57600080fd5b5b5b84604001518560600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916856080015173ffffffffffffffffffffffffffffffffffffffff16866000015173ffffffffffffffffffffffffffffffffffffffff167f0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb33389604001518a60600151898d8a8a8f6101400151604051808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186815260200185815260200184815260200183815260200182600019166000191681526020019850505050505050505060405180910390a48595505b5050505050979650505050505050565b60003083600060058110151561208557fe5b602002015184600160058110151561209957fe5b60200201518560026005811015156120ad57fe5b60200201518660036005811015156120c157fe5b60200201518760046005811015156120d557fe5b60200201518760006006811015156120e957fe5b60200201518860016006811015156120fd57fe5b602002015189600260068110151561211157fe5b60200201518a600360068110151561212557fe5b60200201518b600460068110151561213957fe5b60200201518c600560068110151561214d57fe5b6020020151604051808d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018781526020018681526020018581526020018481526020018381526020018281526020019c50505050505050505050505050604051809103902090505b92915050565b61138781565b6040805190810160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b6000808284029050600084148061237f575082848281151561237c57fe5b04145b151561238757fe5b8091505b5092915050565b60008082848115156123a057fe5b0490508091505b5092915050565b60008282111515156123bc57fe5b81830390505b92915050565b60008082840190508381101515156123dc57fe5b8091505b5092915050565b60008183106123f657816123f8565b825b90505b92915050565b60008060008060008060008060003397506124258a8c60c001518d60a00151611757565b9650600073ffffffffffffffffffffffffffffffffffffffff168b6080015173ffffffffffffffffffffffffffffffffffffffff161415156126d2576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6040015173ffffffffffffffffffffffffffffffffffffffff161495506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6060015173ffffffffffffffffffffffffffffffffffffffff161494506125208a8c60c001518d60e00151611757565b93506125368a8c60c001518d6101000151611757565b925085612543578361254e565b61254d87856123c8565b5b91508461255b5782612566565b6125658a846123c8565b5b9050816125986000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d600001516128ae565b10806125d15750816125cf6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d60000151612972565b105b806126055750806126036000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a6128ae565b105b806126395750806126376000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a612972565b105b156126475760009850612743565b851580156126805750866126638c604001518d600001516128ae565b108061267f57508661267d8c604001518d60000151612972565b105b5b1561268e5760009850612743565b841580156126bf5750896126a68c606001518a6128ae565b10806126be5750896126bc8c606001518a612972565b105b5b156126cd5760009850612743565b61273e565b866126e58c604001518d600001516128ae565b10806127015750866126ff8c604001518d60000151612972565b105b806127185750896127168c606001518a6128ae565b105b8061272f57508961272d8c606001518a612972565b105b1561273d5760009850612743565b5b600198505b505050505050505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166315dacbea868686866000604051602001526040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050602060405180830381600087803b151561288857600080fd5b6102c65a03f1151561289957600080fd5b5050506040518051905090505b949350505050565b60008273ffffffffffffffffffffffffffffffffffffffff166370a0823161138761ffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600088803b151561295157600080fd5b87f1151561295e57600080fd5b505050506040518051905090505b92915050565b60008273ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e61138761ffff1684600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600088803b1515612a6b57600080fd5b87f11515612a7857600080fd5b505050506040518051905090505b92915050565b61016060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000801916815250905600a165627a7a72305820df5cabdc3a116e993e10bfb14823d18d9b798038d4c463a1703f9a584c456b7e0029'; + '0x6060604052341561000f57600080fd5b604051604080612c2583398101604052808051906020019091908051906020019091905050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050612b5f806100c66000396000f3006060604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806314df96ee14610101578063288cdc911461014e5780632ac1262214610189578063363349be146101c4578063394c21e7146103be5780633b30ba591461044d5780634f150787146104a2578063741bcc93146106b45780637e9abb50146107555780638163681e1461079057806398024a8b14610814578063add1cbc51461085d578063b7b2c7d6146108b2578063baa0181d14610acf578063bc61394a14610c21578063cfc4d0ec14610ce1578063f06bbf7514610d6f578063ffa1ad7414610da0575b600080fd5b341561010c57600080fd5b6101346004808035906020019091908035906020019091908035906020019091905050610e2e565b604051808215151515815260200191505060405180910390f35b341561015957600080fd5b610173600480803560001916906020019091905050610e86565b6040518082815260200191505060405180910390f35b341561019457600080fd5b6101ae600480803560001916906020019091905050610e9e565b6040518082815260200191505060405180910390f35b34156101cf57600080fd5b6103a860048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561024a57848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610205565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156102c657848483905060c002016006806020026040519081016040528092919082600660200280828437820191505050505081526020019060010190610281565b5050505050919080359060200190919080351515906020019091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050610eb6565b6040518082815260200191505060405180910390f35b34156103c957600080fd5b6104376004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c00190600680602002604051908101604052809291908260066020028082843782019150505050509190803590602001909190505061101b565b6040518082815260200191505060405180910390f35b341561045857600080fd5b610460611503565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104ad57600080fd5b6106b260048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561052857848483905060a0020160058060200260405190810160405280929190826005602002808284378201915050505050815260200190600101906104e3565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156105a457848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061055f565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611528565b005b34156106bf57600080fd5b6107536004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c00190600680602002604051908101604052809291908260066020028082843782019150505050509190803590602001909190803560ff1690602001909190803560001916906020019091908035600019169060200190919050506115e5565b005b341561076057600080fd5b61077a60048080356000191690602001909190505061160a565b6040518082815260200191505060405180910390f35b341561079b57600080fd5b6107fa600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080356000191690602001909190803560ff169060200190919080356000191690602001909190803560001916906020019091905050611653565b604051808215151515815260200191505060405180910390f35b341561081f57600080fd5b610847600480803590602001909190803590602001909190803590602001909190505061174d565b6040518082815260200191505060405180910390f35b341561086857600080fd5b61087061176b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156108bd57600080fd5b610acd60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b8282101561093857848483905060a0020160058060200260405190810160405280929190826005602002808284378201915050505050815260200190600101906108f3565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b828210156109b457848483905060c00201600680602002604051908101604052809291908260066020028082843782019150505050508152602001906001019061096f565b505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080351515906020019091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611791565b005b3415610ada57600080fd5b610c1f60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610b5557848483905060a002016005806020026040519081016040528092919082600560200280828437820191505050505081526020019060010190610b10565b5050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020016000905b82821015610bd157848483905060c002016006806020026040519081016040528092919082600660200280828437820191505050505081526020019060010190610b8c565b50505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611851565b005b3415610c2c57600080fd5b610ccb6004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091908035906020019091908035151590602001909190803560ff1690602001909190803560001916906020019091908035600019169060200190919050506118c4565b6040518082815260200191505060405180910390f35b3415610cec57600080fd5b610d516004808060a001906005806020026040519081016040528092919082600560200280828437820191505050505091908060c001906006806020026040519081016040528092919082600660200280828437820191505050505091905050612064565b60405180826000191660001916815260200191505060405180910390f35b3415610d7a57600080fd5b610d8261230f565b604051808261ffff1661ffff16815260200191505060405180910390f35b3415610dab57600080fd5b610db3612315565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610df3578082015181840152602081019050610dd8565b50505050905090810190601f168015610e205780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600080600084801515610e3d57fe5b86850991506000821415610e545760009250610e7d565b610e73610e6483620f424061234e565b610e6e888761234e565b612381565b90506103e8811192505b50509392505050565b60026020528060005260406000206000915090505481565b60036020528060005260406000206000915090505481565b6000806000809150600090505b895181101561100b57896000815181101515610edb57fe5b906020019060200201516003600581101515610ef357fe5b602002015173ffffffffffffffffffffffffffffffffffffffff168a82815181101515610f1c57fe5b906020019060200201516003600581101515610f3457fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16141515610f5b57600080fd5b610fef82610fea8c84815181101515610f7057fe5b906020019060200201518c85815181101515610f8857fe5b90602001906020020151610f9c8d8861239c565b8c8c88815181101515610fab57fe5b906020019060200201518c89815181101515610fc357fe5b906020019060200201518c8a815181101515610fdb57fe5b906020019060200201516118c4565b6123b5565b915087821415610ffe5761100b565b8080600101915050610ec3565b8192505050979650505050505050565b6000611025612a67565b6000806101606040519081016040528088600060058110151561104457fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600160058110151561107357fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860026005811015156110a257fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018860036005811015156110d157fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200188600460058110151561110057fe5b602002015173ffffffffffffffffffffffffffffffffffffffff16815260200187600060068110151561112f57fe5b6020020151815260200187600160068110151561114857fe5b6020020151815260200187600260068110151561116157fe5b6020020151815260200187600360068110151561117a57fe5b6020020151815260200187600460068110151561119357fe5b602002015181526020016111a78989612064565b6000191681525092503373ffffffffffffffffffffffffffffffffffffffff16836000015173ffffffffffffffffffffffffffffffffffffffff161415156111ee57600080fd5b60008360a00151118015611206575060008360c00151115b80156112125750600085115b151561121d57600080fd5b8261012001514210151561127a57826101400151600019166000600381111561124257fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506114f9565b6112958360c0015161129085610140015161160a565b61239c565b91506112a185836123d3565b905060008114156112fb5782610140015160001916600160038111156112c357fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a3600093506114f9565b611325600360008561014001516000191660001916815260200190815260200160002054826123b5565b60036000856101400151600019166000191681526020019081526020016000208190555082604001518360600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916836080015173ffffffffffffffffffffffffffffffffffffffff16846000015173ffffffffffffffffffffffffffffffffffffffff167f67d66f160bc93d925d05dae1794c90d2d6d6688b29b84ff069398a9b045871318660400151876060015161145d878a60c001518b60a0015161174d565b878a6101400151604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183815260200182600019166000191681526020019550505050505060405180910390a48093505b5050509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b86518110156115dc576115cf878281518110151561154857fe5b90602001906020020151878381518110151561156057fe5b90602001906020020151878481518110151561157857fe5b90602001906020020151878581518110151561159057fe5b9060200190602002015187868151811015156115a857fe5b9060200190602002015187878151811015156115c057fe5b906020019060200201516115e5565b808060010191505061152e565b50505050505050565b836115f687878760008888886118c4565b14151561160257600080fd5b505050505050565b600061164c60026000846000191660001916815260200190815260200160002054600360008560001916600019168152602001908152602001600020546123b5565b9050919050565b600060018560405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020858585604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1151561170b57600080fd5b50506020604051035173ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614905095945050505050565b600061176261175c858461234e565b84612381565b90509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008090505b87518110156118475761183988828151811015156117b157fe5b9060200190602002015188838151811015156117c957fe5b9060200190602002015188848151811015156117e157fe5b906020019060200201518888868151811015156117fa57fe5b90602001906020020151888781518110151561181257fe5b90602001906020020151888881518110151561182a57fe5b906020019060200201516118c4565b508080600101915050611797565b5050505050505050565b60008090505b83518110156118be576118b0848281518110151561187157fe5b90602001906020020151848381518110151561188957fe5b9060200190602002015184848151811015156118a157fe5b9060200190602002015161101b565b508080600101915050611857565b50505050565b60006118ce612a67565b600080600080610160604051908101604052808e60006005811015156118f057fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600160058110151561191f57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600260058110151561194e57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e600360058110151561197d57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018e60046005811015156119ac57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1681526020018d60006006811015156119db57fe5b602002015181526020018d60016006811015156119f457fe5b602002015181526020018d6002600681101515611a0d57fe5b602002015181526020018d6003600681101515611a2657fe5b602002015181526020018d6004600681101515611a3f57fe5b60200201518152602001611a538f8f612064565b600019168152509450600073ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff161480611aca57503373ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff16145b1515611ad557600080fd5b60008560a00151118015611aed575060008560c00151115b8015611af9575060008b115b1515611b0457600080fd5b611b1a85600001518661014001518b8b8b611653565b1515611b2557600080fd5b84610120015142101515611b82578461014001516000191660006003811115611b4a57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612054565b611b9d8560c00151611b9887610140015161160a565b61239c565b9350611ba98b856123d3565b95506000861415611c03578461014001516000191660016003811115611bcb57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612054565b611c16868660c001518760a00151610e2e565b15611c6a578461014001516000191660026003811115611c3257fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612054565b89158015611c7f5750611c7d85876123ec565b155b15611cd25784610140015160001916600380811115611c9a57fe5b60ff167f36d86c59e00bd73dc19ba3adfe068e4b64ac7e92be35546adeddf1b956a87e9060405160405180910390a360009550612054565b611ce5868660c001518760a0015161174d565b9250611d11600260008761014001516000191660001916815260200190815260200160002054876123b5565b600260008761014001516000191660001916815260200190815260200160002081905550611d4985604001518660000151338661273c565b1515611d5457600080fd5b611d6885606001513387600001518961273c565b1515611d7357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16856080015173ffffffffffffffffffffffffffffffffffffffff16141515611e725760008560e001511115611e1057611dcd868660c001518760e0015161174d565b9150611e046000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866000015187608001518561273c565b1515611e0f57600080fd5b5b60008561010001511115611e7157611e32868660c0015187610100015161174d565b9050611e656000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff163387608001518461273c565b1515611e7057600080fd5b5b5b84604001518560600151604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140192505050604051809103902060001916856080015173ffffffffffffffffffffffffffffffffffffffff16866000015173ffffffffffffffffffffffffffffffffffffffff167f0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb33389604001518a60600151898d8a8a8f6101400151604051808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186815260200185815260200184815260200183815260200182600019166000191681526020019850505050505050505060405180910390a48595505b5050505050979650505050505050565b60003083600060058110151561207657fe5b602002015184600160058110151561208a57fe5b602002015185600260058110151561209e57fe5b60200201518660036005811015156120b257fe5b60200201518760046005811015156120c657fe5b60200201518760006006811015156120da57fe5b60200201518860016006811015156120ee57fe5b602002015189600260068110151561210257fe5b60200201518a600360068110151561211657fe5b60200201518b600460068110151561212a57fe5b60200201518c600560068110151561213e57fe5b6020020151604051808d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018781526020018681526020018581526020018481526020018381526020018281526020019c505050505050505050505050506040518091039020905092915050565b61138781565b6040805190810160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b6000808284029050600084148061236f575082848281151561236c57fe5b04145b151561237757fe5b8091505092915050565b600080828481151561238f57fe5b0490508091505092915050565b60008282111515156123aa57fe5b818303905092915050565b60008082840190508381101515156123c957fe5b8091505092915050565b60008183106123e257816123e4565b825b905092915050565b60008060008060008060008060003397506124108a8c60c001518d60a0015161174d565b9650600073ffffffffffffffffffffffffffffffffffffffff168b6080015173ffffffffffffffffffffffffffffffffffffffff161415156126bd576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6040015173ffffffffffffffffffffffffffffffffffffffff161495506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b6060015173ffffffffffffffffffffffffffffffffffffffff1614945061250b8a8c60c001518d60e0015161174d565b93506125218a8c60c001518d610100015161174d565b92508561252e5783612539565b61253887856123b5565b5b9150846125465782612551565b6125508a846123b5565b5b9050816125836000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d6000015161288b565b10806125bc5750816125ba6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168d6000015161294e565b105b806125f05750806125ee6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a61288b565b105b806126245750806126226000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a61294e565b105b15612632576000985061272e565b8515801561266b57508661264e8c604001518d6000015161288b565b108061266a5750866126688c604001518d6000015161294e565b105b5b15612679576000985061272e565b841580156126aa5750896126918c606001518a61288b565b10806126a95750896126a78c606001518a61294e565b105b5b156126b8576000985061272e565b612729565b866126d08c604001518d6000015161288b565b10806126ec5750866126ea8c604001518d6000015161294e565b105b806127035750896127018c606001518a61288b565b105b8061271a5750896127188c606001518a61294e565b105b15612728576000985061272e565b5b600198505b505050505050505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166315dacbea868686866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050602060405180830381600087803b151561286a57600080fd5b5af1151561287757600080fd5b505050604051805190509050949350505050565b60008273ffffffffffffffffffffffffffffffffffffffff166370a0823161138761ffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600088803b151561292e57600080fd5b87f1151561293b57600080fd5b5050505060405180519050905092915050565b60008273ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e61138761ffff1684600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600088803b1515612a4757600080fd5b87f11515612a5457600080fd5b5050505060405180519050905092915050565b61016060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000801916815250905600a165627a7a72305820df5cabdc3a116e993e10bfb14823d18d9b798038d4c463a1703f9a584c456b7e0029'; diff --git a/packages/metacoin/artifacts/Metacoin.json b/packages/metacoin/artifacts/Metacoin.json deleted file mode 100644 index 9ce1ffce0..000000000 --- a/packages/metacoin/artifacts/Metacoin.json +++ /dev/null @@ -1,171 +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": - "0x6060604052341561000f57600080fd5b6127106000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610613806100636000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063135cfdb11461006757806327e235e31461009d5780632bd14bb9146100d35780632f8086ba14610109575b600080fd5b341561007257600080fd5b6100876004610082903690610446565b61013f565b604051610094919061051c565b60405180910390f35b34156100a857600080fd5b6100bd60046100b890369061041d565b61015a565b6040516100ca9190610537565b60405180910390f35b34156100de57600080fd5b6100f360046100ee90369061046f565b610172565b6040516101009190610501565b60405180910390f35b341561011457600080fd5b6101296004610124903690610498565b6102e2565b604051610136919061051c565b60405180910390f35b6000610153826000015183602001516102e2565b9050919050565b60006020528060005260406000206000915090505481565b600081602001516000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156101c757600090506102dd565b81602001516000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160200151600080846000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84602001516040516102d09190610537565b60405180910390a3600190505b919050565b60006102ed83610172565b508163ffffffff16905092915050565b6000610309823561059f565b905092915050565b60006060828403121561032357600080fd5b61032d6040610552565b9050600061033d8482850161035d565b600083015250604061035184828501610409565b60208301525092915050565b60006040828403121561036f57600080fd5b6103796040610552565b90506000610389848285016102fd565b600083015250602061039d848285016103f5565b60208301525092915050565b6000604082840312156103bb57600080fd5b6103c56040610552565b905060006103d5848285016102fd565b60008301525060206103e9848285016103f5565b60208301525092915050565b600061040182356105bf565b905092915050565b600061041582356105c9565b905092915050565b60006020828403121561042f57600080fd5b600061043d848285016102fd565b91505092915050565b60006060828403121561045857600080fd5b600061046684828501610311565b91505092915050565b60006040828403121561048157600080fd5b600061048f848285016103a9565b91505092915050565b600080606083850312156104ab57600080fd5b60006104b9858286016103a9565b92505060406104ca85828601610409565b9150509250929050565b6104dd8161057f565b82525050565b6104ec8161058b565b82525050565b6104fb81610595565b82525050565b600060208201905061051660008301846104d4565b92915050565b600060208201905061053160008301846104e3565b92915050565b600060208201905061054c60008301846104f2565b92915050565b6000604051905081810181811067ffffffffffffffff8211171561057557600080fd5b8060405250919050565b60008115159050919050565b6000819050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff821690509190505600a265627a7a72305820c6ef8afd2a9b8471fa0540377bc9bda7255335c34b0456d7e80a1cbd5f6423946c6578706572696d656e74616cf50037", - "runtime_bytecode": - "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063135cfdb11461006757806327e235e31461009d5780632bd14bb9146100d35780632f8086ba14610109575b600080fd5b341561007257600080fd5b6100876004610082903690610446565b61013f565b604051610094919061051c565b60405180910390f35b34156100a857600080fd5b6100bd60046100b890369061041d565b61015a565b6040516100ca9190610537565b60405180910390f35b34156100de57600080fd5b6100f360046100ee90369061046f565b610172565b6040516101009190610501565b60405180910390f35b341561011457600080fd5b6101296004610124903690610498565b6102e2565b604051610136919061051c565b60405180910390f35b6000610153826000015183602001516102e2565b9050919050565b60006020528060005260406000206000915090505481565b600081602001516000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156101c757600090506102dd565b81602001516000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160200151600080846000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84602001516040516102d09190610537565b60405180910390a3600190505b919050565b60006102ed83610172565b508163ffffffff16905092915050565b6000610309823561059f565b905092915050565b60006060828403121561032357600080fd5b61032d6040610552565b9050600061033d8482850161035d565b600083015250604061035184828501610409565b60208301525092915050565b60006040828403121561036f57600080fd5b6103796040610552565b90506000610389848285016102fd565b600083015250602061039d848285016103f5565b60208301525092915050565b6000604082840312156103bb57600080fd5b6103c56040610552565b905060006103d5848285016102fd565b60008301525060206103e9848285016103f5565b60208301525092915050565b600061040182356105bf565b905092915050565b600061041582356105c9565b905092915050565b60006020828403121561042f57600080fd5b600061043d848285016102fd565b91505092915050565b60006060828403121561045857600080fd5b600061046684828501610311565b91505092915050565b60006040828403121561048157600080fd5b600061048f848285016103a9565b91505092915050565b600080606083850312156104ab57600080fd5b60006104b9858286016103a9565b92505060406104ca85828601610409565b9150509250929050565b6104dd8161057f565b82525050565b6104ec8161058b565b82525050565b6104fb81610595565b82525050565b600060208201905061051660008301846104d4565b92915050565b600060208201905061053160008301846104e3565b92915050565b600060208201905061054c60008301846104f2565b92915050565b6000604051905081810181811067ffffffffffffffff8211171561057557600080fd5b8060405250919050565b60008115159050919050565b6000819050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff821690509190505600a265627a7a72305820c6ef8afd2a9b8471fa0540377bc9bda7255335c34b0456d7e80a1cbd5f6423946c6578706572696d656e74616cf50037", - "updated_at": 1523363832029, - "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": ["/Users/leonidlogvinov/Dev/0x/0x-monorepo/packages/metacoin/contracts/Metacoin.sol"] - } - } -} diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index 148ae32a1..150a1bd51 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -7,7 +7,7 @@ "build:watch": "tsc -w", "lint": "tslint --project .", "clean": "shx rm -rf lib", - "prebuild": "run-s clean generate_contract_wrappers copy_artifacts", + "prebuild": "run-s clean compile generate_contract_wrappers copy_artifacts", "copy_artifacts": "copyfiles './artifacts/**/*' './contracts/**/*' ./lib", "build": "tsc", "test": "run-s build run_mocha", diff --git a/packages/resolver/package.json b/packages/resolver/package.json new file mode 100644 index 000000000..107405cf8 --- /dev/null +++ b/packages/resolver/package.json @@ -0,0 +1,39 @@ +{ + "name": "@0xproject/resolver", + "version": "0.0.1", + "description": "Import resolver for smart contracts dependencies", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "scripts": { + "build:watch": "tsc -w", + "build": "yarn clean && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "clean": "shx rm -rf lib scripts", + "lint": "tslint --project .", + "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/0xProject/0x-monorepo.git" + }, + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/0xProject/0x-monorepo/issues" + }, + "homepage": "https://github.com/0xProject/0x-monorepo/packages/resolver/README.md", + "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.16", + "@0xproject/tslint-config": "^0.4.14", + "copyfiles": "^1.2.0", + "shx": "^0.2.2", + "tslint": "5.8.0", + "typescript": "2.7.1" + }, + "dependencies": { + "@0xproject/typescript-typings": "^0.0.3", + "@0xproject/types": "^0.6.0", + "lodash": "^4.17.4" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/resolver/src/index.ts b/packages/resolver/src/index.ts new file mode 100644 index 000000000..cd6ec42ec --- /dev/null +++ b/packages/resolver/src/index.ts @@ -0,0 +1,8 @@ +export { ContractSource, ContractSources } from './types'; +export { FallthroughResolver } from './resolvers/fallthrough_resolver'; +export { URLResolver } from './resolvers/url_resolver'; +export { NPMResolver } from './resolvers/npm_resolver'; +export { FSResolver } from './resolvers/fs_resolver'; +export { NameResolver } from './resolvers/name_resolver'; +export { EnumerableResolver } from './resolvers/enumerable_resolver'; +export { Resolver } from './resolvers/resolver'; diff --git a/packages/resolver/src/resolvers/enumerable_resolver.ts b/packages/resolver/src/resolvers/enumerable_resolver.ts new file mode 100644 index 000000000..bb578bb86 --- /dev/null +++ b/packages/resolver/src/resolvers/enumerable_resolver.ts @@ -0,0 +1,7 @@ +import { ContractSource } from '../types'; + +import { Resolver } from './resolver'; + +export abstract class EnumerableResolver extends Resolver { + public abstract getAllContracts(): ContractSource[]; +} diff --git a/packages/resolver/src/resolvers/fallthrough_resolver.ts b/packages/resolver/src/resolvers/fallthrough_resolver.ts new file mode 100644 index 000000000..8f6af9be0 --- /dev/null +++ b/packages/resolver/src/resolvers/fallthrough_resolver.ts @@ -0,0 +1,21 @@ +import * as _ from 'lodash'; + +import { ContractSource } from '../types'; + +import { Resolver } from './resolver'; + +export class FallthroughResolver extends Resolver { + private _resolvers: Resolver[] = []; + public appendResolver(resolver: Resolver): void { + this._resolvers.push(resolver); + } + public resolveIfExists(importPath: string): ContractSource | undefined { + for (const resolver of this._resolvers) { + const contractSourceIfExists = resolver.resolveIfExists(importPath); + if (!_.isUndefined(contractSourceIfExists)) { + return contractSourceIfExists; + } + } + return undefined; + } +} diff --git a/packages/resolver/src/resolvers/fs_resolver.ts b/packages/resolver/src/resolvers/fs_resolver.ts new file mode 100644 index 000000000..4f05fba88 --- /dev/null +++ b/packages/resolver/src/resolvers/fs_resolver.ts @@ -0,0 +1,19 @@ +import * as fs from 'fs'; + +import { ContractSource } from '../types'; + +import { Resolver } from './resolver'; + +export class FSResolver extends Resolver { + // tslint:disable-next-line:prefer-function-over-method + public resolveIfExists(importPath: string): ContractSource | undefined { + if (fs.existsSync(importPath)) { + const fileContent = fs.readFileSync(importPath).toString(); + return { + source: fileContent, + path: importPath, + }; + } + return undefined; + } +} diff --git a/packages/resolver/src/resolvers/name_resolver.ts b/packages/resolver/src/resolvers/name_resolver.ts new file mode 100644 index 000000000..522e10142 --- /dev/null +++ b/packages/resolver/src/resolvers/name_resolver.ts @@ -0,0 +1,66 @@ +import * as fs from 'fs'; +import * as _ from 'lodash'; +import * as path from 'path'; + +import { ContractSource } from '../types'; + +import { EnumerableResolver } from './enumerable_resolver'; + +export class NameResolver extends EnumerableResolver { + private _contractsDir: string; + constructor(contractsDir: string) { + super(); + this._contractsDir = contractsDir; + } + public resolveIfExists(lookupContractName: string): ContractSource | undefined { + const SOLIDITY_FILE_EXTENSION = '.sol'; + let contractSource: ContractSource | undefined; + const onFile = (filePath: string) => { + const contractName = path.basename(filePath, SOLIDITY_FILE_EXTENSION); + if (contractName === lookupContractName) { + const source = fs.readFileSync(filePath).toString(); + contractSource = { + source, + path: filePath, + }; + return true; + } + return undefined; + }; + this._traverseContractsDir(this._contractsDir, onFile); + return contractSource; + } + public getAllContracts(): ContractSource[] { + const SOLIDITY_FILE_EXTENSION = '.sol'; + const contractSources: ContractSource[] = []; + const onFile = (filePath: string) => { + const contractName = path.basename(filePath, SOLIDITY_FILE_EXTENSION); + const source = fs.readFileSync(filePath).toString(); + const contractSource = { + source, + path: filePath, + }; + contractSources.push(contractSource); + }; + this._traverseContractsDir(this._contractsDir, onFile); + return contractSources; + } + // tslint:disable-next-line:prefer-function-over-method + private _traverseContractsDir(dirPath: string, onFile: (filePath: string) => true | void): boolean { + let dirContents: string[] = []; + try { + dirContents = fs.readdirSync(dirPath); + } catch (err) { + throw new Error(`No directory found at ${dirPath}`); + } + for (const fileName of dirContents) { + const entryPath = path.join(dirPath, fileName); + const isDirectory = fs.lstatSync(entryPath).isDirectory(); + const isComplete = isDirectory ? this._traverseContractsDir(entryPath, onFile) : onFile(entryPath); + if (isComplete) { + return isComplete; + } + } + return false; + } +} diff --git a/packages/resolver/src/resolvers/npm_resolver.ts b/packages/resolver/src/resolvers/npm_resolver.ts new file mode 100644 index 000000000..2c0a44aad --- /dev/null +++ b/packages/resolver/src/resolvers/npm_resolver.ts @@ -0,0 +1,34 @@ +import * as fs from 'fs'; +import * as path from 'path'; + +import { ContractSource } from '../types'; + +import { Resolver } from './resolver'; + +export class NPMResolver extends Resolver { + private _packagePath: string; + constructor(packagePath: string) { + super(); + this._packagePath = packagePath; + } + public resolveIfExists(importPath: string): ContractSource | undefined { + if (!importPath.startsWith('/')) { + const [packageName, ...other] = importPath.split('/'); + const pathWithinPackage = path.join(...other); + let currentPath = this._packagePath; + const ROOT_PATH = '/'; + while (currentPath !== ROOT_PATH) { + const lookupPath = path.join(currentPath, 'node_modules', packageName, pathWithinPackage); + if (fs.existsSync(lookupPath)) { + const fileContent = fs.readFileSync(lookupPath).toString(); + return { + source: fileContent, + path: lookupPath, + }; + } + currentPath = path.dirname(currentPath); + } + } + return undefined; + } +} diff --git a/packages/resolver/src/resolvers/resolver.ts b/packages/resolver/src/resolvers/resolver.ts new file mode 100644 index 000000000..7edc9a85d --- /dev/null +++ b/packages/resolver/src/resolvers/resolver.ts @@ -0,0 +1,14 @@ +import * as _ from 'lodash'; + +import { ContractSource } from '../types'; + +export abstract class Resolver { + public abstract resolveIfExists(importPath: string): ContractSource | undefined; + public resolve(importPath: string): ContractSource { + const contractSourceIfExists = this.resolveIfExists(importPath); + if (_.isUndefined(contractSourceIfExists)) { + throw new Error(`Failed to resolve ${importPath}`); + } + return contractSourceIfExists; + } +} diff --git a/packages/resolver/src/resolvers/url_resolver.ts b/packages/resolver/src/resolvers/url_resolver.ts new file mode 100644 index 000000000..180b0c9f6 --- /dev/null +++ b/packages/resolver/src/resolvers/url_resolver.ts @@ -0,0 +1,21 @@ +import * as fs from 'fs'; + +import { ContractSource } from '../types'; + +import { Resolver } from './resolver'; + +export class URLResolver extends Resolver { + // tslint:disable-next-line:prefer-function-over-method + public resolveIfExists(importPath: string): ContractSource | undefined { + const FILE_URL_PREXIF = 'file://'; + if (importPath.startsWith(FILE_URL_PREXIF)) { + const filePath = importPath.substr(FILE_URL_PREXIF.length); + const fileContent = fs.readFileSync(filePath).toString(); + return { + source: fileContent, + path: importPath, + }; + } + return undefined; + } +} diff --git a/packages/resolver/src/types.ts b/packages/resolver/src/types.ts new file mode 100644 index 000000000..41492622d --- /dev/null +++ b/packages/resolver/src/types.ts @@ -0,0 +1,8 @@ +export interface ContractSource { + source: string; + path: string; +} + +export interface ContractSources { + [key: string]: ContractSource; +} diff --git a/packages/resolver/tsconfig.json b/packages/resolver/tsconfig.json new file mode 100644 index 000000000..f5f4b37c2 --- /dev/null +++ b/packages/resolver/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["src/**/*"] +} diff --git a/packages/resolver/tslint.json b/packages/resolver/tslint.json new file mode 100644 index 000000000..ffaefe83a --- /dev/null +++ b/packages/resolver/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": ["@0xproject/tslint-config"] +} diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index f92850db5..277f40130 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -7,13 +7,14 @@ "scripts": { "build:watch": "tsc -w", "lint": "tslint --project . 'src/**/*.ts'", - "test": "run-s clean build run_mocha", + "test": "run-s clean build compile_test run_mocha", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "test:circleci": "yarn test:coverage", "run_mocha": "mocha lib/test/**/*_test.js --exit", "clean": "shx rm -rf lib scripts", "build": "copyfiles 'test/fixtures/**/*' ./lib && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "compile_test": "node ../deployer/lib/src/cli.js compile --contracts SimpleStorage --contracts-dir test/fixtures/contracts --artifacts-dir test/fixtures/artifacts", "manual:postpublish": "yarn build; node ./scripts/postpublish.js", "docs:stage": "yarn build && node ./scripts/stage_docs.js", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES", @@ -53,6 +54,7 @@ "solidity-parser-antlr": "^0.2.8" }, "devDependencies": { + "@0xproject/deployer": "^0.3.5", "@0xproject/monorepo-scripts": "^0.1.17", "@0xproject/tslint-config": "^0.4.15", "@types/istanbul": "^0.4.29", diff --git a/packages/sol-cov/src/collect_contract_data.ts b/packages/sol-cov/src/collect_contract_data.ts index e4a13695a..da56e8d0d 100644 --- a/packages/sol-cov/src/collect_contract_data.ts +++ b/packages/sol-cov/src/collect_contract_data.ts @@ -6,27 +6,17 @@ import * as path from 'path'; import { ContractData } from './types'; export const collectContractsData = (artifactsPath: string, sourcesPath: string, networkId: number) => { - const sourcesGlob = `${sourcesPath}/**/*.sol`; - const sourceFileNames = glob.sync(sourcesGlob, { absolute: true }); - const contractsDataIfExists: Array<ContractData | {}> = _.map(sourceFileNames, sourceFileName => { - const baseName = path.basename(sourceFileName, '.sol'); - const artifactFileName = path.join(artifactsPath, `${baseName}.json`); - if (!fs.existsSync(artifactFileName)) { - // If the contract isn't directly compiled, but is imported as the part of the other contract - we don't - // have an artifact for it and therefore can't do anything useful with it - return {}; - } + const artifactsGlob = `${artifactsPath}/**/*.json`; + const artifactFileNames = glob.sync(artifactsGlob, { absolute: true }); + const contractsDataIfExists: Array<ContractData | {}> = _.map(artifactFileNames, artifactFileName => { const artifact = JSON.parse(fs.readFileSync(artifactFileName).toString()); const sources = artifact.networks[networkId].sources; - const sourceCodes = _.map(sources, (source: string) => { - const includedSourceCode = fs.readFileSync(source).toString(); - return includedSourceCode; - }); + const contractName = artifact.contract_name; + const sourceCodes = _.map(sources, (source: string) => fs.readFileSync(source).toString()); if (_.isUndefined(artifact.networks[networkId])) { - throw new Error(`No ${baseName} artifacts found for networkId ${networkId}`); + throw new Error(`No ${contractName} artifacts found for networkId ${networkId}`); } const contractData = { - baseName, sourceCodes, sources, sourceMap: artifact.networks[networkId].source_map, diff --git a/packages/sol-cov/src/types.ts b/packages/sol-cov/src/types.ts index d6491100b..01359d858 100644 --- a/packages/sol-cov/src/types.ts +++ b/packages/sol-cov/src/types.ts @@ -79,7 +79,6 @@ export interface ContractData { runtimeBytecode: string; sourceMapRuntime: string; sourceCodes: string[]; - baseName: string; sources: string[]; } diff --git a/packages/sol-cov/test/collect_contracts_data_test.ts b/packages/sol-cov/test/collect_contracts_data_test.ts index e793085e3..943a4a878 100644 --- a/packages/sol-cov/test/collect_contracts_data_test.ts +++ b/packages/sol-cov/test/collect_contracts_data_test.ts @@ -16,7 +16,6 @@ describe('Collect contracts data', () => { const contractsData = collectContractsData(artifactsPath, sourcesPath, networkId); _.forEach(contractsData, contractData => { expect(contractData).to.have.keys([ - 'baseName', 'sourceCodes', 'sources', 'sourceMap', diff --git a/packages/sol-cov/test/collect_coverage_entries_test.ts b/packages/sol-cov/test/collect_coverage_entries_test.ts index c7bc45bbf..c7b9d44b1 100644 --- a/packages/sol-cov/test/collect_coverage_entries_test.ts +++ b/packages/sol-cov/test/collect_coverage_entries_test.ts @@ -39,13 +39,13 @@ describe('Collect coverage entries', () => { const coverageEntries = collectCoverageEntries(simpleStorageContract); const fnIds = _.keys(coverageEntries.fnMap); expect(coverageEntries.fnMap[fnIds[0]].name).to.be.equal('set'); - expect(coverageEntries.fnMap[fnIds[0]].line).to.be.equal(3); + expect(coverageEntries.fnMap[fnIds[0]].line).to.be.equal(5); const setFunction = `function set(uint x) { storedData = x; }`; expect(getRange(simpleStorageContract, coverageEntries.fnMap[fnIds[0]].loc)).to.be.equal(setFunction); expect(coverageEntries.fnMap[fnIds[1]].name).to.be.equal('get'); - expect(coverageEntries.fnMap[fnIds[1]].line).to.be.equal(6); + expect(coverageEntries.fnMap[fnIds[1]].line).to.be.equal(8); const getFunction = `function get() constant returns (uint retVal) { return storedData; }`; diff --git a/packages/sol-cov/test/fixtures/artifacts/SimpleStorage.json b/packages/sol-cov/test/fixtures/artifacts/SimpleStorage.json deleted file mode 100644 index 416170ef2..000000000 --- a/packages/sol-cov/test/fixtures/artifacts/SimpleStorage.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "contract_name": "SimpleStorage", - "networks": { - "50": { - "solc_version": "0.4.21", - "keccak256": "0x18dc5b5a0e813c17e49936d2f2f7c07c51f050c09ba5e7206f17c855f23f4b6a", - "source_tree_hash": "0x18dc5b5a0e813c17e49936d2f2f7c07c51f050c09ba5e7206f17c855f23f4b6a", - "optimizer_enabled": 0, - "abi": [ - { - "constant": true, - "inputs": [], - "name": "storedData", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "x", - "type": "uint256" - } - ], - "name": "set", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "get", - "outputs": [ - { - "name": "retVal", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ], - "bytecode": - "0x6060604052341561000f57600080fd5b6101098061001e6000396000f3006060604052600436106053576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605857806360fe47b114607e5780636d4ce63c14609e575b600080fd5b3415606257600080fd5b606860c4565b6040518082815260200191505060405180910390f35b3415608857600080fd5b609c600480803590602001909190505060ca565b005b341560a857600080fd5b60ae60d4565b6040518082815260200191505060405180910390f35b60005481565b8060008190555050565b600080549050905600a165627a7a723058207f743855fd0c71699620424a21a257cd197ed05032d6768eb9b874e4898f44c60029", - "runtime_bytecode": - "0x6060604052600436106053576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605857806360fe47b114607e5780636d4ce63c14609e575b600080fd5b3415606257600080fd5b606860c4565b6040518082815260200191505060405180910390f35b3415608857600080fd5b609c600480803590602001909190505060ca565b005b341560a857600080fd5b60ae60d4565b6040518082815260200191505060405180910390f35b60005481565b8060008190555050565b600080549050905600a165627a7a723058207f743855fd0c71699620424a21a257cd197ed05032d6768eb9b874e4898f44c60029", - "updated_at": 1521118350895, - "source_map": "26:196:0:-;;;;;;;;;;;;;;;;;", - "source_map_runtime": - "26:196:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;55:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;83:52;;;;;;;;;;;;;;;;;;;;;;;;;;140:80;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;55:22;;;;:::o;83:52::-;127:1;114:10;:14;;;;83:52;:::o;140:80::-;173:11;203:10;;196:17;;140:80;:::o", - "sources": ["SimpleStorage.sol"] - } - } -} diff --git a/packages/sol-cov/test/fixtures/artifacts/Simplest.json b/packages/sol-cov/test/fixtures/artifacts/Simplest.json deleted file mode 100644 index 8de60e481..000000000 --- a/packages/sol-cov/test/fixtures/artifacts/Simplest.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "contract_name": "Simplest", - "networks": { - "50": { - "solc_version": "0.4.21", - "keccak256": "0x8e7d62e19c7c7b8bf9a4a43749e111605950cc877574fb9640a1a07d1c3749f9", - "source_tree_hash": "0x8e7d62e19c7c7b8bf9a4a43749e111605950cc877574fb9640a1a07d1c3749f9", - "optimizer_enabled": 0, - "abi": [], - "bytecode": - "0x60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a7230582097cfe05b4d18d6ffb3a8d8fab0570cf09640d3131b9677ddb9be4e9fbcb65f010029", - "runtime_bytecode": - "0x6060604052600080fd00a165627a7a7230582097cfe05b4d18d6ffb3a8d8fab0570cf09640d3131b9677ddb9be4e9fbcb65f010029", - "updated_at": 1521118525393, - "source_map": "26:21:0:-;;;;;;;;;;;;;;;;;", - "source_map_runtime": "26:21:0:-;;;;;", - "sources": ["Simplest.sol"] - } - } -} diff --git a/packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol b/packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol index 178a52318..e4b4ac246 100644 --- a/packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol +++ b/packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol @@ -1,3 +1,5 @@ +pragma solidity ^0.4.21; + contract SimpleStorage { uint public storedData; function set(uint x) { |