From ae220c37dff04c8d4d22e48865a5a268000c2f12 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 9 May 2018 23:05:20 +0200 Subject: Add solcVersion to CompilerOpts --- packages/sol-compiler/src/compiler.ts | 13 +++++++++---- packages/sol-compiler/src/index.ts | 1 + packages/sol-compiler/src/utils/types.ts | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index c17616246..2ebc5228e 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -74,6 +74,7 @@ export class Compiler { private _contractsDir: string; private _compilerSettings: solc.CompilerSettings; private _artifactsDir: string; + private _solcVersionIfExists: string | undefined; private _specifiedContracts: string[] | TYPE_ALL_FILES_IDENTIFIER; /** * Instantiates a new instance of the Compiler class. @@ -85,6 +86,7 @@ export class Compiler { ? JSON.parse(fs.readFileSync(CONFIG_FILE).toString()) : {}; this._contractsDir = opts.contractsDir || config.contractsDir || DEFAULT_CONTRACTS_DIR; + this._solcVersionIfExists = opts.solcVersion || config.solcVersion; this._compilerSettings = opts.compilerSettings || config.compilerSettings || DEFAULT_COMPILER_SETTINGS; this._artifactsDir = opts.artifactsDir || config.artifactsDir || DEFAULT_ARTIFACTS_DIR; this._specifiedContracts = opts.contracts || config.contracts || ALL_CONTRACTS_IDENTIFIER; @@ -139,9 +141,12 @@ export class Compiler { if (!shouldCompile) { return; } - const solcVersionRange = parseSolidityVersionRange(contractSource.source); - const availableCompilerVersions = _.keys(binPaths); - const solcVersion = semver.maxSatisfying(availableCompilerVersions, solcVersionRange); + let solcVersion = this._solcVersionIfExists; + if (_.isUndefined(solcVersion)) { + const solcVersionRange = parseSolidityVersionRange(contractSource.source); + const availableCompilerVersions = _.keys(binPaths); + solcVersion = semver.maxSatisfying(availableCompilerVersions, solcVersionRange); + } const fullSolcVersion = binPaths[solcVersion]; const compilerBinFilename = path.join(SOLC_BIN_DIR, fullSolcVersion); let solcjs: string; @@ -229,7 +234,7 @@ export class Compiler { sourceTreeHashHex, compiler: { name: 'solc', - version: solcVersion, + version: fullSolcVersion, settings: this._compilerSettings, }, }; diff --git a/packages/sol-compiler/src/index.ts b/packages/sol-compiler/src/index.ts index 4b4c51de2..15c166992 100644 --- a/packages/sol-compiler/src/index.ts +++ b/packages/sol-compiler/src/index.ts @@ -1,2 +1,3 @@ export { Compiler } from './compiler'; +export { CompilerOptions } from './utils/types'; export { ContractArtifact, ContractNetworks } from './utils/types'; diff --git a/packages/sol-compiler/src/utils/types.ts b/packages/sol-compiler/src/utils/types.ts index b12a11b79..d43347fa6 100644 --- a/packages/sol-compiler/src/utils/types.ts +++ b/packages/sol-compiler/src/utils/types.ts @@ -55,6 +55,7 @@ export interface CompilerOptions { artifactsDir?: string; compilerSettings?: solc.CompilerSettings; contracts?: string[] | '*'; + solcVersion?: string; } export interface ContractSourceData { -- cgit v1.2.3 From 842f2ea5cc75c66397597a21202f4b8cf3082ed6 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 14 May 2018 18:34:04 +0200 Subject: Fix a bug in FS resolver causing it to try reading directories --- packages/sol-resolver/src/resolvers/fs_resolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sol-resolver/src/resolvers/fs_resolver.ts b/packages/sol-resolver/src/resolvers/fs_resolver.ts index 4f05fba88..63fc3448e 100644 --- a/packages/sol-resolver/src/resolvers/fs_resolver.ts +++ b/packages/sol-resolver/src/resolvers/fs_resolver.ts @@ -7,7 +7,7 @@ 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)) { + if (fs.existsSync(importPath) && fs.lstatSync(importPath).isFile()) { const fileContent = fs.readFileSync(importPath).toString(); return { source: fileContent, -- cgit v1.2.3 From 60b1fdd367101047d433d4b9c1c47925925296a2 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 14 May 2018 18:34:37 +0200 Subject: Only look at *.sol files in NameResolver --- packages/sol-resolver/src/resolvers/name_resolver.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/sol-resolver/src/resolvers/name_resolver.ts b/packages/sol-resolver/src/resolvers/name_resolver.ts index 76bed802e..586fad86a 100644 --- a/packages/sol-resolver/src/resolvers/name_resolver.ts +++ b/packages/sol-resolver/src/resolvers/name_resolver.ts @@ -6,6 +6,8 @@ import { ContractSource } from '../types'; import { EnumerableResolver } from './enumerable_resolver'; +const SOLIDITY_FILE_EXTENSION = '.sol'; + export class NameResolver extends EnumerableResolver { private _contractsDir: string; constructor(contractsDir: string) { @@ -13,7 +15,6 @@ export class NameResolver extends EnumerableResolver { 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); @@ -32,7 +33,6 @@ export class NameResolver extends EnumerableResolver { return contractSource; } public getAll(): ContractSource[] { - const SOLIDITY_FILE_EXTENSION = '.sol'; const contractSources: ContractSource[] = []; const onFile = (filePath: string) => { const contractName = path.basename(filePath, SOLIDITY_FILE_EXTENSION); @@ -56,6 +56,9 @@ export class NameResolver extends EnumerableResolver { throw new Error(`No directory found at ${dirPath}`); } for (const fileName of dirContents) { + if (!fileName.endsWith(SOLIDITY_FILE_EXTENSION)) { + continue; + } const absoluteEntryPath = path.join(dirPath, fileName); const isDirectory = fs.lstatSync(absoluteEntryPath).isDirectory(); const entryPath = path.relative(this._contractsDir, absoluteEntryPath); -- cgit v1.2.3 From 974575b695108dd70f4b165f6789f71c3647c2b1 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 14 May 2018 20:01:18 +0200 Subject: Make sol-cov work with truffle and other artifact adapters --- packages/dev-utils/src/coverage.ts | 5 +- packages/metacoin/test/utils/config.ts | 4 +- packages/metacoin/test/utils/coverage.ts | 5 +- packages/sol-cov/package.json | 4 + packages/sol-cov/src/artifact_adapters/0x.ts | 41 +++++++++ packages/sol-cov/src/artifact_adapters/abstract.ts | 5 ++ packages/sol-cov/src/artifact_adapters/truffle.ts | 43 +++++++++ packages/sol-cov/src/collect_contract_data.ts | 31 ------- packages/sol-cov/src/coverage_manager.ts | 99 ++++++++++++-------- packages/sol-cov/src/coverage_subprovider.ts | 38 +++++--- packages/sol-cov/src/index.ts | 4 + packages/sol-cov/src/trace.ts | 100 +++++++++++++++++++++ .../sol-cov/test/collect_contracts_data_test.ts | 7 +- packages/sol-cov/test/trace_test.ts | 57 ++++++++++++ 14 files changed, 354 insertions(+), 89 deletions(-) create mode 100644 packages/sol-cov/src/artifact_adapters/0x.ts create mode 100644 packages/sol-cov/src/artifact_adapters/abstract.ts create mode 100644 packages/sol-cov/src/artifact_adapters/truffle.ts delete mode 100644 packages/sol-cov/src/collect_contract_data.ts create mode 100644 packages/sol-cov/src/trace.ts create mode 100644 packages/sol-cov/test/trace_test.ts diff --git a/packages/dev-utils/src/coverage.ts b/packages/dev-utils/src/coverage.ts index 6f7640835..caf04672f 100644 --- a/packages/dev-utils/src/coverage.ts +++ b/packages/dev-utils/src/coverage.ts @@ -1,4 +1,4 @@ -import { CoverageSubprovider } from '@0xproject/sol-cov'; +import { CoverageSubprovider, ZeroExArtifactAdapter } from '@0xproject/sol-cov'; import * as _ from 'lodash'; import { constants } from './constants'; @@ -16,6 +16,7 @@ export const coverage = { const artifactsPath = '../migrations/artifacts/1.0.0'; const contractsPath = 'src/contracts'; const defaultFromAddress = constants.TESTRPC_FIRST_ADDRESS; - return new CoverageSubprovider(artifactsPath, contractsPath, defaultFromAddress); + const zeroExArtifactsAdapter = new ZeroExArtifactAdapter(artifactsPath, contractsPath); + return new CoverageSubprovider(zeroExArtifactsAdapter, defaultFromAddress); }, }; diff --git a/packages/metacoin/test/utils/config.ts b/packages/metacoin/test/utils/config.ts index 389edb388..ef4932845 100644 --- a/packages/metacoin/test/utils/config.ts +++ b/packages/metacoin/test/utils/config.ts @@ -3,8 +3,8 @@ import * as path from 'path'; export const config = { networkId: 50, - artifactsDir: path.resolve(__dirname, '../../artifacts'), - contractsDir: path.resolve(__dirname, '../../contracts'), + artifactsDir: 'artifacts', + contractsDir: 'contracts', ganacheLogFile: 'ganache.log', txDefaults: { from: devConstants.TESTRPC_FIRST_ADDRESS, diff --git a/packages/metacoin/test/utils/coverage.ts b/packages/metacoin/test/utils/coverage.ts index debd544ed..83b56596f 100644 --- a/packages/metacoin/test/utils/coverage.ts +++ b/packages/metacoin/test/utils/coverage.ts @@ -1,5 +1,5 @@ import { devConstants } from '@0xproject/dev-utils'; -import { CoverageSubprovider } from '@0xproject/sol-cov'; +import { CoverageSubprovider, ZeroExArtifactAdapter } from '@0xproject/sol-cov'; import * as _ from 'lodash'; import { config } from './config'; @@ -15,6 +15,7 @@ export const coverage = { }, _getCoverageSubprovider(): CoverageSubprovider { const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS; - return new CoverageSubprovider(config.artifactsDir, config.contractsDir, defaultFromAddress); + const zeroExArtifactsAdapter = new ZeroExArtifactAdapter(config.artifactsDir, config.contractsDir); + return new CoverageSubprovider(zeroExArtifactsAdapter, defaultFromAddress); }, }; diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index 28ceae0fa..593ff8356 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -48,9 +48,12 @@ "dependencies": { "@0xproject/subproviders": "^0.10.1", "@0xproject/types": "^0.6.3", + "@0xproject/utils": "^0.6.1", + "@0xproject/sol-compiler": "^0.4.3", "@0xproject/typescript-typings": "^0.3.1", "@0xproject/utils": "^0.6.1", "ethereumjs-util": "^5.1.1", + "rimraf": "^2.6.2", "glob": "^7.1.2", "istanbul": "^0.4.5", "lodash": "^4.17.4", @@ -62,6 +65,7 @@ "@0xproject/monorepo-scripts": "^0.1.19", "@0xproject/tslint-config": "^0.4.17", "@types/istanbul": "^0.4.30", + "@types/rimraf": "^2.0.2", "@types/mkdirp": "^0.5.1", "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", diff --git a/packages/sol-cov/src/artifact_adapters/0x.ts b/packages/sol-cov/src/artifact_adapters/0x.ts new file mode 100644 index 000000000..87d23b0aa --- /dev/null +++ b/packages/sol-cov/src/artifact_adapters/0x.ts @@ -0,0 +1,41 @@ +import * as fs from 'fs'; +import * as glob from 'glob'; +import * as _ from 'lodash'; +import * as path from 'path'; + +import { ContractData } from '../types'; + +import { AbstractArtifactAdapter } from './abstract'; + +export class ZeroExArtifactAdapter extends AbstractArtifactAdapter { + private _artifactsPath: string; + private _sourcesPath: string; + constructor(artifactsPath: string, sourcesPath: string) { + super(); + this._artifactsPath = artifactsPath; + this._sourcesPath = sourcesPath; + } + public async collectContractsDataAsync(): Promise { + const artifactsGlob = `${this._artifactsPath}/**/*.json`; + const artifactFileNames = glob.sync(artifactsGlob, { absolute: true }); + const contractsData: ContractData[] = []; + for (const artifactFileName of artifactFileNames) { + const artifact = JSON.parse(fs.readFileSync(artifactFileName).toString()); + let sources = _.keys(artifact.sources); + sources = _.map(sources, relativeFilePath => path.resolve(this._sourcesPath, relativeFilePath)); + const contractName = artifact.contractName; + // We don't compute coverage for dependencies + const sourceCodes = _.map(sources, (source: string) => fs.readFileSync(source).toString()); + const contractData = { + sourceCodes, + sources, + bytecode: artifact.compilerOutput.evm.bytecode.object, + sourceMap: artifact.compilerOutput.evm.bytecode.sourceMap, + runtimeBytecode: artifact.compilerOutput.evm.deployedBytecode.object, + sourceMapRuntime: artifact.compilerOutput.evm.deployedBytecode.sourceMap, + }; + contractsData.push(contractData); + } + return contractsData; + } +} diff --git a/packages/sol-cov/src/artifact_adapters/abstract.ts b/packages/sol-cov/src/artifact_adapters/abstract.ts new file mode 100644 index 000000000..fcc6562ad --- /dev/null +++ b/packages/sol-cov/src/artifact_adapters/abstract.ts @@ -0,0 +1,5 @@ +import { ContractData } from '../types'; + +export abstract class AbstractArtifactAdapter { + public abstract async collectContractsDataAsync(): Promise; +} diff --git a/packages/sol-cov/src/artifact_adapters/truffle.ts b/packages/sol-cov/src/artifact_adapters/truffle.ts new file mode 100644 index 000000000..e891bb464 --- /dev/null +++ b/packages/sol-cov/src/artifact_adapters/truffle.ts @@ -0,0 +1,43 @@ +import { Compiler, CompilerOptions } from '@0xproject/sol-compiler'; +import * as fs from 'fs'; +import * as glob from 'glob'; +import * as _ from 'lodash'; +import * as path from 'path'; +import * as rimraf from 'rimraf'; + +import { ContractData } from '../types'; + +import { ZeroExArtifactAdapter } from './0x'; +import { AbstractArtifactAdapter } from './abstract'; + +export class TruffleArtifactAdapter extends AbstractArtifactAdapter { + private _solcVersion: string; + private _sourcesPath: string; + constructor(sourcesPath: string, solcVersion: string) { + super(); + this._solcVersion = solcVersion; + this._sourcesPath = sourcesPath; + } + public async collectContractsDataAsync(): Promise { + const artifactsDir = '0x-artifacts'; + const compilerOptions: CompilerOptions = { + contractsDir: this._sourcesPath, + artifactsDir, + compilerSettings: { + outputSelection: { + ['*']: { + ['*']: ['abi', 'evm.bytecode.object', 'evm.deployedBytecode.object'], + }, + }, + }, + contracts: '*', + solcVersion: this._solcVersion, + }; + const compiler = new Compiler(compilerOptions); + await compiler.compileAsync(); + const zeroExArtifactAdapter = new ZeroExArtifactAdapter(artifactsDir, this._sourcesPath); + const contractsDataFrom0xArtifacts = await zeroExArtifactAdapter.collectContractsDataAsync(); + rimraf.sync(artifactsDir); + return contractsDataFrom0xArtifacts; + } +} diff --git a/packages/sol-cov/src/collect_contract_data.ts b/packages/sol-cov/src/collect_contract_data.ts deleted file mode 100644 index 2c2a12835..000000000 --- a/packages/sol-cov/src/collect_contract_data.ts +++ /dev/null @@ -1,31 +0,0 @@ -import * as fs from 'fs'; -import * as glob from 'glob'; -import * as _ from 'lodash'; -import * as path from 'path'; - -import { ContractData } from './types'; - -export const collectContractsData = (artifactsPath: string, sourcesPath: string) => { - const artifactsGlob = `${artifactsPath}/**/*.json`; - const artifactFileNames = glob.sync(artifactsGlob, { absolute: true }); - const contractsData: ContractData[] = []; - _.forEach(artifactFileNames, artifactFileName => { - const artifact = JSON.parse(fs.readFileSync(artifactFileName).toString()); - const sources = _.keys(artifact.sources); - const contractName = artifact.contractName; - // We don't compute coverage for dependencies - const sourceCodes = _.map(sources, (source: string) => - fs.readFileSync(path.join(sourcesPath, source)).toString(), - ); - const contractData = { - sourceCodes, - sources, - bytecode: artifact.compilerOutput.evm.bytecode.object, - sourceMap: artifact.compilerOutput.evm.bytecode.sourceMap, - runtimeBytecode: artifact.compilerOutput.evm.deployedBytecode.object, - sourceMapRuntime: artifact.compilerOutput.evm.deployedBytecode.sourceMap, - }; - contractsData.push(contractData); - }); - return contractsData; -}; diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts index 800ca96dd..65a6086c0 100644 --- a/packages/sol-cov/src/coverage_manager.ts +++ b/packages/sol-cov/src/coverage_manager.ts @@ -6,7 +6,7 @@ import * as _ from 'lodash'; import * as mkdirp from 'mkdirp'; import * as path from 'path'; -import { collectContractsData } from './collect_contract_data'; +import { AbstractArtifactAdapter } from './artifact_adapters/abstract'; import { collectCoverageEntries } from './collect_coverage_entries'; import { constants } from './constants'; import { parseSourceMap } from './source_maps'; @@ -34,41 +34,23 @@ import { utils } from './utils'; const mkdirpAsync = promisify(mkdirp); export class CoverageManager { - private _sourcesPath: string; + private _artifactAdapter: AbstractArtifactAdapter; + private _verbose: boolean; private _traceInfos: TraceInfo[] = []; - private _contractsData: ContractData[] = []; private _getContractCodeAsync: (address: string) => Promise; - constructor( - artifactsPath: string, - sourcesPath: string, - getContractCodeAsync: (address: string) => Promise, - ) { - this._getContractCodeAsync = getContractCodeAsync; - this._sourcesPath = sourcesPath; - this._contractsData = collectContractsData(artifactsPath, this._sourcesPath); - } - public appendTraceInfo(traceInfo: TraceInfo): void { - this._traceInfos.push(traceInfo); - } - public async writeCoverageAsync(): Promise { - const finalCoverage = await this._computeCoverageAsync(); - const stringifiedCoverage = JSON.stringify(finalCoverage, null, '\t'); - await mkdirpAsync('coverage'); - fs.writeFileSync('coverage/coverage.json', stringifiedCoverage); - } - private _getSingleFileCoverageForTrace( + private static _getSingleFileCoverageForTrace( contractData: ContractData, coveredPcs: number[], pcToSourceRange: { [programCounter: number]: SourceRange }, fileIndex: number, ): Coverage { - const fileName = contractData.sources[fileIndex]; + const absoluteFileName = contractData.sources[fileIndex]; const coverageEntriesDescription = collectCoverageEntries(contractData.sourceCodes[fileIndex]); let sourceRanges = _.map(coveredPcs, coveredPc => pcToSourceRange[coveredPc]); sourceRanges = _.compact(sourceRanges); // Some PC's don't map to a source range and we just ignore them. // By default lodash does a shallow object comparasion. We JSON.stringify them and compare as strings. sourceRanges = _.uniqBy(sourceRanges, s => JSON.stringify(s)); // We don't care if one PC was covered multiple times within a single transaction - sourceRanges = _.filter(sourceRanges, sourceRange => sourceRange.fileName === fileName); + sourceRanges = _.filter(sourceRanges, sourceRange => sourceRange.fileName === absoluteFileName); const branchCoverage: BranchCoverage = {}; const branchIds = _.keys(coverageEntriesDescription.branchMap); for (const branchId of branchIds) { @@ -118,7 +100,6 @@ export class CoverageManager { ); statementCoverage[modifierStatementId] = isModifierCovered; } - const absoluteFileName = path.join(this._sourcesPath, fileName); const partialCoverage = { [absoluteFileName]: { ...coverageEntriesDescription, @@ -131,18 +112,53 @@ export class CoverageManager { }; return partialCoverage; } + constructor( + artifactAdapter: AbstractArtifactAdapter, + getContractCodeAsync: (address: string) => Promise, + verbose: boolean, + ) { + this._getContractCodeAsync = getContractCodeAsync; + this._artifactAdapter = artifactAdapter; + this._verbose = verbose; + } + public appendTraceInfo(traceInfo: TraceInfo): void { + // console.log(JSON.stringify(traceInfo, null, '\n')); + this._traceInfos.push(traceInfo); + } + public async writeCoverageAsync(): Promise { + const finalCoverage = await this._computeCoverageAsync(); + const stringifiedCoverage = JSON.stringify(finalCoverage, null, '\t'); + await mkdirpAsync('coverage'); + fs.writeFileSync('coverage/coverage.json', stringifiedCoverage); + } private async _computeCoverageAsync(): Promise { + const contractsData = await this._artifactAdapter.collectContractsDataAsync(); const collector = new Collector(); for (const traceInfo of this._traceInfos) { if (traceInfo.address !== constants.NEW_CONTRACT) { // Runtime transaction let runtimeBytecode = (traceInfo as TraceInfoExistingContract).runtimeBytecode; runtimeBytecode = addHexPrefix(runtimeBytecode); - const contractData = _.find(this._contractsData, { runtimeBytecode }) as ContractData; + const contractData = _.find(contractsData, contractDataCandidate => { + // Library linking placeholder: __ConvertLib____________________________ + let runtimeBytecodeRegex = contractDataCandidate.runtimeBytecode.replace(/_.*_/, '.*'); + // Last 86 characters is solidity compiler metadata that's different between compilations + runtimeBytecodeRegex = runtimeBytecodeRegex.replace(/.{86}$/, ''); + // Libraries contain their own address at the beginning of the code and it's impossible to know it in advance + runtimeBytecodeRegex = runtimeBytecodeRegex.replace( + /^0x730000000000000000000000000000000000000000/, + '0x73........................................', + ); + return !_.isNull(runtimeBytecode.match(runtimeBytecodeRegex)); + }) as ContractData; if (_.isUndefined(contractData)) { - throw new Error(`Transaction to an unknown address: ${traceInfo.address}`); + if (this._verbose) { + // tslint:disable-next-line:no-console + console.warn(`Transaction to an unknown address: ${traceInfo.address}`); + } + continue; } - const bytecodeHex = contractData.runtimeBytecode.slice(2); + const bytecodeHex = runtimeBytecode.slice(2); const sourceMap = contractData.sourceMapRuntime; const pcToSourceRange = parseSourceMap( contractData.sourceCodes, @@ -151,7 +167,7 @@ export class CoverageManager { contractData.sources, ); for (let fileIndex = 0; fileIndex < contractData.sources.length; fileIndex++) { - const singleFileCoverageForTrace = this._getSingleFileCoverageForTrace( + const singleFileCoverageForTrace = CoverageManager._getSingleFileCoverageForTrace( contractData, traceInfo.coveredPcs, pcToSourceRange, @@ -163,13 +179,26 @@ export class CoverageManager { // Contract creation transaction let bytecode = (traceInfo as TraceInfoNewContract).bytecode; bytecode = addHexPrefix(bytecode); - const contractData = _.find(this._contractsData, contractDataCandidate => - bytecode.startsWith(contractDataCandidate.bytecode), - ) as ContractData; + const contractData = _.find(contractsData, contractDataCandidate => { + // Library linking placeholder: __ConvertLib____________________________ + let bytecodeRegex = contractDataCandidate.bytecode.replace(/_.*_/, '.*'); + // Last 86 characters is solidity compiler metadata that's different between compilations + bytecodeRegex = bytecodeRegex.replace(/.{86}$/, ''); + // Libraries contain their own address at the beginning of the code and it's impossible to know it in advance + bytecodeRegex = bytecodeRegex.replace( + /^0x730000000000000000000000000000000000000000/, + '0x73........................................', + ); + return !_.isNull(bytecode.match(bytecodeRegex)); + }) as ContractData; if (_.isUndefined(contractData)) { - throw new Error(`Unknown contract creation transaction`); + if (this._verbose) { + // tslint:disable-next-line:no-console + console.warn(`Unknown contract creation transaction`); + } + continue; } - const bytecodeHex = contractData.bytecode.slice(2); + const bytecodeHex = bytecode.slice(2); const sourceMap = contractData.sourceMap; const pcToSourceRange = parseSourceMap( contractData.sourceCodes, @@ -178,7 +207,7 @@ export class CoverageManager { contractData.sources, ); for (let fileIndex = 0; fileIndex < contractData.sources.length; fileIndex++) { - const singleFileCoverageForTrace = this._getSingleFileCoverageForTrace( + const singleFileCoverageForTrace = CoverageManager._getSingleFileCoverageForTrace( contractData, traceInfo.coveredPcs, pcToSourceRange, diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts index 08efeaa24..f421a17fd 100644 --- a/packages/sol-cov/src/coverage_subprovider.ts +++ b/packages/sol-cov/src/coverage_subprovider.ts @@ -1,10 +1,13 @@ import { Callback, ErrorCallback, NextCallback, Subprovider } from '@0xproject/subproviders'; import { BlockParam, CallData, JSONRPCRequestPayload, TransactionTrace, TxData } from '@0xproject/types'; +import * as fs from 'fs'; import * as _ from 'lodash'; import { Lock } from 'semaphore-async-await'; +import { AbstractArtifactAdapter } from './artifact_adapters/abstract'; import { constants } from './constants'; import { CoverageManager } from './coverage_manager'; +import { getTracesByContractAddress } from './trace'; import { TraceInfoExistingContract, TraceInfoNewContract } from './types'; interface MaybeFakeTxData extends TxData { @@ -26,15 +29,15 @@ export class CoverageSubprovider extends Subprovider { private _defaultFromAddress: string; /** * Instantiates a CoverageSubprovider instance - * @param artifactsPath Path to the smart contract artifacts - * @param sourcesPath Path to the smart contract source files + * @param artifactAdapter Adapter for used artifacts format (0x, truffle, giveth, etc.) * @param defaultFromAddress default from address to use when sending transactions + * @param verbose If true, we will log any unknown transactions. Otherwise we will ignore them */ - constructor(artifactsPath: string, sourcesPath: string, defaultFromAddress: string) { + constructor(artifactAdapter: AbstractArtifactAdapter, defaultFromAddress: string, verbose: boolean = true) { super(); this._lock = new Lock(); this._defaultFromAddress = defaultFromAddress; - this._coverageManager = new CoverageManager(artifactsPath, sourcesPath, this._getContractCodeAsync.bind(this)); + this._coverageManager = new CoverageManager(artifactAdapter, this._getContractCodeAsync.bind(this), verbose); } /** * Write the test coverage results to a file in Istanbul format. @@ -119,8 +122,10 @@ export class CoverageSubprovider extends Subprovider { }; const jsonRPCResponsePayload = await this.emitPayloadAsync(payload); const trace: TransactionTrace = jsonRPCResponsePayload.result; - const coveredPcs = _.map(trace.structLogs, log => log.pc); if (address === constants.NEW_CONTRACT) { + // TODO handle calls to external contracts and contract creations from within the constructor + const structLogsOnDepth0 = _.filter(trace.structLogs, { depth: 0 }); + const coveredPcs = _.map(structLogsOnDepth0, log => log.pc); const traceInfo: TraceInfoNewContract = { coveredPcs, txHash, @@ -129,15 +134,20 @@ export class CoverageSubprovider extends Subprovider { }; this._coverageManager.appendTraceInfo(traceInfo); } else { - payload = { method: 'eth_getCode', params: [address, 'latest'] }; - const runtimeBytecode = (await this.emitPayloadAsync(payload)).result; - const traceInfo: TraceInfoExistingContract = { - coveredPcs, - txHash, - address, - runtimeBytecode, - }; - this._coverageManager.appendTraceInfo(traceInfo); + const tracesByContractAddress = getTracesByContractAddress(trace.structLogs, address); + for (const subcallAddress of _.keys(tracesByContractAddress)) { + payload = { method: 'eth_getCode', params: [subcallAddress, 'latest'] }; + const runtimeBytecode = (await this.emitPayloadAsync(payload)).result; + const traceForThatSubcall = tracesByContractAddress[subcallAddress]; + const coveredPcs = _.map(traceForThatSubcall, log => log.pc); + const traceInfo: TraceInfoExistingContract = { + coveredPcs, + txHash, + address: subcallAddress, + runtimeBytecode, + }; + this._coverageManager.appendTraceInfo(traceInfo); + } } } private async _recordCallTraceAsync(callData: Partial, blockNumber: BlockParam): Promise { diff --git a/packages/sol-cov/src/index.ts b/packages/sol-cov/src/index.ts index e5c5e5be3..18031372b 100644 --- a/packages/sol-cov/src/index.ts +++ b/packages/sol-cov/src/index.ts @@ -1 +1,5 @@ export { CoverageSubprovider } from './coverage_subprovider'; +export { ZeroExArtifactAdapter } from './artifact_adapters/0x'; +export { TruffleArtifactAdapter } from './artifact_adapters/truffle'; +export { AbstractArtifactAdapter } from './artifact_adapters/abstract'; +export { ContractData } from './types'; diff --git a/packages/sol-cov/src/trace.ts b/packages/sol-cov/src/trace.ts new file mode 100644 index 000000000..6bc28989d --- /dev/null +++ b/packages/sol-cov/src/trace.ts @@ -0,0 +1,100 @@ +import { StructLog, TransactionTrace } from '@0xproject/types'; +import { BigNumber } from '@0xproject/utils'; +import { addHexPrefix, stripHexPrefix } from 'ethereumjs-util'; +import * as fs from 'fs'; +import * as _ from 'lodash'; + +export interface TraceByContractAddress { + [contractAddress: string]: StructLog[]; +} +function padZeros(address: string) { + return addHexPrefix(_.padStart(stripHexPrefix(address), 40, '0')); +} + +export function getTracesByContractAddress(structLogs: StructLog[], startAddress: string): TraceByContractAddress { + const traceByContractAddress: TraceByContractAddress = {}; + let currentTraceSegment = []; + const callStack = [startAddress]; + // tslint:disable-next-line: prefer-for-of + for (let i = 0; i < structLogs.length; ++i) { + const structLog = structLogs[i]; + if (structLog.depth !== callStack.length - 1) { + throw new Error("Malformed trace. trace depth doesn't match call stack depth"); + } + // After that check we have a guarantee that call stack is never empty + // If it would: callStack.length - 1 === structLog.depth === -1 + // That means that we can always safely pop from it + currentTraceSegment.push(structLog); + + if (structLog.op === 'DELEGATECALL') { + const currentAddress = _.last(callStack) as string; + const jumpAddressOffset = 4; + const newAddress = padZeros(new BigNumber(addHexPrefix(structLog.stack[jumpAddressOffset])).toString(16)); + callStack.push(newAddress); + traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( + currentTraceSegment, + ); + currentTraceSegment = []; + } else if (structLog.op === 'RETURN') { + const currentAddress = callStack.pop() as string; + traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( + currentTraceSegment, + ); + currentTraceSegment = []; + } else if (structLog.op === 'STOP') { + const currentAddress = callStack.pop() as string; + traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( + currentTraceSegment, + ); + currentTraceSegment = []; + if (i !== structLogs.length - 1) { + throw new Error('Malformed trace. STOP is not the last opcode executed'); + } + } else if (structLog.op === 'CREATE') { + console.warn( + "Detected a contract created from within another contract. Sol-cov currently doesn't support that scenario. We'll just skip that trace", + ); + return traceByContractAddress; + } else if (structLog.op === 'CALL') { + const currentAddress = _.last(callStack) as string; + const jumpAddressOffset = 2; + const newAddress = padZeros(new BigNumber(addHexPrefix(structLog.stack[jumpAddressOffset])).toString(16)); + callStack.push(newAddress); + traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( + currentTraceSegment, + ); + currentTraceSegment = []; + } else if (structLog.op === 'CALLCODE') { + throw new Error('CALLCODE opcode unsupported by coverage'); + } else if (structLog.op === 'STATICCALL') { + throw new Error('STATICCALL opcode unsupported by coverage'); + } else if (structLog.op === 'REVERT') { + const currentAddress = callStack.pop() as string; + traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( + currentTraceSegment, + ); + currentTraceSegment = []; + if (i !== structLogs.length - 1) { + throw new Error('Malformed trace. REVERT is not the last opcode executed'); + } + } else if (structLog.op === 'INVALID') { + const currentAddress = callStack.pop() as string; + traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( + currentTraceSegment, + ); + currentTraceSegment = []; + if (i !== structLogs.length - 1) { + throw new Error('Malformed trace. INVALID is not the last opcode executed'); + } + } else if (structLog.op === 'SELFDESTRUCT') { + throw new Error('SELFDESTRUCT opcode unsupported by coverage'); + } + } + if (callStack.length !== 0) { + throw new Error('Malformed trace. Call stack non empty at the end'); + } + if (currentTraceSegment.length !== 0) { + throw new Error('Malformed trace. currentTraceSegment non empty at the end'); + } + return traceByContractAddress; +} diff --git a/packages/sol-cov/test/collect_contracts_data_test.ts b/packages/sol-cov/test/collect_contracts_data_test.ts index d84ac5a39..906b7f4e2 100644 --- a/packages/sol-cov/test/collect_contracts_data_test.ts +++ b/packages/sol-cov/test/collect_contracts_data_test.ts @@ -4,16 +4,17 @@ import 'make-promises-safe'; import 'mocha'; import * as path from 'path'; -import { collectContractsData } from '../src/collect_contract_data'; +import { ZeroExArtifactAdapter } from '../src/artifact_adapters/0x'; const expect = chai.expect; describe('Collect contracts data', () => { describe('#collectContractsData', () => { - it('correctly collects contracts data', () => { + it('correctly collects contracts data', async () => { const artifactsPath = path.resolve(__dirname, 'fixtures/artifacts'); const sourcesPath = path.resolve(__dirname, 'fixtures/contracts'); - const contractsData = collectContractsData(artifactsPath, sourcesPath); + const zeroExArtifactsAdapter = new ZeroExArtifactAdapter(artifactsPath, sourcesPath); + const contractsData = await zeroExArtifactsAdapter.collectContractsDataAsync(); _.forEach(contractsData, contractData => { expect(contractData).to.have.keys([ 'sourceCodes', diff --git a/packages/sol-cov/test/trace_test.ts b/packages/sol-cov/test/trace_test.ts new file mode 100644 index 000000000..b9d846732 --- /dev/null +++ b/packages/sol-cov/test/trace_test.ts @@ -0,0 +1,57 @@ +import { StructLog } from '@0xproject/types'; +import * as chai from 'chai'; +import * as fs from 'fs'; +import * as _ from 'lodash'; +import 'mocha'; +import * as path from 'path'; + +import { getTracesByContractAddress } from '../src/trace'; + +const expect = chai.expect; + +const DEFAULT_STRUCT_LOG: StructLog = { + depth: 0, + error: '', + gas: 0, + gasCost: 0, + memory: [], + op: 'DEFAULT', + pc: 0, + stack: [], + storage: {}, +}; + +function addDefaultStructLogFields(compactStructLog: Partial & { op: string; depth: number }): StructLog { + return { ...DEFAULT_STRUCT_LOG, ...compactStructLog }; +} + +describe('Trace', () => { + describe('#getTracesByContractAddress', () => { + it('correctly splits trace by contract address', () => { + const delegateCallAddress = '0x0000000000000000000000000000000000000002'; + const trace = [ + { + op: 'DELEGATECALL', + stack: ['0x', '0x', delegateCallAddress], + depth: 0, + }, + { + op: 'RETURN', + depth: 1, + }, + { + op: 'RETURN', + depth: 0, + }, + ]; + const fullTrace = _.map(trace, compactStructLog => addDefaultStructLogFields(compactStructLog)); + const startAddress = '0x0000000000000000000000000000000000000001'; + const traceByContractAddress = getTracesByContractAddress(fullTrace, startAddress); + const expectedTraceByContractAddress = { + [startAddress]: [fullTrace[0], fullTrace[2]], + [delegateCallAddress]: [fullTrace[1]], + }; + expect(traceByContractAddress).to.be.deep.equal(expectedTraceByContractAddress); + }); + }); +}); -- cgit v1.2.3 From 427a29145d90070e8c67753e7f76c7b88322eefb Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 15 May 2018 11:13:01 +0200 Subject: Support all opcodes in a trace parser --- packages/sol-cov/src/trace.ts | 72 +++++++++++++------------------------ packages/sol-cov/test/trace_test.ts | 12 +++---- packages/types/src/index.ts | 13 ++++++- packages/utils/src/log_utils.ts | 3 ++ 4 files changed, 45 insertions(+), 55 deletions(-) diff --git a/packages/sol-cov/src/trace.ts b/packages/sol-cov/src/trace.ts index 6bc28989d..febb1034e 100644 --- a/packages/sol-cov/src/trace.ts +++ b/packages/sol-cov/src/trace.ts @@ -1,5 +1,5 @@ -import { StructLog, TransactionTrace } from '@0xproject/types'; -import { BigNumber } from '@0xproject/utils'; +import { OpCode, StructLog, TransactionTrace } from '@0xproject/types'; +import { BigNumber, logUtils } from '@0xproject/utils'; import { addHexPrefix, stripHexPrefix } from 'ethereumjs-util'; import * as fs from 'fs'; import * as _ from 'lodash'; @@ -26,68 +26,44 @@ export function getTracesByContractAddress(structLogs: StructLog[], startAddress // That means that we can always safely pop from it currentTraceSegment.push(structLog); - if (structLog.op === 'DELEGATECALL') { + if ( + structLog.op === OpCode.CallCode || + structLog.op === OpCode.StaticCall || + structLog.op === OpCode.Call || + structLog.op === OpCode.DelegateCall + ) { const currentAddress = _.last(callStack) as string; - const jumpAddressOffset = 4; + const jumpAddressOffset = structLog.op === OpCode.DelegateCall ? 4 : 2; const newAddress = padZeros(new BigNumber(addHexPrefix(structLog.stack[jumpAddressOffset])).toString(16)); callStack.push(newAddress); traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( currentTraceSegment, ); currentTraceSegment = []; - } else if (structLog.op === 'RETURN') { + } else if ( + structLog.op === OpCode.Return || + structLog.op === OpCode.Stop || + structLog.op === OpCode.Revert || + structLog.op === OpCode.Invalid || + structLog.op === OpCode.SelfDestruct + ) { const currentAddress = callStack.pop() as string; traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( currentTraceSegment, ); currentTraceSegment = []; - } else if (structLog.op === 'STOP') { - const currentAddress = callStack.pop() as string; - traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( - currentTraceSegment, - ); - currentTraceSegment = []; - if (i !== structLogs.length - 1) { - throw new Error('Malformed trace. STOP is not the last opcode executed'); + if (structLog.op === OpCode.SelfDestruct) { + // TODO: Record contract bytecode before the selfdestruct and handle that scenario + logUtils.warn( + "Detected a selfdestruct. Sol-cov currently doesn't support that scenario. We'll just skip the trace part for a destructed contract", + ); } - } else if (structLog.op === 'CREATE') { - console.warn( + } else if (structLog.op === OpCode.Create) { + // TODO: Extract the new contract address from the stack and handle that scenario + logUtils.warn( "Detected a contract created from within another contract. Sol-cov currently doesn't support that scenario. We'll just skip that trace", ); return traceByContractAddress; - } else if (structLog.op === 'CALL') { - const currentAddress = _.last(callStack) as string; - const jumpAddressOffset = 2; - const newAddress = padZeros(new BigNumber(addHexPrefix(structLog.stack[jumpAddressOffset])).toString(16)); - callStack.push(newAddress); - traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( - currentTraceSegment, - ); - currentTraceSegment = []; - } else if (structLog.op === 'CALLCODE') { - throw new Error('CALLCODE opcode unsupported by coverage'); - } else if (structLog.op === 'STATICCALL') { - throw new Error('STATICCALL opcode unsupported by coverage'); - } else if (structLog.op === 'REVERT') { - const currentAddress = callStack.pop() as string; - traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( - currentTraceSegment, - ); - currentTraceSegment = []; - if (i !== structLogs.length - 1) { - throw new Error('Malformed trace. REVERT is not the last opcode executed'); - } - } else if (structLog.op === 'INVALID') { - const currentAddress = callStack.pop() as string; - traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( - currentTraceSegment, - ); - currentTraceSegment = []; - if (i !== structLogs.length - 1) { - throw new Error('Malformed trace. INVALID is not the last opcode executed'); - } - } else if (structLog.op === 'SELFDESTRUCT') { - throw new Error('SELFDESTRUCT opcode unsupported by coverage'); } } if (callStack.length !== 0) { diff --git a/packages/sol-cov/test/trace_test.ts b/packages/sol-cov/test/trace_test.ts index b9d846732..58b9203b0 100644 --- a/packages/sol-cov/test/trace_test.ts +++ b/packages/sol-cov/test/trace_test.ts @@ -1,4 +1,4 @@ -import { StructLog } from '@0xproject/types'; +import { OpCode, StructLog } from '@0xproject/types'; import * as chai from 'chai'; import * as fs from 'fs'; import * as _ from 'lodash'; @@ -15,13 +15,13 @@ const DEFAULT_STRUCT_LOG: StructLog = { gas: 0, gasCost: 0, memory: [], - op: 'DEFAULT', + op: OpCode.Invalid, pc: 0, stack: [], storage: {}, }; -function addDefaultStructLogFields(compactStructLog: Partial & { op: string; depth: number }): StructLog { +function addDefaultStructLogFields(compactStructLog: Partial & { op: OpCode; depth: number }): StructLog { return { ...DEFAULT_STRUCT_LOG, ...compactStructLog }; } @@ -31,16 +31,16 @@ describe('Trace', () => { const delegateCallAddress = '0x0000000000000000000000000000000000000002'; const trace = [ { - op: 'DELEGATECALL', + op: OpCode.DelegateCall, stack: ['0x', '0x', delegateCallAddress], depth: 0, }, { - op: 'RETURN', + op: OpCode.Return, depth: 1, }, { - op: 'RETURN', + op: OpCode.Return, depth: 0, }, ]; diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index f28c2f9a3..055c47e0a 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -58,7 +58,18 @@ export interface DataItem { components?: DataItem[]; } -export type OpCode = string; +export enum OpCode { + DelegateCall = 'DELEGATECALL', + Revert = 'REVERT', + Create = 'CREATE', + Stop = 'STOP', + Invalid = 'INVALID', + CallCode = 'CALLCODE', + StaticCall = 'STATICCALL', + Return = 'RETURN', + Call = 'CALL', + SelfDestruct = 'SELFDESTRUCT', +} export interface StructLog { depth: number; diff --git a/packages/utils/src/log_utils.ts b/packages/utils/src/log_utils.ts index d0f0e34c9..87f8479b5 100644 --- a/packages/utils/src/log_utils.ts +++ b/packages/utils/src/log_utils.ts @@ -2,4 +2,7 @@ export const logUtils = { log(...args: any[]): void { console.log(...args); // tslint:disable-line:no-console }, + warn(...args: any[]): void { + console.warn(...args); // tslint:disable-line:no-console + }, }; -- cgit v1.2.3 From b86248f13fcb8f326098252beee6ca557e0175e7 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 15 May 2018 11:29:52 +0200 Subject: Add CHANGELOG entries --- packages/dev-utils/CHANGELOG.json | 4 + packages/sol-compiler/CHANGELOG.json | 4 + packages/sol-cov/CHANGELOG.json | 21 + packages/sol-resolver/CHANGELOG.json | 13 + packages/testnet-faucets/bin/server.js | 780 +++++++++++++++++++++++++++++ packages/testnet-faucets/bin/server.js.map | 1 + packages/types/CHANGELOG.json | 4 + packages/utils/CHANGELOG.json | 9 + 8 files changed, 836 insertions(+) create mode 100644 packages/testnet-faucets/bin/server.js create mode 100644 packages/testnet-faucets/bin/server.js.map diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index 3f70a93cc..72ecdbabb 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -2,6 +2,10 @@ { "version": "0.4.2", "changes": [ + { + "note": "Pass ZeroExArtifactsAdapter to CoverageSubprovider", + "pr": 589 + }, { "note": "Move callbackErrorReporter over from 0x.js", "pr": 579 diff --git a/packages/sol-compiler/CHANGELOG.json b/packages/sol-compiler/CHANGELOG.json index a1b53fb9e..35f2c6179 100644 --- a/packages/sol-compiler/CHANGELOG.json +++ b/packages/sol-compiler/CHANGELOG.json @@ -5,6 +5,10 @@ { "note": "Properly export the executable binary", "pr": 588 + }, + { + "note": "Add a possibility to define a solidity version to use", + "pr": 589 } ] }, diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json index 468957fe3..9c978df5a 100644 --- a/packages/sol-cov/CHANGELOG.json +++ b/packages/sol-cov/CHANGELOG.json @@ -1,4 +1,25 @@ [ + { + "version": "0.1.0", + "changes": [ + { + "note": "Add artifact adapter as a parameter for CoverageSubprovider. Export AbstractArtifactAdapter", + "pr": 589 + }, + { + "note": "Implement ZeroExArtiactAdapter and TruffleArtifactAdapter", + "pr": 589 + }, + { + "note": "Properly parse multi-level traces", + "pr": 589 + }, + { + "note": "Add support for solidity libraries", + "pr": 589 + } + ] + }, { "timestamp": 1525477860, "version": "0.0.10", diff --git a/packages/sol-resolver/CHANGELOG.json b/packages/sol-resolver/CHANGELOG.json index 0126fa170..eb52d85e0 100644 --- a/packages/sol-resolver/CHANGELOG.json +++ b/packages/sol-resolver/CHANGELOG.json @@ -1,4 +1,17 @@ [ + { + "version": "0.0.5", + "changes": [ + { + "note": "Fix a bug in FsResolver trying to read directories as files", + "pr": 589 + }, + { + "note": "Fix a bug in NameResolver not ignoring .sol files", + "pr": 589 + } + ] + }, { "timestamp": 1525477860, "version": "0.0.4", diff --git a/packages/testnet-faucets/bin/server.js b/packages/testnet-faucets/bin/server.js new file mode 100644 index 000000000..bee332843 --- /dev/null +++ b/packages/testnet-faucets/bin/server.js @@ -0,0 +1,780 @@ +require("source-map-support").install(); +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 6); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + +module.exports = require("@0xproject/utils"); + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.configs = { + DISPENSER_ADDRESS: process.env.DISPENSER_ADDRESS.toLowerCase(), + DISPENSER_PRIVATE_KEY: process.env.DISPENSER_PRIVATE_KEY, + ENVIRONMENT: process.env.FAUCET_ENVIRONMENT, + INFURA_API_KEY: process.env.INFURA_API_KEY, + ROLLBAR_ACCESS_KEY: process.env.FAUCET_ROLLBAR_ACCESS_KEY, +}; + + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + +module.exports = require("lodash"); + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var utils_1 = __webpack_require__(0); +var rollbar = __webpack_require__(10); +var configs_1 = __webpack_require__(1); +exports.errorReporter = { + setup: function () { + var _this = this; + rollbar.init(configs_1.configs.ROLLBAR_ACCESS_KEY, { + environment: configs_1.configs.ENVIRONMENT, + }); + rollbar.handleUncaughtExceptions(configs_1.configs.ROLLBAR_ACCESS_KEY); + process.on('unhandledRejection', function (err) { return __awaiter(_this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + utils_1.logUtils.log("Uncaught exception " + err + ". Stack: " + err.stack); + return [4 /*yield*/, this.reportAsync(err)]; + case 1: + _a.sent(); + process.exit(1); + return [2 /*return*/]; + } + }); + }); }); + }, + reportAsync: function (err, req) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + if (configs_1.configs.ENVIRONMENT === 'development') { + return [2 /*return*/]; // Do not log development environment errors + } + return [2 /*return*/, new Promise(function (resolve, reject) { + rollbar.handleError(err, req, function (rollbarErr) { + if (rollbarErr) { + utils_1.logUtils.log("Error reporting to rollbar, ignoring: " + rollbarErr); + reject(rollbarErr); + } + else { + resolve(); + } + }); + })]; + }); + }); + }, + errorHandler: function () { + return rollbar.errorHandler(configs_1.configs.ROLLBAR_ACCESS_KEY); + }, +}; + + +/***/ }), +/* 4 */ +/***/ (function(module, exports) { + +module.exports = require("0x.js"); + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var configs_1 = __webpack_require__(1); +var productionRpcUrls = { + '3': "https://ropsten.infura.io/" + configs_1.configs.INFURA_API_KEY, + '4': "https://rinkeby.infura.io/" + configs_1.configs.INFURA_API_KEY, + '42': "https://kovan.infura.io/" + configs_1.configs.INFURA_API_KEY, +}; +var developmentRpcUrls = { + '50': 'http://127.0.0.1:8545', +}; +exports.rpcUrls = configs_1.configs.ENVIRONMENT === 'development' ? developmentRpcUrls : productionRpcUrls; + + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(7); + + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var bodyParser = __webpack_require__(8); +var express = __webpack_require__(9); +var error_reporter_1 = __webpack_require__(3); +var handler_1 = __webpack_require__(11); +var parameter_transformer_1 = __webpack_require__(18); +// Setup the errorReporter to catch uncaught exceptions and unhandled rejections +error_reporter_1.errorReporter.setup(); +var app = express(); +app.use(bodyParser.json()); // for parsing application/json +app.use(function (req, res, next) { + res.header('Access-Control-Allow-Origin', '*'); + res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); + next(); +}); +var handler = new handler_1.Handler(); +app.get('/ping', function (req, res) { + res.status(200).send('pong'); +}); +app.get('/info', handler.getQueueInfo.bind(handler)); +app.get('/ether/:recipient', parameter_transformer_1.parameterTransformer.transform, handler.dispenseEther.bind(handler)); +app.get('/zrx/:recipient', parameter_transformer_1.parameterTransformer.transform, handler.dispenseZRX.bind(handler)); +app.get('/order/weth/:recipient', parameter_transformer_1.parameterTransformer.transform, handler.dispenseWETHOrder.bind(handler)); +app.get('/order/zrx/:recipient', parameter_transformer_1.parameterTransformer.transform, handler.dispenseZRXOrder.bind(handler)); +// Log to rollbar any errors unhandled by handlers +app.use(error_reporter_1.errorReporter.errorHandler()); +var port = process.env.PORT || 3000; +app.listen(port); + + +/***/ }), +/* 8 */ +/***/ (function(module, exports) { + +module.exports = require("body-parser"); + +/***/ }), +/* 9 */ +/***/ (function(module, exports) { + +module.exports = require("express"); + +/***/ }), +/* 10 */ +/***/ (function(module, exports) { + +module.exports = require("rollbar"); + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var _0x_js_1 = __webpack_require__(4); +var utils_1 = __webpack_require__(0); +var _ = __webpack_require__(2); +var Web3 = __webpack_require__(12); +// HACK: web3 injects XMLHttpRequest into the global scope and ProviderEngine checks XMLHttpRequest +// to know whether it is running in a browser or node environment. We need it to be undefined since +// we are not running in a browser env. +// Filed issue: https://github.com/ethereum/web3.js/issues/844 +global.XMLHttpRequest = undefined; +var subproviders_1 = __webpack_require__(13); +var ProviderEngine = __webpack_require__(14); +var RpcSubprovider = __webpack_require__(15); +var configs_1 = __webpack_require__(1); +var dispatch_queue_1 = __webpack_require__(16); +var dispense_asset_tasks_1 = __webpack_require__(17); +var rpc_urls_1 = __webpack_require__(5); +var RequestedAssetType; +(function (RequestedAssetType) { + RequestedAssetType["ETH"] = "ETH"; + RequestedAssetType["WETH"] = "WETH"; + RequestedAssetType["ZRX"] = "ZRX"; +})(RequestedAssetType || (RequestedAssetType = {})); +var FIVE_DAYS_IN_MS = 4.32e8; // TODO: make this configurable +var Handler = /** @class */ (function () { + function Handler() { + var _this = this; + this._networkConfigByNetworkId = {}; + _.forIn(rpc_urls_1.rpcUrls, function (rpcUrl, networkId) { + var providerObj = Handler._createProviderEngine(rpcUrl); + var web3 = new Web3(providerObj); + var zeroExConfig = { + networkId: +networkId, + }; + var zeroEx = new _0x_js_1.ZeroEx(web3.currentProvider, zeroExConfig); + var dispatchQueue = new dispatch_queue_1.DispatchQueue(); + _this._networkConfigByNetworkId[networkId] = { + dispatchQueue: dispatchQueue, + web3: web3, + zeroEx: zeroEx, + }; + }); + } + Handler._createProviderEngine = function (rpcUrl) { + if (_.isUndefined(configs_1.configs.DISPENSER_PRIVATE_KEY)) { + throw new Error('Dispenser Private key not found'); + } + var engine = new ProviderEngine(); + engine.addProvider(new subproviders_1.NonceTrackerSubprovider()); + engine.addProvider(new subproviders_1.PrivateKeyWalletSubprovider(configs_1.configs.DISPENSER_PRIVATE_KEY)); + engine.addProvider(new RpcSubprovider({ + rpcUrl: rpcUrl, + })); + engine.start(); + return engine; + }; + Handler.prototype.getQueueInfo = function (req, res) { + var _this = this; + res.setHeader('Content-Type', 'application/json'); + var queueInfo = _.mapValues(rpc_urls_1.rpcUrls, function (rpcUrl, networkId) { + var dispatchQueue = _this._networkConfigByNetworkId[networkId].dispatchQueue; + return { + full: dispatchQueue.isFull(), + size: dispatchQueue.size(), + }; + }); + var payload = JSON.stringify(queueInfo); + res.status(200).send(payload); + }; + Handler.prototype.dispenseEther = function (req, res) { + this._dispenseAsset(req, res, RequestedAssetType.ETH); + }; + Handler.prototype.dispenseZRX = function (req, res) { + this._dispenseAsset(req, res, RequestedAssetType.ZRX); + }; + Handler.prototype.dispenseWETHOrder = function (req, res) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this._dispenseOrder(req, res, RequestedAssetType.WETH)]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }); + }; + Handler.prototype.dispenseZRXOrder = function (req, res, next) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this._dispenseOrder(req, res, RequestedAssetType.ZRX)]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }); + }; + Handler.prototype._dispenseAsset = function (req, res, requestedAssetType) { + var networkId = req.params.networkId; + var recipient = req.params.recipient; + var networkConfig = this._networkConfigByNetworkId[networkId]; + var dispenserTask; + switch (requestedAssetType) { + case RequestedAssetType.ETH: + dispenserTask = dispense_asset_tasks_1.dispenseAssetTasks.dispenseEtherTask(recipient, networkConfig.web3); + break; + case RequestedAssetType.WETH: + case RequestedAssetType.ZRX: + dispenserTask = dispense_asset_tasks_1.dispenseAssetTasks.dispenseTokenTask(recipient, requestedAssetType, networkConfig.zeroEx); + break; + default: + throw new Error("Unsupported asset type: " + requestedAssetType); + } + var didAddToQueue = networkConfig.dispatchQueue.add(dispenserTask); + if (!didAddToQueue) { + res.status(503).send('QUEUE_IS_FULL'); + return; + } + utils_1.logUtils.log("Added " + recipient + " to queue: " + requestedAssetType + " networkId: " + networkId); + res.status(200).end(); + }; + Handler.prototype._dispenseOrder = function (req, res, requestedAssetType) { + return __awaiter(this, void 0, void 0, function () { + var networkConfig, zeroEx, makerToken, takerTokenSymbol, takerToken, makerTokenAmount, takerTokenAmount, order, orderHash, signature, signedOrder, signedOrderHash, payload; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + networkConfig = _.get(this._networkConfigByNetworkId, req.params.networkId); + if (_.isUndefined(networkConfig)) { + res.status(400).send('UNSUPPORTED_NETWORK_ID'); + return [2 /*return*/]; + } + zeroEx = networkConfig.zeroEx; + res.setHeader('Content-Type', 'application/json'); + return [4 /*yield*/, zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(requestedAssetType)]; + case 1: + makerToken = _a.sent(); + if (_.isUndefined(makerToken)) { + throw new Error("Unsupported asset type: " + requestedAssetType); + } + takerTokenSymbol = requestedAssetType === RequestedAssetType.WETH ? RequestedAssetType.ZRX : RequestedAssetType.WETH; + return [4 /*yield*/, zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(takerTokenSymbol)]; + case 2: + takerToken = _a.sent(); + if (_.isUndefined(takerToken)) { + throw new Error("Unsupported asset type: " + requestedAssetType); + } + makerTokenAmount = _0x_js_1.ZeroEx.toBaseUnitAmount(new utils_1.BigNumber(0.1), makerToken.decimals); + takerTokenAmount = _0x_js_1.ZeroEx.toBaseUnitAmount(new utils_1.BigNumber(0.1), takerToken.decimals); + order = { + maker: configs_1.configs.DISPENSER_ADDRESS, + taker: req.params.recipient, + makerFee: new utils_1.BigNumber(0), + takerFee: new utils_1.BigNumber(0), + makerTokenAmount: makerTokenAmount, + takerTokenAmount: takerTokenAmount, + makerTokenAddress: makerToken.address, + takerTokenAddress: takerToken.address, + salt: _0x_js_1.ZeroEx.generatePseudoRandomSalt(), + exchangeContractAddress: zeroEx.exchange.getContractAddress(), + feeRecipient: _0x_js_1.ZeroEx.NULL_ADDRESS, + expirationUnixTimestampSec: new utils_1.BigNumber(Date.now() + FIVE_DAYS_IN_MS), + }; + orderHash = _0x_js_1.ZeroEx.getOrderHashHex(order); + return [4 /*yield*/, zeroEx.signOrderHashAsync(orderHash, configs_1.configs.DISPENSER_ADDRESS, false)]; + case 3: + signature = _a.sent(); + signedOrder = __assign({}, order, { ecSignature: signature }); + signedOrderHash = _0x_js_1.ZeroEx.getOrderHashHex(signedOrder); + payload = JSON.stringify(signedOrder); + utils_1.logUtils.log("Dispensed signed order: " + payload); + res.status(200).send(payload); + return [2 /*return*/]; + } + }); + }); + }; + return Handler; +}()); +exports.Handler = Handler; + + +/***/ }), +/* 12 */ +/***/ (function(module, exports) { + +module.exports = require("web3"); + +/***/ }), +/* 13 */ +/***/ (function(module, exports) { + +module.exports = require("@0xproject/subproviders"); + +/***/ }), +/* 14 */ +/***/ (function(module, exports) { + +module.exports = require("web3-provider-engine"); + +/***/ }), +/* 15 */ +/***/ (function(module, exports) { + +module.exports = require("web3-provider-engine/subproviders/rpc"); + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var utils_1 = __webpack_require__(0); +var _ = __webpack_require__(2); +var error_reporter_1 = __webpack_require__(3); +var MAX_QUEUE_SIZE = 500; +var DEFAULT_QUEUE_INTERVAL_MS = 1000; +var DispatchQueue = /** @class */ (function () { + function DispatchQueue() { + this._queueIntervalMs = DEFAULT_QUEUE_INTERVAL_MS; + this._queue = []; + this._start(); + } + DispatchQueue.prototype.add = function (taskAsync) { + if (this.isFull()) { + return false; + } + this._queue.push(taskAsync); + return true; + }; + DispatchQueue.prototype.size = function () { + return this._queue.length; + }; + DispatchQueue.prototype.isFull = function () { + return this.size() >= MAX_QUEUE_SIZE; + }; + DispatchQueue.prototype.stop = function () { + if (!_.isUndefined(this._queueIntervalIdIfExists)) { + utils_1.intervalUtils.clearAsyncExcludingInterval(this._queueIntervalIdIfExists); + } + }; + DispatchQueue.prototype._start = function () { + var _this = this; + this._queueIntervalIdIfExists = utils_1.intervalUtils.setAsyncExcludingInterval(function () { return __awaiter(_this, void 0, void 0, function () { + var taskAsync; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + taskAsync = this._queue.shift(); + if (_.isUndefined(taskAsync)) { + return [2 /*return*/, Promise.resolve()]; + } + return [4 /*yield*/, taskAsync()]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }); }, this._queueIntervalMs, function (err) { + utils_1.logUtils.log("Unexpected err: " + err + " - " + JSON.stringify(err)); + // tslint:disable-next-line:no-floating-promises + error_reporter_1.errorReporter.reportAsync(err); + }); + }; + return DispatchQueue; +}()); +exports.DispatchQueue = DispatchQueue; + + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var _0x_js_1 = __webpack_require__(4); +var utils_1 = __webpack_require__(0); +var _ = __webpack_require__(2); +var configs_1 = __webpack_require__(1); +var DISPENSE_AMOUNT_ETHER = 0.1; +var DISPENSE_AMOUNT_TOKEN = 0.1; +var DISPENSE_MAX_AMOUNT_TOKEN = 2; +var DISPENSE_MAX_AMOUNT_ETHER = 2; +exports.dispenseAssetTasks = { + dispenseEtherTask: function (recipientAddress, web3) { + var _this = this; + return function () { return __awaiter(_this, void 0, void 0, function () { + var userBalance, maxAmountInWei, sendTransactionAsync, txHash; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + utils_1.logUtils.log("Processing ETH " + recipientAddress); + return [4 /*yield*/, utils_1.promisify(web3.eth.getBalance)(recipientAddress)]; + case 1: + userBalance = _a.sent(); + maxAmountInWei = new utils_1.BigNumber(web3.toWei(DISPENSE_MAX_AMOUNT_ETHER, 'ether')); + if (userBalance.greaterThanOrEqualTo(maxAmountInWei)) { + utils_1.logUtils.log("User exceeded ETH balance maximum (" + maxAmountInWei + ") " + recipientAddress + " " + userBalance + " "); + return [2 /*return*/]; + } + sendTransactionAsync = utils_1.promisify(web3.eth.sendTransaction); + return [4 /*yield*/, sendTransactionAsync({ + from: configs_1.configs.DISPENSER_ADDRESS, + to: recipientAddress, + value: web3.toWei(DISPENSE_AMOUNT_ETHER, 'ether'), + })]; + case 2: + txHash = _a.sent(); + utils_1.logUtils.log("Sent " + DISPENSE_AMOUNT_ETHER + " ETH to " + recipientAddress + " tx: " + txHash); + return [2 /*return*/]; + } + }); + }); }; + }, + dispenseTokenTask: function (recipientAddress, tokenSymbol, zeroEx) { + var _this = this; + return function () { return __awaiter(_this, void 0, void 0, function () { + var amountToDispense, token, baseUnitAmount, userBalanceBaseUnits, maxAmountBaseUnits, txHash; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + utils_1.logUtils.log("Processing " + tokenSymbol + " " + recipientAddress); + amountToDispense = new utils_1.BigNumber(DISPENSE_AMOUNT_TOKEN); + return [4 /*yield*/, zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(tokenSymbol)]; + case 1: + token = _a.sent(); + if (_.isUndefined(token)) { + throw new Error("Unsupported asset type: " + tokenSymbol); + } + baseUnitAmount = _0x_js_1.ZeroEx.toBaseUnitAmount(amountToDispense, token.decimals); + return [4 /*yield*/, zeroEx.token.getBalanceAsync(token.address, recipientAddress)]; + case 2: + userBalanceBaseUnits = _a.sent(); + maxAmountBaseUnits = _0x_js_1.ZeroEx.toBaseUnitAmount(new utils_1.BigNumber(DISPENSE_MAX_AMOUNT_TOKEN), token.decimals); + if (userBalanceBaseUnits.greaterThanOrEqualTo(maxAmountBaseUnits)) { + utils_1.logUtils.log("User exceeded token balance maximum (" + maxAmountBaseUnits + ") " + recipientAddress + " " + userBalanceBaseUnits + " "); + return [2 /*return*/]; + } + return [4 /*yield*/, zeroEx.token.transferAsync(token.address, configs_1.configs.DISPENSER_ADDRESS, recipientAddress, baseUnitAmount)]; + case 3: + txHash = _a.sent(); + utils_1.logUtils.log("Sent " + amountToDispense + " ZRX to " + recipientAddress + " tx: " + txHash); + return [2 /*return*/]; + } + }); + }); }; + }, +}; + + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var utils_1 = __webpack_require__(0); +var _ = __webpack_require__(2); +var rpc_urls_1 = __webpack_require__(5); +var DEFAULT_NETWORK_ID = 42; // kovan +exports.parameterTransformer = { + transform: function (req, res, next) { + var recipientAddress = req.params.recipient; + if (_.isUndefined(recipientAddress) || !utils_1.addressUtils.isAddress(recipientAddress)) { + res.status(400).send('INVALID_RECIPIENT_ADDRESS'); + return; + } + var lowerCaseRecipientAddress = recipientAddress.toLowerCase(); + req.params.recipient = lowerCaseRecipientAddress; + var networkId = _.get(req.query, 'networkId', DEFAULT_NETWORK_ID); + var rpcUrlIfExists = _.get(rpc_urls_1.rpcUrls, networkId); + if (_.isUndefined(rpcUrlIfExists)) { + res.status(400).send('UNSUPPORTED_NETWORK_ID'); + return; + } + req.params.networkId = networkId; + next(); + }, +}; + + +/***/ }) +/******/ ]); +//# sourceMappingURL=server.js.map \ No newline at end of file diff --git a/packages/testnet-faucets/bin/server.js.map b/packages/testnet-faucets/bin/server.js.map new file mode 100644 index 000000000..c8c227727 --- /dev/null +++ b/packages/testnet-faucets/bin/server.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/bootstrap b91d2cee364b5e101d43","webpack:///external \"@0xproject/utils\"","webpack:///./src/ts/configs.ts","webpack:///external \"lodash\"","webpack:///./src/ts/error_reporter.ts","webpack:///external \"0x.js\"","webpack:///./src/ts/rpc_urls.ts","webpack:///./src/ts/server.ts","webpack:///external \"body-parser\"","webpack:///external \"express\"","webpack:///external \"rollbar\"","webpack:///./src/ts/handler.ts","webpack:///external \"web3\"","webpack:///external \"@0xproject/subproviders\"","webpack:///external \"web3-provider-engine\"","webpack:///external \"web3-provider-engine/subproviders/rpc\"","webpack:///./src/ts/dispatch_queue.ts","webpack:///./src/ts/dispense_asset_tasks.ts","webpack:///./src/ts/parameter_transformer.ts"],"names":[],"mappings":"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","file":"server.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap b91d2cee364b5e101d43","module.exports = require(\"@0xproject/utils\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@0xproject/utils\"\n// module id = 0\n// module chunks = 0","export const configs = {\n DISPENSER_ADDRESS: (process.env.DISPENSER_ADDRESS as string).toLowerCase(),\n DISPENSER_PRIVATE_KEY: process.env.DISPENSER_PRIVATE_KEY,\n ENVIRONMENT: process.env.FAUCET_ENVIRONMENT,\n INFURA_API_KEY: process.env.INFURA_API_KEY,\n ROLLBAR_ACCESS_KEY: process.env.FAUCET_ROLLBAR_ACCESS_KEY,\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/configs.ts","module.exports = require(\"lodash\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"lodash\"\n// module id = 2\n// module chunks = 0","import { logUtils } from '@0xproject/utils';\nimport * as express from 'express';\nimport rollbar = require('rollbar');\n\nimport { configs } from './configs';\n\nexport const errorReporter = {\n setup() {\n rollbar.init(configs.ROLLBAR_ACCESS_KEY, {\n environment: configs.ENVIRONMENT,\n });\n rollbar.handleUncaughtExceptions(configs.ROLLBAR_ACCESS_KEY);\n process.on('unhandledRejection', async (err: Error) => {\n logUtils.log(`Uncaught exception ${err}. Stack: ${err.stack}`);\n await this.reportAsync(err);\n process.exit(1);\n });\n },\n async reportAsync(err: Error, req?: express.Request): Promise {\n if (configs.ENVIRONMENT === 'development') {\n return; // Do not log development environment errors\n }\n return new Promise((resolve, reject) => {\n rollbar.handleError(err, req, (rollbarErr: Error) => {\n if (rollbarErr) {\n logUtils.log(`Error reporting to rollbar, ignoring: ${rollbarErr}`);\n reject(rollbarErr);\n } else {\n resolve();\n }\n });\n });\n },\n errorHandler() {\n return rollbar.errorHandler(configs.ROLLBAR_ACCESS_KEY);\n },\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/error_reporter.ts","module.exports = require(\"0x.js\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"0x.js\"\n// module id = 4\n// module chunks = 0","import { configs } from './configs';\n\nconst productionRpcUrls = {\n '3': `https://ropsten.infura.io/${configs.INFURA_API_KEY}`,\n '4': `https://rinkeby.infura.io/${configs.INFURA_API_KEY}`,\n '42': `https://kovan.infura.io/${configs.INFURA_API_KEY}`,\n};\n\nconst developmentRpcUrls = {\n '50': 'http://127.0.0.1:8545',\n};\n\nexport const rpcUrls = configs.ENVIRONMENT === 'development' ? developmentRpcUrls : productionRpcUrls;\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/rpc_urls.ts","import * as bodyParser from 'body-parser';\nimport * as express from 'express';\n\nimport { errorReporter } from './error_reporter';\nimport { Handler } from './handler';\nimport { parameterTransformer } from './parameter_transformer';\n\n// Setup the errorReporter to catch uncaught exceptions and unhandled rejections\nerrorReporter.setup();\n\nconst app = express();\napp.use(bodyParser.json()); // for parsing application/json\napp.use((req, res, next) => {\n res.header('Access-Control-Allow-Origin', '*');\n res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');\n next();\n});\n\nconst handler = new Handler();\napp.get('/ping', (req: express.Request, res: express.Response) => {\n res.status(200).send('pong');\n});\napp.get('/info', handler.getQueueInfo.bind(handler));\napp.get('/ether/:recipient', parameterTransformer.transform, handler.dispenseEther.bind(handler));\napp.get('/zrx/:recipient', parameterTransformer.transform, handler.dispenseZRX.bind(handler));\napp.get('/order/weth/:recipient', parameterTransformer.transform, handler.dispenseWETHOrder.bind(handler));\napp.get('/order/zrx/:recipient', parameterTransformer.transform, handler.dispenseZRXOrder.bind(handler));\n\n// Log to rollbar any errors unhandled by handlers\napp.use(errorReporter.errorHandler());\nconst port = process.env.PORT || 3000;\napp.listen(port);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/server.ts","module.exports = require(\"body-parser\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"body-parser\"\n// module id = 8\n// module chunks = 0","module.exports = require(\"express\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"express\"\n// module id = 9\n// module chunks = 0","module.exports = require(\"rollbar\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"rollbar\"\n// module id = 10\n// module chunks = 0","import { Order, SignedOrder, ZeroEx } from '0x.js';\nimport { BigNumber, logUtils } from '@0xproject/utils';\nimport * as express from 'express';\nimport * as _ from 'lodash';\nimport * as Web3 from 'web3';\n\n// HACK: web3 injects XMLHttpRequest into the global scope and ProviderEngine checks XMLHttpRequest\n// to know whether it is running in a browser or node environment. We need it to be undefined since\n// we are not running in a browser env.\n// Filed issue: https://github.com/ethereum/web3.js/issues/844\n(global as any).XMLHttpRequest = undefined;\nimport { NonceTrackerSubprovider, PrivateKeyWalletSubprovider } from '@0xproject/subproviders';\nimport ProviderEngine = require('web3-provider-engine');\nimport RpcSubprovider = require('web3-provider-engine/subproviders/rpc');\n\nimport { configs } from './configs';\nimport { DispatchQueue } from './dispatch_queue';\nimport { dispenseAssetTasks } from './dispense_asset_tasks';\nimport { rpcUrls } from './rpc_urls';\n\ninterface NetworkConfig {\n dispatchQueue: DispatchQueue;\n web3: Web3;\n zeroEx: ZeroEx;\n}\n\ninterface ItemByNetworkId {\n [networkId: string]: T;\n}\n\nenum RequestedAssetType {\n ETH = 'ETH',\n WETH = 'WETH',\n ZRX = 'ZRX',\n}\n\nconst FIVE_DAYS_IN_MS = 4.32e8; // TODO: make this configurable\n\nexport class Handler {\n private _networkConfigByNetworkId: ItemByNetworkId = {};\n private static _createProviderEngine(rpcUrl: string) {\n if (_.isUndefined(configs.DISPENSER_PRIVATE_KEY)) {\n throw new Error('Dispenser Private key not found');\n }\n const engine = new ProviderEngine();\n engine.addProvider(new NonceTrackerSubprovider());\n engine.addProvider(new PrivateKeyWalletSubprovider(configs.DISPENSER_PRIVATE_KEY));\n engine.addProvider(\n new RpcSubprovider({\n rpcUrl,\n }),\n );\n engine.start();\n return engine;\n }\n constructor() {\n _.forIn(rpcUrls, (rpcUrl: string, networkId: string) => {\n const providerObj = Handler._createProviderEngine(rpcUrl);\n const web3 = new Web3(providerObj);\n const zeroExConfig = {\n networkId: +networkId,\n };\n const zeroEx = new ZeroEx(web3.currentProvider, zeroExConfig);\n const dispatchQueue = new DispatchQueue();\n this._networkConfigByNetworkId[networkId] = {\n dispatchQueue,\n web3,\n zeroEx,\n };\n });\n }\n public getQueueInfo(req: express.Request, res: express.Response) {\n res.setHeader('Content-Type', 'application/json');\n const queueInfo = _.mapValues(rpcUrls, (rpcUrl: string, networkId: string) => {\n const dispatchQueue = this._networkConfigByNetworkId[networkId].dispatchQueue;\n return {\n full: dispatchQueue.isFull(),\n size: dispatchQueue.size(),\n };\n });\n const payload = JSON.stringify(queueInfo);\n res.status(200).send(payload);\n }\n public dispenseEther(req: express.Request, res: express.Response) {\n this._dispenseAsset(req, res, RequestedAssetType.ETH);\n }\n public dispenseZRX(req: express.Request, res: express.Response) {\n this._dispenseAsset(req, res, RequestedAssetType.ZRX);\n }\n public async dispenseWETHOrder(req: express.Request, res: express.Response) {\n await this._dispenseOrder(req, res, RequestedAssetType.WETH);\n }\n public async dispenseZRXOrder(req: express.Request, res: express.Response, next: express.NextFunction) {\n await this._dispenseOrder(req, res, RequestedAssetType.ZRX);\n }\n private _dispenseAsset(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType) {\n const networkId = req.params.networkId;\n const recipient = req.params.recipient;\n const networkConfig = this._networkConfigByNetworkId[networkId];\n let dispenserTask;\n switch (requestedAssetType) {\n case RequestedAssetType.ETH:\n dispenserTask = dispenseAssetTasks.dispenseEtherTask(recipient, networkConfig.web3);\n break;\n case RequestedAssetType.WETH:\n case RequestedAssetType.ZRX:\n dispenserTask = dispenseAssetTasks.dispenseTokenTask(\n recipient,\n requestedAssetType,\n networkConfig.zeroEx,\n );\n break;\n default:\n throw new Error(`Unsupported asset type: ${requestedAssetType}`);\n }\n const didAddToQueue = networkConfig.dispatchQueue.add(dispenserTask);\n if (!didAddToQueue) {\n res.status(503).send('QUEUE_IS_FULL');\n return;\n }\n logUtils.log(`Added ${recipient} to queue: ${requestedAssetType} networkId: ${networkId}`);\n res.status(200).end();\n }\n private async _dispenseOrder(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType) {\n const networkConfig = _.get(this._networkConfigByNetworkId, req.params.networkId);\n if (_.isUndefined(networkConfig)) {\n res.status(400).send('UNSUPPORTED_NETWORK_ID');\n return;\n }\n const zeroEx = networkConfig.zeroEx;\n res.setHeader('Content-Type', 'application/json');\n const makerToken = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(requestedAssetType);\n if (_.isUndefined(makerToken)) {\n throw new Error(`Unsupported asset type: ${requestedAssetType}`);\n }\n const takerTokenSymbol =\n requestedAssetType === RequestedAssetType.WETH ? RequestedAssetType.ZRX : RequestedAssetType.WETH;\n const takerToken = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(takerTokenSymbol);\n if (_.isUndefined(takerToken)) {\n throw new Error(`Unsupported asset type: ${requestedAssetType}`);\n }\n const makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(0.1), makerToken.decimals);\n const takerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(0.1), takerToken.decimals);\n const order: Order = {\n maker: configs.DISPENSER_ADDRESS,\n taker: req.params.recipient,\n makerFee: new BigNumber(0),\n takerFee: new BigNumber(0),\n makerTokenAmount,\n takerTokenAmount,\n makerTokenAddress: makerToken.address,\n takerTokenAddress: takerToken.address,\n salt: ZeroEx.generatePseudoRandomSalt(),\n exchangeContractAddress: zeroEx.exchange.getContractAddress(),\n feeRecipient: ZeroEx.NULL_ADDRESS,\n expirationUnixTimestampSec: new BigNumber(Date.now() + FIVE_DAYS_IN_MS),\n };\n const orderHash = ZeroEx.getOrderHashHex(order);\n const signature = await zeroEx.signOrderHashAsync(orderHash, configs.DISPENSER_ADDRESS, false);\n const signedOrder = {\n ...order,\n ecSignature: signature,\n };\n const signedOrderHash = ZeroEx.getOrderHashHex(signedOrder);\n const payload = JSON.stringify(signedOrder);\n logUtils.log(`Dispensed signed order: ${payload}`);\n res.status(200).send(payload);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/handler.ts","module.exports = require(\"web3\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"web3\"\n// module id = 12\n// module chunks = 0","module.exports = require(\"@0xproject/subproviders\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@0xproject/subproviders\"\n// module id = 13\n// module chunks = 0","module.exports = require(\"web3-provider-engine\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"web3-provider-engine\"\n// module id = 14\n// module chunks = 0","module.exports = require(\"web3-provider-engine/subproviders/rpc\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"web3-provider-engine/subproviders/rpc\"\n// module id = 15\n// module chunks = 0","import { intervalUtils, logUtils } from '@0xproject/utils';\nimport * as _ from 'lodash';\n\nimport { errorReporter } from './error_reporter';\n\nconst MAX_QUEUE_SIZE = 500;\nconst DEFAULT_QUEUE_INTERVAL_MS = 1000;\n\nexport class DispatchQueue {\n private _queueIntervalMs: number;\n private _queue: Array<() => Promise>;\n private _queueIntervalIdIfExists?: NodeJS.Timer;\n constructor() {\n this._queueIntervalMs = DEFAULT_QUEUE_INTERVAL_MS;\n this._queue = [];\n this._start();\n }\n public add(taskAsync: () => Promise): boolean {\n if (this.isFull()) {\n return false;\n }\n this._queue.push(taskAsync);\n return true;\n }\n public size(): number {\n return this._queue.length;\n }\n public isFull(): boolean {\n return this.size() >= MAX_QUEUE_SIZE;\n }\n public stop() {\n if (!_.isUndefined(this._queueIntervalIdIfExists)) {\n intervalUtils.clearAsyncExcludingInterval(this._queueIntervalIdIfExists);\n }\n }\n private _start() {\n this._queueIntervalIdIfExists = intervalUtils.setAsyncExcludingInterval(\n async () => {\n const taskAsync = this._queue.shift();\n if (_.isUndefined(taskAsync)) {\n return Promise.resolve();\n }\n await taskAsync();\n },\n this._queueIntervalMs,\n (err: Error) => {\n logUtils.log(`Unexpected err: ${err} - ${JSON.stringify(err)}`);\n // tslint:disable-next-line:no-floating-promises\n errorReporter.reportAsync(err);\n },\n );\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/dispatch_queue.ts","import { ZeroEx } from '0x.js';\nimport { BigNumber, logUtils, promisify } from '@0xproject/utils';\nimport * as _ from 'lodash';\nimport * as Web3 from 'web3';\n\nimport { configs } from './configs';\nimport { errorReporter } from './error_reporter';\n\nconst DISPENSE_AMOUNT_ETHER = 0.1;\nconst DISPENSE_AMOUNT_TOKEN = 0.1;\nconst DISPENSE_MAX_AMOUNT_TOKEN = 2;\nconst DISPENSE_MAX_AMOUNT_ETHER = 2;\n\nexport const dispenseAssetTasks = {\n dispenseEtherTask(recipientAddress: string, web3: Web3) {\n return async () => {\n logUtils.log(`Processing ETH ${recipientAddress}`);\n const userBalance = await promisify(web3.eth.getBalance)(recipientAddress);\n const maxAmountInWei = new BigNumber(web3.toWei(DISPENSE_MAX_AMOUNT_ETHER, 'ether'));\n if (userBalance.greaterThanOrEqualTo(maxAmountInWei)) {\n logUtils.log(\n `User exceeded ETH balance maximum (${maxAmountInWei}) ${recipientAddress} ${userBalance} `,\n );\n return;\n }\n const sendTransactionAsync = promisify(web3.eth.sendTransaction);\n const txHash = await sendTransactionAsync({\n from: configs.DISPENSER_ADDRESS,\n to: recipientAddress,\n value: web3.toWei(DISPENSE_AMOUNT_ETHER, 'ether'),\n });\n logUtils.log(`Sent ${DISPENSE_AMOUNT_ETHER} ETH to ${recipientAddress} tx: ${txHash}`);\n };\n },\n dispenseTokenTask(recipientAddress: string, tokenSymbol: string, zeroEx: ZeroEx) {\n return async () => {\n logUtils.log(`Processing ${tokenSymbol} ${recipientAddress}`);\n const amountToDispense = new BigNumber(DISPENSE_AMOUNT_TOKEN);\n const token = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(tokenSymbol);\n if (_.isUndefined(token)) {\n throw new Error(`Unsupported asset type: ${tokenSymbol}`);\n }\n const baseUnitAmount = ZeroEx.toBaseUnitAmount(amountToDispense, token.decimals);\n const userBalanceBaseUnits = await zeroEx.token.getBalanceAsync(token.address, recipientAddress);\n const maxAmountBaseUnits = ZeroEx.toBaseUnitAmount(\n new BigNumber(DISPENSE_MAX_AMOUNT_TOKEN),\n token.decimals,\n );\n if (userBalanceBaseUnits.greaterThanOrEqualTo(maxAmountBaseUnits)) {\n logUtils.log(\n `User exceeded token balance maximum (${maxAmountBaseUnits}) ${recipientAddress} ${userBalanceBaseUnits} `,\n );\n return;\n }\n const txHash = await zeroEx.token.transferAsync(\n token.address,\n configs.DISPENSER_ADDRESS,\n recipientAddress,\n baseUnitAmount,\n );\n logUtils.log(`Sent ${amountToDispense} ZRX to ${recipientAddress} tx: ${txHash}`);\n };\n },\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/dispense_asset_tasks.ts","import { addressUtils } from '@0xproject/utils';\nimport { NextFunction, Request, Response } from 'express';\nimport * as _ from 'lodash';\n\nimport { configs } from './configs';\nimport { rpcUrls } from './rpc_urls';\n\nconst DEFAULT_NETWORK_ID = 42; // kovan\n\nexport const parameterTransformer = {\n transform(req: Request, res: Response, next: NextFunction) {\n const recipientAddress = req.params.recipient;\n if (_.isUndefined(recipientAddress) || !addressUtils.isAddress(recipientAddress)) {\n res.status(400).send('INVALID_RECIPIENT_ADDRESS');\n return;\n }\n const lowerCaseRecipientAddress = recipientAddress.toLowerCase();\n req.params.recipient = lowerCaseRecipientAddress;\n const networkId = _.get(req.query, 'networkId', DEFAULT_NETWORK_ID);\n const rpcUrlIfExists = _.get(rpcUrls, networkId);\n if (_.isUndefined(rpcUrlIfExists)) {\n res.status(400).send('UNSUPPORTED_NETWORK_ID');\n return;\n }\n req.params.networkId = networkId;\n next();\n },\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/parameter_transformer.ts"],"sourceRoot":""} \ No newline at end of file diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index afcfd862c..aef14fead 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -2,6 +2,10 @@ { "version": "0.7.0", "changes": [ + { + "note": "Make OpCode type an enum", + "pr": 589 + }, { "note": "Moved ExchangeContractErrs, DoneCallback, Token, OrderRelevantState, OrderStateValid, OrderStateInvalid, OrderState, OrderAddresses and OrderValues types from 0x.js", diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index d3c7da7b9..f447bdd1c 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "0.7.0", + "changes": [ + { + "note": "Add logUtils.warn", + "pr": 589 + } + ] + }, { "timestamp": 1525477860, "version": "0.6.1", -- cgit v1.2.3 From 1ff34bd0f4084d2f9dfd6f07447bb63684ac51ac Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 15 May 2018 15:14:36 +0200 Subject: Remove web3Factory.create and remove dev-tools dependency on sol-cov --- packages/0x.js/test/utils/web3_wrapper.ts | 5 +- packages/contract-wrappers/test/artifacts_test.ts | 4 +- .../contract-wrappers/test/utils/web3_wrapper.ts | 5 +- packages/contracts/package.json | 2 + packages/contracts/src/utils/web3_wrapper.ts | 12 +- packages/contracts/test/global_hooks.ts | 4 +- packages/contracts/test/utils/coverage.ts | 21 + packages/dev-utils/package.json | 1 - packages/dev-utils/src/coverage.ts | 22 - packages/dev-utils/src/index.ts | 1 - packages/dev-utils/src/web3_factory.ts | 20 +- packages/metacoin/test/utils/web3_wrapper.ts | 11 +- packages/migrations/package.json | 2 +- packages/migrations/src/migrate.ts | 3 +- packages/order-utils/test/utils/web3_wrapper.ts | 5 +- packages/order-watcher/test/utils/web3_wrapper.ts | 5 +- packages/sol-compiler/test/util/provider.ts | 3 +- packages/sol-cov/src/coverage_subprovider.ts | 2 +- packages/sol-cov/src/trace.json | 3227 ++++++++++++++++++++ packages/sol-cov/src/trace.ts | 2 +- packages/sol-cov/test/trace_test.ts | 2 +- packages/subproviders/src/index.ts | 1 + .../subproviders/src/utils/subprovider_utils.ts | 13 + packages/testnet-faucets/bin/server.js | 780 ----- packages/testnet-faucets/bin/server.js.map | 1 - .../types/web3-provider-engine/index.d.ts | 18 +- 26 files changed, 3310 insertions(+), 862 deletions(-) create mode 100644 packages/contracts/test/utils/coverage.ts delete mode 100644 packages/dev-utils/src/coverage.ts create mode 100644 packages/sol-cov/src/trace.json create mode 100644 packages/subproviders/src/utils/subprovider_utils.ts delete mode 100644 packages/testnet-faucets/bin/server.js delete mode 100644 packages/testnet-faucets/bin/server.js.map diff --git a/packages/0x.js/test/utils/web3_wrapper.ts b/packages/0x.js/test/utils/web3_wrapper.ts index b0ccfa546..71a0dc1c2 100644 --- a/packages/0x.js/test/utils/web3_wrapper.ts +++ b/packages/0x.js/test/utils/web3_wrapper.ts @@ -2,8 +2,7 @@ import { devConstants, web3Factory } from '@0xproject/dev-utils'; import { Provider } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -const web3 = web3Factory.create({ shouldUseInProcessGanache: true }); -const provider: Provider = web3.currentProvider; -const web3Wrapper = new Web3Wrapper(web3.currentProvider); +const provider: Provider = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true }); +const web3Wrapper = new Web3Wrapper(provider); export { provider, web3Wrapper }; diff --git a/packages/contract-wrappers/test/artifacts_test.ts b/packages/contract-wrappers/test/artifacts_test.ts index 446b8f9d1..eaaa89c48 100644 --- a/packages/contract-wrappers/test/artifacts_test.ts +++ b/packages/contract-wrappers/test/artifacts_test.ts @@ -15,7 +15,7 @@ const TIMEOUT = 10000; describe('Artifacts', () => { describe('contracts are deployed on kovan', () => { const kovanRpcUrl = constants.KOVAN_RPC_URL; - const provider = web3Factory.create({ rpcUrl: kovanRpcUrl }).currentProvider; + const provider = web3Factory.getRpcProvider({ rpcUrl: kovanRpcUrl }); const config = { networkId: constants.KOVAN_NETWORK_ID, }; @@ -32,7 +32,7 @@ describe('Artifacts', () => { }); describe('contracts are deployed on ropsten', () => { const ropstenRpcUrl = constants.ROPSTEN_RPC_URL; - const provider = web3Factory.create({ rpcUrl: ropstenRpcUrl }).currentProvider; + const provider = web3Factory.getRpcProvider({ rpcUrl: ropstenRpcUrl }); const config = { networkId: constants.ROPSTEN_NETWORK_ID, }; diff --git a/packages/contract-wrappers/test/utils/web3_wrapper.ts b/packages/contract-wrappers/test/utils/web3_wrapper.ts index b0ccfa546..71a0dc1c2 100644 --- a/packages/contract-wrappers/test/utils/web3_wrapper.ts +++ b/packages/contract-wrappers/test/utils/web3_wrapper.ts @@ -2,8 +2,7 @@ import { devConstants, web3Factory } from '@0xproject/dev-utils'; import { Provider } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -const web3 = web3Factory.create({ shouldUseInProcessGanache: true }); -const provider: Provider = web3.currentProvider; -const web3Wrapper = new Web3Wrapper(web3.currentProvider); +const provider: Provider = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true }); +const web3Wrapper = new Web3Wrapper(provider); export { provider, web3Wrapper }; diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 9c7142cdb..f17c64a6f 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -44,6 +44,8 @@ "devDependencies": { "@0xproject/abi-gen": "^0.2.13", "@0xproject/dev-utils": "^0.4.1", + "@0xproject/subproviders": "^0.10.1", + "@0xproject/sol-cov": "^0.0.10", "@0xproject/tslint-config": "^0.4.17", "@types/lodash": "4.14.104", "@types/node": "^8.0.53", diff --git a/packages/contracts/src/utils/web3_wrapper.ts b/packages/contracts/src/utils/web3_wrapper.ts index ed1c488a2..5d3d9f7c9 100644 --- a/packages/contracts/src/utils/web3_wrapper.ts +++ b/packages/contracts/src/utils/web3_wrapper.ts @@ -1,12 +1,18 @@ -import { devConstants, web3Factory } from '@0xproject/dev-utils'; +import { devConstants, env, EnvVars, web3Factory } from '@0xproject/dev-utils'; +import { prependSubprovider } from '@0xproject/subproviders'; import { Provider } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { coverage } from './coverage'; + export const txDefaults = { from: devConstants.TESTRPC_FIRST_ADDRESS, gas: devConstants.GAS_ESTIMATE, }; const providerConfigs = { shouldUseInProcessGanache: true }; -export const web3 = web3Factory.create(providerConfigs); -export const provider = web3.currentProvider; +export const provider = web3Factory.getRpcProvider(providerConfigs); +const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage); +if (isCoverageEnabled) { + prependSubprovider(provider, coverage.getCoverageSubproviderSingleton()); +} export const web3Wrapper = new Web3Wrapper(provider); diff --git a/packages/contracts/test/global_hooks.ts b/packages/contracts/test/global_hooks.ts index 089521d94..509dc6837 100644 --- a/packages/contracts/test/global_hooks.ts +++ b/packages/contracts/test/global_hooks.ts @@ -1,4 +1,6 @@ -import { coverage, env, EnvVars } from '@0xproject/dev-utils'; +import { env, EnvVars } from '@0xproject/dev-utils'; + +import { coverage } from './utils/coverage'; after('generate coverage report', async () => { if (env.parseBoolean(EnvVars.SolidityCoverage)) { diff --git a/packages/contracts/test/utils/coverage.ts b/packages/contracts/test/utils/coverage.ts new file mode 100644 index 000000000..e3c5be428 --- /dev/null +++ b/packages/contracts/test/utils/coverage.ts @@ -0,0 +1,21 @@ +import { devConstants } from '@0xproject/dev-utils'; +import { CoverageSubprovider, ZeroExArtifactAdapter } from '@0xproject/sol-cov'; +import * as fs from 'fs'; +import * as _ from 'lodash'; + +let coverageSubprovider: CoverageSubprovider; + +export const coverage = { + getCoverageSubproviderSingleton(): CoverageSubprovider { + if (_.isUndefined(coverageSubprovider)) { + coverageSubprovider = coverage._getCoverageSubprovider(); + } + return coverageSubprovider; + }, + _getCoverageSubprovider(): CoverageSubprovider { + const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS; + const config = JSON.parse(fs.readFileSync('compiler.json').toString()); + const zeroExArtifactsAdapter = new ZeroExArtifactAdapter(config.artifactsDir, config.contractsDir); + return new CoverageSubprovider(zeroExArtifactsAdapter, defaultFromAddress); + }, +}; diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 49964c82a..9dd3750c5 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -44,7 +44,6 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/sol-cov": "^0.0.10", "@0xproject/subproviders": "^0.10.1", "@0xproject/types": "^0.6.3", "@0xproject/typescript-typings": "^0.3.1", diff --git a/packages/dev-utils/src/coverage.ts b/packages/dev-utils/src/coverage.ts deleted file mode 100644 index caf04672f..000000000 --- a/packages/dev-utils/src/coverage.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { CoverageSubprovider, ZeroExArtifactAdapter } from '@0xproject/sol-cov'; -import * as _ from 'lodash'; - -import { constants } from './constants'; - -let coverageSubprovider: CoverageSubprovider; - -export const coverage = { - getCoverageSubproviderSingleton(): CoverageSubprovider { - if (_.isUndefined(coverageSubprovider)) { - coverageSubprovider = coverage._getCoverageSubprovider(); - } - return coverageSubprovider; - }, - _getCoverageSubprovider(): CoverageSubprovider { - const artifactsPath = '../migrations/artifacts/1.0.0'; - const contractsPath = 'src/contracts'; - const defaultFromAddress = constants.TESTRPC_FIRST_ADDRESS; - const zeroExArtifactsAdapter = new ZeroExArtifactAdapter(artifactsPath, contractsPath); - return new CoverageSubprovider(zeroExArtifactsAdapter, defaultFromAddress); - }, -}; diff --git a/packages/dev-utils/src/index.ts b/packages/dev-utils/src/index.ts index 9124f3e28..d4c19f1bf 100644 --- a/packages/dev-utils/src/index.ts +++ b/packages/dev-utils/src/index.ts @@ -1,6 +1,5 @@ export { BlockchainLifecycle } from './blockchain_lifecycle'; export { web3Factory } from './web3_factory'; export { constants as devConstants } from './constants'; -export { coverage } from './coverage'; export { env, EnvVars } from './env'; export { callbackErrorReporter } from './callback_error_reporter'; diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts index 4cd343c44..5b32d3930 100644 --- a/packages/dev-utils/src/web3_factory.ts +++ b/packages/dev-utils/src/web3_factory.ts @@ -13,16 +13,8 @@ import * as _ from 'lodash'; import * as process from 'process'; import { constants } from './constants'; -import { coverage } from './coverage'; import { env, EnvVars } from './env'; -// HACK: web3 leaks XMLHttpRequest into the global scope and causes requests to hang -// because they are using the wrong XHR package. -// importing web3 after subproviders fixes this issue -// Filed issue: https://github.com/ethereum/web3.js/issues/844 -// tslint:disable-next-line:ordered-imports -import * as Web3 from 'web3'; - export interface Web3Config { hasAddresses?: boolean; // default: true shouldUseInProcessGanache?: boolean; // default: false @@ -30,18 +22,8 @@ export interface Web3Config { } export const web3Factory = { - create(config: Web3Config = {}): Web3 { - const provider = this.getRpcProvider(config); - const web3 = new Web3(); - web3.setProvider(provider); - return web3; - }, - getRpcProvider(config: Web3Config = {}): Provider { + getRpcProvider(config: Web3Config = {}): ProviderEngine { const provider = new ProviderEngine(); - const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage); - if (isCoverageEnabled) { - provider.addProvider(coverage.getCoverageSubproviderSingleton()); - } const hasAddresses = _.isUndefined(config.hasAddresses) || config.hasAddresses; if (!hasAddresses) { provider.addProvider(new EmptyWalletSubprovider()); diff --git a/packages/metacoin/test/utils/web3_wrapper.ts b/packages/metacoin/test/utils/web3_wrapper.ts index b4bb61f09..9f6b155fc 100644 --- a/packages/metacoin/test/utils/web3_wrapper.ts +++ b/packages/metacoin/test/utils/web3_wrapper.ts @@ -1,5 +1,5 @@ import { env, EnvVars } from '@0xproject/dev-utils'; -import { GanacheSubprovider } from '@0xproject/subproviders'; +import { GanacheSubprovider, prependSubprovider } from '@0xproject/subproviders'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as fs from 'fs'; import * as _ from 'lodash'; @@ -9,10 +9,6 @@ import { config } from './config'; import { coverage } from './coverage'; export const provider = new ProviderEngine(); -const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage); -if (isCoverageEnabled) { - provider.addProvider(coverage.getCoverageSubproviderSingleton()); -} provider.addProvider( new GanacheSubprovider({ logger: { @@ -27,4 +23,9 @@ provider.addProvider( ); provider.start(); +const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage); +if (isCoverageEnabled) { + prependSubprovider(provider, coverage.getCoverageSubproviderSingleton()); +} + export const web3Wrapper = new Web3Wrapper(provider); diff --git a/packages/migrations/package.json b/packages/migrations/package.json index d9e68caaf..61dfc5de6 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -9,7 +9,7 @@ "types": "lib/index.d.ts", "scripts": { "watch": "tsc -w", - "prebuild": "run-s clean compile copy_artifacts generate_contract_wrappers", + "prebuild": "run-s clean copy_artifacts generate_contract_wrappers", "copy_artifacts": "copyfiles 'artifacts/1.0.0/**/*' ./lib", "build": "tsc", "clean": "shx rm -rf lib src/contract_wrappers", diff --git a/packages/migrations/src/migrate.ts b/packages/migrations/src/migrate.ts index b00ba698f..1230f376e 100644 --- a/packages/migrations/src/migrate.ts +++ b/packages/migrations/src/migrate.ts @@ -11,8 +11,7 @@ import { runMigrationsAsync } from './migration'; from: devConstants.TESTRPC_FIRST_ADDRESS, }; const providerConfigs = { shouldUseInProcessGanache: false }; - const web3 = web3Factory.create(providerConfigs); - const provider = web3.currentProvider; + const provider: Provider = web3Factory.getRpcProvider(providerConfigs); const artifactsDir = 'artifacts/1.0.0'; await runMigrationsAsync(provider, artifactsDir, txDefaults); process.exit(0); diff --git a/packages/order-utils/test/utils/web3_wrapper.ts b/packages/order-utils/test/utils/web3_wrapper.ts index b0ccfa546..71a0dc1c2 100644 --- a/packages/order-utils/test/utils/web3_wrapper.ts +++ b/packages/order-utils/test/utils/web3_wrapper.ts @@ -2,8 +2,7 @@ import { devConstants, web3Factory } from '@0xproject/dev-utils'; import { Provider } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -const web3 = web3Factory.create({ shouldUseInProcessGanache: true }); -const provider: Provider = web3.currentProvider; -const web3Wrapper = new Web3Wrapper(web3.currentProvider); +const provider: Provider = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true }); +const web3Wrapper = new Web3Wrapper(provider); export { provider, web3Wrapper }; diff --git a/packages/order-watcher/test/utils/web3_wrapper.ts b/packages/order-watcher/test/utils/web3_wrapper.ts index b0ccfa546..71a0dc1c2 100644 --- a/packages/order-watcher/test/utils/web3_wrapper.ts +++ b/packages/order-watcher/test/utils/web3_wrapper.ts @@ -2,8 +2,7 @@ import { devConstants, web3Factory } from '@0xproject/dev-utils'; import { Provider } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -const web3 = web3Factory.create({ shouldUseInProcessGanache: true }); -const provider: Provider = web3.currentProvider; -const web3Wrapper = new Web3Wrapper(web3.currentProvider); +const provider: Provider = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true }); +const web3Wrapper = new Web3Wrapper(provider); export { provider, web3Wrapper }; diff --git a/packages/sol-compiler/test/util/provider.ts b/packages/sol-compiler/test/util/provider.ts index e0fcb362a..2bd178129 100644 --- a/packages/sol-compiler/test/util/provider.ts +++ b/packages/sol-compiler/test/util/provider.ts @@ -3,7 +3,6 @@ import { Provider } from '@0xproject/types'; import * as Web3 from 'web3'; const providerConfigs = { shouldUseInProcessGanache: true }; -const web3Instance = web3Factory.create(providerConfigs); -const provider: Provider = web3Instance.currentProvider; +const provider: Provider = web3Factory.getRpcProvider(providerConfigs); export { provider }; diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts index f421a17fd..addad5e8f 100644 --- a/packages/sol-cov/src/coverage_subprovider.ts +++ b/packages/sol-cov/src/coverage_subprovider.ts @@ -118,7 +118,7 @@ export class CoverageSubprovider extends Subprovider { private async _recordTxTraceAsync(address: string, data: string | undefined, txHash: string): Promise { let payload = { method: 'debug_traceTransaction', - params: [txHash, { disableMemory: true, disableStack: true, disableStorage: true }], // TODO For now testrpc just ignores those parameters https://github.com/trufflesuite/ganache-cli/issues/489 + params: [txHash, { disableMemory: true, disableStack: false, disableStorage: true }], }; const jsonRPCResponsePayload = await this.emitPayloadAsync(payload); const trace: TransactionTrace = jsonRPCResponsePayload.result; diff --git a/packages/sol-cov/src/trace.json b/packages/sol-cov/src/trace.json new file mode 100644 index 000000000..77ec20a72 --- /dev/null +++ b/packages/sol-cov/src/trace.json @@ -0,0 +1,3227 @@ +[ + { + "depth": 0, + "error": "", + "gas": 21216, + "gasCost": 21784, + "memory": null, + "op": "PUSH1", + "pc": 0, + "stack": [], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21213, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 2, + "stack": ["0000000000000000000000000000000000000000000000000000000000000080"], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21210, + "gasCost": 3, + "memory": null, + "op": "MSTORE", + "pc": 4, + "stack": [ + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000040" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21198, + "gasCost": 12, + "memory": null, + "op": "PUSH1", + "pc": 5, + "stack": [], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21195, + "gasCost": 3, + "memory": null, + "op": "CALLDATASIZE", + "pc": 7, + "stack": ["0000000000000000000000000000000000000000000000000000000000000004"], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21193, + "gasCost": 2, + "memory": null, + "op": "LT", + "pc": 8, + "stack": [ + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000024" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21190, + "gasCost": 3, + "memory": null, + "op": "PUSH2", + "pc": 9, + "stack": ["0000000000000000000000000000000000000000000000000000000000000000"], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21187, + "gasCost": 3, + "memory": null, + "op": "JUMPI", + "pc": 12, + "stack": [ + "0000000000000000000000000000000000000000000000000000000000000000", + "00000000000000000000000000000000000000000000000000000000000000af" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21177, + "gasCost": 10, + "memory": null, + "op": "PUSH1", + "pc": 13, + "stack": [], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21174, + "gasCost": 3, + "memory": null, + "op": "CALLDATALOAD", + "pc": 15, + "stack": ["0000000000000000000000000000000000000000000000000000000000000000"], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21171, + "gasCost": 3, + "memory": null, + "op": "PUSH29", + "pc": 16, + "stack": ["2e1a7d4d0000000000000000000000000000000000000000000000000de0b6b3"], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21168, + "gasCost": 3, + "memory": null, + "op": "SWAP1", + "pc": 46, + "stack": [ + "2e1a7d4d0000000000000000000000000000000000000000000000000de0b6b3", + "0000000100000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21165, + "gasCost": 3, + "memory": null, + "op": "DIV", + "pc": 47, + "stack": [ + "0000000100000000000000000000000000000000000000000000000000000000", + "2e1a7d4d0000000000000000000000000000000000000000000000000de0b6b3" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21160, + "gasCost": 5, + "memory": null, + "op": "PUSH4", + "pc": 48, + "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21157, + "gasCost": 3, + "memory": null, + "op": "AND", + "pc": 53, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "00000000000000000000000000000000000000000000000000000000ffffffff" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21154, + "gasCost": 3, + "memory": null, + "op": "DUP1", + "pc": 54, + "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21151, + "gasCost": 3, + "memory": null, + "op": "PUSH4", + "pc": 55, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "000000000000000000000000000000000000000000000000000000002e1a7d4d" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21148, + "gasCost": 3, + "memory": null, + "op": "EQ", + "pc": 60, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000006fdde03" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21145, + "gasCost": 3, + "memory": null, + "op": "PUSH2", + "pc": 61, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21142, + "gasCost": 3, + "memory": null, + "op": "JUMPI", + "pc": 64, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000000", + "00000000000000000000000000000000000000000000000000000000000000b9" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21132, + "gasCost": 10, + "memory": null, + "op": "DUP1", + "pc": 65, + "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21129, + "gasCost": 3, + "memory": null, + "op": "PUSH4", + "pc": 66, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "000000000000000000000000000000000000000000000000000000002e1a7d4d" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21126, + "gasCost": 3, + "memory": null, + "op": "EQ", + "pc": 71, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "00000000000000000000000000000000000000000000000000000000095ea7b3" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21123, + "gasCost": 3, + "memory": null, + "op": "PUSH2", + "pc": 72, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21120, + "gasCost": 3, + "memory": null, + "op": "JUMPI", + "pc": 75, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000149" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21110, + "gasCost": 10, + "memory": null, + "op": "DUP1", + "pc": 76, + "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21107, + "gasCost": 3, + "memory": null, + "op": "PUSH4", + "pc": 77, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "000000000000000000000000000000000000000000000000000000002e1a7d4d" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21104, + "gasCost": 3, + "memory": null, + "op": "EQ", + "pc": 82, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000018160ddd" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21101, + "gasCost": 3, + "memory": null, + "op": "PUSH2", + "pc": 83, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21098, + "gasCost": 3, + "memory": null, + "op": "JUMPI", + "pc": 86, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000000", + "00000000000000000000000000000000000000000000000000000000000001ae" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21088, + "gasCost": 10, + "memory": null, + "op": "DUP1", + "pc": 87, + "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21085, + "gasCost": 3, + "memory": null, + "op": "PUSH4", + "pc": 88, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "000000000000000000000000000000000000000000000000000000002e1a7d4d" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21082, + "gasCost": 3, + "memory": null, + "op": "EQ", + "pc": 93, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000023b872dd" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21079, + "gasCost": 3, + "memory": null, + "op": "PUSH2", + "pc": 94, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21076, + "gasCost": 3, + "memory": null, + "op": "JUMPI", + "pc": 97, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000000", + "00000000000000000000000000000000000000000000000000000000000001d9" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21066, + "gasCost": 10, + "memory": null, + "op": "DUP1", + "pc": 98, + "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21063, + "gasCost": 3, + "memory": null, + "op": "PUSH4", + "pc": 99, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "000000000000000000000000000000000000000000000000000000002e1a7d4d" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21060, + "gasCost": 3, + "memory": null, + "op": "EQ", + "pc": 104, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "000000000000000000000000000000000000000000000000000000002e1a7d4d" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21057, + "gasCost": 3, + "memory": null, + "op": "PUSH2", + "pc": 105, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000001" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21054, + "gasCost": 3, + "memory": null, + "op": "JUMPI", + "pc": 108, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000001", + "000000000000000000000000000000000000000000000000000000000000025e" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21044, + "gasCost": 10, + "memory": null, + "op": "JUMPDEST", + "pc": 606, + "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21043, + "gasCost": 1, + "memory": null, + "op": "CALLVALUE", + "pc": 607, + "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21041, + "gasCost": 2, + "memory": null, + "op": "DUP1", + "pc": 608, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21038, + "gasCost": 3, + "memory": null, + "op": "ISZERO", + "pc": 609, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21035, + "gasCost": 3, + "memory": null, + "op": "PUSH2", + "pc": 610, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000001" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21032, + "gasCost": 3, + "memory": null, + "op": "JUMPI", + "pc": 613, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000001", + "000000000000000000000000000000000000000000000000000000000000026a" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21022, + "gasCost": 10, + "memory": null, + "op": "JUMPDEST", + "pc": 618, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21021, + "gasCost": 1, + "memory": null, + "op": "POP", + "pc": 619, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21019, + "gasCost": 2, + "memory": null, + "op": "PUSH2", + "pc": 620, + "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21016, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 623, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21013, + "gasCost": 3, + "memory": null, + "op": "DUP1", + "pc": 625, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000000000000000004" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21010, + "gasCost": 3, + "memory": null, + "op": "CALLDATASIZE", + "pc": 626, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000004" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21008, + "gasCost": 2, + "memory": null, + "op": "SUB", + "pc": 627, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000024" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21005, + "gasCost": 3, + "memory": null, + "op": "DUP2", + "pc": 628, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000020" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 21002, + "gasCost": 3, + "memory": null, + "op": "ADD", + "pc": 629, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000020", + "0000000000000000000000000000000000000000000000000000000000000004" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20999, + "gasCost": 3, + "memory": null, + "op": "SWAP1", + "pc": 630, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000024" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20996, + "gasCost": 3, + "memory": null, + "op": "DUP1", + "pc": 631, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000000000000000024", + "0000000000000000000000000000000000000000000000000000000000000004" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20993, + "gasCost": 3, + "memory": null, + "op": "DUP1", + "pc": 632, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000000000000000024", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000004" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20990, + "gasCost": 3, + "memory": null, + "op": "CALLDATALOAD", + "pc": 633, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000000000000000024", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000004" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20987, + "gasCost": 3, + "memory": null, + "op": "SWAP1", + "pc": 634, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000000000000000024", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20984, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 635, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000000000000000024", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000004" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20981, + "gasCost": 3, + "memory": null, + "op": "ADD", + "pc": 637, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000000000000000024", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000020" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20978, + "gasCost": 3, + "memory": null, + "op": "SWAP1", + "pc": 638, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000000000000000024", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000024" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20975, + "gasCost": 3, + "memory": null, + "op": "SWAP3", + "pc": 639, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000000000000000024", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000024", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20972, + "gasCost": 3, + "memory": null, + "op": "SWAP2", + "pc": 640, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000024", + "0000000000000000000000000000000000000000000000000000000000000024" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20969, + "gasCost": 3, + "memory": null, + "op": "SWAP1", + "pc": 641, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000024", + "0000000000000000000000000000000000000000000000000000000000000024", + "0000000000000000000000000000000000000000000000000000000000000004" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20966, + "gasCost": 3, + "memory": null, + "op": "POP", + "pc": 642, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000024", + "0000000000000000000000000000000000000000000000000000000000000004", + "0000000000000000000000000000000000000000000000000000000000000024" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20964, + "gasCost": 2, + "memory": null, + "op": "POP", + "pc": 643, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000024", + "0000000000000000000000000000000000000000000000000000000000000004" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20962, + "gasCost": 2, + "memory": null, + "op": "POP", + "pc": 644, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000024" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20960, + "gasCost": 2, + "memory": null, + "op": "PUSH2", + "pc": 645, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20957, + "gasCost": 3, + "memory": null, + "op": "JUMP", + "pc": 648, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000a22" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20949, + "gasCost": 8, + "memory": null, + "op": "JUMPDEST", + "pc": 2594, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20948, + "gasCost": 1, + "memory": null, + "op": "DUP1", + "pc": 2595, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20945, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 2596, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20942, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 2598, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20939, + "gasCost": 3, + "memory": null, + "op": "CALLER", + "pc": 2600, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20937, + "gasCost": 2, + "memory": null, + "op": "PUSH20", + "pc": 2601, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20934, + "gasCost": 3, + "memory": null, + "op": "AND", + "pc": 2622, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "000000000000000000000000ffffffffffffffffffffffffffffffffffffffff" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20931, + "gasCost": 3, + "memory": null, + "op": "PUSH20", + "pc": 2623, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20928, + "gasCost": 3, + "memory": null, + "op": "AND", + "pc": 2644, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "000000000000000000000000ffffffffffffffffffffffffffffffffffffffff" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20925, + "gasCost": 3, + "memory": null, + "op": "DUP2", + "pc": 2645, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20922, + "gasCost": 3, + "memory": null, + "op": "MSTORE", + "pc": 2646, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20919, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 2647, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20916, + "gasCost": 3, + "memory": null, + "op": "ADD", + "pc": 2649, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000020" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20913, + "gasCost": 3, + "memory": null, + "op": "SWAP1", + "pc": 2650, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000020" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20910, + "gasCost": 3, + "memory": null, + "op": "DUP2", + "pc": 2651, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000020", + "0000000000000000000000000000000000000000000000000000000000000003" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20907, + "gasCost": 3, + "memory": null, + "op": "MSTORE", + "pc": 2652, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000020", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000020" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20904, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 2653, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000020" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20901, + "gasCost": 3, + "memory": null, + "op": "ADD", + "pc": 2655, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000020", + "0000000000000000000000000000000000000000000000000000000000000020" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20898, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 2656, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000040" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20895, + "gasCost": 3, + "memory": null, + "op": "SHA3", + "pc": 2658, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000040", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20853, + "gasCost": 42, + "memory": null, + "op": "SLOAD", + "pc": 2659, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20653, + "gasCost": 200, + "memory": null, + "op": "LT", + "pc": 2660, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20650, + "gasCost": 3, + "memory": null, + "op": "ISZERO", + "pc": 2661, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20647, + "gasCost": 3, + "memory": null, + "op": "ISZERO", + "pc": 2662, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000001" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20644, + "gasCost": 3, + "memory": null, + "op": "ISZERO", + "pc": 2663, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20641, + "gasCost": 3, + "memory": null, + "op": "PUSH2", + "pc": 2664, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000001" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20638, + "gasCost": 3, + "memory": null, + "op": "JUMPI", + "pc": 2667, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000001", + "0000000000000000000000000000000000000000000000000000000000000a70" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20628, + "gasCost": 10, + "memory": null, + "op": "JUMPDEST", + "pc": 2672, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20627, + "gasCost": 1, + "memory": null, + "op": "DUP1", + "pc": 2673, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20624, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 2674, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20621, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 2676, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20618, + "gasCost": 3, + "memory": null, + "op": "CALLER", + "pc": 2678, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20616, + "gasCost": 2, + "memory": null, + "op": "PUSH20", + "pc": 2679, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20613, + "gasCost": 3, + "memory": null, + "op": "AND", + "pc": 2700, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "000000000000000000000000ffffffffffffffffffffffffffffffffffffffff" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20610, + "gasCost": 3, + "memory": null, + "op": "PUSH20", + "pc": 2701, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20607, + "gasCost": 3, + "memory": null, + "op": "AND", + "pc": 2722, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "000000000000000000000000ffffffffffffffffffffffffffffffffffffffff" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20604, + "gasCost": 3, + "memory": null, + "op": "DUP2", + "pc": 2723, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20601, + "gasCost": 3, + "memory": null, + "op": "MSTORE", + "pc": 2724, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20598, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 2725, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20595, + "gasCost": 3, + "memory": null, + "op": "ADD", + "pc": 2727, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000020" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20592, + "gasCost": 3, + "memory": null, + "op": "SWAP1", + "pc": 2728, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000020" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20589, + "gasCost": 3, + "memory": null, + "op": "DUP2", + "pc": 2729, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000020", + "0000000000000000000000000000000000000000000000000000000000000003" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20586, + "gasCost": 3, + "memory": null, + "op": "MSTORE", + "pc": 2730, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000020", + "0000000000000000000000000000000000000000000000000000000000000003", + "0000000000000000000000000000000000000000000000000000000000000020" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20583, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 2731, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000020" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20580, + "gasCost": 3, + "memory": null, + "op": "ADD", + "pc": 2733, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000020", + "0000000000000000000000000000000000000000000000000000000000000020" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20577, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 2734, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000040" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20574, + "gasCost": 3, + "memory": null, + "op": "SHA3", + "pc": 2736, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000040", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20532, + "gasCost": 42, + "memory": null, + "op": "PUSH1", + "pc": 2737, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20529, + "gasCost": 3, + "memory": null, + "op": "DUP3", + "pc": 2739, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20526, + "gasCost": 3, + "memory": null, + "op": "DUP3", + "pc": 2740, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20523, + "gasCost": 3, + "memory": null, + "op": "SLOAD", + "pc": 2741, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20323, + "gasCost": 200, + "memory": null, + "op": "SUB", + "pc": 2742, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20320, + "gasCost": 3, + "memory": null, + "op": "SWAP3", + "pc": 2743, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20317, + "gasCost": 3, + "memory": null, + "op": "POP", + "pc": 2744, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000000", + "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20315, + "gasCost": 2, + "memory": null, + "op": "POP", + "pc": 2745, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000000", + "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20313, + "gasCost": 2, + "memory": null, + "op": "DUP2", + "pc": 2746, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000000", + "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20310, + "gasCost": 3, + "memory": null, + "op": "SWAP1", + "pc": 2747, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000000", + "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 20307, + "gasCost": 3, + "memory": null, + "op": "SSTORE", + "pc": 2748, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15307, + "gasCost": 5000, + "memory": null, + "op": "POP", + "pc": 2749, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15305, + "gasCost": 2, + "memory": null, + "op": "CALLER", + "pc": 2750, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15303, + "gasCost": 2, + "memory": null, + "op": "PUSH20", + "pc": 2751, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15300, + "gasCost": 3, + "memory": null, + "op": "AND", + "pc": 2772, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "000000000000000000000000ffffffffffffffffffffffffffffffffffffffff" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15297, + "gasCost": 3, + "memory": null, + "op": "PUSH2", + "pc": 2773, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15294, + "gasCost": 3, + "memory": null, + "op": "DUP3", + "pc": 2776, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "00000000000000000000000000000000000000000000000000000000000008fc" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15291, + "gasCost": 3, + "memory": null, + "op": "SWAP1", + "pc": 2777, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "00000000000000000000000000000000000000000000000000000000000008fc", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15288, + "gasCost": 3, + "memory": null, + "op": "DUP2", + "pc": 2778, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "00000000000000000000000000000000000000000000000000000000000008fc" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15285, + "gasCost": 3, + "memory": null, + "op": "ISZERO", + "pc": 2779, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "00000000000000000000000000000000000000000000000000000000000008fc", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15282, + "gasCost": 3, + "memory": null, + "op": "MUL", + "pc": 2780, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "00000000000000000000000000000000000000000000000000000000000008fc", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15277, + "gasCost": 5, + "memory": null, + "op": "SWAP1", + "pc": 2781, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15274, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 2782, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15271, + "gasCost": 3, + "memory": null, + "op": "MLOAD", + "pc": 2784, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000040" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15268, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 2785, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15265, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 2787, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15262, + "gasCost": 3, + "memory": null, + "op": "MLOAD", + "pc": 2789, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000040" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15259, + "gasCost": 3, + "memory": null, + "op": "DUP1", + "pc": 2790, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15256, + "gasCost": 3, + "memory": null, + "op": "DUP4", + "pc": 2791, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000080" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15253, + "gasCost": 3, + "memory": null, + "op": "SUB", + "pc": 2792, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000080" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15250, + "gasCost": 3, + "memory": null, + "op": "DUP2", + "pc": 2793, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15247, + "gasCost": 3, + "memory": null, + "op": "DUP6", + "pc": 2794, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15244, + "gasCost": 3, + "memory": null, + "op": "DUP9", + "pc": 2795, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15241, + "gasCost": 3, + "memory": null, + "op": "DUP9", + "pc": 2796, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 15238, + "gasCost": 3, + "memory": null, + "op": "CALL", + "pc": 2797, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7838, + "gasCost": 7400, + "memory": null, + "op": "SWAP4", + "pc": 2798, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "00000000000000000000000000000000000000000000000000000000000008fc", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000001" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7835, + "gasCost": 3, + "memory": null, + "op": "POP", + "pc": 2799, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000001", + "00000000000000000000000000000000000000000000000000000000000008fc", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7833, + "gasCost": 2, + "memory": null, + "op": "POP", + "pc": 2800, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000001", + "00000000000000000000000000000000000000000000000000000000000008fc", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7831, + "gasCost": 2, + "memory": null, + "op": "POP", + "pc": 2801, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000001", + "00000000000000000000000000000000000000000000000000000000000008fc", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7829, + "gasCost": 2, + "memory": null, + "op": "POP", + "pc": 2802, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000001", + "00000000000000000000000000000000000000000000000000000000000008fc" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7827, + "gasCost": 2, + "memory": null, + "op": "ISZERO", + "pc": 2803, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000001" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7824, + "gasCost": 3, + "memory": null, + "op": "DUP1", + "pc": 2804, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7821, + "gasCost": 3, + "memory": null, + "op": "ISZERO", + "pc": 2805, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7818, + "gasCost": 3, + "memory": null, + "op": "PUSH2", + "pc": 2806, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000001" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7815, + "gasCost": 3, + "memory": null, + "op": "JUMPI", + "pc": 2809, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000001", + "0000000000000000000000000000000000000000000000000000000000000b03" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7805, + "gasCost": 10, + "memory": null, + "op": "JUMPDEST", + "pc": 2819, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7804, + "gasCost": 1, + "memory": null, + "op": "POP", + "pc": 2820, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7802, + "gasCost": 2, + "memory": null, + "op": "CALLER", + "pc": 2821, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7800, + "gasCost": 2, + "memory": null, + "op": "PUSH20", + "pc": 2822, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7797, + "gasCost": 3, + "memory": null, + "op": "AND", + "pc": 2843, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "000000000000000000000000ffffffffffffffffffffffffffffffffffffffff" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7794, + "gasCost": 3, + "memory": null, + "op": "PUSH32", + "pc": 2844, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7791, + "gasCost": 3, + "memory": null, + "op": "DUP3", + "pc": 2877, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7788, + "gasCost": 3, + "memory": null, + "op": "PUSH1", + "pc": 2878, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7785, + "gasCost": 3, + "memory": null, + "op": "MLOAD", + "pc": 2880, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000040" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7782, + "gasCost": 3, + "memory": null, + "op": "DUP1", + "pc": 2881, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7779, + "gasCost": 3, + "memory": null, + "op": "DUP3", + "pc": 2882, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000080" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7776, + "gasCost": 3, + "memory": null, + "op": "DUP2", + "pc": 2883, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7773, + "gasCost": 3, + "memory": null, + "op": "MSTORE", + "pc": 2884, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7764, + "gasCost": 9, + "memory": null, + "op": "PUSH1", + "pc": 2885, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000080" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7761, + "gasCost": 3, + "memory": null, + "op": "ADD", + "pc": 2887, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000020" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7758, + "gasCost": 3, + "memory": null, + "op": "SWAP2", + "pc": 2888, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000000000000000000000000000000000000000000080", + "00000000000000000000000000000000000000000000000000000000000000a0" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7755, + "gasCost": 3, + "memory": null, + "op": "POP", + "pc": 2889, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "00000000000000000000000000000000000000000000000000000000000000a0", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7753, + "gasCost": 2, + "memory": null, + "op": "POP", + "pc": 2890, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "00000000000000000000000000000000000000000000000000000000000000a0", + "0000000000000000000000000000000000000000000000000000000000000080" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7751, + "gasCost": 2, + "memory": null, + "op": "PUSH1", + "pc": 2891, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "00000000000000000000000000000000000000000000000000000000000000a0" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7748, + "gasCost": 3, + "memory": null, + "op": "MLOAD", + "pc": 2893, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "00000000000000000000000000000000000000000000000000000000000000a0", + "0000000000000000000000000000000000000000000000000000000000000040" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7745, + "gasCost": 3, + "memory": null, + "op": "DUP1", + "pc": 2894, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "00000000000000000000000000000000000000000000000000000000000000a0", + "0000000000000000000000000000000000000000000000000000000000000080" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7742, + "gasCost": 3, + "memory": null, + "op": "SWAP2", + "pc": 2895, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "00000000000000000000000000000000000000000000000000000000000000a0", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000080" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7739, + "gasCost": 3, + "memory": null, + "op": "SUB", + "pc": 2896, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000080", + "00000000000000000000000000000000000000000000000000000000000000a0" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7736, + "gasCost": 3, + "memory": null, + "op": "SWAP1", + "pc": 2897, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0000000000000000000000000000000000000000000000000000000000000080", + "0000000000000000000000000000000000000000000000000000000000000020" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 7733, + "gasCost": 3, + "memory": null, + "op": "LOG2", + "pc": 2898, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000", + "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", + "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", + "0000000000000000000000000000000000000000000000000000000000000020", + "0000000000000000000000000000000000000000000000000000000000000080" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 6352, + "gasCost": 1381, + "memory": null, + "op": "POP", + "pc": 2899, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289", + "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 6350, + "gasCost": 2, + "memory": null, + "op": "JUMP", + "pc": 2900, + "stack": [ + "000000000000000000000000000000000000000000000000000000002e1a7d4d", + "0000000000000000000000000000000000000000000000000000000000000289" + ], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 6342, + "gasCost": 8, + "memory": null, + "op": "JUMPDEST", + "pc": 649, + "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], + "storage": null + }, + { + "depth": 0, + "error": "", + "gas": 6341, + "gasCost": 1, + "memory": null, + "op": "STOP", + "pc": 650, + "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], + "storage": null + } +] diff --git a/packages/sol-cov/src/trace.ts b/packages/sol-cov/src/trace.ts index febb1034e..30508898b 100644 --- a/packages/sol-cov/src/trace.ts +++ b/packages/sol-cov/src/trace.ts @@ -7,7 +7,7 @@ import * as _ from 'lodash'; export interface TraceByContractAddress { [contractAddress: string]: StructLog[]; } -function padZeros(address: string) { +function padZeros(address: string): string { return addHexPrefix(_.padStart(stripHexPrefix(address), 40, '0')); } diff --git a/packages/sol-cov/test/trace_test.ts b/packages/sol-cov/test/trace_test.ts index 58b9203b0..2d6697ce5 100644 --- a/packages/sol-cov/test/trace_test.ts +++ b/packages/sol-cov/test/trace_test.ts @@ -32,7 +32,7 @@ describe('Trace', () => { const trace = [ { op: OpCode.DelegateCall, - stack: ['0x', '0x', delegateCallAddress], + stack: ['0x', '0x', '0x', '0x', delegateCallAddress], depth: 0, }, { diff --git a/packages/subproviders/src/index.ts b/packages/subproviders/src/index.ts index ff28b8a8d..6cc650a4d 100644 --- a/packages/subproviders/src/index.ts +++ b/packages/subproviders/src/index.ts @@ -4,6 +4,7 @@ export { ECSignature } from '@0xproject/types'; import { LedgerEthereumClient } from './types'; +export { prependSubprovider } from './utils/subprovider_utils'; export { EmptyWalletSubprovider } from './subproviders/empty_wallet_subprovider'; export { FakeGasEstimateSubprovider } from './subproviders/fake_gas_estimate_subprovider'; export { InjectedWeb3Subprovider } from './subproviders/injected_web3'; diff --git a/packages/subproviders/src/utils/subprovider_utils.ts b/packages/subproviders/src/utils/subprovider_utils.ts new file mode 100644 index 000000000..380f98606 --- /dev/null +++ b/packages/subproviders/src/utils/subprovider_utils.ts @@ -0,0 +1,13 @@ +import ProviderEngine = require('web3-provider-engine'); + +import { Subprovider } from '../subproviders/subprovider'; + +/** + * Prepends a subprovider to a provider + * @param provider Given provider + * @param subprovider Subprovider to prepend + */ +export function prependSubprovider(provider: ProviderEngine, subprovider: Subprovider): void { + subprovider.setEngine(provider); + (provider as any)._providers = [subprovider, ...(provider as any)._providers]; +} diff --git a/packages/testnet-faucets/bin/server.js b/packages/testnet-faucets/bin/server.js deleted file mode 100644 index bee332843..000000000 --- a/packages/testnet-faucets/bin/server.js +++ /dev/null @@ -1,780 +0,0 @@ -require("source-map-support").install(); -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 6); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports) { - -module.exports = require("@0xproject/utils"); - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.configs = { - DISPENSER_ADDRESS: process.env.DISPENSER_ADDRESS.toLowerCase(), - DISPENSER_PRIVATE_KEY: process.env.DISPENSER_PRIVATE_KEY, - ENVIRONMENT: process.env.FAUCET_ENVIRONMENT, - INFURA_API_KEY: process.env.INFURA_API_KEY, - ROLLBAR_ACCESS_KEY: process.env.FAUCET_ROLLBAR_ACCESS_KEY, -}; - - -/***/ }), -/* 2 */ -/***/ (function(module, exports) { - -module.exports = require("lodash"); - -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [0, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var utils_1 = __webpack_require__(0); -var rollbar = __webpack_require__(10); -var configs_1 = __webpack_require__(1); -exports.errorReporter = { - setup: function () { - var _this = this; - rollbar.init(configs_1.configs.ROLLBAR_ACCESS_KEY, { - environment: configs_1.configs.ENVIRONMENT, - }); - rollbar.handleUncaughtExceptions(configs_1.configs.ROLLBAR_ACCESS_KEY); - process.on('unhandledRejection', function (err) { return __awaiter(_this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - utils_1.logUtils.log("Uncaught exception " + err + ". Stack: " + err.stack); - return [4 /*yield*/, this.reportAsync(err)]; - case 1: - _a.sent(); - process.exit(1); - return [2 /*return*/]; - } - }); - }); }); - }, - reportAsync: function (err, req) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - if (configs_1.configs.ENVIRONMENT === 'development') { - return [2 /*return*/]; // Do not log development environment errors - } - return [2 /*return*/, new Promise(function (resolve, reject) { - rollbar.handleError(err, req, function (rollbarErr) { - if (rollbarErr) { - utils_1.logUtils.log("Error reporting to rollbar, ignoring: " + rollbarErr); - reject(rollbarErr); - } - else { - resolve(); - } - }); - })]; - }); - }); - }, - errorHandler: function () { - return rollbar.errorHandler(configs_1.configs.ROLLBAR_ACCESS_KEY); - }, -}; - - -/***/ }), -/* 4 */ -/***/ (function(module, exports) { - -module.exports = require("0x.js"); - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var configs_1 = __webpack_require__(1); -var productionRpcUrls = { - '3': "https://ropsten.infura.io/" + configs_1.configs.INFURA_API_KEY, - '4': "https://rinkeby.infura.io/" + configs_1.configs.INFURA_API_KEY, - '42': "https://kovan.infura.io/" + configs_1.configs.INFURA_API_KEY, -}; -var developmentRpcUrls = { - '50': 'http://127.0.0.1:8545', -}; -exports.rpcUrls = configs_1.configs.ENVIRONMENT === 'development' ? developmentRpcUrls : productionRpcUrls; - - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(7); - - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var bodyParser = __webpack_require__(8); -var express = __webpack_require__(9); -var error_reporter_1 = __webpack_require__(3); -var handler_1 = __webpack_require__(11); -var parameter_transformer_1 = __webpack_require__(18); -// Setup the errorReporter to catch uncaught exceptions and unhandled rejections -error_reporter_1.errorReporter.setup(); -var app = express(); -app.use(bodyParser.json()); // for parsing application/json -app.use(function (req, res, next) { - res.header('Access-Control-Allow-Origin', '*'); - res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); - next(); -}); -var handler = new handler_1.Handler(); -app.get('/ping', function (req, res) { - res.status(200).send('pong'); -}); -app.get('/info', handler.getQueueInfo.bind(handler)); -app.get('/ether/:recipient', parameter_transformer_1.parameterTransformer.transform, handler.dispenseEther.bind(handler)); -app.get('/zrx/:recipient', parameter_transformer_1.parameterTransformer.transform, handler.dispenseZRX.bind(handler)); -app.get('/order/weth/:recipient', parameter_transformer_1.parameterTransformer.transform, handler.dispenseWETHOrder.bind(handler)); -app.get('/order/zrx/:recipient', parameter_transformer_1.parameterTransformer.transform, handler.dispenseZRXOrder.bind(handler)); -// Log to rollbar any errors unhandled by handlers -app.use(error_reporter_1.errorReporter.errorHandler()); -var port = process.env.PORT || 3000; -app.listen(port); - - -/***/ }), -/* 8 */ -/***/ (function(module, exports) { - -module.exports = require("body-parser"); - -/***/ }), -/* 9 */ -/***/ (function(module, exports) { - -module.exports = require("express"); - -/***/ }), -/* 10 */ -/***/ (function(module, exports) { - -module.exports = require("rollbar"); - -/***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __assign = (this && this.__assign) || Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [0, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var _0x_js_1 = __webpack_require__(4); -var utils_1 = __webpack_require__(0); -var _ = __webpack_require__(2); -var Web3 = __webpack_require__(12); -// HACK: web3 injects XMLHttpRequest into the global scope and ProviderEngine checks XMLHttpRequest -// to know whether it is running in a browser or node environment. We need it to be undefined since -// we are not running in a browser env. -// Filed issue: https://github.com/ethereum/web3.js/issues/844 -global.XMLHttpRequest = undefined; -var subproviders_1 = __webpack_require__(13); -var ProviderEngine = __webpack_require__(14); -var RpcSubprovider = __webpack_require__(15); -var configs_1 = __webpack_require__(1); -var dispatch_queue_1 = __webpack_require__(16); -var dispense_asset_tasks_1 = __webpack_require__(17); -var rpc_urls_1 = __webpack_require__(5); -var RequestedAssetType; -(function (RequestedAssetType) { - RequestedAssetType["ETH"] = "ETH"; - RequestedAssetType["WETH"] = "WETH"; - RequestedAssetType["ZRX"] = "ZRX"; -})(RequestedAssetType || (RequestedAssetType = {})); -var FIVE_DAYS_IN_MS = 4.32e8; // TODO: make this configurable -var Handler = /** @class */ (function () { - function Handler() { - var _this = this; - this._networkConfigByNetworkId = {}; - _.forIn(rpc_urls_1.rpcUrls, function (rpcUrl, networkId) { - var providerObj = Handler._createProviderEngine(rpcUrl); - var web3 = new Web3(providerObj); - var zeroExConfig = { - networkId: +networkId, - }; - var zeroEx = new _0x_js_1.ZeroEx(web3.currentProvider, zeroExConfig); - var dispatchQueue = new dispatch_queue_1.DispatchQueue(); - _this._networkConfigByNetworkId[networkId] = { - dispatchQueue: dispatchQueue, - web3: web3, - zeroEx: zeroEx, - }; - }); - } - Handler._createProviderEngine = function (rpcUrl) { - if (_.isUndefined(configs_1.configs.DISPENSER_PRIVATE_KEY)) { - throw new Error('Dispenser Private key not found'); - } - var engine = new ProviderEngine(); - engine.addProvider(new subproviders_1.NonceTrackerSubprovider()); - engine.addProvider(new subproviders_1.PrivateKeyWalletSubprovider(configs_1.configs.DISPENSER_PRIVATE_KEY)); - engine.addProvider(new RpcSubprovider({ - rpcUrl: rpcUrl, - })); - engine.start(); - return engine; - }; - Handler.prototype.getQueueInfo = function (req, res) { - var _this = this; - res.setHeader('Content-Type', 'application/json'); - var queueInfo = _.mapValues(rpc_urls_1.rpcUrls, function (rpcUrl, networkId) { - var dispatchQueue = _this._networkConfigByNetworkId[networkId].dispatchQueue; - return { - full: dispatchQueue.isFull(), - size: dispatchQueue.size(), - }; - }); - var payload = JSON.stringify(queueInfo); - res.status(200).send(payload); - }; - Handler.prototype.dispenseEther = function (req, res) { - this._dispenseAsset(req, res, RequestedAssetType.ETH); - }; - Handler.prototype.dispenseZRX = function (req, res) { - this._dispenseAsset(req, res, RequestedAssetType.ZRX); - }; - Handler.prototype.dispenseWETHOrder = function (req, res) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this._dispenseOrder(req, res, RequestedAssetType.WETH)]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }); - }; - Handler.prototype.dispenseZRXOrder = function (req, res, next) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this._dispenseOrder(req, res, RequestedAssetType.ZRX)]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }); - }; - Handler.prototype._dispenseAsset = function (req, res, requestedAssetType) { - var networkId = req.params.networkId; - var recipient = req.params.recipient; - var networkConfig = this._networkConfigByNetworkId[networkId]; - var dispenserTask; - switch (requestedAssetType) { - case RequestedAssetType.ETH: - dispenserTask = dispense_asset_tasks_1.dispenseAssetTasks.dispenseEtherTask(recipient, networkConfig.web3); - break; - case RequestedAssetType.WETH: - case RequestedAssetType.ZRX: - dispenserTask = dispense_asset_tasks_1.dispenseAssetTasks.dispenseTokenTask(recipient, requestedAssetType, networkConfig.zeroEx); - break; - default: - throw new Error("Unsupported asset type: " + requestedAssetType); - } - var didAddToQueue = networkConfig.dispatchQueue.add(dispenserTask); - if (!didAddToQueue) { - res.status(503).send('QUEUE_IS_FULL'); - return; - } - utils_1.logUtils.log("Added " + recipient + " to queue: " + requestedAssetType + " networkId: " + networkId); - res.status(200).end(); - }; - Handler.prototype._dispenseOrder = function (req, res, requestedAssetType) { - return __awaiter(this, void 0, void 0, function () { - var networkConfig, zeroEx, makerToken, takerTokenSymbol, takerToken, makerTokenAmount, takerTokenAmount, order, orderHash, signature, signedOrder, signedOrderHash, payload; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - networkConfig = _.get(this._networkConfigByNetworkId, req.params.networkId); - if (_.isUndefined(networkConfig)) { - res.status(400).send('UNSUPPORTED_NETWORK_ID'); - return [2 /*return*/]; - } - zeroEx = networkConfig.zeroEx; - res.setHeader('Content-Type', 'application/json'); - return [4 /*yield*/, zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(requestedAssetType)]; - case 1: - makerToken = _a.sent(); - if (_.isUndefined(makerToken)) { - throw new Error("Unsupported asset type: " + requestedAssetType); - } - takerTokenSymbol = requestedAssetType === RequestedAssetType.WETH ? RequestedAssetType.ZRX : RequestedAssetType.WETH; - return [4 /*yield*/, zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(takerTokenSymbol)]; - case 2: - takerToken = _a.sent(); - if (_.isUndefined(takerToken)) { - throw new Error("Unsupported asset type: " + requestedAssetType); - } - makerTokenAmount = _0x_js_1.ZeroEx.toBaseUnitAmount(new utils_1.BigNumber(0.1), makerToken.decimals); - takerTokenAmount = _0x_js_1.ZeroEx.toBaseUnitAmount(new utils_1.BigNumber(0.1), takerToken.decimals); - order = { - maker: configs_1.configs.DISPENSER_ADDRESS, - taker: req.params.recipient, - makerFee: new utils_1.BigNumber(0), - takerFee: new utils_1.BigNumber(0), - makerTokenAmount: makerTokenAmount, - takerTokenAmount: takerTokenAmount, - makerTokenAddress: makerToken.address, - takerTokenAddress: takerToken.address, - salt: _0x_js_1.ZeroEx.generatePseudoRandomSalt(), - exchangeContractAddress: zeroEx.exchange.getContractAddress(), - feeRecipient: _0x_js_1.ZeroEx.NULL_ADDRESS, - expirationUnixTimestampSec: new utils_1.BigNumber(Date.now() + FIVE_DAYS_IN_MS), - }; - orderHash = _0x_js_1.ZeroEx.getOrderHashHex(order); - return [4 /*yield*/, zeroEx.signOrderHashAsync(orderHash, configs_1.configs.DISPENSER_ADDRESS, false)]; - case 3: - signature = _a.sent(); - signedOrder = __assign({}, order, { ecSignature: signature }); - signedOrderHash = _0x_js_1.ZeroEx.getOrderHashHex(signedOrder); - payload = JSON.stringify(signedOrder); - utils_1.logUtils.log("Dispensed signed order: " + payload); - res.status(200).send(payload); - return [2 /*return*/]; - } - }); - }); - }; - return Handler; -}()); -exports.Handler = Handler; - - -/***/ }), -/* 12 */ -/***/ (function(module, exports) { - -module.exports = require("web3"); - -/***/ }), -/* 13 */ -/***/ (function(module, exports) { - -module.exports = require("@0xproject/subproviders"); - -/***/ }), -/* 14 */ -/***/ (function(module, exports) { - -module.exports = require("web3-provider-engine"); - -/***/ }), -/* 15 */ -/***/ (function(module, exports) { - -module.exports = require("web3-provider-engine/subproviders/rpc"); - -/***/ }), -/* 16 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [0, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var utils_1 = __webpack_require__(0); -var _ = __webpack_require__(2); -var error_reporter_1 = __webpack_require__(3); -var MAX_QUEUE_SIZE = 500; -var DEFAULT_QUEUE_INTERVAL_MS = 1000; -var DispatchQueue = /** @class */ (function () { - function DispatchQueue() { - this._queueIntervalMs = DEFAULT_QUEUE_INTERVAL_MS; - this._queue = []; - this._start(); - } - DispatchQueue.prototype.add = function (taskAsync) { - if (this.isFull()) { - return false; - } - this._queue.push(taskAsync); - return true; - }; - DispatchQueue.prototype.size = function () { - return this._queue.length; - }; - DispatchQueue.prototype.isFull = function () { - return this.size() >= MAX_QUEUE_SIZE; - }; - DispatchQueue.prototype.stop = function () { - if (!_.isUndefined(this._queueIntervalIdIfExists)) { - utils_1.intervalUtils.clearAsyncExcludingInterval(this._queueIntervalIdIfExists); - } - }; - DispatchQueue.prototype._start = function () { - var _this = this; - this._queueIntervalIdIfExists = utils_1.intervalUtils.setAsyncExcludingInterval(function () { return __awaiter(_this, void 0, void 0, function () { - var taskAsync; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - taskAsync = this._queue.shift(); - if (_.isUndefined(taskAsync)) { - return [2 /*return*/, Promise.resolve()]; - } - return [4 /*yield*/, taskAsync()]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }); }, this._queueIntervalMs, function (err) { - utils_1.logUtils.log("Unexpected err: " + err + " - " + JSON.stringify(err)); - // tslint:disable-next-line:no-floating-promises - error_reporter_1.errorReporter.reportAsync(err); - }); - }; - return DispatchQueue; -}()); -exports.DispatchQueue = DispatchQueue; - - -/***/ }), -/* 17 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [0, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var _0x_js_1 = __webpack_require__(4); -var utils_1 = __webpack_require__(0); -var _ = __webpack_require__(2); -var configs_1 = __webpack_require__(1); -var DISPENSE_AMOUNT_ETHER = 0.1; -var DISPENSE_AMOUNT_TOKEN = 0.1; -var DISPENSE_MAX_AMOUNT_TOKEN = 2; -var DISPENSE_MAX_AMOUNT_ETHER = 2; -exports.dispenseAssetTasks = { - dispenseEtherTask: function (recipientAddress, web3) { - var _this = this; - return function () { return __awaiter(_this, void 0, void 0, function () { - var userBalance, maxAmountInWei, sendTransactionAsync, txHash; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - utils_1.logUtils.log("Processing ETH " + recipientAddress); - return [4 /*yield*/, utils_1.promisify(web3.eth.getBalance)(recipientAddress)]; - case 1: - userBalance = _a.sent(); - maxAmountInWei = new utils_1.BigNumber(web3.toWei(DISPENSE_MAX_AMOUNT_ETHER, 'ether')); - if (userBalance.greaterThanOrEqualTo(maxAmountInWei)) { - utils_1.logUtils.log("User exceeded ETH balance maximum (" + maxAmountInWei + ") " + recipientAddress + " " + userBalance + " "); - return [2 /*return*/]; - } - sendTransactionAsync = utils_1.promisify(web3.eth.sendTransaction); - return [4 /*yield*/, sendTransactionAsync({ - from: configs_1.configs.DISPENSER_ADDRESS, - to: recipientAddress, - value: web3.toWei(DISPENSE_AMOUNT_ETHER, 'ether'), - })]; - case 2: - txHash = _a.sent(); - utils_1.logUtils.log("Sent " + DISPENSE_AMOUNT_ETHER + " ETH to " + recipientAddress + " tx: " + txHash); - return [2 /*return*/]; - } - }); - }); }; - }, - dispenseTokenTask: function (recipientAddress, tokenSymbol, zeroEx) { - var _this = this; - return function () { return __awaiter(_this, void 0, void 0, function () { - var amountToDispense, token, baseUnitAmount, userBalanceBaseUnits, maxAmountBaseUnits, txHash; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - utils_1.logUtils.log("Processing " + tokenSymbol + " " + recipientAddress); - amountToDispense = new utils_1.BigNumber(DISPENSE_AMOUNT_TOKEN); - return [4 /*yield*/, zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(tokenSymbol)]; - case 1: - token = _a.sent(); - if (_.isUndefined(token)) { - throw new Error("Unsupported asset type: " + tokenSymbol); - } - baseUnitAmount = _0x_js_1.ZeroEx.toBaseUnitAmount(amountToDispense, token.decimals); - return [4 /*yield*/, zeroEx.token.getBalanceAsync(token.address, recipientAddress)]; - case 2: - userBalanceBaseUnits = _a.sent(); - maxAmountBaseUnits = _0x_js_1.ZeroEx.toBaseUnitAmount(new utils_1.BigNumber(DISPENSE_MAX_AMOUNT_TOKEN), token.decimals); - if (userBalanceBaseUnits.greaterThanOrEqualTo(maxAmountBaseUnits)) { - utils_1.logUtils.log("User exceeded token balance maximum (" + maxAmountBaseUnits + ") " + recipientAddress + " " + userBalanceBaseUnits + " "); - return [2 /*return*/]; - } - return [4 /*yield*/, zeroEx.token.transferAsync(token.address, configs_1.configs.DISPENSER_ADDRESS, recipientAddress, baseUnitAmount)]; - case 3: - txHash = _a.sent(); - utils_1.logUtils.log("Sent " + amountToDispense + " ZRX to " + recipientAddress + " tx: " + txHash); - return [2 /*return*/]; - } - }); - }); }; - }, -}; - - -/***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var utils_1 = __webpack_require__(0); -var _ = __webpack_require__(2); -var rpc_urls_1 = __webpack_require__(5); -var DEFAULT_NETWORK_ID = 42; // kovan -exports.parameterTransformer = { - transform: function (req, res, next) { - var recipientAddress = req.params.recipient; - if (_.isUndefined(recipientAddress) || !utils_1.addressUtils.isAddress(recipientAddress)) { - res.status(400).send('INVALID_RECIPIENT_ADDRESS'); - return; - } - var lowerCaseRecipientAddress = recipientAddress.toLowerCase(); - req.params.recipient = lowerCaseRecipientAddress; - var networkId = _.get(req.query, 'networkId', DEFAULT_NETWORK_ID); - var rpcUrlIfExists = _.get(rpc_urls_1.rpcUrls, networkId); - if (_.isUndefined(rpcUrlIfExists)) { - res.status(400).send('UNSUPPORTED_NETWORK_ID'); - return; - } - req.params.networkId = networkId; - next(); - }, -}; - - -/***/ }) -/******/ ]); -//# sourceMappingURL=server.js.map \ No newline at end of file diff --git a/packages/testnet-faucets/bin/server.js.map b/packages/testnet-faucets/bin/server.js.map deleted file mode 100644 index c8c227727..000000000 --- a/packages/testnet-faucets/bin/server.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap b91d2cee364b5e101d43","webpack:///external \"@0xproject/utils\"","webpack:///./src/ts/configs.ts","webpack:///external \"lodash\"","webpack:///./src/ts/error_reporter.ts","webpack:///external \"0x.js\"","webpack:///./src/ts/rpc_urls.ts","webpack:///./src/ts/server.ts","webpack:///external \"body-parser\"","webpack:///external \"express\"","webpack:///external \"rollbar\"","webpack:///./src/ts/handler.ts","webpack:///external \"web3\"","webpack:///external \"@0xproject/subproviders\"","webpack:///external \"web3-provider-engine\"","webpack:///external \"web3-provider-engine/subproviders/rpc\"","webpack:///./src/ts/dispatch_queue.ts","webpack:///./src/ts/dispense_asset_tasks.ts","webpack:///./src/ts/parameter_transformer.ts"],"names":[],"mappings":"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","file":"server.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap b91d2cee364b5e101d43","module.exports = require(\"@0xproject/utils\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@0xproject/utils\"\n// module id = 0\n// module chunks = 0","export const configs = {\n DISPENSER_ADDRESS: (process.env.DISPENSER_ADDRESS as string).toLowerCase(),\n DISPENSER_PRIVATE_KEY: process.env.DISPENSER_PRIVATE_KEY,\n ENVIRONMENT: process.env.FAUCET_ENVIRONMENT,\n INFURA_API_KEY: process.env.INFURA_API_KEY,\n ROLLBAR_ACCESS_KEY: process.env.FAUCET_ROLLBAR_ACCESS_KEY,\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/configs.ts","module.exports = require(\"lodash\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"lodash\"\n// module id = 2\n// module chunks = 0","import { logUtils } from '@0xproject/utils';\nimport * as express from 'express';\nimport rollbar = require('rollbar');\n\nimport { configs } from './configs';\n\nexport const errorReporter = {\n setup() {\n rollbar.init(configs.ROLLBAR_ACCESS_KEY, {\n environment: configs.ENVIRONMENT,\n });\n rollbar.handleUncaughtExceptions(configs.ROLLBAR_ACCESS_KEY);\n process.on('unhandledRejection', async (err: Error) => {\n logUtils.log(`Uncaught exception ${err}. Stack: ${err.stack}`);\n await this.reportAsync(err);\n process.exit(1);\n });\n },\n async reportAsync(err: Error, req?: express.Request): Promise {\n if (configs.ENVIRONMENT === 'development') {\n return; // Do not log development environment errors\n }\n return new Promise((resolve, reject) => {\n rollbar.handleError(err, req, (rollbarErr: Error) => {\n if (rollbarErr) {\n logUtils.log(`Error reporting to rollbar, ignoring: ${rollbarErr}`);\n reject(rollbarErr);\n } else {\n resolve();\n }\n });\n });\n },\n errorHandler() {\n return rollbar.errorHandler(configs.ROLLBAR_ACCESS_KEY);\n },\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/error_reporter.ts","module.exports = require(\"0x.js\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"0x.js\"\n// module id = 4\n// module chunks = 0","import { configs } from './configs';\n\nconst productionRpcUrls = {\n '3': `https://ropsten.infura.io/${configs.INFURA_API_KEY}`,\n '4': `https://rinkeby.infura.io/${configs.INFURA_API_KEY}`,\n '42': `https://kovan.infura.io/${configs.INFURA_API_KEY}`,\n};\n\nconst developmentRpcUrls = {\n '50': 'http://127.0.0.1:8545',\n};\n\nexport const rpcUrls = configs.ENVIRONMENT === 'development' ? developmentRpcUrls : productionRpcUrls;\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/rpc_urls.ts","import * as bodyParser from 'body-parser';\nimport * as express from 'express';\n\nimport { errorReporter } from './error_reporter';\nimport { Handler } from './handler';\nimport { parameterTransformer } from './parameter_transformer';\n\n// Setup the errorReporter to catch uncaught exceptions and unhandled rejections\nerrorReporter.setup();\n\nconst app = express();\napp.use(bodyParser.json()); // for parsing application/json\napp.use((req, res, next) => {\n res.header('Access-Control-Allow-Origin', '*');\n res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');\n next();\n});\n\nconst handler = new Handler();\napp.get('/ping', (req: express.Request, res: express.Response) => {\n res.status(200).send('pong');\n});\napp.get('/info', handler.getQueueInfo.bind(handler));\napp.get('/ether/:recipient', parameterTransformer.transform, handler.dispenseEther.bind(handler));\napp.get('/zrx/:recipient', parameterTransformer.transform, handler.dispenseZRX.bind(handler));\napp.get('/order/weth/:recipient', parameterTransformer.transform, handler.dispenseWETHOrder.bind(handler));\napp.get('/order/zrx/:recipient', parameterTransformer.transform, handler.dispenseZRXOrder.bind(handler));\n\n// Log to rollbar any errors unhandled by handlers\napp.use(errorReporter.errorHandler());\nconst port = process.env.PORT || 3000;\napp.listen(port);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/server.ts","module.exports = require(\"body-parser\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"body-parser\"\n// module id = 8\n// module chunks = 0","module.exports = require(\"express\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"express\"\n// module id = 9\n// module chunks = 0","module.exports = require(\"rollbar\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"rollbar\"\n// module id = 10\n// module chunks = 0","import { Order, SignedOrder, ZeroEx } from '0x.js';\nimport { BigNumber, logUtils } from '@0xproject/utils';\nimport * as express from 'express';\nimport * as _ from 'lodash';\nimport * as Web3 from 'web3';\n\n// HACK: web3 injects XMLHttpRequest into the global scope and ProviderEngine checks XMLHttpRequest\n// to know whether it is running in a browser or node environment. We need it to be undefined since\n// we are not running in a browser env.\n// Filed issue: https://github.com/ethereum/web3.js/issues/844\n(global as any).XMLHttpRequest = undefined;\nimport { NonceTrackerSubprovider, PrivateKeyWalletSubprovider } from '@0xproject/subproviders';\nimport ProviderEngine = require('web3-provider-engine');\nimport RpcSubprovider = require('web3-provider-engine/subproviders/rpc');\n\nimport { configs } from './configs';\nimport { DispatchQueue } from './dispatch_queue';\nimport { dispenseAssetTasks } from './dispense_asset_tasks';\nimport { rpcUrls } from './rpc_urls';\n\ninterface NetworkConfig {\n dispatchQueue: DispatchQueue;\n web3: Web3;\n zeroEx: ZeroEx;\n}\n\ninterface ItemByNetworkId {\n [networkId: string]: T;\n}\n\nenum RequestedAssetType {\n ETH = 'ETH',\n WETH = 'WETH',\n ZRX = 'ZRX',\n}\n\nconst FIVE_DAYS_IN_MS = 4.32e8; // TODO: make this configurable\n\nexport class Handler {\n private _networkConfigByNetworkId: ItemByNetworkId = {};\n private static _createProviderEngine(rpcUrl: string) {\n if (_.isUndefined(configs.DISPENSER_PRIVATE_KEY)) {\n throw new Error('Dispenser Private key not found');\n }\n const engine = new ProviderEngine();\n engine.addProvider(new NonceTrackerSubprovider());\n engine.addProvider(new PrivateKeyWalletSubprovider(configs.DISPENSER_PRIVATE_KEY));\n engine.addProvider(\n new RpcSubprovider({\n rpcUrl,\n }),\n );\n engine.start();\n return engine;\n }\n constructor() {\n _.forIn(rpcUrls, (rpcUrl: string, networkId: string) => {\n const providerObj = Handler._createProviderEngine(rpcUrl);\n const web3 = new Web3(providerObj);\n const zeroExConfig = {\n networkId: +networkId,\n };\n const zeroEx = new ZeroEx(web3.currentProvider, zeroExConfig);\n const dispatchQueue = new DispatchQueue();\n this._networkConfigByNetworkId[networkId] = {\n dispatchQueue,\n web3,\n zeroEx,\n };\n });\n }\n public getQueueInfo(req: express.Request, res: express.Response) {\n res.setHeader('Content-Type', 'application/json');\n const queueInfo = _.mapValues(rpcUrls, (rpcUrl: string, networkId: string) => {\n const dispatchQueue = this._networkConfigByNetworkId[networkId].dispatchQueue;\n return {\n full: dispatchQueue.isFull(),\n size: dispatchQueue.size(),\n };\n });\n const payload = JSON.stringify(queueInfo);\n res.status(200).send(payload);\n }\n public dispenseEther(req: express.Request, res: express.Response) {\n this._dispenseAsset(req, res, RequestedAssetType.ETH);\n }\n public dispenseZRX(req: express.Request, res: express.Response) {\n this._dispenseAsset(req, res, RequestedAssetType.ZRX);\n }\n public async dispenseWETHOrder(req: express.Request, res: express.Response) {\n await this._dispenseOrder(req, res, RequestedAssetType.WETH);\n }\n public async dispenseZRXOrder(req: express.Request, res: express.Response, next: express.NextFunction) {\n await this._dispenseOrder(req, res, RequestedAssetType.ZRX);\n }\n private _dispenseAsset(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType) {\n const networkId = req.params.networkId;\n const recipient = req.params.recipient;\n const networkConfig = this._networkConfigByNetworkId[networkId];\n let dispenserTask;\n switch (requestedAssetType) {\n case RequestedAssetType.ETH:\n dispenserTask = dispenseAssetTasks.dispenseEtherTask(recipient, networkConfig.web3);\n break;\n case RequestedAssetType.WETH:\n case RequestedAssetType.ZRX:\n dispenserTask = dispenseAssetTasks.dispenseTokenTask(\n recipient,\n requestedAssetType,\n networkConfig.zeroEx,\n );\n break;\n default:\n throw new Error(`Unsupported asset type: ${requestedAssetType}`);\n }\n const didAddToQueue = networkConfig.dispatchQueue.add(dispenserTask);\n if (!didAddToQueue) {\n res.status(503).send('QUEUE_IS_FULL');\n return;\n }\n logUtils.log(`Added ${recipient} to queue: ${requestedAssetType} networkId: ${networkId}`);\n res.status(200).end();\n }\n private async _dispenseOrder(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType) {\n const networkConfig = _.get(this._networkConfigByNetworkId, req.params.networkId);\n if (_.isUndefined(networkConfig)) {\n res.status(400).send('UNSUPPORTED_NETWORK_ID');\n return;\n }\n const zeroEx = networkConfig.zeroEx;\n res.setHeader('Content-Type', 'application/json');\n const makerToken = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(requestedAssetType);\n if (_.isUndefined(makerToken)) {\n throw new Error(`Unsupported asset type: ${requestedAssetType}`);\n }\n const takerTokenSymbol =\n requestedAssetType === RequestedAssetType.WETH ? RequestedAssetType.ZRX : RequestedAssetType.WETH;\n const takerToken = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(takerTokenSymbol);\n if (_.isUndefined(takerToken)) {\n throw new Error(`Unsupported asset type: ${requestedAssetType}`);\n }\n const makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(0.1), makerToken.decimals);\n const takerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(0.1), takerToken.decimals);\n const order: Order = {\n maker: configs.DISPENSER_ADDRESS,\n taker: req.params.recipient,\n makerFee: new BigNumber(0),\n takerFee: new BigNumber(0),\n makerTokenAmount,\n takerTokenAmount,\n makerTokenAddress: makerToken.address,\n takerTokenAddress: takerToken.address,\n salt: ZeroEx.generatePseudoRandomSalt(),\n exchangeContractAddress: zeroEx.exchange.getContractAddress(),\n feeRecipient: ZeroEx.NULL_ADDRESS,\n expirationUnixTimestampSec: new BigNumber(Date.now() + FIVE_DAYS_IN_MS),\n };\n const orderHash = ZeroEx.getOrderHashHex(order);\n const signature = await zeroEx.signOrderHashAsync(orderHash, configs.DISPENSER_ADDRESS, false);\n const signedOrder = {\n ...order,\n ecSignature: signature,\n };\n const signedOrderHash = ZeroEx.getOrderHashHex(signedOrder);\n const payload = JSON.stringify(signedOrder);\n logUtils.log(`Dispensed signed order: ${payload}`);\n res.status(200).send(payload);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/handler.ts","module.exports = require(\"web3\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"web3\"\n// module id = 12\n// module chunks = 0","module.exports = require(\"@0xproject/subproviders\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@0xproject/subproviders\"\n// module id = 13\n// module chunks = 0","module.exports = require(\"web3-provider-engine\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"web3-provider-engine\"\n// module id = 14\n// module chunks = 0","module.exports = require(\"web3-provider-engine/subproviders/rpc\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"web3-provider-engine/subproviders/rpc\"\n// module id = 15\n// module chunks = 0","import { intervalUtils, logUtils } from '@0xproject/utils';\nimport * as _ from 'lodash';\n\nimport { errorReporter } from './error_reporter';\n\nconst MAX_QUEUE_SIZE = 500;\nconst DEFAULT_QUEUE_INTERVAL_MS = 1000;\n\nexport class DispatchQueue {\n private _queueIntervalMs: number;\n private _queue: Array<() => Promise>;\n private _queueIntervalIdIfExists?: NodeJS.Timer;\n constructor() {\n this._queueIntervalMs = DEFAULT_QUEUE_INTERVAL_MS;\n this._queue = [];\n this._start();\n }\n public add(taskAsync: () => Promise): boolean {\n if (this.isFull()) {\n return false;\n }\n this._queue.push(taskAsync);\n return true;\n }\n public size(): number {\n return this._queue.length;\n }\n public isFull(): boolean {\n return this.size() >= MAX_QUEUE_SIZE;\n }\n public stop() {\n if (!_.isUndefined(this._queueIntervalIdIfExists)) {\n intervalUtils.clearAsyncExcludingInterval(this._queueIntervalIdIfExists);\n }\n }\n private _start() {\n this._queueIntervalIdIfExists = intervalUtils.setAsyncExcludingInterval(\n async () => {\n const taskAsync = this._queue.shift();\n if (_.isUndefined(taskAsync)) {\n return Promise.resolve();\n }\n await taskAsync();\n },\n this._queueIntervalMs,\n (err: Error) => {\n logUtils.log(`Unexpected err: ${err} - ${JSON.stringify(err)}`);\n // tslint:disable-next-line:no-floating-promises\n errorReporter.reportAsync(err);\n },\n );\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/dispatch_queue.ts","import { ZeroEx } from '0x.js';\nimport { BigNumber, logUtils, promisify } from '@0xproject/utils';\nimport * as _ from 'lodash';\nimport * as Web3 from 'web3';\n\nimport { configs } from './configs';\nimport { errorReporter } from './error_reporter';\n\nconst DISPENSE_AMOUNT_ETHER = 0.1;\nconst DISPENSE_AMOUNT_TOKEN = 0.1;\nconst DISPENSE_MAX_AMOUNT_TOKEN = 2;\nconst DISPENSE_MAX_AMOUNT_ETHER = 2;\n\nexport const dispenseAssetTasks = {\n dispenseEtherTask(recipientAddress: string, web3: Web3) {\n return async () => {\n logUtils.log(`Processing ETH ${recipientAddress}`);\n const userBalance = await promisify(web3.eth.getBalance)(recipientAddress);\n const maxAmountInWei = new BigNumber(web3.toWei(DISPENSE_MAX_AMOUNT_ETHER, 'ether'));\n if (userBalance.greaterThanOrEqualTo(maxAmountInWei)) {\n logUtils.log(\n `User exceeded ETH balance maximum (${maxAmountInWei}) ${recipientAddress} ${userBalance} `,\n );\n return;\n }\n const sendTransactionAsync = promisify(web3.eth.sendTransaction);\n const txHash = await sendTransactionAsync({\n from: configs.DISPENSER_ADDRESS,\n to: recipientAddress,\n value: web3.toWei(DISPENSE_AMOUNT_ETHER, 'ether'),\n });\n logUtils.log(`Sent ${DISPENSE_AMOUNT_ETHER} ETH to ${recipientAddress} tx: ${txHash}`);\n };\n },\n dispenseTokenTask(recipientAddress: string, tokenSymbol: string, zeroEx: ZeroEx) {\n return async () => {\n logUtils.log(`Processing ${tokenSymbol} ${recipientAddress}`);\n const amountToDispense = new BigNumber(DISPENSE_AMOUNT_TOKEN);\n const token = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(tokenSymbol);\n if (_.isUndefined(token)) {\n throw new Error(`Unsupported asset type: ${tokenSymbol}`);\n }\n const baseUnitAmount = ZeroEx.toBaseUnitAmount(amountToDispense, token.decimals);\n const userBalanceBaseUnits = await zeroEx.token.getBalanceAsync(token.address, recipientAddress);\n const maxAmountBaseUnits = ZeroEx.toBaseUnitAmount(\n new BigNumber(DISPENSE_MAX_AMOUNT_TOKEN),\n token.decimals,\n );\n if (userBalanceBaseUnits.greaterThanOrEqualTo(maxAmountBaseUnits)) {\n logUtils.log(\n `User exceeded token balance maximum (${maxAmountBaseUnits}) ${recipientAddress} ${userBalanceBaseUnits} `,\n );\n return;\n }\n const txHash = await zeroEx.token.transferAsync(\n token.address,\n configs.DISPENSER_ADDRESS,\n recipientAddress,\n baseUnitAmount,\n );\n logUtils.log(`Sent ${amountToDispense} ZRX to ${recipientAddress} tx: ${txHash}`);\n };\n },\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/dispense_asset_tasks.ts","import { addressUtils } from '@0xproject/utils';\nimport { NextFunction, Request, Response } from 'express';\nimport * as _ from 'lodash';\n\nimport { configs } from './configs';\nimport { rpcUrls } from './rpc_urls';\n\nconst DEFAULT_NETWORK_ID = 42; // kovan\n\nexport const parameterTransformer = {\n transform(req: Request, res: Response, next: NextFunction) {\n const recipientAddress = req.params.recipient;\n if (_.isUndefined(recipientAddress) || !addressUtils.isAddress(recipientAddress)) {\n res.status(400).send('INVALID_RECIPIENT_ADDRESS');\n return;\n }\n const lowerCaseRecipientAddress = recipientAddress.toLowerCase();\n req.params.recipient = lowerCaseRecipientAddress;\n const networkId = _.get(req.query, 'networkId', DEFAULT_NETWORK_ID);\n const rpcUrlIfExists = _.get(rpcUrls, networkId);\n if (_.isUndefined(rpcUrlIfExists)) {\n res.status(400).send('UNSUPPORTED_NETWORK_ID');\n return;\n }\n req.params.networkId = networkId;\n next();\n },\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/parameter_transformer.ts"],"sourceRoot":""} \ No newline at end of file diff --git a/packages/typescript-typings/types/web3-provider-engine/index.d.ts b/packages/typescript-typings/types/web3-provider-engine/index.d.ts index 15a8d0005..8d5aef749 100644 --- a/packages/typescript-typings/types/web3-provider-engine/index.d.ts +++ b/packages/typescript-typings/types/web3-provider-engine/index.d.ts @@ -1,8 +1,12 @@ declare module 'web3-provider-engine' { - class Web3ProviderEngine { + import { Provider, JSONRPCRequestPayload, JSONRPCResponsePayload } from '@0xproject/types'; + class Web3ProviderEngine implements Provider { public on(event: string, handler: () => void): void; - public send(payload: any): void; - public sendAsync(payload: any, callback: (error: any, response: any) => void): void; + public send(payload: JSONRPCRequestPayload): void; + public sendAsync( + payload: JSONRPCRequestPayload, + callback: (error: null | Error, response: JSONRPCResponsePayload) => void, + ): void; public addProvider(provider: any): void; public start(): void; public stop(): void; @@ -19,13 +23,13 @@ declare module 'web3-provider-engine/subproviders/subprovider' { export = Subprovider; } declare module 'web3-provider-engine/subproviders/rpc' { - import { JSONRPCRequestPayload } from '@0xproject/types'; + import { JSONRPCRequestPayload, JSONRPCResponsePayload } from '@0xproject/types'; class RpcSubprovider { constructor(options: { rpcUrl: string }); public handleRequest( payload: JSONRPCRequestPayload, next: () => void, - end: (err: Error | null, data?: any) => void, + end: (err: Error | null, data?: JSONRPCResponsePayload) => void, ): void; } export = RpcSubprovider; @@ -37,13 +41,13 @@ declare module 'web3-provider-engine/util/rpc-cache-utils' { export = ProviderEngineRpcUtils; } declare module 'web3-provider-engine/subproviders/fixture' { - import { JSONRPCRequestPayload } from '@0xproject/types'; + import { JSONRPCRequestPayload, JSONRPCResponsePayload } from '@0xproject/types'; class FixtureSubprovider { constructor(staticResponses: any); public handleRequest( payload: JSONRPCRequestPayload, next: () => void, - end: (err: Error | null, data?: any) => void, + end: (err: Error | null, data?: JSONRPCResponsePayload) => void, ): void; } export = FixtureSubprovider; -- cgit v1.2.3 From 56d1b0103f100c19ce0ee1572980b949161532f4 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 21 May 2018 16:38:43 -0700 Subject: Introduce CONFIG_FILE --- packages/contracts/test/utils/coverage.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/contracts/test/utils/coverage.ts b/packages/contracts/test/utils/coverage.ts index e3c5be428..58010e47f 100644 --- a/packages/contracts/test/utils/coverage.ts +++ b/packages/contracts/test/utils/coverage.ts @@ -14,7 +14,8 @@ export const coverage = { }, _getCoverageSubprovider(): CoverageSubprovider { const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS; - const config = JSON.parse(fs.readFileSync('compiler.json').toString()); + const CONFIG_FILE = 'compiler.json'; + const config = JSON.parse(fs.readFileSync(CONFIG_FILE).toString()); const zeroExArtifactsAdapter = new ZeroExArtifactAdapter(config.artifactsDir, config.contractsDir); return new CoverageSubprovider(zeroExArtifactsAdapter, defaultFromAddress); }, -- cgit v1.2.3 From 8267950dbcc22bb6d572a9523bfa578f78f891f8 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 21 May 2018 16:41:19 -0700 Subject: Assign then return --- packages/contracts/test/utils/coverage.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/contracts/test/utils/coverage.ts b/packages/contracts/test/utils/coverage.ts index 58010e47f..52c419ffc 100644 --- a/packages/contracts/test/utils/coverage.ts +++ b/packages/contracts/test/utils/coverage.ts @@ -17,6 +17,7 @@ export const coverage = { const CONFIG_FILE = 'compiler.json'; const config = JSON.parse(fs.readFileSync(CONFIG_FILE).toString()); const zeroExArtifactsAdapter = new ZeroExArtifactAdapter(config.artifactsDir, config.contractsDir); - return new CoverageSubprovider(zeroExArtifactsAdapter, defaultFromAddress); + const coverageSubrpovider = new CoverageSubprovider(zeroExArtifactsAdapter, defaultFromAddress); + return coverageSubprovider; }, }; -- cgit v1.2.3 From 6aafda45170d77f9e10025ce119d47d9710a87ec Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 21 May 2018 16:42:37 -0700 Subject: Assign then pass --- packages/metacoin/test/utils/web3_wrapper.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/metacoin/test/utils/web3_wrapper.ts b/packages/metacoin/test/utils/web3_wrapper.ts index 9f6b155fc..724ed4e1f 100644 --- a/packages/metacoin/test/utils/web3_wrapper.ts +++ b/packages/metacoin/test/utils/web3_wrapper.ts @@ -25,7 +25,8 @@ provider.start(); const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage); if (isCoverageEnabled) { - prependSubprovider(provider, coverage.getCoverageSubproviderSingleton()); + const coverageSubprovider = coverage.getCoverageSubproviderSingleton(); + prependSubprovider(provider, coverageSubprovider); } export const web3Wrapper = new Web3Wrapper(provider); -- cgit v1.2.3 From 86f17fb466124ad4ecd9e4ac47e7fecde8f585ee Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 21 May 2018 16:44:25 -0700 Subject: Rename ZeroExArtifactAdapter to SolCompilerArtifactAdapter --- packages/contracts/test/utils/coverage.ts | 4 ++-- packages/metacoin/test/utils/coverage.ts | 4 ++-- packages/sol-cov/src/artifact_adapters/0x.ts | 2 +- packages/sol-cov/src/artifact_adapters/truffle.ts | 6 +++--- packages/sol-cov/src/index.ts | 2 +- packages/sol-cov/test/collect_contracts_data_test.ts | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/contracts/test/utils/coverage.ts b/packages/contracts/test/utils/coverage.ts index 52c419ffc..eeb47667f 100644 --- a/packages/contracts/test/utils/coverage.ts +++ b/packages/contracts/test/utils/coverage.ts @@ -1,5 +1,5 @@ import { devConstants } from '@0xproject/dev-utils'; -import { CoverageSubprovider, ZeroExArtifactAdapter } from '@0xproject/sol-cov'; +import { CoverageSubprovider, SolCompilerArtifactAdapter } from '@0xproject/sol-cov'; import * as fs from 'fs'; import * as _ from 'lodash'; @@ -16,7 +16,7 @@ export const coverage = { const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS; const CONFIG_FILE = 'compiler.json'; const config = JSON.parse(fs.readFileSync(CONFIG_FILE).toString()); - const zeroExArtifactsAdapter = new ZeroExArtifactAdapter(config.artifactsDir, config.contractsDir); + const zeroExArtifactsAdapter = new SolCompilerArtifactAdapter(config.artifactsDir, config.contractsDir); const coverageSubrpovider = new CoverageSubprovider(zeroExArtifactsAdapter, defaultFromAddress); return coverageSubprovider; }, diff --git a/packages/metacoin/test/utils/coverage.ts b/packages/metacoin/test/utils/coverage.ts index 83b56596f..945afb0a7 100644 --- a/packages/metacoin/test/utils/coverage.ts +++ b/packages/metacoin/test/utils/coverage.ts @@ -1,5 +1,5 @@ import { devConstants } from '@0xproject/dev-utils'; -import { CoverageSubprovider, ZeroExArtifactAdapter } from '@0xproject/sol-cov'; +import { CoverageSubprovider, SolCompilerArtifactAdapter } from '@0xproject/sol-cov'; import * as _ from 'lodash'; import { config } from './config'; @@ -15,7 +15,7 @@ export const coverage = { }, _getCoverageSubprovider(): CoverageSubprovider { const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS; - const zeroExArtifactsAdapter = new ZeroExArtifactAdapter(config.artifactsDir, config.contractsDir); + const zeroExArtifactsAdapter = new SolCompilerArtifactAdapter(config.artifactsDir, config.contractsDir); return new CoverageSubprovider(zeroExArtifactsAdapter, defaultFromAddress); }, }; diff --git a/packages/sol-cov/src/artifact_adapters/0x.ts b/packages/sol-cov/src/artifact_adapters/0x.ts index 87d23b0aa..f61364df6 100644 --- a/packages/sol-cov/src/artifact_adapters/0x.ts +++ b/packages/sol-cov/src/artifact_adapters/0x.ts @@ -7,7 +7,7 @@ import { ContractData } from '../types'; import { AbstractArtifactAdapter } from './abstract'; -export class ZeroExArtifactAdapter extends AbstractArtifactAdapter { +export class SolCompilerArtifactAdapter extends AbstractArtifactAdapter { private _artifactsPath: string; private _sourcesPath: string; constructor(artifactsPath: string, sourcesPath: string) { diff --git a/packages/sol-cov/src/artifact_adapters/truffle.ts b/packages/sol-cov/src/artifact_adapters/truffle.ts index e891bb464..b9c9c4d42 100644 --- a/packages/sol-cov/src/artifact_adapters/truffle.ts +++ b/packages/sol-cov/src/artifact_adapters/truffle.ts @@ -7,7 +7,7 @@ import * as rimraf from 'rimraf'; import { ContractData } from '../types'; -import { ZeroExArtifactAdapter } from './0x'; +import { SolCompilerArtifactAdapter } from './0x'; import { AbstractArtifactAdapter } from './abstract'; export class TruffleArtifactAdapter extends AbstractArtifactAdapter { @@ -35,8 +35,8 @@ export class TruffleArtifactAdapter extends AbstractArtifactAdapter { }; const compiler = new Compiler(compilerOptions); await compiler.compileAsync(); - const zeroExArtifactAdapter = new ZeroExArtifactAdapter(artifactsDir, this._sourcesPath); - const contractsDataFrom0xArtifacts = await zeroExArtifactAdapter.collectContractsDataAsync(); + const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter(artifactsDir, this._sourcesPath); + const contractsDataFrom0xArtifacts = await solCompilerArtifactAdapter.collectContractsDataAsync(); rimraf.sync(artifactsDir); return contractsDataFrom0xArtifacts; } diff --git a/packages/sol-cov/src/index.ts b/packages/sol-cov/src/index.ts index 18031372b..a4d2b027f 100644 --- a/packages/sol-cov/src/index.ts +++ b/packages/sol-cov/src/index.ts @@ -1,5 +1,5 @@ export { CoverageSubprovider } from './coverage_subprovider'; -export { ZeroExArtifactAdapter } from './artifact_adapters/0x'; +export { SolCompilerArtifactAdapter } from './artifact_adapters/0x'; export { TruffleArtifactAdapter } from './artifact_adapters/truffle'; export { AbstractArtifactAdapter } from './artifact_adapters/abstract'; export { ContractData } from './types'; diff --git a/packages/sol-cov/test/collect_contracts_data_test.ts b/packages/sol-cov/test/collect_contracts_data_test.ts index 906b7f4e2..7a0b9fef5 100644 --- a/packages/sol-cov/test/collect_contracts_data_test.ts +++ b/packages/sol-cov/test/collect_contracts_data_test.ts @@ -4,7 +4,7 @@ import 'make-promises-safe'; import 'mocha'; import * as path from 'path'; -import { ZeroExArtifactAdapter } from '../src/artifact_adapters/0x'; +import { SolCompilerArtifactAdapter } from '../src/artifact_adapters/0x'; const expect = chai.expect; @@ -13,7 +13,7 @@ describe('Collect contracts data', () => { it('correctly collects contracts data', async () => { const artifactsPath = path.resolve(__dirname, 'fixtures/artifacts'); const sourcesPath = path.resolve(__dirname, 'fixtures/contracts'); - const zeroExArtifactsAdapter = new ZeroExArtifactAdapter(artifactsPath, sourcesPath); + const zeroExArtifactsAdapter = new SolCompilerArtifactAdapter(artifactsPath, sourcesPath); const contractsData = await zeroExArtifactsAdapter.collectContractsDataAsync(); _.forEach(contractsData, contractData => { expect(contractData).to.have.keys([ -- cgit v1.2.3 From ac925aa22685a1ea412feddb760cf21022ef84c0 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 21 May 2018 16:45:38 -0700 Subject: Improve a CHANGELOG comment --- packages/sol-compiler/CHANGELOG.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sol-compiler/CHANGELOG.json b/packages/sol-compiler/CHANGELOG.json index 35f2c6179..b71135ea7 100644 --- a/packages/sol-compiler/CHANGELOG.json +++ b/packages/sol-compiler/CHANGELOG.json @@ -7,7 +7,7 @@ "pr": 588 }, { - "note": "Add a possibility to define a solidity version to use", + "note": "Add the ability to define a specific solidity version", "pr": 589 } ] -- cgit v1.2.3 From 334ef5c3eb1cba0b6872c41faaac96f08a4b2a3e Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 21 May 2018 16:46:28 -0700 Subject: Improve a CHANGELOG comment --- packages/sol-cov/CHANGELOG.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json index 9c978df5a..5572c5845 100644 --- a/packages/sol-cov/CHANGELOG.json +++ b/packages/sol-cov/CHANGELOG.json @@ -7,7 +7,7 @@ "pr": 589 }, { - "note": "Implement ZeroExArtiactAdapter and TruffleArtifactAdapter", + "note": "Implement SolCompilerArtifactAdapter and TruffleArtifactAdapter", "pr": 589 }, { -- cgit v1.2.3 From 08b08ef1d0fbff2da8b64524704cf1bc50f77f30 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 21 May 2018 16:56:00 -0700 Subject: Match class names with file names --- packages/sol-cov/src/artifact_adapters/0x.ts | 41 --------------------- packages/sol-cov/src/artifact_adapters/abstract.ts | 5 --- .../artifact_adapters/abstract_artifact_adapter.ts | 5 +++ .../sol_compiler_artifact_adapter.ts | 41 +++++++++++++++++++++ packages/sol-cov/src/artifact_adapters/truffle.ts | 43 ---------------------- .../artifact_adapters/truffle_artifact_adapter.ts | 43 ++++++++++++++++++++++ packages/sol-cov/src/index.ts | 6 +-- 7 files changed, 92 insertions(+), 92 deletions(-) delete mode 100644 packages/sol-cov/src/artifact_adapters/0x.ts delete mode 100644 packages/sol-cov/src/artifact_adapters/abstract.ts create mode 100644 packages/sol-cov/src/artifact_adapters/abstract_artifact_adapter.ts create mode 100644 packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts delete mode 100644 packages/sol-cov/src/artifact_adapters/truffle.ts create mode 100644 packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts diff --git a/packages/sol-cov/src/artifact_adapters/0x.ts b/packages/sol-cov/src/artifact_adapters/0x.ts deleted file mode 100644 index f61364df6..000000000 --- a/packages/sol-cov/src/artifact_adapters/0x.ts +++ /dev/null @@ -1,41 +0,0 @@ -import * as fs from 'fs'; -import * as glob from 'glob'; -import * as _ from 'lodash'; -import * as path from 'path'; - -import { ContractData } from '../types'; - -import { AbstractArtifactAdapter } from './abstract'; - -export class SolCompilerArtifactAdapter extends AbstractArtifactAdapter { - private _artifactsPath: string; - private _sourcesPath: string; - constructor(artifactsPath: string, sourcesPath: string) { - super(); - this._artifactsPath = artifactsPath; - this._sourcesPath = sourcesPath; - } - public async collectContractsDataAsync(): Promise { - const artifactsGlob = `${this._artifactsPath}/**/*.json`; - const artifactFileNames = glob.sync(artifactsGlob, { absolute: true }); - const contractsData: ContractData[] = []; - for (const artifactFileName of artifactFileNames) { - const artifact = JSON.parse(fs.readFileSync(artifactFileName).toString()); - let sources = _.keys(artifact.sources); - sources = _.map(sources, relativeFilePath => path.resolve(this._sourcesPath, relativeFilePath)); - const contractName = artifact.contractName; - // We don't compute coverage for dependencies - const sourceCodes = _.map(sources, (source: string) => fs.readFileSync(source).toString()); - const contractData = { - sourceCodes, - sources, - bytecode: artifact.compilerOutput.evm.bytecode.object, - sourceMap: artifact.compilerOutput.evm.bytecode.sourceMap, - runtimeBytecode: artifact.compilerOutput.evm.deployedBytecode.object, - sourceMapRuntime: artifact.compilerOutput.evm.deployedBytecode.sourceMap, - }; - contractsData.push(contractData); - } - return contractsData; - } -} diff --git a/packages/sol-cov/src/artifact_adapters/abstract.ts b/packages/sol-cov/src/artifact_adapters/abstract.ts deleted file mode 100644 index fcc6562ad..000000000 --- a/packages/sol-cov/src/artifact_adapters/abstract.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { ContractData } from '../types'; - -export abstract class AbstractArtifactAdapter { - public abstract async collectContractsDataAsync(): Promise; -} diff --git a/packages/sol-cov/src/artifact_adapters/abstract_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/abstract_artifact_adapter.ts new file mode 100644 index 000000000..fcc6562ad --- /dev/null +++ b/packages/sol-cov/src/artifact_adapters/abstract_artifact_adapter.ts @@ -0,0 +1,5 @@ +import { ContractData } from '../types'; + +export abstract class AbstractArtifactAdapter { + public abstract async collectContractsDataAsync(): Promise; +} diff --git a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts new file mode 100644 index 000000000..f61364df6 --- /dev/null +++ b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts @@ -0,0 +1,41 @@ +import * as fs from 'fs'; +import * as glob from 'glob'; +import * as _ from 'lodash'; +import * as path from 'path'; + +import { ContractData } from '../types'; + +import { AbstractArtifactAdapter } from './abstract'; + +export class SolCompilerArtifactAdapter extends AbstractArtifactAdapter { + private _artifactsPath: string; + private _sourcesPath: string; + constructor(artifactsPath: string, sourcesPath: string) { + super(); + this._artifactsPath = artifactsPath; + this._sourcesPath = sourcesPath; + } + public async collectContractsDataAsync(): Promise { + const artifactsGlob = `${this._artifactsPath}/**/*.json`; + const artifactFileNames = glob.sync(artifactsGlob, { absolute: true }); + const contractsData: ContractData[] = []; + for (const artifactFileName of artifactFileNames) { + const artifact = JSON.parse(fs.readFileSync(artifactFileName).toString()); + let sources = _.keys(artifact.sources); + sources = _.map(sources, relativeFilePath => path.resolve(this._sourcesPath, relativeFilePath)); + const contractName = artifact.contractName; + // We don't compute coverage for dependencies + const sourceCodes = _.map(sources, (source: string) => fs.readFileSync(source).toString()); + const contractData = { + sourceCodes, + sources, + bytecode: artifact.compilerOutput.evm.bytecode.object, + sourceMap: artifact.compilerOutput.evm.bytecode.sourceMap, + runtimeBytecode: artifact.compilerOutput.evm.deployedBytecode.object, + sourceMapRuntime: artifact.compilerOutput.evm.deployedBytecode.sourceMap, + }; + contractsData.push(contractData); + } + return contractsData; + } +} diff --git a/packages/sol-cov/src/artifact_adapters/truffle.ts b/packages/sol-cov/src/artifact_adapters/truffle.ts deleted file mode 100644 index b9c9c4d42..000000000 --- a/packages/sol-cov/src/artifact_adapters/truffle.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Compiler, CompilerOptions } from '@0xproject/sol-compiler'; -import * as fs from 'fs'; -import * as glob from 'glob'; -import * as _ from 'lodash'; -import * as path from 'path'; -import * as rimraf from 'rimraf'; - -import { ContractData } from '../types'; - -import { SolCompilerArtifactAdapter } from './0x'; -import { AbstractArtifactAdapter } from './abstract'; - -export class TruffleArtifactAdapter extends AbstractArtifactAdapter { - private _solcVersion: string; - private _sourcesPath: string; - constructor(sourcesPath: string, solcVersion: string) { - super(); - this._solcVersion = solcVersion; - this._sourcesPath = sourcesPath; - } - public async collectContractsDataAsync(): Promise { - const artifactsDir = '0x-artifacts'; - const compilerOptions: CompilerOptions = { - contractsDir: this._sourcesPath, - artifactsDir, - compilerSettings: { - outputSelection: { - ['*']: { - ['*']: ['abi', 'evm.bytecode.object', 'evm.deployedBytecode.object'], - }, - }, - }, - contracts: '*', - solcVersion: this._solcVersion, - }; - const compiler = new Compiler(compilerOptions); - await compiler.compileAsync(); - const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter(artifactsDir, this._sourcesPath); - const contractsDataFrom0xArtifacts = await solCompilerArtifactAdapter.collectContractsDataAsync(); - rimraf.sync(artifactsDir); - return contractsDataFrom0xArtifacts; - } -} diff --git a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts new file mode 100644 index 000000000..b9c9c4d42 --- /dev/null +++ b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts @@ -0,0 +1,43 @@ +import { Compiler, CompilerOptions } from '@0xproject/sol-compiler'; +import * as fs from 'fs'; +import * as glob from 'glob'; +import * as _ from 'lodash'; +import * as path from 'path'; +import * as rimraf from 'rimraf'; + +import { ContractData } from '../types'; + +import { SolCompilerArtifactAdapter } from './0x'; +import { AbstractArtifactAdapter } from './abstract'; + +export class TruffleArtifactAdapter extends AbstractArtifactAdapter { + private _solcVersion: string; + private _sourcesPath: string; + constructor(sourcesPath: string, solcVersion: string) { + super(); + this._solcVersion = solcVersion; + this._sourcesPath = sourcesPath; + } + public async collectContractsDataAsync(): Promise { + const artifactsDir = '0x-artifacts'; + const compilerOptions: CompilerOptions = { + contractsDir: this._sourcesPath, + artifactsDir, + compilerSettings: { + outputSelection: { + ['*']: { + ['*']: ['abi', 'evm.bytecode.object', 'evm.deployedBytecode.object'], + }, + }, + }, + contracts: '*', + solcVersion: this._solcVersion, + }; + const compiler = new Compiler(compilerOptions); + await compiler.compileAsync(); + const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter(artifactsDir, this._sourcesPath); + const contractsDataFrom0xArtifacts = await solCompilerArtifactAdapter.collectContractsDataAsync(); + rimraf.sync(artifactsDir); + return contractsDataFrom0xArtifacts; + } +} diff --git a/packages/sol-cov/src/index.ts b/packages/sol-cov/src/index.ts index a4d2b027f..7a2afbe80 100644 --- a/packages/sol-cov/src/index.ts +++ b/packages/sol-cov/src/index.ts @@ -1,5 +1,5 @@ export { CoverageSubprovider } from './coverage_subprovider'; -export { SolCompilerArtifactAdapter } from './artifact_adapters/0x'; -export { TruffleArtifactAdapter } from './artifact_adapters/truffle'; -export { AbstractArtifactAdapter } from './artifact_adapters/abstract'; +export { SolCompilerArtifactAdapter } from './artifact_adapters/sol_compiler_artifact_adapter'; +export { TruffleArtifactAdapter } from './artifact_adapters/truffle_artifact_adapter'; +export { AbstractArtifactAdapter } from './artifact_adapters/abstract_artifact_adapter'; export { ContractData } from './types'; -- cgit v1.2.3 From d9907f227e2187441b5496e26d166fc7e289cdc6 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 21 May 2018 17:00:10 -0700 Subject: Use a hidden directory for temp artifacts --- packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts | 1 - packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts index f61364df6..138c35b1e 100644 --- a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts +++ b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts @@ -24,7 +24,6 @@ export class SolCompilerArtifactAdapter extends AbstractArtifactAdapter { let sources = _.keys(artifact.sources); sources = _.map(sources, relativeFilePath => path.resolve(this._sourcesPath, relativeFilePath)); const contractName = artifact.contractName; - // We don't compute coverage for dependencies const sourceCodes = _.map(sources, (source: string) => fs.readFileSync(source).toString()); const contractData = { sourceCodes, diff --git a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts index b9c9c4d42..36a31383d 100644 --- a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts +++ b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts @@ -19,7 +19,7 @@ export class TruffleArtifactAdapter extends AbstractArtifactAdapter { this._sourcesPath = sourcesPath; } public async collectContractsDataAsync(): Promise { - const artifactsDir = '0x-artifacts'; + const artifactsDir = '.0x-artifacts'; const compilerOptions: CompilerOptions = { contractsDir: this._sourcesPath, artifactsDir, -- cgit v1.2.3 From 5c9bde203e0d9726f77f910adcf386c5758df072 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 21 May 2018 17:01:55 -0700 Subject: Remove a comment --- packages/sol-cov/src/coverage_manager.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts index 65a6086c0..1adddbbd6 100644 --- a/packages/sol-cov/src/coverage_manager.ts +++ b/packages/sol-cov/src/coverage_manager.ts @@ -122,7 +122,6 @@ export class CoverageManager { this._verbose = verbose; } public appendTraceInfo(traceInfo: TraceInfo): void { - // console.log(JSON.stringify(traceInfo, null, '\n')); this._traceInfos.push(traceInfo); } public async writeCoverageAsync(): Promise { -- cgit v1.2.3 From e4fe4975041f6fd28b84085ce5083dd1c4cb3b22 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 21 May 2018 17:23:01 -0700 Subject: Refactor ContractData lookup --- .../artifact_adapters/truffle_artifact_adapter.ts | 4 +- packages/sol-cov/src/coverage_manager.ts | 63 +++++++++++----------- 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts index 36a31383d..c7f21b6eb 100644 --- a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts +++ b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts @@ -7,8 +7,8 @@ import * as rimraf from 'rimraf'; import { ContractData } from '../types'; -import { SolCompilerArtifactAdapter } from './0x'; -import { AbstractArtifactAdapter } from './abstract'; +import { AbstractArtifactAdapter } from './abstract_artifact_adapter'; +import { SolCompilerArtifactAdapter } from './sol_compiler_artifact_adapter'; export class TruffleArtifactAdapter extends AbstractArtifactAdapter { private _solcVersion: string; diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts index 1adddbbd6..d7a00f86d 100644 --- a/packages/sol-cov/src/coverage_manager.ts +++ b/packages/sol-cov/src/coverage_manager.ts @@ -1,12 +1,12 @@ import { promisify } from '@0xproject/utils'; -import { addHexPrefix } from 'ethereumjs-util'; +import { addHexPrefix, stripHexPrefix } from 'ethereumjs-util'; import * as fs from 'fs'; import { Collector } from 'istanbul'; import * as _ from 'lodash'; import * as mkdirp from 'mkdirp'; import * as path from 'path'; -import { AbstractArtifactAdapter } from './artifact_adapters/abstract'; +import { AbstractArtifactAdapter } from './artifact_adapters/abstract_artifact_adapter'; import { collectCoverageEntries } from './collect_coverage_entries'; import { constants } from './constants'; import { parseSourceMap } from './source_maps'; @@ -112,6 +112,29 @@ export class CoverageManager { }; return partialCoverage; } + private static _bytecodeToBytecodeRegex(bytecode: string): string { + const bytecodeRegex = bytecode + // Library linking placeholder: __ConvertLib____________________________ + .replace(/_.*_/, '.*') + // Last 86 characters is solidity compiler metadata that's different between compilations + .replace(/.{86}$/, '') + // Libraries contain their own address at the beginning of the code and it's impossible to know it in advance + .replace(/^0x730000000000000000000000000000000000000000/, '0x73........................................'); + return bytecodeRegex; + } + private static _getContractDataIfExists(contractsData: ContractData[], bytecode: string): ContractData | undefined { + if (!bytecode.startsWith('0x')) { + throw new Error(')x missing'); + } + const contractData = _.find(contractsData, contractDataCandidate => { + const bytecodeRegex = CoverageManager._bytecodeToBytecodeRegex(contractDataCandidate.bytecode); + const runtimeBytecodeRegex = CoverageManager._bytecodeToBytecodeRegex( + contractDataCandidate.runtimeBytecode, + ); + return !_.isNull(bytecode.match(bytecodeRegex)) || !_.isNull(bytecode.match(runtimeBytecodeRegex)); + }); + return contractData; + } constructor( artifactAdapter: AbstractArtifactAdapter, getContractCodeAsync: (address: string) => Promise, @@ -136,20 +159,8 @@ export class CoverageManager { for (const traceInfo of this._traceInfos) { if (traceInfo.address !== constants.NEW_CONTRACT) { // Runtime transaction - let runtimeBytecode = (traceInfo as TraceInfoExistingContract).runtimeBytecode; - runtimeBytecode = addHexPrefix(runtimeBytecode); - const contractData = _.find(contractsData, contractDataCandidate => { - // Library linking placeholder: __ConvertLib____________________________ - let runtimeBytecodeRegex = contractDataCandidate.runtimeBytecode.replace(/_.*_/, '.*'); - // Last 86 characters is solidity compiler metadata that's different between compilations - runtimeBytecodeRegex = runtimeBytecodeRegex.replace(/.{86}$/, ''); - // Libraries contain their own address at the beginning of the code and it's impossible to know it in advance - runtimeBytecodeRegex = runtimeBytecodeRegex.replace( - /^0x730000000000000000000000000000000000000000/, - '0x73........................................', - ); - return !_.isNull(runtimeBytecode.match(runtimeBytecodeRegex)); - }) as ContractData; + const runtimeBytecode = (traceInfo as TraceInfoExistingContract).runtimeBytecode; + const contractData = CoverageManager._getContractDataIfExists(contractsData, runtimeBytecode); if (_.isUndefined(contractData)) { if (this._verbose) { // tslint:disable-next-line:no-console @@ -157,7 +168,7 @@ export class CoverageManager { } continue; } - const bytecodeHex = runtimeBytecode.slice(2); + const bytecodeHex = stripHexPrefix(runtimeBytecode); const sourceMap = contractData.sourceMapRuntime; const pcToSourceRange = parseSourceMap( contractData.sourceCodes, @@ -176,20 +187,8 @@ export class CoverageManager { } } else { // Contract creation transaction - let bytecode = (traceInfo as TraceInfoNewContract).bytecode; - bytecode = addHexPrefix(bytecode); - const contractData = _.find(contractsData, contractDataCandidate => { - // Library linking placeholder: __ConvertLib____________________________ - let bytecodeRegex = contractDataCandidate.bytecode.replace(/_.*_/, '.*'); - // Last 86 characters is solidity compiler metadata that's different between compilations - bytecodeRegex = bytecodeRegex.replace(/.{86}$/, ''); - // Libraries contain their own address at the beginning of the code and it's impossible to know it in advance - bytecodeRegex = bytecodeRegex.replace( - /^0x730000000000000000000000000000000000000000/, - '0x73........................................', - ); - return !_.isNull(bytecode.match(bytecodeRegex)); - }) as ContractData; + const bytecode = (traceInfo as TraceInfoNewContract).bytecode; + const contractData = CoverageManager._getContractDataIfExists(contractsData, bytecode); if (_.isUndefined(contractData)) { if (this._verbose) { // tslint:disable-next-line:no-console @@ -197,7 +196,7 @@ export class CoverageManager { } continue; } - const bytecodeHex = bytecode.slice(2); + const bytecodeHex = stripHexPrefix(bytecode); const sourceMap = contractData.sourceMap; const pcToSourceRange = parseSourceMap( contractData.sourceCodes, -- cgit v1.2.3 From 253bada6432bb4727de2e9d21658cd2c7a2c01b7 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 21 May 2018 17:30:38 -0700 Subject: Fix import paths --- packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts | 2 +- packages/sol-cov/src/coverage_subprovider.ts | 2 +- packages/sol-cov/test/collect_contracts_data_test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts index 138c35b1e..cb164f769 100644 --- a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts +++ b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts @@ -5,7 +5,7 @@ import * as path from 'path'; import { ContractData } from '../types'; -import { AbstractArtifactAdapter } from './abstract'; +import { AbstractArtifactAdapter } from './abstract_artifact_adapter'; export class SolCompilerArtifactAdapter extends AbstractArtifactAdapter { private _artifactsPath: string; diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts index addad5e8f..1e050080f 100644 --- a/packages/sol-cov/src/coverage_subprovider.ts +++ b/packages/sol-cov/src/coverage_subprovider.ts @@ -4,7 +4,7 @@ import * as fs from 'fs'; import * as _ from 'lodash'; import { Lock } from 'semaphore-async-await'; -import { AbstractArtifactAdapter } from './artifact_adapters/abstract'; +import { AbstractArtifactAdapter } from './artifact_adapters/abstract_artifact_adapter'; import { constants } from './constants'; import { CoverageManager } from './coverage_manager'; import { getTracesByContractAddress } from './trace'; diff --git a/packages/sol-cov/test/collect_contracts_data_test.ts b/packages/sol-cov/test/collect_contracts_data_test.ts index 7a0b9fef5..d423bc603 100644 --- a/packages/sol-cov/test/collect_contracts_data_test.ts +++ b/packages/sol-cov/test/collect_contracts_data_test.ts @@ -4,7 +4,7 @@ import 'make-promises-safe'; import 'mocha'; import * as path from 'path'; -import { SolCompilerArtifactAdapter } from '../src/artifact_adapters/0x'; +import { SolCompilerArtifactAdapter } from '../src/artifact_adapters/sol_compiler_artifact_adapter'; const expect = chai.expect; -- cgit v1.2.3 From 2f35e4789c5a41e25a97896bab68ac73b8ba3d28 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 09:50:37 -0700 Subject: Change publish command name --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2d44e468e..48ff3939a 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "prettier:ci": "prettier --list-different '**/*.{ts,tsx,json,md}' --config .prettierrc", "report_coverage": "lcov-result-merger 'packages/*/coverage/lcov.info' | coveralls", "test:installation": "node ./packages/monorepo-scripts/lib/test_installation.js", - "publish": "run-s install:all rebuild script:publish", - "publish:dry": "run-s install:all rebuild script:publish:dry", + "run:publish": "run-s install:all rebuild script:publish", + "run:publish:dry": "run-s install:all rebuild script:publish:dry", "script:publish": "node ./packages/monorepo-scripts/lib/publish.js", "script:publish:dry": "IS_DRY_RUN=true yarn script:publish", "install:all": "yarn install", -- cgit v1.2.3 From f8c628b0c7b750e1096dcc507190525feb8bd572 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 10:16:38 -0700 Subject: Updated CHANGELOGS --- packages/0x.js/CHANGELOG.json | 3 ++- packages/0x.js/CHANGELOG.md | 7 ++++++- packages/abi-gen/CHANGELOG.json | 3 ++- packages/abi-gen/CHANGELOG.md | 6 +++++- packages/assert/CHANGELOG.json | 9 +++++++++ packages/assert/CHANGELOG.md | 6 +++++- packages/base-contract/CHANGELOG.json | 9 +++++++++ packages/base-contract/CHANGELOG.md | 6 +++++- packages/connect/CHANGELOG.json | 9 +++++++++ packages/connect/CHANGELOG.md | 6 +++++- packages/contract-wrappers/CHANGELOG.json | 10 ++++++++++ packages/contract-wrappers/CHANGELOG.md | 8 ++++++++ packages/dev-utils/CHANGELOG.json | 3 ++- packages/dev-utils/CHANGELOG.md | 6 +++++- packages/fill-scenarios/CHANGELOG.json | 10 ++++++++++ packages/fill-scenarios/CHANGELOG.md | 14 ++++++++++++++ packages/json-schemas/CHANGELOG.json | 9 +++++++++ packages/json-schemas/CHANGELOG.md | 6 +++++- packages/migrations/CHANGELOG.json | 9 +++++++++ packages/migrations/CHANGELOG.md | 6 +++++- packages/monorepo-scripts/CHANGELOG.json | 9 +++++++++ packages/monorepo-scripts/CHANGELOG.md | 4 ++++ packages/order-utils/CHANGELOG.json | 6 ++---- packages/order-utils/CHANGELOG.md | 6 +++++- packages/order-watcher/CHANGELOG.json | 10 ++++++++++ packages/order-watcher/CHANGELOG.md | 14 ++++++++++++++ packages/react-docs/CHANGELOG.json | 9 +++++++++ packages/react-docs/CHANGELOG.md | 6 +++++- packages/react-shared/CHANGELOG.json | 9 +++++++++ packages/react-shared/CHANGELOG.md | 6 +++++- packages/sol-compiler/CHANGELOG.json | 3 ++- packages/sol-compiler/CHANGELOG.md | 6 +++++- packages/sol-cov/CHANGELOG.json | 9 +++++++++ packages/sol-cov/CHANGELOG.md | 6 +++++- packages/sol-resolver/CHANGELOG.json | 9 +++++++++ packages/sol-resolver/CHANGELOG.md | 6 +++++- packages/sra-report/CHANGELOG.json | 3 ++- packages/sra-report/CHANGELOG.md | 6 +++++- packages/subproviders/CHANGELOG.json | 9 +++++++++ packages/subproviders/CHANGELOG.md | 6 +++++- packages/tslint-config/CHANGELOG.json | 9 +++++++++ packages/tslint-config/CHANGELOG.md | 4 ++++ packages/types/CHANGELOG.json | 3 ++- packages/types/CHANGELOG.md | 6 +++++- packages/typescript-typings/CHANGELOG.json | 9 +++++++++ packages/typescript-typings/CHANGELOG.md | 6 +++++- packages/utils/CHANGELOG.json | 9 +++++++++ packages/utils/CHANGELOG.md | 6 +++++- packages/web3-wrapper/CHANGELOG.json | 9 +++++++++ packages/web3-wrapper/CHANGELOG.md | 6 +++++- 50 files changed, 324 insertions(+), 30 deletions(-) create mode 100644 packages/fill-scenarios/CHANGELOG.md create mode 100644 packages/order-watcher/CHANGELOG.md diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index 5e4a726b1..2a219180d 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -11,7 +11,8 @@ "Renamed ZeroExError to ContractWrappersErrors since they now lives in the @0xproject/contract-wrappers subpackage", "pr": 579 } - ] + ], + "timestamp": 1527008270 }, { "timestamp": 1525477860, diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index 353e0de29..f7ceaa552 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -5,7 +5,12 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.37.2 - _May 5, 2018_ +## v0.38.0 - _May 22, 2018_ + + * Renamed createOrderStateWatcher to createOrderWatcherAsync since it is now async (#579) + * Renamed ZeroExError to ContractWrappersErrors since they now lives in the @0xproject/contract-wrappers subpackage (#579) + +## v0.37.2 - _May 4, 2018_ * Dependencies updated diff --git a/packages/abi-gen/CHANGELOG.json b/packages/abi-gen/CHANGELOG.json index 4b23b8118..71cbaac1e 100644 --- a/packages/abi-gen/CHANGELOG.json +++ b/packages/abi-gen/CHANGELOG.json @@ -6,7 +6,8 @@ "note": "Properly export the executable binary", "pr": 588 } - ] + ], + "timestamp": 1527008270 }, { "timestamp": 1525477860, diff --git a/packages/abi-gen/CHANGELOG.md b/packages/abi-gen/CHANGELOG.md index 803414e14..bcd807a3c 100644 --- a/packages/abi-gen/CHANGELOG.md +++ b/packages/abi-gen/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.2.13 - _May 5, 2018_ +## v0.3.0 - _May 22, 2018_ + + * Properly export the executable binary (#588) + +## v0.2.13 - _May 4, 2018_ * Dependencies updated diff --git a/packages/assert/CHANGELOG.json b/packages/assert/CHANGELOG.json index f826c7675..048763732 100644 --- a/packages/assert/CHANGELOG.json +++ b/packages/assert/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1527008270, + "version": "0.2.10", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1525477860, "version": "0.2.9", diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md index ab058b9fc..974ac5c42 100644 --- a/packages/assert/CHANGELOG.md +++ b/packages/assert/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.2.9 - _May 5, 2018_ +## v0.2.10 - _May 22, 2018_ + + * Dependencies updated + +## v0.2.9 - _May 4, 2018_ * Dependencies updated diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json index 106c26989..04029576c 100644 --- a/packages/base-contract/CHANGELOG.json +++ b/packages/base-contract/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1527008270, + "version": "0.3.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1525477860, "version": "0.3.1", diff --git a/packages/base-contract/CHANGELOG.md b/packages/base-contract/CHANGELOG.md index b57bd5fc0..90ad066b5 100644 --- a/packages/base-contract/CHANGELOG.md +++ b/packages/base-contract/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.3.1 - _May 5, 2018_ +## v0.3.2 - _May 22, 2018_ + + * Dependencies updated + +## v0.3.1 - _May 4, 2018_ * Dependencies updated diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json index dd172e975..58fcc635b 100644 --- a/packages/connect/CHANGELOG.json +++ b/packages/connect/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1527008270, + "version": "0.6.13", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1525477860, "version": "0.6.12", diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md index 4e118de38..acc6f33bd 100644 --- a/packages/connect/CHANGELOG.md +++ b/packages/connect/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.6.12 - _May 5, 2018_ +## v0.6.13 - _May 22, 2018_ + + * Dependencies updated + +## v0.6.12 - _May 4, 2018_ * Dependencies updated diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index 18ca4143e..84e773933 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -1,5 +1,15 @@ [ { + "version": "0.0.2", + "changes": [ + { + "note": "Dependencies updated" + } + ], + "timestamp": 1527008544 + }, + { + "timestamp": 1527008270, "version": "0.0.1", "changes": [ { diff --git a/packages/contract-wrappers/CHANGELOG.md b/packages/contract-wrappers/CHANGELOG.md index 5565d6210..c8a0145d5 100644 --- a/packages/contract-wrappers/CHANGELOG.md +++ b/packages/contract-wrappers/CHANGELOG.md @@ -4,3 +4,11 @@ Edit the package's CHANGELOG.json file only. --> CHANGELOG + +## v0.0.2 - _May 22, 2018_ + + * Dependencies updated + +## v0.0.1 - _May 22, 2018_ + + * Moved contractWrappers out of 0x.js (#579) diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index 72ecdbabb..4f6f7bd76 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -10,7 +10,8 @@ "note": "Move callbackErrorReporter over from 0x.js", "pr": 579 } - ] + ], + "timestamp": 1527008544 }, { "timestamp": 1525477860, diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index ab824c898..8e2f007d2 100644 --- a/packages/dev-utils/CHANGELOG.md +++ b/packages/dev-utils/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.4.1 - _May 5, 2018_ +## v0.4.2 - _May 22, 2018_ + + * Move callbackErrorReporter over from 0x.js (#579) + +## v0.4.1 - _May 4, 2018_ * Dependencies updated diff --git a/packages/fill-scenarios/CHANGELOG.json b/packages/fill-scenarios/CHANGELOG.json index 3cbba3ecb..c97cc7dd8 100644 --- a/packages/fill-scenarios/CHANGELOG.json +++ b/packages/fill-scenarios/CHANGELOG.json @@ -1,5 +1,15 @@ [ { + "timestamp": 1527008544, + "version": "0.0.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { + "timestamp": 1527008544, "version": "0.0.1", "changes": [ { diff --git a/packages/fill-scenarios/CHANGELOG.md b/packages/fill-scenarios/CHANGELOG.md new file mode 100644 index 000000000..b32b8a289 --- /dev/null +++ b/packages/fill-scenarios/CHANGELOG.md @@ -0,0 +1,14 @@ + + +CHANGELOG + +## v0.0.2 - _May 22, 2018_ + + * Dependencies updated + +## v0.0.1 - _May 22, 2018_ + + * Move FillScenarios out of 0x.js (#579) diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json index 4114cdcf4..ea0df7eb7 100644 --- a/packages/json-schemas/CHANGELOG.json +++ b/packages/json-schemas/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1527008794, + "version": "0.7.24", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1525477860, "version": "0.7.23", diff --git a/packages/json-schemas/CHANGELOG.md b/packages/json-schemas/CHANGELOG.md index 257d14fdf..0b35f2408 100644 --- a/packages/json-schemas/CHANGELOG.md +++ b/packages/json-schemas/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.7.23 - _May 5, 2018_ +## v0.7.24 - _May 22, 2018_ + + * Dependencies updated + +## v0.7.23 - _May 4, 2018_ * Dependencies updated diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json index 142468dad..f22d4a77f 100644 --- a/packages/migrations/CHANGELOG.json +++ b/packages/migrations/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1527008794, + "version": "0.0.6", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1525477860, "version": "0.0.5", diff --git a/packages/migrations/CHANGELOG.md b/packages/migrations/CHANGELOG.md index 99da91a35..78d915b6c 100644 --- a/packages/migrations/CHANGELOG.md +++ b/packages/migrations/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.0.5 - _May 5, 2018_ +## v0.0.6 - _May 22, 2018_ + + * Dependencies updated + +## v0.0.5 - _May 4, 2018_ * Dependencies updated diff --git a/packages/monorepo-scripts/CHANGELOG.json b/packages/monorepo-scripts/CHANGELOG.json index 10fe8acb1..58d946cd6 100644 --- a/packages/monorepo-scripts/CHANGELOG.json +++ b/packages/monorepo-scripts/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1527008794, + "version": "0.1.20", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1525428773, "version": "0.1.19", diff --git a/packages/monorepo-scripts/CHANGELOG.md b/packages/monorepo-scripts/CHANGELOG.md index df70792b8..db5afd5af 100644 --- a/packages/monorepo-scripts/CHANGELOG.md +++ b/packages/monorepo-scripts/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.1.20 - _May 22, 2018_ + + * Dependencies updated + ## v0.1.19 - _May 4, 2018_ * Dependencies updated diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index 9399379fa..1bdb25347 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -3,13 +3,11 @@ "version": "0.0.5", "changes": [ { - "note": "Add formatters package for converting signedOrder to orderAddresses & orderValues", - "note": "Add RemainingFillableCalculator to calculate the remaining fillable amount of an order", - "note": "Add AbstractBalanceAndProxyAllowanceFetcher and AbstractOrderFilledCancelledFetcher", "note": "Add orderStateUtils, a module for computing order state needed to decide if an order is still valid" } - ] + ], + "timestamp": 1527008794 }, { "timestamp": 1525477860, diff --git a/packages/order-utils/CHANGELOG.md b/packages/order-utils/CHANGELOG.md index d0bb706aa..5b10c13bc 100644 --- a/packages/order-utils/CHANGELOG.md +++ b/packages/order-utils/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.0.4 - _May 5, 2018_ +## v0.0.5 - _May 22, 2018_ + + * Add orderStateUtils, a module for computing order state needed to decide if an order is still valid + +## v0.0.4 - _May 4, 2018_ * Dependencies updated diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index 87f40bcb7..dde78445a 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -1,5 +1,15 @@ [ { + "timestamp": 1527008794, + "version": "0.0.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { + "timestamp": 1527008794, "version": "0.0.1", "changes": [ { diff --git a/packages/order-watcher/CHANGELOG.md b/packages/order-watcher/CHANGELOG.md new file mode 100644 index 000000000..999d62f44 --- /dev/null +++ b/packages/order-watcher/CHANGELOG.md @@ -0,0 +1,14 @@ + + +CHANGELOG + +## v0.0.2 - _May 22, 2018_ + + * Dependencies updated + +## v0.0.1 - _May 22, 2018_ + + * Moved OrderWatcher out of 0x.js package (#579) diff --git a/packages/react-docs/CHANGELOG.json b/packages/react-docs/CHANGELOG.json index 0cb767dfc..32fa49264 100644 --- a/packages/react-docs/CHANGELOG.json +++ b/packages/react-docs/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1527009133, + "version": "0.0.12", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1525477860, "version": "0.0.11", diff --git a/packages/react-docs/CHANGELOG.md b/packages/react-docs/CHANGELOG.md index 8a0afbeed..e46198f6c 100644 --- a/packages/react-docs/CHANGELOG.md +++ b/packages/react-docs/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.0.11 - _May 5, 2018_ +## v0.0.12 - _May 22, 2018_ + + * Dependencies updated + +## v0.0.11 - _May 4, 2018_ * Dependencies updated diff --git a/packages/react-shared/CHANGELOG.json b/packages/react-shared/CHANGELOG.json index 3e03f81f1..5227bbf72 100644 --- a/packages/react-shared/CHANGELOG.json +++ b/packages/react-shared/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1527009133, + "version": "0.1.7", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "0.2.0", "changes": [ diff --git a/packages/react-shared/CHANGELOG.md b/packages/react-shared/CHANGELOG.md index 51d804b63..68eac96cf 100644 --- a/packages/react-shared/CHANGELOG.md +++ b/packages/react-shared/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.1.6 - _May 5, 2018_ +## v0.1.7 - _May 22, 2018_ + + * Dependencies updated + +## v0.1.6 - _May 4, 2018_ * Dependencies updated diff --git a/packages/sol-compiler/CHANGELOG.json b/packages/sol-compiler/CHANGELOG.json index b71135ea7..33fd99e4f 100644 --- a/packages/sol-compiler/CHANGELOG.json +++ b/packages/sol-compiler/CHANGELOG.json @@ -10,7 +10,8 @@ "note": "Add the ability to define a specific solidity version", "pr": 589 } - ] + ], + "timestamp": 1527009133 }, { "timestamp": 1525477860, diff --git a/packages/sol-compiler/CHANGELOG.md b/packages/sol-compiler/CHANGELOG.md index 4eb0ed453..ee9b53f4e 100644 --- a/packages/sol-compiler/CHANGELOG.md +++ b/packages/sol-compiler/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.4.3 - _May 5, 2018_ +## v0.5.0 - _May 22, 2018_ + + * Properly export the executable binary (#588) + +## v0.4.3 - _May 4, 2018_ * Dependencies updated diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json index 5572c5845..f49e36525 100644 --- a/packages/sol-cov/CHANGELOG.json +++ b/packages/sol-cov/CHANGELOG.json @@ -20,6 +20,15 @@ } ] }, + { + "timestamp": 1527009133, + "version": "0.0.11", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1525477860, "version": "0.0.10", diff --git a/packages/sol-cov/CHANGELOG.md b/packages/sol-cov/CHANGELOG.md index 9e2995328..f0312d297 100644 --- a/packages/sol-cov/CHANGELOG.md +++ b/packages/sol-cov/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.0.10 - _May 5, 2018_ +## v0.0.11 - _May 22, 2018_ + + * Dependencies updated + +## v0.0.10 - _May 4, 2018_ * Dependencies updated diff --git a/packages/sol-resolver/CHANGELOG.json b/packages/sol-resolver/CHANGELOG.json index eb52d85e0..6d5917212 100644 --- a/packages/sol-resolver/CHANGELOG.json +++ b/packages/sol-resolver/CHANGELOG.json @@ -12,6 +12,15 @@ } ] }, + { + "timestamp": 1527009133, + "version": "0.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1525477860, "version": "0.0.4", diff --git a/packages/sol-resolver/CHANGELOG.md b/packages/sol-resolver/CHANGELOG.md index 4780544fa..bd94b1b41 100644 --- a/packages/sol-resolver/CHANGELOG.md +++ b/packages/sol-resolver/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.0.4 - _May 5, 2018_ +## v0.0.5 - _May 22, 2018_ + + * Dependencies updated + +## v0.0.4 - _May 4, 2018_ * Dependencies updated diff --git a/packages/sra-report/CHANGELOG.json b/packages/sra-report/CHANGELOG.json index 90a807c85..015279157 100644 --- a/packages/sra-report/CHANGELOG.json +++ b/packages/sra-report/CHANGELOG.json @@ -6,7 +6,8 @@ "note": "Properly export the executable binary", "pr": 588 } - ] + ], + "timestamp": 1527009133 }, { "timestamp": 1525477860, diff --git a/packages/sra-report/CHANGELOG.md b/packages/sra-report/CHANGELOG.md index e390e76ef..208a1e174 100644 --- a/packages/sra-report/CHANGELOG.md +++ b/packages/sra-report/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.0.14 - _May 5, 2018_ +## v0.1.0 - _May 22, 2018_ + + * Properly export the executable binary (#588) + +## v0.0.14 - _May 4, 2018_ * Dependencies updated diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json index 799c2c99a..d3bf79ac4 100644 --- a/packages/subproviders/CHANGELOG.json +++ b/packages/subproviders/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1527009133, + "version": "0.10.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1525477860, "version": "0.10.1", diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md index 22a5f90e8..8c4990a7c 100644 --- a/packages/subproviders/CHANGELOG.md +++ b/packages/subproviders/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.10.1 - _May 5, 2018_ +## v0.10.2 - _May 22, 2018_ + + * Dependencies updated + +## v0.10.1 - _May 4, 2018_ * Dependencies updated diff --git a/packages/tslint-config/CHANGELOG.json b/packages/tslint-config/CHANGELOG.json index ac59f7b19..4868b3983 100644 --- a/packages/tslint-config/CHANGELOG.json +++ b/packages/tslint-config/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1527009133, + "version": "0.4.18", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1525428773, "version": "0.4.17", diff --git a/packages/tslint-config/CHANGELOG.md b/packages/tslint-config/CHANGELOG.md index 6f5042a52..56b65cadd 100644 --- a/packages/tslint-config/CHANGELOG.md +++ b/packages/tslint-config/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.4.18 - _May 22, 2018_ + + * Dependencies updated + ## v0.4.17 - _May 4, 2018_ * Dependencies updated diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index aef14fead..8abc5bd99 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -11,7 +11,8 @@ "Moved ExchangeContractErrs, DoneCallback, Token, OrderRelevantState, OrderStateValid, OrderStateInvalid, OrderState, OrderAddresses and OrderValues types from 0x.js", "pr": 579 } - ] + ], + "timestamp": 1527009133 }, { "timestamp": 1525477860, diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index edfd42269..68e5ed438 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.6.3 - _May 5, 2018_ +## v0.7.0 - _May 22, 2018_ + + * Moved ExchangeContractErrs, DoneCallback, Token, OrderRelevantState, OrderStateValid, OrderStateInvalid, OrderState, OrderAddresses and OrderValues types from 0x.js (#579) + +## v0.6.3 - _May 4, 2018_ * Dependencies updated diff --git a/packages/typescript-typings/CHANGELOG.json b/packages/typescript-typings/CHANGELOG.json index 84b92b56c..2e2998bb3 100644 --- a/packages/typescript-typings/CHANGELOG.json +++ b/packages/typescript-typings/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1527009133, + "version": "0.3.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1525477860, "version": "0.3.1", diff --git a/packages/typescript-typings/CHANGELOG.md b/packages/typescript-typings/CHANGELOG.md index ad7622071..e12ce63f2 100644 --- a/packages/typescript-typings/CHANGELOG.md +++ b/packages/typescript-typings/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.3.1 - _May 5, 2018_ +## v0.3.2 - _May 22, 2018_ + + * Dependencies updated + +## v0.3.1 - _May 4, 2018_ * Dependencies updated diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index f447bdd1c..616a17d62 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1527009133, + "version": "0.6.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "0.7.0", "changes": [ diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 92e466b17..0c01bf4f1 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.6.1 - _May 5, 2018_ +## v0.6.2 - _May 22, 2018_ + + * Dependencies updated + +## v0.6.1 - _May 4, 2018_ * Dependencies updated diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json index 35e4383fd..b753ffbac 100644 --- a/packages/web3-wrapper/CHANGELOG.json +++ b/packages/web3-wrapper/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1527009133, + "version": "0.6.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1525477860, "version": "0.6.3", diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md index 3358c9a01..4b8fb7bac 100644 --- a/packages/web3-wrapper/CHANGELOG.md +++ b/packages/web3-wrapper/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.6.3 - _May 5, 2018_ +## v0.6.4 - _May 22, 2018_ + + * Dependencies updated + +## v0.6.3 - _May 4, 2018_ * Dependencies updated -- cgit v1.2.3 From fa4e694859730fdb45a4b9bbc000278b2f081d9c Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 10:26:39 -0700 Subject: Updated CHANGELOGS --- packages/sol-cov/CHANGELOG.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json index f49e36525..0d3303231 100644 --- a/packages/sol-cov/CHANGELOG.json +++ b/packages/sol-cov/CHANGELOG.json @@ -1,5 +1,6 @@ [ { + "timestamp": 1527009134, "version": "0.1.0", "changes": [ { -- cgit v1.2.3 From 84a1b5612de3b22bbe6b8b01a997234771d98005 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 10:26:47 -0700 Subject: Publish - 0x.js@0.38.0 - @0xproject/abi-gen@0.3.0 - @0xproject/assert@0.2.10 - @0xproject/base-contract@0.3.2 - @0xproject/connect@0.6.13 - @0xproject/contract-wrappers@0.0.2 - contracts@2.1.29 - @0xproject/dev-utils@0.4.2 - @0xproject/fill-scenarios@0.0.2 - @0xproject/json-schemas@0.7.24 - @0xproject/metacoin@0.0.7 - @0xproject/migrations@0.0.6 - @0xproject/monorepo-scripts@0.1.20 - @0xproject/order-utils@0.0.5 - @0xproject/order-watcher@0.0.2 - @0xproject/react-docs-example@0.0.12 - @0xproject/react-docs@0.0.12 - @0xproject/react-shared@0.1.7 - @0xproject/sol-compiler@0.5.0 - @0xproject/sol-cov@0.0.11 - @0xproject/sol-resolver@0.0.5 - @0xproject/sra-report@0.1.0 - @0xproject/subproviders@0.10.2 - @0xproject/testnet-faucets@1.0.30 - @0xproject/tslint-config@0.4.18 - @0xproject/types@0.7.0 - @0xproject/typescript-typings@0.3.2 - @0xproject/utils@0.6.2 - @0xproject/web3-wrapper@0.6.4 - @0xproject/website@0.0.33 --- packages/0x.js/package.json | 34 ++++++++++++++++---------------- packages/abi-gen/package.json | 12 +++++------ packages/assert/package.json | 12 +++++------ packages/base-contract/package.json | 14 ++++++------- packages/connect/package.json | 16 +++++++-------- packages/contract-wrappers/package.json | 34 ++++++++++++++++---------------- packages/contracts/package.json | 22 ++++++++++----------- packages/dev-utils/package.json | 14 ++++++------- packages/fill-scenarios/package.json | 22 ++++++++++----------- packages/json-schemas/package.json | 10 +++++----- packages/metacoin/package.json | 22 ++++++++++----------- packages/migrations/package.json | 20 +++++++++---------- packages/monorepo-scripts/package.json | 2 +- packages/order-utils/package.json | 20 +++++++++---------- packages/order-watcher/package.json | 34 ++++++++++++++++---------------- packages/react-docs-example/package.json | 6 +++--- packages/react-docs/package.json | 12 +++++------ packages/react-shared/package.json | 8 ++++---- packages/sol-compiler/package.json | 20 +++++++++---------- packages/sol-cov/package.json | 15 +++++++------- packages/sol-resolver/package.json | 8 ++++---- packages/sra-report/package.json | 18 ++++++++--------- packages/subproviders/package.json | 16 +++++++-------- packages/testnet-faucets/package.json | 14 ++++++------- packages/tslint-config/package.json | 4 ++-- packages/types/package.json | 6 +++--- packages/typescript-typings/package.json | 6 +++--- packages/utils/package.json | 10 +++++----- packages/web3-wrapper/package.json | 12 +++++------ packages/website/package.json | 16 +++++++-------- 30 files changed, 229 insertions(+), 230 deletions(-) diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 2fff1c058..6eff2fd9b 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -1,6 +1,6 @@ { "name": "0x.js", - "version": "0.37.2", + "version": "0.38.0", "engines": { "node": ">=6.12" }, @@ -68,12 +68,12 @@ }, "license": "Apache-2.0", "devDependencies": { - "@0xproject/abi-gen": "^0.2.13", - "@0xproject/dev-utils": "^0.4.1", - "@0xproject/migrations": "^0.0.5", - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/sol-compiler": "^0.4.3", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/abi-gen": "^0.3.0", + "@0xproject/dev-utils": "^0.4.2", + "@0xproject/migrations": "^0.0.6", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/sol-compiler": "^0.5.0", + "@0xproject/tslint-config": "^0.4.18", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", @@ -100,16 +100,16 @@ "webpack": "^3.1.0" }, "dependencies": { - "@0xproject/assert": "^0.2.9", - "@0xproject/base-contract": "^0.3.1", - "@0xproject/contract-wrappers": "^0.0.1", - "@0xproject/order-utils": "^0.0.4", - "@0xproject/order-watcher": "^0.0.1", - "@0xproject/sol-compiler": "^0.4.3", - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", - "@0xproject/web3-wrapper": "^0.6.3", + "@0xproject/assert": "^0.2.10", + "@0xproject/base-contract": "^0.3.2", + "@0xproject/contract-wrappers": "^0.0.2", + "@0xproject/order-utils": "^0.0.5", + "@0xproject/order-watcher": "^0.0.2", + "@0xproject/sol-compiler": "^0.5.0", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", + "@0xproject/web3-wrapper": "^0.6.4", "ethers": "^3.0.15", "lodash": "^4.17.4" }, diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index ca666dc9b..d3af33fdf 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/abi-gen", - "version": "0.2.13", + "version": "0.3.0", "engines": { "node": ">=6.12" }, @@ -27,9 +27,9 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md", "dependencies": { - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", "chalk": "^2.3.0", "glob": "^7.1.2", "handlebars": "^4.0.11", @@ -39,8 +39,8 @@ "yargs": "^10.0.3" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "@types/glob": "^5.0.33", "@types/handlebars": "^4.0.36", "@types/mkdirp": "^0.5.1", diff --git a/packages/assert/package.json b/packages/assert/package.json index e3ac0d3ed..88f4dac99 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/assert", - "version": "0.2.9", + "version": "0.2.10", "engines": { "node": ">=6.12" }, @@ -30,8 +30,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/assert/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "@types/valid-url": "^1.0.2", @@ -47,9 +47,9 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/json-schemas": "^0.7.23", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", + "@0xproject/json-schemas": "^0.7.24", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", "lodash": "^4.17.4", "valid-url": "^1.0.9" }, diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index ca59dc4c8..f79d3ebf6 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/base-contract", - "version": "0.3.1", + "version": "0.3.2", "engines": { "node": ">=6.12" }, @@ -29,8 +29,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/base-contract/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "@types/lodash": "4.14.104", "chai": "^4.0.1", "copyfiles": "^1.2.0", @@ -42,10 +42,10 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", - "@0xproject/web3-wrapper": "^0.6.3", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", + "@0xproject/web3-wrapper": "^0.6.4", "ethers": "^3.0.15", "lodash": "^4.17.4" }, diff --git a/packages/connect/package.json b/packages/connect/package.json index 65aa50a42..ed54b47ac 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/connect", - "version": "0.6.12", + "version": "0.6.13", "engines": { "node": ">=6.12" }, @@ -50,19 +50,19 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md", "dependencies": { - "@0xproject/assert": "^0.2.9", - "@0xproject/json-schemas": "^0.7.23", - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", + "@0xproject/assert": "^0.2.10", + "@0xproject/json-schemas": "^0.7.24", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", "isomorphic-fetch": "^2.2.1", "lodash": "^4.17.4", "query-string": "^5.0.1", "websocket": "^1.0.25" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "@types/fetch-mock": "^5.12.1", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 6cb16c2c0..9dd6f097d 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/contract-wrappers", - "version": "0.0.1", + "version": "0.0.2", "description": "Smart TS wrappers for 0x smart contracts", "keywords": [ "0xproject", @@ -44,13 +44,13 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/abi-gen": "^0.2.13", - "@0xproject/dev-utils": "^0.4.1", - "@0xproject/migrations": "^0.0.5", - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/sol-compiler": "^0.4.3", - "@0xproject/subproviders": "^0.10.1", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/abi-gen": "^0.3.0", + "@0xproject/dev-utils": "^0.4.2", + "@0xproject/migrations": "^0.0.6", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/sol-compiler": "^0.5.0", + "@0xproject/subproviders": "^0.10.2", + "@0xproject/tslint-config": "^0.4.18", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", @@ -76,15 +76,15 @@ "web3-provider-engine": "^14.0.4" }, "dependencies": { - "@0xproject/assert": "^0.2.9", - "@0xproject/base-contract": "^0.3.1", - "@0xproject/fill-scenarios": "^0.0.1", - "@0xproject/json-schemas": "^0.7.23", - "@0xproject/order-utils": "^0.0.4", - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", - "@0xproject/web3-wrapper": "^0.6.3", + "@0xproject/assert": "^0.2.10", + "@0xproject/base-contract": "^0.3.2", + "@0xproject/fill-scenarios": "^0.0.2", + "@0xproject/json-schemas": "^0.7.24", + "@0xproject/order-utils": "^0.0.5", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", + "@0xproject/web3-wrapper": "^0.6.4", "ethereumjs-blockstream": "^2.0.6", "ethereumjs-util": "^5.1.1", "ethers": "^3.0.15", diff --git a/packages/contracts/package.json b/packages/contracts/package.json index f17c64a6f..0147aac0b 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "contracts", - "version": "2.1.28", + "version": "2.1.29", "engines": { "node": ">=6.12" }, @@ -42,11 +42,11 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md", "devDependencies": { - "@0xproject/abi-gen": "^0.2.13", - "@0xproject/dev-utils": "^0.4.1", + "@0xproject/abi-gen": "^0.3.0", + "@0xproject/dev-utils": "^0.4.2", + "@0xproject/tslint-config": "^0.4.18", "@0xproject/subproviders": "^0.10.1", "@0xproject/sol-cov": "^0.0.10", - "@0xproject/tslint-config": "^0.4.17", "@types/lodash": "4.14.104", "@types/node": "^8.0.53", "@types/yargs": "^10.0.0", @@ -66,13 +66,13 @@ "yargs": "^10.0.3" }, "dependencies": { - "0x.js": "^0.37.2", - "@0xproject/base-contract": "^0.3.1", - "@0xproject/sol-compiler": "^0.4.3", - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", - "@0xproject/web3-wrapper": "^0.6.3", + "0x.js": "^0.38.0", + "@0xproject/base-contract": "^0.3.2", + "@0xproject/sol-compiler": "^0.5.0", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", + "@0xproject/web3-wrapper": "^0.6.4", "bn.js": "^4.11.8", "ethereumjs-abi": "^0.6.4", "ethereumjs-util": "^5.1.1", diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 9dd3750c5..0b11029f6 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/dev-utils", - "version": "0.4.1", + "version": "0.4.2", "engines": { "node": ">=6.12" }, @@ -29,8 +29,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/dev-utils/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "chai": "^4.0.1", @@ -44,10 +44,10 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/subproviders": "^0.10.1", - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/web3-wrapper": "^0.6.3", + "@0xproject/subproviders": "^0.10.2", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/web3-wrapper": "^0.6.4", "lodash": "^4.17.4", "web3": "^0.20.0", "web3-provider-engine": "^14.0.4" diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json index ee426c7a1..0d8ea6d13 100644 --- a/packages/fill-scenarios/package.json +++ b/packages/fill-scenarios/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/fill-scenarios", - "version": "0.0.1", + "version": "0.0.2", "description": "0x order fill scenario generator", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -23,10 +23,10 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/fill-scenarios/README.md", "devDependencies": { - "@0xproject/abi-gen": "^0.2.13", - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/sol-compiler": "^0.4.3", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/abi-gen": "^0.3.0", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/sol-compiler": "^0.5.0", + "@0xproject/tslint-config": "^0.4.18", "@types/lodash": "4.14.104", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", @@ -36,12 +36,12 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/base-contract": "^0.3.1", - "@0xproject/order-utils": "^0.0.4", - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", - "@0xproject/web3-wrapper": "^0.6.3", + "@0xproject/base-contract": "^0.3.2", + "@0xproject/order-utils": "^0.0.5", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", + "@0xproject/web3-wrapper": "^0.6.4", "ethers": "^3.0.15", "lodash": "^4.17.4" }, diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index aece885ec..1612bbc0a 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/json-schemas", - "version": "0.7.23", + "version": "0.7.24", "engines": { "node": ">=6.12" }, @@ -45,15 +45,15 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/json-schemas/README.md", "dependencies": { - "@0xproject/typescript-typings": "^0.3.1", + "@0xproject/typescript-typings": "^0.3.2", "@types/node": "^8.0.53", "jsonschema": "^1.2.0", "lodash.values": "^4.3.0" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", - "@0xproject/utils": "^0.6.1", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", + "@0xproject/utils": "^0.6.2", "@types/lodash.foreach": "^4.5.3", "@types/lodash.values": "^4.3.3", "@types/mocha": "^2.2.42", diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index 83d083b3f..312aa0819 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/metacoin", - "version": "0.0.6", + "version": "0.0.7", "engines": { "node": ">=6.12" }, @@ -26,21 +26,21 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "@0xproject/abi-gen": "^0.2.13", - "@0xproject/base-contract": "^0.3.1", - "@0xproject/sol-compiler": "^0.4.3", - "@0xproject/sol-cov": "^0.0.10", - "@0xproject/subproviders": "^0.10.1", - "@0xproject/tslint-config": "^0.4.17", - "@0xproject/types": "^0.6.3", - "@0xproject/utils": "^0.6.1", - "@0xproject/web3-wrapper": "^0.6.3", + "@0xproject/abi-gen": "^0.3.0", + "@0xproject/base-contract": "^0.3.2", + "@0xproject/sol-compiler": "^0.5.0", + "@0xproject/sol-cov": "^0.0.11", + "@0xproject/subproviders": "^0.10.2", + "@0xproject/tslint-config": "^0.4.18", + "@0xproject/types": "^0.7.0", + "@0xproject/utils": "^0.6.2", + "@0xproject/web3-wrapper": "^0.6.4", "ethers": "^3.0.15", "lodash": "^4.17.4", "web3-provider-engine": "^14.0.4" }, "devDependencies": { - "@0xproject/dev-utils": "^0.4.1", + "@0xproject/dev-utils": "^0.4.2", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", "chai-bignumber": "^2.0.1", diff --git a/packages/migrations/package.json b/packages/migrations/package.json index 61dfc5de6..08f7aa6b2 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/migrations", - "version": "0.0.5", + "version": "0.0.6", "engines": { "node": ">=6.12" }, @@ -25,10 +25,10 @@ }, "license": "Apache-2.0", "devDependencies": { - "@0xproject/abi-gen": "^0.2.13", - "@0xproject/dev-utils": "^0.4.1", - "@0xproject/tslint-config": "^0.4.17", - "@0xproject/types": "^0.6.3", + "@0xproject/abi-gen": "^0.3.0", + "@0xproject/dev-utils": "^0.4.2", + "@0xproject/tslint-config": "^0.4.18", + "@0xproject/types": "^0.7.0", "make-promises-safe": "^1.1.0", "npm-run-all": "^4.1.2", "shx": "^0.2.2", @@ -36,11 +36,11 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/base-contract": "^0.3.1", - "@0xproject/sol-compiler": "^0.4.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", - "@0xproject/web3-wrapper": "^0.6.3", + "@0xproject/base-contract": "^0.3.2", + "@0xproject/sol-compiler": "^0.5.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", + "@0xproject/web3-wrapper": "^0.6.4", "ethers": "^3.0.15", "lodash": "^4.17.4" }, diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index 4fa9497b9..02a8e4a42 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/monorepo-scripts", - "version": "0.1.19", + "version": "0.1.20", "engines": { "node": ">=6.12" }, diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index 63caaec34..117b57f45 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/order-utils", - "version": "0.0.4", + "version": "0.0.5", "engines": { "node": ">=6.12" }, @@ -43,9 +43,9 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md", "devDependencies": { - "@0xproject/dev-utils": "^0.4.1", - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/dev-utils": "^0.4.2", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "@types/lodash": "4.14.104", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", @@ -62,12 +62,12 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/assert": "^0.2.9", - "@0xproject/json-schemas": "^0.7.23", - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", - "@0xproject/web3-wrapper": "^0.6.3", + "@0xproject/assert": "^0.2.10", + "@0xproject/json-schemas": "^0.7.24", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", + "@0xproject/web3-wrapper": "^0.6.4", "@types/node": "^8.0.53", "bn.js": "^4.11.8", "ethereumjs-abi": "^0.6.4", diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index d65d3f175..2bd7e4dcb 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/order-watcher", - "version": "0.0.1", + "version": "0.0.2", "description": "An order watcher daemon that watches for order validity", "keywords": [ "0x", @@ -45,12 +45,12 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/abi-gen": "^0.2.13", - "@0xproject/dev-utils": "^0.4.1", - "@0xproject/migrations": "^0.0.5", - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/sol-compiler": "^0.4.3", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/abi-gen": "^0.3.0", + "@0xproject/dev-utils": "^0.4.2", + "@0xproject/migrations": "^0.0.6", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/sol-compiler": "^0.5.0", + "@0xproject/tslint-config": "^0.4.18", "@types/bintrees": "^1.0.2", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", @@ -76,16 +76,16 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/assert": "^0.2.9", - "@0xproject/base-contract": "^0.3.1", - "@0xproject/contract-wrappers": "^0.0.1", - "@0xproject/fill-scenarios": "^0.0.1", - "@0xproject/json-schemas": "^0.7.23", - "@0xproject/order-utils": "^0.0.4", - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", - "@0xproject/web3-wrapper": "^0.6.3", + "@0xproject/assert": "^0.2.10", + "@0xproject/base-contract": "^0.3.2", + "@0xproject/contract-wrappers": "^0.0.2", + "@0xproject/fill-scenarios": "^0.0.2", + "@0xproject/json-schemas": "^0.7.24", + "@0xproject/order-utils": "^0.0.5", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", + "@0xproject/web3-wrapper": "^0.6.4", "bintrees": "^1.0.2", "ethers": "^3.0.15", "lodash": "^4.17.4" diff --git a/packages/react-docs-example/package.json b/packages/react-docs-example/package.json index 2cbf3ef73..a0538b933 100644 --- a/packages/react-docs-example/package.json +++ b/packages/react-docs-example/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@0xproject/react-docs-example", - "version": "0.0.11", + "version": "0.0.12", "engines": { "node": ">=6.12" }, @@ -26,7 +26,7 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/tslint-config": "^0.4.18", "@types/lodash": "4.14.104", "@types/material-ui": "0.18.0", "@types/node": "^8.0.53", @@ -50,7 +50,7 @@ "webpack-dev-server": "^2.11.1" }, "dependencies": { - "@0xproject/react-docs": "^0.0.11", + "@0xproject/react-docs": "^0.0.12", "basscss": "^8.0.3", "lodash": "^4.17.4", "material-ui": "^0.17.1", diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index 9245cfb1e..531c0d90c 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/react-docs", - "version": "0.0.11", + "version": "0.0.12", "engines": { "node": ">=6.12" }, @@ -25,9 +25,9 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0xproject/dev-utils": "^0.4.1", - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/dev-utils": "^0.4.2", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", "shx": "^0.2.2", @@ -35,8 +35,8 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/react-shared": "^0.1.6", - "@0xproject/utils": "^0.6.1", + "@0xproject/react-shared": "^0.1.7", + "@0xproject/utils": "^0.6.2", "@types/lodash": "4.14.104", "@types/material-ui": "0.18.0", "@types/node": "^8.0.53", diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index af0920d27..d28972325 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/react-shared", - "version": "0.1.6", + "version": "0.1.7", "engines": { "node": ">=6.12" }, @@ -25,9 +25,9 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0xproject/dev-utils": "^0.4.1", - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/dev-utils": "^0.4.2", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", "shx": "^0.2.2", diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index 31a10f8b7..c94e59eb4 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-compiler", - "version": "0.4.3", + "version": "0.5.0", "engines": { "node": ">=6.12" }, @@ -49,9 +49,9 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-compiler/README.md", "devDependencies": { - "@0xproject/dev-utils": "^0.4.1", - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/dev-utils": "^0.4.2", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "@types/mkdirp": "^0.5.2", "@types/require-from-string": "^1.2.0", "@types/semver": "^5.5.0", @@ -72,12 +72,12 @@ "zeppelin-solidity": "1.8.0" }, "dependencies": { - "@0xproject/json-schemas": "^0.7.23", - "@0xproject/sol-resolver": "^0.0.4", - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", - "@0xproject/web3-wrapper": "^0.6.3", + "@0xproject/json-schemas": "^0.7.24", + "@0xproject/sol-resolver": "^0.0.5", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", + "@0xproject/web3-wrapper": "^0.6.4", "@types/yargs": "^11.0.0", "chalk": "^2.3.0", "ethereumjs-util": "^5.1.1", diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index 593ff8356..e4d8c6da8 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-cov", - "version": "0.0.10", + "version": "0.0.11", "engines": { "node": ">=6.12" }, @@ -46,12 +46,11 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/sol-cov/README.md", "dependencies": { - "@0xproject/subproviders": "^0.10.1", - "@0xproject/types": "^0.6.3", - "@0xproject/utils": "^0.6.1", + "@0xproject/subproviders": "^0.10.2", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", "@0xproject/sol-compiler": "^0.4.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", "ethereumjs-util": "^5.1.1", "rimraf": "^2.6.2", "glob": "^7.1.2", @@ -62,8 +61,8 @@ "solidity-parser-antlr": "^0.2.8" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "@types/istanbul": "^0.4.30", "@types/rimraf": "^2.0.2", "@types/mkdirp": "^0.5.1", diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json index 54d8308de..64a0f19ab 100644 --- a/packages/sol-resolver/package.json +++ b/packages/sol-resolver/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-resolver", - "version": "0.0.4", + "version": "0.0.5", "engines": { "node": ">=6.12" }, @@ -24,8 +24,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/resolver/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", "shx": "^0.2.2", @@ -33,7 +33,7 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/types": "^0.6.3", + "@0xproject/types": "^0.7.0", "@0xproject/typescript-typings": "^0.0.3", "lodash": "^4.17.4" }, diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json index 9622acd2e..0ab83f5f7 100644 --- a/packages/sra-report/package.json +++ b/packages/sra-report/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sra-report", - "version": "0.0.14", + "version": "0.1.0", "engines": { "node": ">=6.12" }, @@ -31,20 +31,20 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-report/README.md", "dependencies": { - "0x.js": "^0.37.2", - "@0xproject/assert": "^0.2.9", - "@0xproject/connect": "^0.6.12", - "@0xproject/json-schemas": "^0.7.23", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", + "0x.js": "^0.38.0", + "@0xproject/assert": "^0.2.10", + "@0xproject/connect": "^0.6.13", + "@0xproject/json-schemas": "^0.7.24", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", "chalk": "^2.3.0", "lodash": "^4.17.4", "newman": "^3.9.3", "yargs": "^10.0.3" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.48", "@types/nock": "^9.1.2", diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 21e47b85a..3cd5f0e9b 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/subproviders", - "version": "0.10.1", + "version": "0.10.2", "engines": { "node": ">=6.12" }, @@ -39,10 +39,10 @@ } }, "dependencies": { - "@0xproject/assert": "^0.2.9", - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", + "@0xproject/assert": "^0.2.10", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", "@ledgerhq/hw-app-eth": "^4.3.0", "@ledgerhq/hw-transport-u2f": "^4.3.0", "bip39": "^2.5.0", @@ -57,9 +57,9 @@ "web3-provider-engine": "^14.0.4" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", - "@0xproject/utils": "^0.6.1", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", + "@0xproject/utils": "^0.6.2", "@types/bip39": "^2.4.0", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index db5fe75c7..c565d5b7d 100644 --- a/packages/testnet-faucets/package.json +++ b/packages/testnet-faucets/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@0xproject/testnet-faucets", - "version": "1.0.29", + "version": "1.0.30", "engines": { "node": ">=6.12" }, @@ -18,11 +18,11 @@ "author": "Fabio Berger", "license": "Apache-2.0", "dependencies": { - "0x.js": "^0.37.2", - "@0xproject/subproviders": "^0.10.1", - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", + "0x.js": "^0.38.0", + "@0xproject/subproviders": "^0.10.2", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", "body-parser": "^1.17.1", "ethereumjs-tx": "^1.3.3", "ethereumjs-util": "^5.1.1", @@ -33,7 +33,7 @@ "web3-provider-engine": "^14.0.4" }, "devDependencies": { - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/tslint-config": "^0.4.18", "@types/body-parser": "^1.16.1", "@types/express": "^4.0.35", "@types/lodash": "4.14.104", diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json index 799f716f3..a64feb836 100644 --- a/packages/tslint-config/package.json +++ b/packages/tslint-config/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/tslint-config", - "version": "0.4.17", + "version": "0.4.18", "engines": { "node": ">=6.12" }, @@ -34,7 +34,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/tslint-config/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", + "@0xproject/monorepo-scripts": "^0.1.20", "@types/lodash": "4.14.104", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", diff --git a/packages/types/package.json b/packages/types/package.json index edd17c42c..0968c6b7a 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/types", - "version": "0.6.3", + "version": "0.7.0", "engines": { "node": ">=6.12" }, @@ -24,8 +24,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/types/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", "shx": "^0.2.2", diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json index 986acfcee..932f89ec5 100644 --- a/packages/typescript-typings/package.json +++ b/packages/typescript-typings/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/typescript-typings", - "version": "0.3.1", + "version": "0.3.2", "engines": { "node": ">=6.12" }, @@ -25,11 +25,11 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/typescript-typings#readme", "dependencies": { - "@0xproject/types": "^0.6.3", + "@0xproject/types": "^0.7.0", "bignumber.js": "~4.1.0" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", + "@0xproject/monorepo-scripts": "^0.1.20", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", "shx": "^0.2.2" diff --git a/packages/utils/package.json b/packages/utils/package.json index 66dc682fa..99d3d9256 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/utils", - "version": "0.6.1", + "version": "0.6.2", "engines": { "node": ">=6.12" }, @@ -24,8 +24,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/utils/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "@types/lodash": "4.14.104", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", @@ -35,8 +35,8 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", "@types/node": "^8.0.53", "bignumber.js": "~4.1.0", "ethers": "^3.0.15", diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index ed2fce7dc..18bbf14a0 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/web3-wrapper", - "version": "0.6.3", + "version": "0.6.4", "engines": { "node": ">=6.12" }, @@ -43,8 +43,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/web3-wrapper/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.19", - "@0xproject/tslint-config": "^0.4.17", + "@0xproject/monorepo-scripts": "^0.1.20", + "@0xproject/tslint-config": "^0.4.18", "@types/lodash": "4.14.104", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", @@ -62,9 +62,9 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/types": "^0.6.3", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", + "@0xproject/types": "^0.7.0", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", "ethers": "^3.0.15", "lodash": "^4.17.4", "web3": "^0.20.0" diff --git a/packages/website/package.json b/packages/website/package.json index 8b34cd743..7d49581cd 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/website", - "version": "0.0.32", + "version": "0.0.33", "engines": { "node": ">=6.12" }, @@ -18,13 +18,13 @@ "author": "Fabio Berger", "license": "Apache-2.0", "dependencies": { - "0x.js": "^0.37.2", - "@0xproject/react-docs": "^0.0.11", - "@0xproject/react-shared": "^0.1.6", - "@0xproject/subproviders": "^0.10.1", - "@0xproject/typescript-typings": "^0.3.1", - "@0xproject/utils": "^0.6.1", - "@0xproject/web3-wrapper": "^0.6.3", + "0x.js": "^0.38.0", + "@0xproject/react-docs": "^0.0.12", + "@0xproject/react-shared": "^0.1.7", + "@0xproject/subproviders": "^0.10.2", + "@0xproject/typescript-typings": "^0.3.2", + "@0xproject/utils": "^0.6.2", + "@0xproject/web3-wrapper": "^0.6.4", "accounting": "^0.4.1", "basscss": "^8.0.3", "blockies": "^0.0.2", -- cgit v1.2.3 From ac52ad88a1884979c74f418398bbf428d727cf34 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 10:39:27 -0700 Subject: Use loglevel instead of verbose flag --- packages/sol-cov/package.json | 8 +++++--- packages/sol-cov/src/coverage_manager.ts | 18 +++++++----------- yarn.lock | 6 +++++- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index e4d8c6da8..0edffb1d2 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -46,17 +46,18 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/sol-cov/README.md", "dependencies": { + "@0xproject/sol-compiler": "^0.4.3", "@0xproject/subproviders": "^0.10.2", "@0xproject/types": "^0.7.0", "@0xproject/typescript-typings": "^0.3.2", "@0xproject/utils": "^0.6.2", - "@0xproject/sol-compiler": "^0.4.3", "ethereumjs-util": "^5.1.1", - "rimraf": "^2.6.2", "glob": "^7.1.2", "istanbul": "^0.4.5", "lodash": "^4.17.4", + "loglevel": "^1.6.1", "mkdirp": "^0.5.1", + "rimraf": "^2.6.2", "semaphore-async-await": "^1.5.1", "solidity-parser-antlr": "^0.2.8" }, @@ -64,10 +65,11 @@ "@0xproject/monorepo-scripts": "^0.1.20", "@0xproject/tslint-config": "^0.4.18", "@types/istanbul": "^0.4.30", - "@types/rimraf": "^2.0.2", + "@types/loglevel": "^1.5.3", "@types/mkdirp": "^0.5.1", "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", + "@types/rimraf": "^2.0.2", "chai": "^4.0.1", "copyfiles": "^1.2.0", "dirty-chai": "^2.0.1", diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts index d7a00f86d..3aa62acff 100644 --- a/packages/sol-cov/src/coverage_manager.ts +++ b/packages/sol-cov/src/coverage_manager.ts @@ -3,6 +3,7 @@ import { addHexPrefix, stripHexPrefix } from 'ethereumjs-util'; import * as fs from 'fs'; import { Collector } from 'istanbul'; import * as _ from 'lodash'; +import { getLogger, levels, Logger, LogLevel } from 'loglevel'; import * as mkdirp from 'mkdirp'; import * as path from 'path'; @@ -35,7 +36,7 @@ const mkdirpAsync = promisify(mkdirp); export class CoverageManager { private _artifactAdapter: AbstractArtifactAdapter; - private _verbose: boolean; + private _logger: Logger; private _traceInfos: TraceInfo[] = []; private _getContractCodeAsync: (address: string) => Promise; private static _getSingleFileCoverageForTrace( @@ -124,7 +125,7 @@ export class CoverageManager { } private static _getContractDataIfExists(contractsData: ContractData[], bytecode: string): ContractData | undefined { if (!bytecode.startsWith('0x')) { - throw new Error(')x missing'); + throw new Error('0x missing'); } const contractData = _.find(contractsData, contractDataCandidate => { const bytecodeRegex = CoverageManager._bytecodeToBytecodeRegex(contractDataCandidate.bytecode); @@ -142,7 +143,8 @@ export class CoverageManager { ) { this._getContractCodeAsync = getContractCodeAsync; this._artifactAdapter = artifactAdapter; - this._verbose = verbose; + this._logger = getLogger('sol-cov'); + this._logger.setLevel(verbose ? levels.TRACE : levels.ERROR); } public appendTraceInfo(traceInfo: TraceInfo): void { this._traceInfos.push(traceInfo); @@ -162,10 +164,7 @@ export class CoverageManager { const runtimeBytecode = (traceInfo as TraceInfoExistingContract).runtimeBytecode; const contractData = CoverageManager._getContractDataIfExists(contractsData, runtimeBytecode); if (_.isUndefined(contractData)) { - if (this._verbose) { - // tslint:disable-next-line:no-console - console.warn(`Transaction to an unknown address: ${traceInfo.address}`); - } + this._logger.warn(`Transaction to an unknown address: ${traceInfo.address}`); continue; } const bytecodeHex = stripHexPrefix(runtimeBytecode); @@ -190,10 +189,7 @@ export class CoverageManager { const bytecode = (traceInfo as TraceInfoNewContract).bytecode; const contractData = CoverageManager._getContractDataIfExists(contractsData, bytecode); if (_.isUndefined(contractData)) { - if (this._verbose) { - // tslint:disable-next-line:no-console - console.warn(`Unknown contract creation transaction`); - } + this._logger.warn(`Unknown contract creation transaction`); continue; } const bytecodeHex = stripHexPrefix(bytecode); diff --git a/yarn.lock b/yarn.lock index 98215f54b..42c4fa025 100644 --- a/yarn.lock +++ b/yarn.lock @@ -184,6 +184,10 @@ version "4.14.99" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.99.tgz#e6e10c0a4cc16c7409b3181f1e66880d2fb7d4dc" +"@types/loglevel@^1.5.3": + version "1.5.3" + resolved "https://registry.yarnpkg.com/@types/loglevel/-/loglevel-1.5.3.tgz#adfce55383edc5998a2170ad581b3e23d6adb5b8" + "@types/marked@0.0.28": version "0.0.28" resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.0.28.tgz#44ba754e9fa51432583e8eb30a7c4dd249b52faa" @@ -7081,7 +7085,7 @@ log-update@^1.0.2: ansi-escapes "^1.0.0" cli-cursor "^1.0.2" -loglevel@^1.4.1: +loglevel@^1.4.1, loglevel@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.1.tgz#e0fc95133b6ef276cdc8887cdaf24aa6f156f8fa" -- cgit v1.2.3 From 83c37c6a7a320326975c8afd9d49a42c9afcefd4 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 11:05:24 -0700 Subject: Address feedback --- packages/sol-cov/src/coverage_manager.ts | 4 +-- packages/sol-cov/src/trace.ts | 27 ++++++------------- .../sol-cov/test/collect_contracts_data_test.ts | 30 ---------------------- .../test/sol_compiler_artifact_adapter_test.ts | 30 ++++++++++++++++++++++ packages/sol-resolver/CHANGELOG.json | 4 +-- .../subproviders/src/utils/subprovider_utils.ts | 2 ++ packages/utils/package.json | 1 + packages/utils/src/abi_decoder.ts | 13 ++-------- packages/utils/src/address_utils.ts | 5 ++++ 9 files changed, 52 insertions(+), 64 deletions(-) delete mode 100644 packages/sol-cov/test/collect_contracts_data_test.ts create mode 100644 packages/sol-cov/test/sol_compiler_artifact_adapter_test.ts diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts index 3aa62acff..ef893527a 100644 --- a/packages/sol-cov/src/coverage_manager.ts +++ b/packages/sol-cov/src/coverage_manager.ts @@ -139,12 +139,12 @@ export class CoverageManager { constructor( artifactAdapter: AbstractArtifactAdapter, getContractCodeAsync: (address: string) => Promise, - verbose: boolean, + isVerbose: boolean, ) { this._getContractCodeAsync = getContractCodeAsync; this._artifactAdapter = artifactAdapter; this._logger = getLogger('sol-cov'); - this._logger.setLevel(verbose ? levels.TRACE : levels.ERROR); + this._logger.setLevel(isVerbose ? levels.TRACE : levels.ERROR); } public appendTraceInfo(traceInfo: TraceInfo): void { this._traceInfos.push(traceInfo); diff --git a/packages/sol-cov/src/trace.ts b/packages/sol-cov/src/trace.ts index 30508898b..81c8bb0ff 100644 --- a/packages/sol-cov/src/trace.ts +++ b/packages/sol-cov/src/trace.ts @@ -1,5 +1,5 @@ import { OpCode, StructLog, TransactionTrace } from '@0xproject/types'; -import { BigNumber, logUtils } from '@0xproject/utils'; +import { addressUtils, BigNumber, logUtils } from '@0xproject/utils'; import { addHexPrefix, stripHexPrefix } from 'ethereumjs-util'; import * as fs from 'fs'; import * as _ from 'lodash'; @@ -7,17 +7,13 @@ import * as _ from 'lodash'; export interface TraceByContractAddress { [contractAddress: string]: StructLog[]; } -function padZeros(address: string): string { - return addHexPrefix(_.padStart(stripHexPrefix(address), 40, '0')); -} export function getTracesByContractAddress(structLogs: StructLog[], startAddress: string): TraceByContractAddress { const traceByContractAddress: TraceByContractAddress = {}; let currentTraceSegment = []; const callStack = [startAddress]; - // tslint:disable-next-line: prefer-for-of - for (let i = 0; i < structLogs.length; ++i) { - const structLog = structLogs[i]; + // tslint:disable-next-line:prefer-for-of + for (const structLog of structLogs) { if (structLog.depth !== callStack.length - 1) { throw new Error("Malformed trace. trace depth doesn't match call stack depth"); } @@ -26,26 +22,19 @@ export function getTracesByContractAddress(structLogs: StructLog[], startAddress // That means that we can always safely pop from it currentTraceSegment.push(structLog); - if ( - structLog.op === OpCode.CallCode || - structLog.op === OpCode.StaticCall || - structLog.op === OpCode.Call || - structLog.op === OpCode.DelegateCall - ) { + if (_.includes([OpCode.CallCode, OpCode.StaticCall, OpCode.Call, OpCode.DelegateCall], structLog.op)) { const currentAddress = _.last(callStack) as string; const jumpAddressOffset = structLog.op === OpCode.DelegateCall ? 4 : 2; - const newAddress = padZeros(new BigNumber(addHexPrefix(structLog.stack[jumpAddressOffset])).toString(16)); + const newAddress = addressUtils.padZeros( + new BigNumber(addHexPrefix(structLog.stack[jumpAddressOffset])).toString(16), + ); callStack.push(newAddress); traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( currentTraceSegment, ); currentTraceSegment = []; } else if ( - structLog.op === OpCode.Return || - structLog.op === OpCode.Stop || - structLog.op === OpCode.Revert || - structLog.op === OpCode.Invalid || - structLog.op === OpCode.SelfDestruct + _.includes([OpCode.Return, OpCode.Stop, OpCode.Revert, OpCode.Invalid, OpCode.SelfDestruct], structLog.op) ) { const currentAddress = callStack.pop() as string; traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( diff --git a/packages/sol-cov/test/collect_contracts_data_test.ts b/packages/sol-cov/test/collect_contracts_data_test.ts deleted file mode 100644 index d423bc603..000000000 --- a/packages/sol-cov/test/collect_contracts_data_test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import * as chai from 'chai'; -import * as _ from 'lodash'; -import 'make-promises-safe'; -import 'mocha'; -import * as path from 'path'; - -import { SolCompilerArtifactAdapter } from '../src/artifact_adapters/sol_compiler_artifact_adapter'; - -const expect = chai.expect; - -describe('Collect contracts data', () => { - describe('#collectContractsData', () => { - it('correctly collects contracts data', async () => { - const artifactsPath = path.resolve(__dirname, 'fixtures/artifacts'); - const sourcesPath = path.resolve(__dirname, 'fixtures/contracts'); - const zeroExArtifactsAdapter = new SolCompilerArtifactAdapter(artifactsPath, sourcesPath); - const contractsData = await zeroExArtifactsAdapter.collectContractsDataAsync(); - _.forEach(contractsData, contractData => { - expect(contractData).to.have.keys([ - 'sourceCodes', - 'sources', - 'sourceMap', - 'sourceMapRuntime', - 'bytecode', - 'runtimeBytecode', - ]); - }); - }); - }); -}); diff --git a/packages/sol-cov/test/sol_compiler_artifact_adapter_test.ts b/packages/sol-cov/test/sol_compiler_artifact_adapter_test.ts new file mode 100644 index 000000000..0ebad669b --- /dev/null +++ b/packages/sol-cov/test/sol_compiler_artifact_adapter_test.ts @@ -0,0 +1,30 @@ +import * as chai from 'chai'; +import * as _ from 'lodash'; +import 'make-promises-safe'; +import 'mocha'; +import * as path from 'path'; + +import { SolCompilerArtifactAdapter } from '../src/artifact_adapters/sol_compiler_artifact_adapter'; + +const expect = chai.expect; + +describe('SolCompilerArtifactAdapter', () => { + describe('#collectContractsData', () => { + it('correctly collects contracts data', async () => { + const artifactsPath = path.resolve(__dirname, 'fixtures/artifacts'); + const sourcesPath = path.resolve(__dirname, 'fixtures/contracts'); + const zeroExArtifactsAdapter = new SolCompilerArtifactAdapter(artifactsPath, sourcesPath); + const contractsData = await zeroExArtifactsAdapter.collectContractsDataAsync(); + _.forEach(contractsData, contractData => { + expect(contractData).to.have.keys([ + 'sourceCodes', + 'sources', + 'sourceMap', + 'sourceMapRuntime', + 'bytecode', + 'runtimeBytecode', + ]); + }); + }); + }); +}); diff --git a/packages/sol-resolver/CHANGELOG.json b/packages/sol-resolver/CHANGELOG.json index 6d5917212..895bd2104 100644 --- a/packages/sol-resolver/CHANGELOG.json +++ b/packages/sol-resolver/CHANGELOG.json @@ -3,11 +3,11 @@ "version": "0.0.5", "changes": [ { - "note": "Fix a bug in FsResolver trying to read directories as files", + "note": "Fix a bug in FsResolver where it tries to read directories as files", "pr": 589 }, { - "note": "Fix a bug in NameResolver not ignoring .sol files", + "note": "Fix a bug in NameResolver where it is not ignoring .sol files", "pr": 589 } ] diff --git a/packages/subproviders/src/utils/subprovider_utils.ts b/packages/subproviders/src/utils/subprovider_utils.ts index 380f98606..24ebedd06 100644 --- a/packages/subproviders/src/utils/subprovider_utils.ts +++ b/packages/subproviders/src/utils/subprovider_utils.ts @@ -9,5 +9,7 @@ import { Subprovider } from '../subproviders/subprovider'; */ export function prependSubprovider(provider: ProviderEngine, subprovider: Subprovider): void { subprovider.setEngine(provider); + // HACK: We use implementation details of provider engine here + // https://github.com/MetaMask/provider-engine/blob/master/index.js#L68 (provider as any)._providers = [subprovider, ...(provider as any)._providers]; } diff --git a/packages/utils/package.json b/packages/utils/package.json index 99d3d9256..24551dd93 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -38,6 +38,7 @@ "@0xproject/types": "^0.7.0", "@0xproject/typescript-typings": "^0.3.2", "@types/node": "^8.0.53", + "ethereumjs-util": "^5.1.1", "bignumber.js": "~4.1.0", "ethers": "^3.0.15", "js-sha3": "^0.7.0", diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts index c78bfa343..d2d8364ca 100644 --- a/packages/utils/src/abi_decoder.ts +++ b/packages/utils/src/abi_decoder.ts @@ -12,21 +12,12 @@ import { import * as ethers from 'ethers'; import * as _ from 'lodash'; +import { addressUtils } from './address_utils'; import { BigNumber } from './configured_bignumber'; export class AbiDecoder { private _savedABIs: AbiDefinition[] = []; private _methodIds: { [signatureHash: string]: EventAbi } = {}; - private static _padZeros(address: string): string { - let formatted = address; - if (_.startsWith(formatted, '0x')) { - formatted = formatted.slice(2); - } - - const addressLength = 40; - formatted = _.padStart(formatted, addressLength, '0'); - return `0x${formatted}`; - } constructor(abiArrays: AbiDefinition[][]) { _.forEach(abiArrays, this.addABI.bind(this)); } @@ -56,7 +47,7 @@ export class AbiDecoder { } if (param.type === SolidityTypes.Address) { const baseHex = 16; - value = AbiDecoder._padZeros(new BigNumber(value).toString(baseHex)); + value = addressUtils.padZeros(new BigNumber(value).toString(baseHex)); } else if (param.type === SolidityTypes.Uint256 || param.type === SolidityTypes.Uint) { value = new BigNumber(value); } else if (param.type === SolidityTypes.Uint8) { diff --git a/packages/utils/src/address_utils.ts b/packages/utils/src/address_utils.ts index e25bde249..cc43bd477 100644 --- a/packages/utils/src/address_utils.ts +++ b/packages/utils/src/address_utils.ts @@ -1,4 +1,6 @@ +import { addHexPrefix, stripHexPrefix } from 'ethereumjs-util'; import * as jsSHA3 from 'js-sha3'; +import * as _ from 'lodash'; const BASIC_ADDRESS_REGEX = /^(0x)?[0-9a-f]{40}$/i; const SAME_CASE_ADDRESS_REGEX = /^(0x)?([0-9a-f]{40}|[0-9A-F]{40})$/; @@ -38,4 +40,7 @@ export const addressUtils = { return isValidChecksummedAddress; } }, + padZeros(address: string): string { + return addHexPrefix(_.padStart(stripHexPrefix(address), 40, '0')); + }, }; -- cgit v1.2.3 From 0c53d276f8f4725feeae48fc3534ab63db8fcafb Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 11:10:03 -0700 Subject: Use BlockParamLiteral.Latest --- packages/sol-cov/src/coverage_subprovider.ts | 8 ++++---- packages/sol-cov/src/types.ts | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts index 1e050080f..3fd45bbd1 100644 --- a/packages/sol-cov/src/coverage_subprovider.ts +++ b/packages/sol-cov/src/coverage_subprovider.ts @@ -8,7 +8,7 @@ import { AbstractArtifactAdapter } from './artifact_adapters/abstract_artifact_a import { constants } from './constants'; import { CoverageManager } from './coverage_manager'; import { getTracesByContractAddress } from './trace'; -import { TraceInfoExistingContract, TraceInfoNewContract } from './types'; +import { BlockParamLiteral, TraceInfoExistingContract, TraceInfoNewContract } from './types'; interface MaybeFakeTxData extends TxData { isFakeTransaction?: boolean; @@ -89,7 +89,7 @@ export class CoverageSubprovider extends Subprovider { } else { const payload = { method: 'eth_getBlockByNumber', - params: ['latest', true], + params: [BlockParamLiteral.Latest, true], }; const jsonRPCResponsePayload = await this.emitPayloadAsync(payload); const transactions = jsonRPCResponsePayload.result.transactions; @@ -136,7 +136,7 @@ export class CoverageSubprovider extends Subprovider { } else { const tracesByContractAddress = getTracesByContractAddress(trace.structLogs, address); for (const subcallAddress of _.keys(tracesByContractAddress)) { - payload = { method: 'eth_getCode', params: [subcallAddress, 'latest'] }; + payload = { method: 'eth_getCode', params: [subcallAddress, BlockParamLiteral.Latest] }; const runtimeBytecode = (await this.emitPayloadAsync(payload)).result; const traceForThatSubcall = tracesByContractAddress[subcallAddress]; const coveredPcs = _.map(traceForThatSubcall, log => log.pc); @@ -178,7 +178,7 @@ export class CoverageSubprovider extends Subprovider { private async _getContractCodeAsync(address: string): Promise { const payload = { method: 'eth_getCode', - params: [address, 'latest'], + params: [address, BlockParamLiteral.Latest], }; const jsonRPCResponsePayload = await this.emitPayloadAsync(payload); const contractCode: string = jsonRPCResponsePayload.result; diff --git a/packages/sol-cov/src/types.ts b/packages/sol-cov/src/types.ts index 01359d858..4c3de55a1 100644 --- a/packages/sol-cov/src/types.ts +++ b/packages/sol-cov/src/types.ts @@ -98,3 +98,7 @@ export interface TraceInfoExistingContract extends TraceInfoBase { } export type TraceInfo = TraceInfoNewContract | TraceInfoExistingContract; + +export enum BlockParamLiteral { + Latest = 'latest', +} -- cgit v1.2.3 From 447b305e3c50145696be715bc6f43523b0770220 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 11:18:09 -0700 Subject: Suppport subcalls in constructor --- packages/0x.js/test/artifacts_test.ts | 4 ++-- packages/sol-cov/src/coverage_subprovider.ts | 36 ++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/packages/0x.js/test/artifacts_test.ts b/packages/0x.js/test/artifacts_test.ts index ca554a4f5..982fb8e63 100644 --- a/packages/0x.js/test/artifacts_test.ts +++ b/packages/0x.js/test/artifacts_test.ts @@ -15,7 +15,7 @@ const TIMEOUT = 10000; describe('Artifacts', () => { describe('contracts are deployed on kovan', () => { const kovanRpcUrl = constants.KOVAN_RPC_URL; - const provider = web3Factory.create({ rpcUrl: kovanRpcUrl }).currentProvider; + const provider = web3Factory.getRpcProvider({ rpcUrl: kovanRpcUrl }); const config = { networkId: constants.KOVAN_NETWORK_ID, }; @@ -32,7 +32,7 @@ describe('Artifacts', () => { }); describe('contracts are deployed on ropsten', () => { const ropstenRpcUrl = constants.ROPSTEN_RPC_URL; - const provider = web3Factory.create({ rpcUrl: ropstenRpcUrl }).currentProvider; + const provider = web3Factory.getRpcProvider({ rpcUrl: ropstenRpcUrl }); const config = { networkId: constants.ROPSTEN_NETWORK_ID, }; diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts index 3fd45bbd1..45b479c0e 100644 --- a/packages/sol-cov/src/coverage_subprovider.ts +++ b/packages/sol-cov/src/coverage_subprovider.ts @@ -123,16 +123,32 @@ export class CoverageSubprovider extends Subprovider { const jsonRPCResponsePayload = await this.emitPayloadAsync(payload); const trace: TransactionTrace = jsonRPCResponsePayload.result; if (address === constants.NEW_CONTRACT) { - // TODO handle calls to external contracts and contract creations from within the constructor - const structLogsOnDepth0 = _.filter(trace.structLogs, { depth: 0 }); - const coveredPcs = _.map(structLogsOnDepth0, log => log.pc); - const traceInfo: TraceInfoNewContract = { - coveredPcs, - txHash, - address: address as 'NEW_CONTRACT', - bytecode: data as string, - }; - this._coverageManager.appendTraceInfo(traceInfo); + const tracesByContractAddress = getTracesByContractAddress(trace.structLogs, address); + for (const subcallAddress of _.keys(tracesByContractAddress)) { + let traceInfo: TraceInfoNewContract | TraceInfoExistingContract; + if (subcallAddress === 'NEW_CONTRACT') { + const traceForThatSubcall = tracesByContractAddress[subcallAddress]; + const coveredPcs = _.map(traceForThatSubcall, log => log.pc); + traceInfo = { + coveredPcs, + txHash, + address: address as 'NEW_CONTRACT', + bytecode: data as string, + }; + } else { + payload = { method: 'eth_getCode', params: [subcallAddress, BlockParamLiteral.Latest] }; + const runtimeBytecode = (await this.emitPayloadAsync(payload)).result; + const traceForThatSubcall = tracesByContractAddress[subcallAddress]; + const coveredPcs = _.map(traceForThatSubcall, log => log.pc); + traceInfo = { + coveredPcs, + txHash, + address: subcallAddress, + runtimeBytecode, + }; + } + this._coverageManager.appendTraceInfo(traceInfo); + } } else { const tracesByContractAddress = getTracesByContractAddress(trace.structLogs, address); for (const subcallAddress of _.keys(tracesByContractAddress)) { -- cgit v1.2.3 From 6540343f456004549077f708f0d43533488fb4e4 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 13:20:58 -0700 Subject: Remove trace.json --- packages/sol-cov/src/trace.json | 3227 --------------------------------------- 1 file changed, 3227 deletions(-) delete mode 100644 packages/sol-cov/src/trace.json diff --git a/packages/sol-cov/src/trace.json b/packages/sol-cov/src/trace.json deleted file mode 100644 index 77ec20a72..000000000 --- a/packages/sol-cov/src/trace.json +++ /dev/null @@ -1,3227 +0,0 @@ -[ - { - "depth": 0, - "error": "", - "gas": 21216, - "gasCost": 21784, - "memory": null, - "op": "PUSH1", - "pc": 0, - "stack": [], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21213, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 2, - "stack": ["0000000000000000000000000000000000000000000000000000000000000080"], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21210, - "gasCost": 3, - "memory": null, - "op": "MSTORE", - "pc": 4, - "stack": [ - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000040" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21198, - "gasCost": 12, - "memory": null, - "op": "PUSH1", - "pc": 5, - "stack": [], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21195, - "gasCost": 3, - "memory": null, - "op": "CALLDATASIZE", - "pc": 7, - "stack": ["0000000000000000000000000000000000000000000000000000000000000004"], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21193, - "gasCost": 2, - "memory": null, - "op": "LT", - "pc": 8, - "stack": [ - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000024" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21190, - "gasCost": 3, - "memory": null, - "op": "PUSH2", - "pc": 9, - "stack": ["0000000000000000000000000000000000000000000000000000000000000000"], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21187, - "gasCost": 3, - "memory": null, - "op": "JUMPI", - "pc": 12, - "stack": [ - "0000000000000000000000000000000000000000000000000000000000000000", - "00000000000000000000000000000000000000000000000000000000000000af" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21177, - "gasCost": 10, - "memory": null, - "op": "PUSH1", - "pc": 13, - "stack": [], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21174, - "gasCost": 3, - "memory": null, - "op": "CALLDATALOAD", - "pc": 15, - "stack": ["0000000000000000000000000000000000000000000000000000000000000000"], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21171, - "gasCost": 3, - "memory": null, - "op": "PUSH29", - "pc": 16, - "stack": ["2e1a7d4d0000000000000000000000000000000000000000000000000de0b6b3"], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21168, - "gasCost": 3, - "memory": null, - "op": "SWAP1", - "pc": 46, - "stack": [ - "2e1a7d4d0000000000000000000000000000000000000000000000000de0b6b3", - "0000000100000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21165, - "gasCost": 3, - "memory": null, - "op": "DIV", - "pc": 47, - "stack": [ - "0000000100000000000000000000000000000000000000000000000000000000", - "2e1a7d4d0000000000000000000000000000000000000000000000000de0b6b3" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21160, - "gasCost": 5, - "memory": null, - "op": "PUSH4", - "pc": 48, - "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21157, - "gasCost": 3, - "memory": null, - "op": "AND", - "pc": 53, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "00000000000000000000000000000000000000000000000000000000ffffffff" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21154, - "gasCost": 3, - "memory": null, - "op": "DUP1", - "pc": 54, - "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21151, - "gasCost": 3, - "memory": null, - "op": "PUSH4", - "pc": 55, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "000000000000000000000000000000000000000000000000000000002e1a7d4d" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21148, - "gasCost": 3, - "memory": null, - "op": "EQ", - "pc": 60, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000006fdde03" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21145, - "gasCost": 3, - "memory": null, - "op": "PUSH2", - "pc": 61, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21142, - "gasCost": 3, - "memory": null, - "op": "JUMPI", - "pc": 64, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000000", - "00000000000000000000000000000000000000000000000000000000000000b9" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21132, - "gasCost": 10, - "memory": null, - "op": "DUP1", - "pc": 65, - "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21129, - "gasCost": 3, - "memory": null, - "op": "PUSH4", - "pc": 66, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "000000000000000000000000000000000000000000000000000000002e1a7d4d" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21126, - "gasCost": 3, - "memory": null, - "op": "EQ", - "pc": 71, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "00000000000000000000000000000000000000000000000000000000095ea7b3" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21123, - "gasCost": 3, - "memory": null, - "op": "PUSH2", - "pc": 72, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21120, - "gasCost": 3, - "memory": null, - "op": "JUMPI", - "pc": 75, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000149" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21110, - "gasCost": 10, - "memory": null, - "op": "DUP1", - "pc": 76, - "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21107, - "gasCost": 3, - "memory": null, - "op": "PUSH4", - "pc": 77, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "000000000000000000000000000000000000000000000000000000002e1a7d4d" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21104, - "gasCost": 3, - "memory": null, - "op": "EQ", - "pc": 82, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000018160ddd" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21101, - "gasCost": 3, - "memory": null, - "op": "PUSH2", - "pc": 83, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21098, - "gasCost": 3, - "memory": null, - "op": "JUMPI", - "pc": 86, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000000", - "00000000000000000000000000000000000000000000000000000000000001ae" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21088, - "gasCost": 10, - "memory": null, - "op": "DUP1", - "pc": 87, - "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21085, - "gasCost": 3, - "memory": null, - "op": "PUSH4", - "pc": 88, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "000000000000000000000000000000000000000000000000000000002e1a7d4d" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21082, - "gasCost": 3, - "memory": null, - "op": "EQ", - "pc": 93, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000023b872dd" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21079, - "gasCost": 3, - "memory": null, - "op": "PUSH2", - "pc": 94, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21076, - "gasCost": 3, - "memory": null, - "op": "JUMPI", - "pc": 97, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000000", - "00000000000000000000000000000000000000000000000000000000000001d9" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21066, - "gasCost": 10, - "memory": null, - "op": "DUP1", - "pc": 98, - "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21063, - "gasCost": 3, - "memory": null, - "op": "PUSH4", - "pc": 99, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "000000000000000000000000000000000000000000000000000000002e1a7d4d" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21060, - "gasCost": 3, - "memory": null, - "op": "EQ", - "pc": 104, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "000000000000000000000000000000000000000000000000000000002e1a7d4d" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21057, - "gasCost": 3, - "memory": null, - "op": "PUSH2", - "pc": 105, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000001" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21054, - "gasCost": 3, - "memory": null, - "op": "JUMPI", - "pc": 108, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000001", - "000000000000000000000000000000000000000000000000000000000000025e" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21044, - "gasCost": 10, - "memory": null, - "op": "JUMPDEST", - "pc": 606, - "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21043, - "gasCost": 1, - "memory": null, - "op": "CALLVALUE", - "pc": 607, - "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21041, - "gasCost": 2, - "memory": null, - "op": "DUP1", - "pc": 608, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21038, - "gasCost": 3, - "memory": null, - "op": "ISZERO", - "pc": 609, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21035, - "gasCost": 3, - "memory": null, - "op": "PUSH2", - "pc": 610, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000001" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21032, - "gasCost": 3, - "memory": null, - "op": "JUMPI", - "pc": 613, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000001", - "000000000000000000000000000000000000000000000000000000000000026a" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21022, - "gasCost": 10, - "memory": null, - "op": "JUMPDEST", - "pc": 618, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21021, - "gasCost": 1, - "memory": null, - "op": "POP", - "pc": 619, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21019, - "gasCost": 2, - "memory": null, - "op": "PUSH2", - "pc": 620, - "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21016, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 623, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21013, - "gasCost": 3, - "memory": null, - "op": "DUP1", - "pc": 625, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000000000000000004" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21010, - "gasCost": 3, - "memory": null, - "op": "CALLDATASIZE", - "pc": 626, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000004" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21008, - "gasCost": 2, - "memory": null, - "op": "SUB", - "pc": 627, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000024" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21005, - "gasCost": 3, - "memory": null, - "op": "DUP2", - "pc": 628, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000020" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 21002, - "gasCost": 3, - "memory": null, - "op": "ADD", - "pc": 629, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000020", - "0000000000000000000000000000000000000000000000000000000000000004" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20999, - "gasCost": 3, - "memory": null, - "op": "SWAP1", - "pc": 630, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000024" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20996, - "gasCost": 3, - "memory": null, - "op": "DUP1", - "pc": 631, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000000000000000024", - "0000000000000000000000000000000000000000000000000000000000000004" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20993, - "gasCost": 3, - "memory": null, - "op": "DUP1", - "pc": 632, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000000000000000024", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000004" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20990, - "gasCost": 3, - "memory": null, - "op": "CALLDATALOAD", - "pc": 633, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000000000000000024", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000004" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20987, - "gasCost": 3, - "memory": null, - "op": "SWAP1", - "pc": 634, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000000000000000024", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20984, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 635, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000000000000000024", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000004" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20981, - "gasCost": 3, - "memory": null, - "op": "ADD", - "pc": 637, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000000000000000024", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000020" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20978, - "gasCost": 3, - "memory": null, - "op": "SWAP1", - "pc": 638, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000000000000000024", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000024" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20975, - "gasCost": 3, - "memory": null, - "op": "SWAP3", - "pc": 639, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000000000000000024", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000024", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20972, - "gasCost": 3, - "memory": null, - "op": "SWAP2", - "pc": 640, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000024", - "0000000000000000000000000000000000000000000000000000000000000024" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20969, - "gasCost": 3, - "memory": null, - "op": "SWAP1", - "pc": 641, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000024", - "0000000000000000000000000000000000000000000000000000000000000024", - "0000000000000000000000000000000000000000000000000000000000000004" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20966, - "gasCost": 3, - "memory": null, - "op": "POP", - "pc": 642, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000024", - "0000000000000000000000000000000000000000000000000000000000000004", - "0000000000000000000000000000000000000000000000000000000000000024" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20964, - "gasCost": 2, - "memory": null, - "op": "POP", - "pc": 643, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000024", - "0000000000000000000000000000000000000000000000000000000000000004" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20962, - "gasCost": 2, - "memory": null, - "op": "POP", - "pc": 644, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000024" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20960, - "gasCost": 2, - "memory": null, - "op": "PUSH2", - "pc": 645, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20957, - "gasCost": 3, - "memory": null, - "op": "JUMP", - "pc": 648, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000a22" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20949, - "gasCost": 8, - "memory": null, - "op": "JUMPDEST", - "pc": 2594, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20948, - "gasCost": 1, - "memory": null, - "op": "DUP1", - "pc": 2595, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20945, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 2596, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20942, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 2598, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20939, - "gasCost": 3, - "memory": null, - "op": "CALLER", - "pc": 2600, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20937, - "gasCost": 2, - "memory": null, - "op": "PUSH20", - "pc": 2601, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20934, - "gasCost": 3, - "memory": null, - "op": "AND", - "pc": 2622, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "000000000000000000000000ffffffffffffffffffffffffffffffffffffffff" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20931, - "gasCost": 3, - "memory": null, - "op": "PUSH20", - "pc": 2623, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20928, - "gasCost": 3, - "memory": null, - "op": "AND", - "pc": 2644, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "000000000000000000000000ffffffffffffffffffffffffffffffffffffffff" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20925, - "gasCost": 3, - "memory": null, - "op": "DUP2", - "pc": 2645, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20922, - "gasCost": 3, - "memory": null, - "op": "MSTORE", - "pc": 2646, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20919, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 2647, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20916, - "gasCost": 3, - "memory": null, - "op": "ADD", - "pc": 2649, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000020" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20913, - "gasCost": 3, - "memory": null, - "op": "SWAP1", - "pc": 2650, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000020" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20910, - "gasCost": 3, - "memory": null, - "op": "DUP2", - "pc": 2651, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000020", - "0000000000000000000000000000000000000000000000000000000000000003" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20907, - "gasCost": 3, - "memory": null, - "op": "MSTORE", - "pc": 2652, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000020", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000020" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20904, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 2653, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000020" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20901, - "gasCost": 3, - "memory": null, - "op": "ADD", - "pc": 2655, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000020", - "0000000000000000000000000000000000000000000000000000000000000020" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20898, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 2656, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000040" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20895, - "gasCost": 3, - "memory": null, - "op": "SHA3", - "pc": 2658, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000040", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20853, - "gasCost": 42, - "memory": null, - "op": "SLOAD", - "pc": 2659, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20653, - "gasCost": 200, - "memory": null, - "op": "LT", - "pc": 2660, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20650, - "gasCost": 3, - "memory": null, - "op": "ISZERO", - "pc": 2661, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20647, - "gasCost": 3, - "memory": null, - "op": "ISZERO", - "pc": 2662, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000001" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20644, - "gasCost": 3, - "memory": null, - "op": "ISZERO", - "pc": 2663, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20641, - "gasCost": 3, - "memory": null, - "op": "PUSH2", - "pc": 2664, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000001" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20638, - "gasCost": 3, - "memory": null, - "op": "JUMPI", - "pc": 2667, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000001", - "0000000000000000000000000000000000000000000000000000000000000a70" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20628, - "gasCost": 10, - "memory": null, - "op": "JUMPDEST", - "pc": 2672, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20627, - "gasCost": 1, - "memory": null, - "op": "DUP1", - "pc": 2673, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20624, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 2674, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20621, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 2676, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20618, - "gasCost": 3, - "memory": null, - "op": "CALLER", - "pc": 2678, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20616, - "gasCost": 2, - "memory": null, - "op": "PUSH20", - "pc": 2679, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20613, - "gasCost": 3, - "memory": null, - "op": "AND", - "pc": 2700, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "000000000000000000000000ffffffffffffffffffffffffffffffffffffffff" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20610, - "gasCost": 3, - "memory": null, - "op": "PUSH20", - "pc": 2701, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20607, - "gasCost": 3, - "memory": null, - "op": "AND", - "pc": 2722, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "000000000000000000000000ffffffffffffffffffffffffffffffffffffffff" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20604, - "gasCost": 3, - "memory": null, - "op": "DUP2", - "pc": 2723, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20601, - "gasCost": 3, - "memory": null, - "op": "MSTORE", - "pc": 2724, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20598, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 2725, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20595, - "gasCost": 3, - "memory": null, - "op": "ADD", - "pc": 2727, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000020" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20592, - "gasCost": 3, - "memory": null, - "op": "SWAP1", - "pc": 2728, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000020" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20589, - "gasCost": 3, - "memory": null, - "op": "DUP2", - "pc": 2729, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000020", - "0000000000000000000000000000000000000000000000000000000000000003" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20586, - "gasCost": 3, - "memory": null, - "op": "MSTORE", - "pc": 2730, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000020", - "0000000000000000000000000000000000000000000000000000000000000003", - "0000000000000000000000000000000000000000000000000000000000000020" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20583, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 2731, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000020" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20580, - "gasCost": 3, - "memory": null, - "op": "ADD", - "pc": 2733, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000020", - "0000000000000000000000000000000000000000000000000000000000000020" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20577, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 2734, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000040" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20574, - "gasCost": 3, - "memory": null, - "op": "SHA3", - "pc": 2736, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000040", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20532, - "gasCost": 42, - "memory": null, - "op": "PUSH1", - "pc": 2737, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20529, - "gasCost": 3, - "memory": null, - "op": "DUP3", - "pc": 2739, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20526, - "gasCost": 3, - "memory": null, - "op": "DUP3", - "pc": 2740, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20523, - "gasCost": 3, - "memory": null, - "op": "SLOAD", - "pc": 2741, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20323, - "gasCost": 200, - "memory": null, - "op": "SUB", - "pc": 2742, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20320, - "gasCost": 3, - "memory": null, - "op": "SWAP3", - "pc": 2743, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20317, - "gasCost": 3, - "memory": null, - "op": "POP", - "pc": 2744, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000000", - "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20315, - "gasCost": 2, - "memory": null, - "op": "POP", - "pc": 2745, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000000", - "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20313, - "gasCost": 2, - "memory": null, - "op": "DUP2", - "pc": 2746, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000000", - "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20310, - "gasCost": 3, - "memory": null, - "op": "SWAP1", - "pc": 2747, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000000", - "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 20307, - "gasCost": 3, - "memory": null, - "op": "SSTORE", - "pc": 2748, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000000", - "e8af3d9c3f2014e95dfc13b23432f282fb88d28d9985b050581f714c3cecb355" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15307, - "gasCost": 5000, - "memory": null, - "op": "POP", - "pc": 2749, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15305, - "gasCost": 2, - "memory": null, - "op": "CALLER", - "pc": 2750, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15303, - "gasCost": 2, - "memory": null, - "op": "PUSH20", - "pc": 2751, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15300, - "gasCost": 3, - "memory": null, - "op": "AND", - "pc": 2772, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "000000000000000000000000ffffffffffffffffffffffffffffffffffffffff" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15297, - "gasCost": 3, - "memory": null, - "op": "PUSH2", - "pc": 2773, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15294, - "gasCost": 3, - "memory": null, - "op": "DUP3", - "pc": 2776, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "00000000000000000000000000000000000000000000000000000000000008fc" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15291, - "gasCost": 3, - "memory": null, - "op": "SWAP1", - "pc": 2777, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "00000000000000000000000000000000000000000000000000000000000008fc", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15288, - "gasCost": 3, - "memory": null, - "op": "DUP2", - "pc": 2778, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "00000000000000000000000000000000000000000000000000000000000008fc" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15285, - "gasCost": 3, - "memory": null, - "op": "ISZERO", - "pc": 2779, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "00000000000000000000000000000000000000000000000000000000000008fc", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15282, - "gasCost": 3, - "memory": null, - "op": "MUL", - "pc": 2780, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "00000000000000000000000000000000000000000000000000000000000008fc", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15277, - "gasCost": 5, - "memory": null, - "op": "SWAP1", - "pc": 2781, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15274, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 2782, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15271, - "gasCost": 3, - "memory": null, - "op": "MLOAD", - "pc": 2784, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000040" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15268, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 2785, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15265, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 2787, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15262, - "gasCost": 3, - "memory": null, - "op": "MLOAD", - "pc": 2789, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000040" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15259, - "gasCost": 3, - "memory": null, - "op": "DUP1", - "pc": 2790, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000080" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15256, - "gasCost": 3, - "memory": null, - "op": "DUP4", - "pc": 2791, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000080" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15253, - "gasCost": 3, - "memory": null, - "op": "SUB", - "pc": 2792, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000080" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15250, - "gasCost": 3, - "memory": null, - "op": "DUP2", - "pc": 2793, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15247, - "gasCost": 3, - "memory": null, - "op": "DUP6", - "pc": 2794, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000080" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15244, - "gasCost": 3, - "memory": null, - "op": "DUP9", - "pc": 2795, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15241, - "gasCost": 3, - "memory": null, - "op": "DUP9", - "pc": 2796, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 15238, - "gasCost": 3, - "memory": null, - "op": "CALL", - "pc": 2797, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7838, - "gasCost": 7400, - "memory": null, - "op": "SWAP4", - "pc": 2798, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "00000000000000000000000000000000000000000000000000000000000008fc", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000001" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7835, - "gasCost": 3, - "memory": null, - "op": "POP", - "pc": 2799, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000001", - "00000000000000000000000000000000000000000000000000000000000008fc", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7833, - "gasCost": 2, - "memory": null, - "op": "POP", - "pc": 2800, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000001", - "00000000000000000000000000000000000000000000000000000000000008fc", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7831, - "gasCost": 2, - "memory": null, - "op": "POP", - "pc": 2801, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000001", - "00000000000000000000000000000000000000000000000000000000000008fc", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7829, - "gasCost": 2, - "memory": null, - "op": "POP", - "pc": 2802, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000001", - "00000000000000000000000000000000000000000000000000000000000008fc" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7827, - "gasCost": 2, - "memory": null, - "op": "ISZERO", - "pc": 2803, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000001" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7824, - "gasCost": 3, - "memory": null, - "op": "DUP1", - "pc": 2804, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7821, - "gasCost": 3, - "memory": null, - "op": "ISZERO", - "pc": 2805, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7818, - "gasCost": 3, - "memory": null, - "op": "PUSH2", - "pc": 2806, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000001" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7815, - "gasCost": 3, - "memory": null, - "op": "JUMPI", - "pc": 2809, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000000", - "0000000000000000000000000000000000000000000000000000000000000001", - "0000000000000000000000000000000000000000000000000000000000000b03" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7805, - "gasCost": 10, - "memory": null, - "op": "JUMPDEST", - "pc": 2819, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7804, - "gasCost": 1, - "memory": null, - "op": "POP", - "pc": 2820, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7802, - "gasCost": 2, - "memory": null, - "op": "CALLER", - "pc": 2821, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7800, - "gasCost": 2, - "memory": null, - "op": "PUSH20", - "pc": 2822, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7797, - "gasCost": 3, - "memory": null, - "op": "AND", - "pc": 2843, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "000000000000000000000000ffffffffffffffffffffffffffffffffffffffff" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7794, - "gasCost": 3, - "memory": null, - "op": "PUSH32", - "pc": 2844, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7791, - "gasCost": 3, - "memory": null, - "op": "DUP3", - "pc": 2877, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7788, - "gasCost": 3, - "memory": null, - "op": "PUSH1", - "pc": 2878, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7785, - "gasCost": 3, - "memory": null, - "op": "MLOAD", - "pc": 2880, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000040" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7782, - "gasCost": 3, - "memory": null, - "op": "DUP1", - "pc": 2881, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7779, - "gasCost": 3, - "memory": null, - "op": "DUP3", - "pc": 2882, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000080" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7776, - "gasCost": 3, - "memory": null, - "op": "DUP2", - "pc": 2883, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7773, - "gasCost": 3, - "memory": null, - "op": "MSTORE", - "pc": 2884, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7764, - "gasCost": 9, - "memory": null, - "op": "PUSH1", - "pc": 2885, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000080" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7761, - "gasCost": 3, - "memory": null, - "op": "ADD", - "pc": 2887, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000020" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7758, - "gasCost": 3, - "memory": null, - "op": "SWAP2", - "pc": 2888, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000000000000000000000000000000000000000000080", - "00000000000000000000000000000000000000000000000000000000000000a0" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7755, - "gasCost": 3, - "memory": null, - "op": "POP", - "pc": 2889, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "00000000000000000000000000000000000000000000000000000000000000a0", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7753, - "gasCost": 2, - "memory": null, - "op": "POP", - "pc": 2890, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "00000000000000000000000000000000000000000000000000000000000000a0", - "0000000000000000000000000000000000000000000000000000000000000080" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7751, - "gasCost": 2, - "memory": null, - "op": "PUSH1", - "pc": 2891, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "00000000000000000000000000000000000000000000000000000000000000a0" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7748, - "gasCost": 3, - "memory": null, - "op": "MLOAD", - "pc": 2893, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "00000000000000000000000000000000000000000000000000000000000000a0", - "0000000000000000000000000000000000000000000000000000000000000040" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7745, - "gasCost": 3, - "memory": null, - "op": "DUP1", - "pc": 2894, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "00000000000000000000000000000000000000000000000000000000000000a0", - "0000000000000000000000000000000000000000000000000000000000000080" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7742, - "gasCost": 3, - "memory": null, - "op": "SWAP2", - "pc": 2895, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "00000000000000000000000000000000000000000000000000000000000000a0", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000080" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7739, - "gasCost": 3, - "memory": null, - "op": "SUB", - "pc": 2896, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000080", - "00000000000000000000000000000000000000000000000000000000000000a0" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7736, - "gasCost": 3, - "memory": null, - "op": "SWAP1", - "pc": 2897, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "0000000000000000000000000000000000000000000000000000000000000080", - "0000000000000000000000000000000000000000000000000000000000000020" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 7733, - "gasCost": 3, - "memory": null, - "op": "LOG2", - "pc": 2898, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000", - "0000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a631", - "7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", - "0000000000000000000000000000000000000000000000000000000000000020", - "0000000000000000000000000000000000000000000000000000000000000080" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 6352, - "gasCost": 1381, - "memory": null, - "op": "POP", - "pc": 2899, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289", - "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 6350, - "gasCost": 2, - "memory": null, - "op": "JUMP", - "pc": 2900, - "stack": [ - "000000000000000000000000000000000000000000000000000000002e1a7d4d", - "0000000000000000000000000000000000000000000000000000000000000289" - ], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 6342, - "gasCost": 8, - "memory": null, - "op": "JUMPDEST", - "pc": 649, - "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], - "storage": null - }, - { - "depth": 0, - "error": "", - "gas": 6341, - "gasCost": 1, - "memory": null, - "op": "STOP", - "pc": 650, - "stack": ["000000000000000000000000000000000000000000000000000000002e1a7d4d"], - "storage": null - } -] -- cgit v1.2.3 From 06be580d2cbe7e3543d8c4deeb4d1c22b325e6a7 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 13:21:44 -0700 Subject: Fix a bug in CALL-like opcode handling --- packages/contracts/src/utils/web3_wrapper.ts | 3 ++- packages/contracts/test/utils/coverage.ts | 6 +++--- packages/sol-cov/src/trace.ts | 24 +++++++++++++++++------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/packages/contracts/src/utils/web3_wrapper.ts b/packages/contracts/src/utils/web3_wrapper.ts index 5d3d9f7c9..02595506b 100644 --- a/packages/contracts/src/utils/web3_wrapper.ts +++ b/packages/contracts/src/utils/web3_wrapper.ts @@ -13,6 +13,7 @@ const providerConfigs = { shouldUseInProcessGanache: true }; export const provider = web3Factory.getRpcProvider(providerConfigs); const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage); if (isCoverageEnabled) { - prependSubprovider(provider, coverage.getCoverageSubproviderSingleton()); + const coverageSubprovider = coverage.getCoverageSubproviderSingleton(); + prependSubprovider(provider, coverageSubprovider); } export const web3Wrapper = new Web3Wrapper(provider); diff --git a/packages/contracts/test/utils/coverage.ts b/packages/contracts/test/utils/coverage.ts index eeb47667f..3b2a8d7b2 100644 --- a/packages/contracts/test/utils/coverage.ts +++ b/packages/contracts/test/utils/coverage.ts @@ -16,8 +16,8 @@ export const coverage = { const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS; const CONFIG_FILE = 'compiler.json'; const config = JSON.parse(fs.readFileSync(CONFIG_FILE).toString()); - const zeroExArtifactsAdapter = new SolCompilerArtifactAdapter(config.artifactsDir, config.contractsDir); - const coverageSubrpovider = new CoverageSubprovider(zeroExArtifactsAdapter, defaultFromAddress); - return coverageSubprovider; + const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter(config.artifactsDir, config.contractsDir); + const subprovider = new CoverageSubprovider(solCompilerArtifactAdapter, defaultFromAddress); + return subprovider; }, }; diff --git a/packages/sol-cov/src/trace.ts b/packages/sol-cov/src/trace.ts index 81c8bb0ff..feebaaab5 100644 --- a/packages/sol-cov/src/trace.ts +++ b/packages/sol-cov/src/trace.ts @@ -13,7 +13,8 @@ export function getTracesByContractAddress(structLogs: StructLog[], startAddress let currentTraceSegment = []; const callStack = [startAddress]; // tslint:disable-next-line:prefer-for-of - for (const structLog of structLogs) { + for (let i = 0; i < structLogs.length; i++) { + const structLog = structLogs[i]; if (structLog.depth !== callStack.length - 1) { throw new Error("Malformed trace. trace depth doesn't match call stack depth"); } @@ -26,13 +27,22 @@ export function getTracesByContractAddress(structLogs: StructLog[], startAddress const currentAddress = _.last(callStack) as string; const jumpAddressOffset = structLog.op === OpCode.DelegateCall ? 4 : 2; const newAddress = addressUtils.padZeros( - new BigNumber(addHexPrefix(structLog.stack[jumpAddressOffset])).toString(16), + new BigNumber(addHexPrefix(structLog.stack[structLog.stack.length - jumpAddressOffset])).toString(16), ); - callStack.push(newAddress); - traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( - currentTraceSegment, - ); - currentTraceSegment = []; + if (structLog === _.last(structLogs)) { + throw new Error('CALL-like opcode can not be the last one'); + } + // Sometimes calls don't change the execution context (current address). When we do a transfer to an + // externally owned account - it does the call and immidiately returns because there is no fallback + // function. We manually check if the call depth had changed to handle that case. + const nextStructLog = structLogs[i + 1]; + if (nextStructLog.depth !== structLog.depth) { + callStack.push(newAddress); + traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( + currentTraceSegment, + ); + currentTraceSegment = []; + } } else if ( _.includes([OpCode.Return, OpCode.Stop, OpCode.Revert, OpCode.Invalid, OpCode.SelfDestruct], structLog.op) ) { -- cgit v1.2.3 From 9740199870d83dc999079883754ec512c1ff544b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 13:44:48 -0700 Subject: Fix sol-cov tests --- packages/sol-cov/src/trace.ts | 4 +++- packages/sol-cov/test/trace_test.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/sol-cov/src/trace.ts b/packages/sol-cov/src/trace.ts index feebaaab5..389bd8309 100644 --- a/packages/sol-cov/src/trace.ts +++ b/packages/sol-cov/src/trace.ts @@ -27,7 +27,9 @@ export function getTracesByContractAddress(structLogs: StructLog[], startAddress const currentAddress = _.last(callStack) as string; const jumpAddressOffset = structLog.op === OpCode.DelegateCall ? 4 : 2; const newAddress = addressUtils.padZeros( - new BigNumber(addHexPrefix(structLog.stack[structLog.stack.length - jumpAddressOffset])).toString(16), + new BigNumber(addHexPrefix(structLog.stack[structLog.stack.length - jumpAddressOffset - 1])).toString( + 16, + ), ); if (structLog === _.last(structLogs)) { throw new Error('CALL-like opcode can not be the last one'); diff --git a/packages/sol-cov/test/trace_test.ts b/packages/sol-cov/test/trace_test.ts index 2d6697ce5..93696b04a 100644 --- a/packages/sol-cov/test/trace_test.ts +++ b/packages/sol-cov/test/trace_test.ts @@ -32,7 +32,7 @@ describe('Trace', () => { const trace = [ { op: OpCode.DelegateCall, - stack: ['0x', '0x', '0x', '0x', delegateCallAddress], + stack: [delegateCallAddress, '0x', '0x', '0x', '0x'], depth: 0, }, { -- cgit v1.2.3 From 127b3e7d60aa5b5256d3d77aecf5efb239649957 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 14:48:23 -0700 Subject: Fix sol-compiler version --- packages/sol-cov/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index 0edffb1d2..74ffa72bd 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -46,7 +46,7 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/sol-cov/README.md", "dependencies": { - "@0xproject/sol-compiler": "^0.4.3", + "@0xproject/sol-compiler": "^0.5.0", "@0xproject/subproviders": "^0.10.2", "@0xproject/types": "^0.7.0", "@0xproject/typescript-typings": "^0.3.2", -- cgit v1.2.3 From 6e0aef5f2bd8cd3ca9086abf4794028feac5ae9b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 15:14:07 -0700 Subject: Fix depth tracking in a tracer --- packages/sol-cov/src/trace.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/sol-cov/src/trace.ts b/packages/sol-cov/src/trace.ts index 389bd8309..28fc7d004 100644 --- a/packages/sol-cov/src/trace.ts +++ b/packages/sol-cov/src/trace.ts @@ -25,7 +25,7 @@ export function getTracesByContractAddress(structLogs: StructLog[], startAddress if (_.includes([OpCode.CallCode, OpCode.StaticCall, OpCode.Call, OpCode.DelegateCall], structLog.op)) { const currentAddress = _.last(callStack) as string; - const jumpAddressOffset = structLog.op === OpCode.DelegateCall ? 4 : 2; + const jumpAddressOffset = 1; const newAddress = addressUtils.padZeros( new BigNumber(addHexPrefix(structLog.stack[structLog.stack.length - jumpAddressOffset - 1])).toString( 16, @@ -65,6 +65,21 @@ export function getTracesByContractAddress(structLogs: StructLog[], startAddress "Detected a contract created from within another contract. Sol-cov currently doesn't support that scenario. We'll just skip that trace", ); return traceByContractAddress; + } else { + if (structLog !== _.last(structLogs)) { + const nextStructLog = structLogs[i + 1]; + if (nextStructLog.depth === structLog.depth) { + continue; + } else if (nextStructLog.depth === structLog.depth - 1) { + const currentAddress = callStack.pop() as string; + traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( + currentTraceSegment, + ); + currentTraceSegment = []; + } else { + throw new Error('Shit broke'); + } + } } } if (callStack.length !== 0) { -- cgit v1.2.3 From 8c7f0902c044b671ca66c004d9c29e018bcdb20e Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 16:29:10 -0700 Subject: Add a more verbose comment for self-destruct --- packages/sol-cov/src/trace.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/sol-cov/src/trace.ts b/packages/sol-cov/src/trace.ts index 28fc7d004..4d106e355 100644 --- a/packages/sol-cov/src/trace.ts +++ b/packages/sol-cov/src/trace.ts @@ -54,7 +54,11 @@ export function getTracesByContractAddress(structLogs: StructLog[], startAddress ); currentTraceSegment = []; if (structLog.op === OpCode.SelfDestruct) { - // TODO: Record contract bytecode before the selfdestruct and handle that scenario + // After contract execution, we look at all sub-calls to external contracts, and for each one, fetch + // the bytecode and compute the coverage for the call. If the contract is destroyed with a call + // to `selfdestruct`, we are unable to fetch it's bytecode and compute coverage. + // TODO: Refactor this logic to fetch the sub-called contract bytecode before the selfdestruct is called + // in order to handle this edge-case. logUtils.warn( "Detected a selfdestruct. Sol-cov currently doesn't support that scenario. We'll just skip the trace part for a destructed contract", ); -- cgit v1.2.3 From d49f2c40ae28bde3574907a72c0fdd84196e8303 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 16:41:50 -0700 Subject: Parse compiler.json in SolCompilerArtifactsAdapter --- packages/contracts/test/utils/coverage.ts | 4 +--- .../artifact_adapters/sol_compiler_artifact_adapter.ts | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/contracts/test/utils/coverage.ts b/packages/contracts/test/utils/coverage.ts index 3b2a8d7b2..a37939464 100644 --- a/packages/contracts/test/utils/coverage.ts +++ b/packages/contracts/test/utils/coverage.ts @@ -14,9 +14,7 @@ export const coverage = { }, _getCoverageSubprovider(): CoverageSubprovider { const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS; - const CONFIG_FILE = 'compiler.json'; - const config = JSON.parse(fs.readFileSync(CONFIG_FILE).toString()); - const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter(config.artifactsDir, config.contractsDir); + const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter(); const subprovider = new CoverageSubprovider(solCompilerArtifactAdapter, defaultFromAddress); return subprovider; }, diff --git a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts index cb164f769..d08828bf6 100644 --- a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts +++ b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts @@ -7,13 +7,22 @@ import { ContractData } from '../types'; import { AbstractArtifactAdapter } from './abstract_artifact_adapter'; +const CONFIG_FILE = 'compiler.json'; + export class SolCompilerArtifactAdapter extends AbstractArtifactAdapter { private _artifactsPath: string; private _sourcesPath: string; - constructor(artifactsPath: string, sourcesPath: string) { + constructor(artifactsPath?: string, sourcesPath?: string) { super(); - this._artifactsPath = artifactsPath; - this._sourcesPath = sourcesPath; + const config = JSON.parse(fs.readFileSync(CONFIG_FILE).toString()); + if (_.isUndefined(artifactsPath) && _.isUndefined(config.artifactsDir)) { + throw new Error(`artifactsDir not found in ${CONFIG_FILE}`); + } + this._artifactsPath = config.artifactsDir; + if (_.isUndefined(sourcesPath) && _.isUndefined(config.contractsDir)) { + throw new Error(`contractsDir not found in ${CONFIG_FILE}`); + } + this._sourcesPath = config.contractsDir; } public async collectContractsDataAsync(): Promise { const artifactsGlob = `${this._artifactsPath}/**/*.json`; -- cgit v1.2.3 From ebc750d5bf95da76424da81550a88e6b74de8c36 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 22 May 2018 17:41:48 -0700 Subject: Address feedback --- packages/dev-utils/CHANGELOG.json | 2 +- packages/sol-cov/src/constants.ts | 2 +- packages/sol-cov/src/coverage_manager.ts | 4 +++- packages/sol-cov/src/coverage_subprovider.ts | 24 +++++++++++--------- packages/sol-cov/src/trace.ts | 34 +++++++++++++++++----------- 5 files changed, 39 insertions(+), 27 deletions(-) diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index 4f6f7bd76..ecb43a42e 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -3,7 +3,7 @@ "version": "0.4.2", "changes": [ { - "note": "Pass ZeroExArtifactsAdapter to CoverageSubprovider", + "note": "Pass SolCompilerArtifactAdapter to CoverageSubprovider", "pr": 589 }, { diff --git a/packages/sol-cov/src/constants.ts b/packages/sol-cov/src/constants.ts index 64d2228a3..34d62b537 100644 --- a/packages/sol-cov/src/constants.ts +++ b/packages/sol-cov/src/constants.ts @@ -1,6 +1,6 @@ // tslint:disable:number-literal-format export const constants = { - NEW_CONTRACT: 'NEW_CONTRACT', + NEW_CONTRACT: 'NEW_CONTRACT' as 'NEW_CONTRACT', PUSH1: 0x60, PUSH2: 0x61, PUSH32: 0x7f, diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts index ef893527a..31b0e6fbc 100644 --- a/packages/sol-cov/src/coverage_manager.ts +++ b/packages/sol-cov/src/coverage_manager.ts @@ -125,13 +125,15 @@ export class CoverageManager { } private static _getContractDataIfExists(contractsData: ContractData[], bytecode: string): ContractData | undefined { if (!bytecode.startsWith('0x')) { - throw new Error('0x missing'); + throw new Error(`0x hex prefix missing: ${bytecode}`); } const contractData = _.find(contractsData, contractDataCandidate => { const bytecodeRegex = CoverageManager._bytecodeToBytecodeRegex(contractDataCandidate.bytecode); const runtimeBytecodeRegex = CoverageManager._bytecodeToBytecodeRegex( contractDataCandidate.runtimeBytecode, ); + // We use that function to find by bytecode or runtimeBytecode. Those are quasi-random strings so + // collisions are practically impossible and it allows us to reuse that code return !_.isNull(bytecode.match(bytecodeRegex)) || !_.isNull(bytecode.match(runtimeBytecodeRegex)); }); return contractData; diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts index 45b479c0e..438339a3f 100644 --- a/packages/sol-cov/src/coverage_subprovider.ts +++ b/packages/sol-cov/src/coverage_subprovider.ts @@ -31,13 +31,13 @@ export class CoverageSubprovider extends Subprovider { * Instantiates a CoverageSubprovider instance * @param artifactAdapter Adapter for used artifacts format (0x, truffle, giveth, etc.) * @param defaultFromAddress default from address to use when sending transactions - * @param verbose If true, we will log any unknown transactions. Otherwise we will ignore them + * @param isVerbose If true, we will log any unknown transactions. Otherwise we will ignore them */ - constructor(artifactAdapter: AbstractArtifactAdapter, defaultFromAddress: string, verbose: boolean = true) { + constructor(artifactAdapter: AbstractArtifactAdapter, defaultFromAddress: string, isVerbose: boolean = true) { super(); this._lock = new Lock(); this._defaultFromAddress = defaultFromAddress; - this._coverageManager = new CoverageManager(artifactAdapter, this._getContractCodeAsync.bind(this), verbose); + this._coverageManager = new CoverageManager(artifactAdapter, this._getContractCodeAsync.bind(this), isVerbose); } /** * Write the test coverage results to a file in Istanbul format. @@ -120,11 +120,12 @@ export class CoverageSubprovider extends Subprovider { method: 'debug_traceTransaction', params: [txHash, { disableMemory: true, disableStack: false, disableStorage: true }], }; - const jsonRPCResponsePayload = await this.emitPayloadAsync(payload); + let jsonRPCResponsePayload = await this.emitPayloadAsync(payload); const trace: TransactionTrace = jsonRPCResponsePayload.result; + const tracesByContractAddress = getTracesByContractAddress(trace.structLogs, address); + const subcallAddresses = _.keys(tracesByContractAddress); if (address === constants.NEW_CONTRACT) { - const tracesByContractAddress = getTracesByContractAddress(trace.structLogs, address); - for (const subcallAddress of _.keys(tracesByContractAddress)) { + for (const subcallAddress of subcallAddresses) { let traceInfo: TraceInfoNewContract | TraceInfoExistingContract; if (subcallAddress === 'NEW_CONTRACT') { const traceForThatSubcall = tracesByContractAddress[subcallAddress]; @@ -132,12 +133,13 @@ export class CoverageSubprovider extends Subprovider { traceInfo = { coveredPcs, txHash, - address: address as 'NEW_CONTRACT', + address: constants.NEW_CONTRACT, bytecode: data as string, }; } else { payload = { method: 'eth_getCode', params: [subcallAddress, BlockParamLiteral.Latest] }; - const runtimeBytecode = (await this.emitPayloadAsync(payload)).result; + jsonRPCResponsePayload = await this.emitPayloadAsync(payload); + const runtimeBytecode = jsonRPCResponsePayload.result; const traceForThatSubcall = tracesByContractAddress[subcallAddress]; const coveredPcs = _.map(traceForThatSubcall, log => log.pc); traceInfo = { @@ -150,10 +152,10 @@ export class CoverageSubprovider extends Subprovider { this._coverageManager.appendTraceInfo(traceInfo); } } else { - const tracesByContractAddress = getTracesByContractAddress(trace.structLogs, address); - for (const subcallAddress of _.keys(tracesByContractAddress)) { + for (const subcallAddress of subcallAddresses) { payload = { method: 'eth_getCode', params: [subcallAddress, BlockParamLiteral.Latest] }; - const runtimeBytecode = (await this.emitPayloadAsync(payload)).result; + jsonRPCResponsePayload = await this.emitPayloadAsync(payload); + const runtimeBytecode = jsonRPCResponsePayload.result; const traceForThatSubcall = tracesByContractAddress[subcallAddress]; const coveredPcs = _.map(traceForThatSubcall, log => log.pc); const traceInfo: TraceInfoExistingContract = { diff --git a/packages/sol-cov/src/trace.ts b/packages/sol-cov/src/trace.ts index 4d106e355..cb5410909 100644 --- a/packages/sol-cov/src/trace.ts +++ b/packages/sol-cov/src/trace.ts @@ -8,6 +8,10 @@ export interface TraceByContractAddress { [contractAddress: string]: StructLog[]; } +function getAddressFromStackEntry(stackEntry: string): string { + return addressUtils.padZeros(new BigNumber(addHexPrefix(stackEntry)).toString(16)); +} + export function getTracesByContractAddress(structLogs: StructLog[], startAddress: string): TraceByContractAddress { const traceByContractAddress: TraceByContractAddress = {}; let currentTraceSegment = []; @@ -16,26 +20,32 @@ export function getTracesByContractAddress(structLogs: StructLog[], startAddress for (let i = 0; i < structLogs.length; i++) { const structLog = structLogs[i]; if (structLog.depth !== callStack.length - 1) { - throw new Error("Malformed trace. trace depth doesn't match call stack depth"); + throw new Error("Malformed trace. Trace depth doesn't match call stack depth"); } // After that check we have a guarantee that call stack is never empty // If it would: callStack.length - 1 === structLog.depth === -1 // That means that we can always safely pop from it currentTraceSegment.push(structLog); - if (_.includes([OpCode.CallCode, OpCode.StaticCall, OpCode.Call, OpCode.DelegateCall], structLog.op)) { + const isCallLike = _.includes( + [OpCode.CallCode, OpCode.StaticCall, OpCode.Call, OpCode.DelegateCall], + structLog.op, + ); + const isEndOpcode = _.includes( + [OpCode.Return, OpCode.Stop, OpCode.Revert, OpCode.Invalid, OpCode.SelfDestruct], + structLog.op, + ); + if (isCallLike) { const currentAddress = _.last(callStack) as string; const jumpAddressOffset = 1; - const newAddress = addressUtils.padZeros( - new BigNumber(addHexPrefix(structLog.stack[structLog.stack.length - jumpAddressOffset - 1])).toString( - 16, - ), + const newAddress = getAddressFromStackEntry( + structLog.stack[structLog.stack.length - jumpAddressOffset - 1], ); if (structLog === _.last(structLogs)) { - throw new Error('CALL-like opcode can not be the last one'); + throw new Error('Malformed trace. CALL-like opcode can not be the last one'); } // Sometimes calls don't change the execution context (current address). When we do a transfer to an - // externally owned account - it does the call and immidiately returns because there is no fallback + // externally owned account - it does the call and immediately returns because there is no fallback // function. We manually check if the call depth had changed to handle that case. const nextStructLog = structLogs[i + 1]; if (nextStructLog.depth !== structLog.depth) { @@ -45,9 +55,7 @@ export function getTracesByContractAddress(structLogs: StructLog[], startAddress ); currentTraceSegment = []; } - } else if ( - _.includes([OpCode.Return, OpCode.Stop, OpCode.Revert, OpCode.Invalid, OpCode.SelfDestruct], structLog.op) - ) { + } else if (isEndOpcode) { const currentAddress = callStack.pop() as string; traceByContractAddress[currentAddress] = (traceByContractAddress[currentAddress] || []).concat( currentTraceSegment, @@ -81,7 +89,7 @@ export function getTracesByContractAddress(structLogs: StructLog[], startAddress ); currentTraceSegment = []; } else { - throw new Error('Shit broke'); + throw new Error('Malformed trace. Unexpected call depth change'); } } } @@ -90,7 +98,7 @@ export function getTracesByContractAddress(structLogs: StructLog[], startAddress throw new Error('Malformed trace. Call stack non empty at the end'); } if (currentTraceSegment.length !== 0) { - throw new Error('Malformed trace. currentTraceSegment non empty at the end'); + throw new Error('Malformed trace. Current trace segment non empty at the end'); } return traceByContractAddress; } -- cgit v1.2.3 From 48e66954470ffb1b547e377d3edbed5d2cf7fc6b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 23 May 2018 09:57:43 -0700 Subject: Fix NameResolver --- packages/sol-resolver/src/resolvers/name_resolver.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/sol-resolver/src/resolvers/name_resolver.ts b/packages/sol-resolver/src/resolvers/name_resolver.ts index 586fad86a..e489c70a7 100644 --- a/packages/sol-resolver/src/resolvers/name_resolver.ts +++ b/packages/sol-resolver/src/resolvers/name_resolver.ts @@ -56,13 +56,15 @@ export class NameResolver extends EnumerableResolver { throw new Error(`No directory found at ${dirPath}`); } for (const fileName of dirContents) { - if (!fileName.endsWith(SOLIDITY_FILE_EXTENSION)) { - continue; - } const absoluteEntryPath = path.join(dirPath, fileName); const isDirectory = fs.lstatSync(absoluteEntryPath).isDirectory(); const entryPath = path.relative(this._contractsDir, absoluteEntryPath); - const isComplete = isDirectory ? this._traverseContractsDir(absoluteEntryPath, onFile) : onFile(entryPath); + let isComplete; + if (isDirectory) { + isComplete = this._traverseContractsDir(absoluteEntryPath, onFile); + } else if (fileName.endsWith(SOLIDITY_FILE_EXTENSION)) { + isComplete = onFile(entryPath); + } if (isComplete) { return isComplete; } -- cgit v1.2.3 From 6a77e0fe56b1fdc3bef990f8418d741c6a338763 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 23 May 2018 10:32:14 -0700 Subject: Move contract utils --- packages/contracts/package.json | 2 +- packages/contracts/src/utils/coverage.ts | 21 ++ packages/contracts/src/utils/match_order_tester.ts | 356 +++++++++++++++++++++ packages/contracts/test/exchange/match_orders.ts | 2 +- packages/contracts/test/global_hooks.ts | 2 +- packages/contracts/test/utils/coverage.ts | 21 -- .../contracts/test/utils/match_order_tester.ts | 356 --------------------- 7 files changed, 380 insertions(+), 380 deletions(-) create mode 100644 packages/contracts/src/utils/coverage.ts create mode 100644 packages/contracts/src/utils/match_order_tester.ts delete mode 100644 packages/contracts/test/utils/coverage.ts delete mode 100644 packages/contracts/test/utils/match_order_tester.ts diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 766280fc9..1c66a3b86 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -45,7 +45,7 @@ "@0xproject/dev-utils": "^0.4.2", "@0xproject/tslint-config": "^0.4.18", "@0xproject/subproviders": "^0.10.1", - "@0xproject/sol-cov": "^0.0.10", + "@0xproject/sol-cov": "^0.0.11", "@types/lodash": "4.14.104", "@types/node": "^8.0.53", "@types/yargs": "^10.0.0", diff --git a/packages/contracts/src/utils/coverage.ts b/packages/contracts/src/utils/coverage.ts new file mode 100644 index 000000000..a37939464 --- /dev/null +++ b/packages/contracts/src/utils/coverage.ts @@ -0,0 +1,21 @@ +import { devConstants } from '@0xproject/dev-utils'; +import { CoverageSubprovider, SolCompilerArtifactAdapter } from '@0xproject/sol-cov'; +import * as fs from 'fs'; +import * as _ from 'lodash'; + +let coverageSubprovider: CoverageSubprovider; + +export const coverage = { + getCoverageSubproviderSingleton(): CoverageSubprovider { + if (_.isUndefined(coverageSubprovider)) { + coverageSubprovider = coverage._getCoverageSubprovider(); + } + return coverageSubprovider; + }, + _getCoverageSubprovider(): CoverageSubprovider { + const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS; + const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter(); + const subprovider = new CoverageSubprovider(solCompilerArtifactAdapter, defaultFromAddress); + return subprovider; + }, +}; diff --git a/packages/contracts/src/utils/match_order_tester.ts b/packages/contracts/src/utils/match_order_tester.ts new file mode 100644 index 000000000..30039937f --- /dev/null +++ b/packages/contracts/src/utils/match_order_tester.ts @@ -0,0 +1,356 @@ +import { BlockchainLifecycle } from '@0xproject/dev-utils'; +import { LogWithDecodedArgs } from '@0xproject/types'; +import { BigNumber } from '@0xproject/utils'; +import * as chai from 'chai'; +import ethUtil = require('ethereumjs-util'); +import * as _ from 'lodash'; + +import { DummyERC20TokenContract } from '../contract_wrappers/generated/dummy_e_r_c20_token'; +import { DummyERC721TokenContract } from '../contract_wrappers/generated/dummy_e_r_c721_token'; +import { ERC20ProxyContract } from '../contract_wrappers/generated/e_r_c20_proxy'; +import { ERC721ProxyContract } from '../contract_wrappers/generated/e_r_c721_proxy'; +import { + CancelContractEventArgs, + ExchangeContract, + FillContractEventArgs, +} from '../contract_wrappers/generated/exchange'; +import { assetProxyUtils } from '../utils/asset_proxy_utils'; +import { chaiSetup } from '../utils/chai_setup'; +import { constants } from '../utils/constants'; +import { crypto } from '../utils/crypto'; +import { ERC20Wrapper } from '../utils/erc20_wrapper'; +import { ERC721Wrapper } from '../utils/erc721_wrapper'; +import { ExchangeWrapper } from '../utils/exchange_wrapper'; +import { OrderFactory } from '../utils/order_factory'; +import { orderUtils } from '../utils/order_utils'; +import { + AssetProxyId, + ContractName, + ERC20BalancesByOwner, + ERC721TokenIdsByOwner, + ExchangeStatus, + SignedOrder, + TransferAmountsByMatchOrders as TransferAmounts, +} from '../utils/types'; +import { provider, web3Wrapper } from '../utils/web3_wrapper'; + +chaiSetup.configure(); +const expect = chai.expect; +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); + +export class MatchOrderTester { + private _exchangeWrapper: ExchangeWrapper; + private _erc20Wrapper: ERC20Wrapper; + private _erc721Wrapper: ERC721Wrapper; + private _feeTokenAddress: string; + + /// @dev Compares a pair of ERC20 balances and a pair of ERC721 token owners. + /// @param expectedNewERC20BalancesByOwner Expected ERC20 balances. + /// @param realERC20BalancesByOwner Actual ERC20 balances. + /// @param expectedNewERC721TokenIdsByOwner Expected ERC721 token owners. + /// @param realERC721TokenIdsByOwner Actual ERC20 token owners. + /// @return True only if ERC20 balances match and ERC721 token owners match. + private static _compareExpectedAndRealBalances( + expectedNewERC20BalancesByOwner: ERC20BalancesByOwner, + realERC20BalancesByOwner: ERC20BalancesByOwner, + expectedNewERC721TokenIdsByOwner: ERC721TokenIdsByOwner, + realERC721TokenIdsByOwner: ERC721TokenIdsByOwner, + ): boolean { + // ERC20 Balances + const doesErc20BalancesMatch = _.isEqual(expectedNewERC20BalancesByOwner, realERC20BalancesByOwner); + if (!doesErc20BalancesMatch) { + return false; + } + // ERC721 Token Ids + const sortedExpectedNewERC721TokenIdsByOwner = _.mapValues( + expectedNewERC721TokenIdsByOwner, + tokenIdsByOwner => { + _.mapValues(tokenIdsByOwner, tokenIds => { + _.sortBy(tokenIds); + }); + }, + ); + const sortedNewERC721TokenIdsByOwner = _.mapValues(realERC721TokenIdsByOwner, tokenIdsByOwner => { + _.mapValues(tokenIdsByOwner, tokenIds => { + _.sortBy(tokenIds); + }); + }); + const doesErc721TokenIdsMatch = _.isEqual( + sortedExpectedNewERC721TokenIdsByOwner, + sortedNewERC721TokenIdsByOwner, + ); + return doesErc721TokenIdsMatch; + } + /// @dev Constructs new MatchOrderTester. + /// @param exchangeWrapper Used to call to the Exchange. + /// @param erc20Wrapper Used to fetch ERC20 balances. + /// @param erc721Wrapper Used to fetch ERC721 token owners. + /// @param feeTokenAddress Address of ERC20 fee token. + constructor( + exchangeWrapper: ExchangeWrapper, + erc20Wrapper: ERC20Wrapper, + erc721Wrapper: ERC721Wrapper, + feeTokenAddress: string, + ) { + this._exchangeWrapper = exchangeWrapper; + this._erc20Wrapper = erc20Wrapper; + this._erc721Wrapper = erc721Wrapper; + this._feeTokenAddress = feeTokenAddress; + } + /// @dev Matches two complementary orders and validates results. + /// Validation either succeeds or throws. + /// @param signedOrderLeft First matched order. + /// @param signedOrderRight Second matched order. + /// @param takerAddress Address of taker (the address who matched the two orders) + /// @param erc20BalancesByOwner Current ERC20 balances. + /// @param erc721TokenIdsByOwner Current ERC721 token owners. + /// @param initialTakerAssetFilledAmountLeft Current amount the left order has been filled. + /// @param initialTakerAssetFilledAmountRight Current amount the right order has been filled. + /// @return New ERC20 balances & ERC721 token owners. + public async matchOrdersAndVerifyBalancesAsync( + signedOrderLeft: SignedOrder, + signedOrderRight: SignedOrder, + takerAddress: string, + erc20BalancesByOwner: ERC20BalancesByOwner, + erc721TokenIdsByOwner: ERC721TokenIdsByOwner, + initialTakerAssetFilledAmountLeft?: BigNumber, + initialTakerAssetFilledAmountRight?: BigNumber, + ): Promise<[ERC20BalancesByOwner, ERC721TokenIdsByOwner]> { + // Test setup & verify preconditions + const makerAddressLeft = signedOrderLeft.makerAddress; + const makerAddressRight = signedOrderRight.makerAddress; + const feeRecipientAddressLeft = signedOrderLeft.feeRecipientAddress; + const feeRecipientAddressRight = signedOrderRight.feeRecipientAddress; + // Verify Left order preconditions + const orderTakerAssetFilledAmountLeft = await this._exchangeWrapper.getTakerAssetFilledAmountAsync( + orderUtils.getOrderHashHex(signedOrderLeft), + ); + const expectedOrderFilledAmountLeft = initialTakerAssetFilledAmountLeft + ? initialTakerAssetFilledAmountLeft + : new BigNumber(0); + expect(expectedOrderFilledAmountLeft).to.be.bignumber.equal(orderTakerAssetFilledAmountLeft); + // Verify Right order preconditions + const orderTakerAssetFilledAmountRight = await this._exchangeWrapper.getTakerAssetFilledAmountAsync( + orderUtils.getOrderHashHex(signedOrderRight), + ); + const expectedOrderFilledAmountRight = initialTakerAssetFilledAmountRight + ? initialTakerAssetFilledAmountRight + : new BigNumber(0); + expect(expectedOrderFilledAmountRight).to.be.bignumber.equal(orderTakerAssetFilledAmountRight); + // Match left & right orders + await this._exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress); + const newERC20BalancesByOwner = await this._erc20Wrapper.getBalancesAsync(); + const newERC721TokenIdsByOwner = await this._erc721Wrapper.getBalancesAsync(); + // Calculate expected balance changes + const expectedTransferAmounts = await this._calculateExpectedTransferAmountsAsync( + signedOrderLeft, + signedOrderRight, + orderTakerAssetFilledAmountLeft, + orderTakerAssetFilledAmountRight, + ); + let expectedERC20BalancesByOwner: ERC20BalancesByOwner; + let expectedERC721TokenIdsByOwner: ERC721TokenIdsByOwner; + [expectedERC20BalancesByOwner, expectedERC721TokenIdsByOwner] = this._calculateExpectedBalances( + signedOrderLeft, + signedOrderRight, + takerAddress, + erc20BalancesByOwner, + erc721TokenIdsByOwner, + expectedTransferAmounts, + ); + // Assert our expected balances are equal to the actual balances + const didExpectedBalancesMatchRealBalances = MatchOrderTester._compareExpectedAndRealBalances( + expectedERC20BalancesByOwner, + newERC20BalancesByOwner, + expectedERC721TokenIdsByOwner, + newERC721TokenIdsByOwner, + ); + expect(didExpectedBalancesMatchRealBalances).to.be.true(); + return [newERC20BalancesByOwner, newERC721TokenIdsByOwner]; + } + /// @dev Calculates expected transfer amounts between order makers, fee recipients, and + /// the taker when two orders are matched. + /// @param signedOrderLeft First matched order. + /// @param signedOrderRight Second matched order. + /// @param orderTakerAssetFilledAmountLeft How much left order has been filled, prior to matching orders. + /// @param orderTakerAssetFilledAmountRight How much the right order has been filled, prior to matching orders. + /// @return TransferAmounts A struct containing the expected transfer amounts. + private async _calculateExpectedTransferAmountsAsync( + signedOrderLeft: SignedOrder, + signedOrderRight: SignedOrder, + orderTakerAssetFilledAmountLeft: BigNumber, + orderTakerAssetFilledAmountRight: BigNumber, + ): Promise { + let amountBoughtByLeftMaker = await this._exchangeWrapper.getTakerAssetFilledAmountAsync( + orderUtils.getOrderHashHex(signedOrderLeft), + ); + amountBoughtByLeftMaker = amountBoughtByLeftMaker.minus(orderTakerAssetFilledAmountLeft); + const amountSoldByLeftMaker = amountBoughtByLeftMaker + .times(signedOrderLeft.makerAssetAmount) + .dividedToIntegerBy(signedOrderLeft.takerAssetAmount); + const amountReceivedByRightMaker = amountBoughtByLeftMaker + .times(signedOrderRight.takerAssetAmount) + .dividedToIntegerBy(signedOrderRight.makerAssetAmount); + const amountReceivedByTaker = amountSoldByLeftMaker.minus(amountReceivedByRightMaker); + let amountBoughtByRightMaker = await this._exchangeWrapper.getTakerAssetFilledAmountAsync( + orderUtils.getOrderHashHex(signedOrderRight), + ); + amountBoughtByRightMaker = amountBoughtByRightMaker.minus(orderTakerAssetFilledAmountRight); + const amountSoldByRightMaker = amountBoughtByRightMaker + .times(signedOrderRight.makerAssetAmount) + .dividedToIntegerBy(signedOrderRight.takerAssetAmount); + const amountReceivedByLeftMaker = amountSoldByRightMaker; + const feePaidByLeftMaker = signedOrderLeft.makerFee + .times(amountSoldByLeftMaker) + .dividedToIntegerBy(signedOrderLeft.makerAssetAmount); + const feePaidByRightMaker = signedOrderRight.makerFee + .times(amountSoldByRightMaker) + .dividedToIntegerBy(signedOrderRight.makerAssetAmount); + const feePaidByTakerLeft = signedOrderLeft.takerFee + .times(amountSoldByLeftMaker) + .dividedToIntegerBy(signedOrderLeft.makerAssetAmount); + const feePaidByTakerRight = signedOrderRight.takerFee + .times(amountSoldByRightMaker) + .dividedToIntegerBy(signedOrderRight.makerAssetAmount); + const totalFeePaidByTaker = feePaidByTakerLeft.add(feePaidByTakerRight); + const feeReceivedLeft = feePaidByLeftMaker.add(feePaidByTakerLeft); + const feeReceivedRight = feePaidByRightMaker.add(feePaidByTakerRight); + // Return values + const expectedTransferAmounts = { + // Left Maker + amountBoughtByLeftMaker, + amountSoldByLeftMaker, + amountReceivedByLeftMaker, + feePaidByLeftMaker, + // Right Maker + amountBoughtByRightMaker, + amountSoldByRightMaker, + amountReceivedByRightMaker, + feePaidByRightMaker, + // Taker + amountReceivedByTaker, + feePaidByTakerLeft, + feePaidByTakerRight, + totalFeePaidByTaker, + // Fee Recipients + feeReceivedLeft, + feeReceivedRight, + }; + return expectedTransferAmounts; + } + /// @dev Calculates the expected balances of order makers, fee recipients, and the taker, + /// as a result of matching two orders. + /// @param signedOrderLeft First matched order. + /// @param signedOrderRight Second matched order. + /// @param takerAddress Address of taker (the address who matched the two orders) + /// @param erc20BalancesByOwner Current ERC20 balances. + /// @param erc721TokenIdsByOwner Current ERC721 token owners. + /// @param expectedTransferAmounts A struct containing the expected transfer amounts. + /// @return Expected ERC20 balances & ERC721 token owners after orders have been matched. + private _calculateExpectedBalances( + signedOrderLeft: SignedOrder, + signedOrderRight: SignedOrder, + takerAddress: string, + erc20BalancesByOwner: ERC20BalancesByOwner, + erc721TokenIdsByOwner: ERC721TokenIdsByOwner, + expectedTransferAmounts: TransferAmounts, + ): [ERC20BalancesByOwner, ERC721TokenIdsByOwner] { + const makerAddressLeft = signedOrderLeft.makerAddress; + const makerAddressRight = signedOrderRight.makerAddress; + const feeRecipientAddressLeft = signedOrderLeft.feeRecipientAddress; + const feeRecipientAddressRight = signedOrderRight.feeRecipientAddress; + // Operations are performed on copies of the balances + const expectedNewERC20BalancesByOwner = _.cloneDeep(erc20BalancesByOwner); + const expectedNewERC721TokenIdsByOwner = _.cloneDeep(erc721TokenIdsByOwner); + // Left Maker Asset (Right Taker Asset) + const makerAssetProxyIdLeft = assetProxyUtils.decodeProxyDataId(signedOrderLeft.makerAssetData); + if (makerAssetProxyIdLeft === AssetProxyId.ERC20) { + // Decode asset data + const erc20ProxyData = assetProxyUtils.decodeERC20ProxyData(signedOrderLeft.makerAssetData); + const makerAssetAddressLeft = erc20ProxyData.tokenAddress; + const takerAssetAddressRight = makerAssetAddressLeft; + // Left Maker + expectedNewERC20BalancesByOwner[makerAddressLeft][makerAssetAddressLeft] = expectedNewERC20BalancesByOwner[ + makerAddressLeft + ][makerAssetAddressLeft].minus(expectedTransferAmounts.amountSoldByLeftMaker); + // Right Maker + expectedNewERC20BalancesByOwner[makerAddressRight][ + takerAssetAddressRight + ] = expectedNewERC20BalancesByOwner[makerAddressRight][takerAssetAddressRight].add( + expectedTransferAmounts.amountReceivedByRightMaker, + ); + // Taker + expectedNewERC20BalancesByOwner[takerAddress][makerAssetAddressLeft] = expectedNewERC20BalancesByOwner[ + takerAddress + ][makerAssetAddressLeft].add(expectedTransferAmounts.amountReceivedByTaker); + } else if (makerAssetProxyIdLeft === AssetProxyId.ERC721) { + // Decode asset data + const erc721ProxyData = assetProxyUtils.decodeERC721ProxyData(signedOrderLeft.makerAssetData); + const makerAssetAddressLeft = erc721ProxyData.tokenAddress; + const makerAssetIdLeft = erc721ProxyData.tokenId; + const takerAssetAddressRight = makerAssetAddressLeft; + const takerAssetIdRight = makerAssetIdLeft; + // Left Maker + _.remove(expectedNewERC721TokenIdsByOwner[makerAddressLeft][makerAssetAddressLeft], makerAssetIdLeft); + // Right Maker + expectedNewERC721TokenIdsByOwner[makerAddressRight][takerAssetAddressRight].push(takerAssetIdRight); + // Taker: Since there is only 1 asset transferred, the taker does not receive any of the left maker asset. + } + // Left Taker Asset (Right Maker Asset) + // Note: This exchange is only between the order makers: the Taker does not receive any of the left taker asset. + const takerAssetProxyIdLeft = assetProxyUtils.decodeProxyDataId(signedOrderLeft.takerAssetData); + if (takerAssetProxyIdLeft === AssetProxyId.ERC20) { + // Decode asset data + const erc20ProxyData = assetProxyUtils.decodeERC20ProxyData(signedOrderLeft.takerAssetData); + const takerAssetAddressLeft = erc20ProxyData.tokenAddress; + const makerAssetAddressRight = takerAssetAddressLeft; + // Left Maker + expectedNewERC20BalancesByOwner[makerAddressLeft][takerAssetAddressLeft] = expectedNewERC20BalancesByOwner[ + makerAddressLeft + ][takerAssetAddressLeft].add(expectedTransferAmounts.amountReceivedByLeftMaker); + // Right Maker + expectedNewERC20BalancesByOwner[makerAddressRight][ + makerAssetAddressRight + ] = expectedNewERC20BalancesByOwner[makerAddressRight][makerAssetAddressRight].minus( + expectedTransferAmounts.amountSoldByRightMaker, + ); + } else if (takerAssetProxyIdLeft === AssetProxyId.ERC721) { + // Decode asset data + const erc721ProxyData = assetProxyUtils.decodeERC721ProxyData(signedOrderRight.makerAssetData); + const makerAssetAddressRight = erc721ProxyData.tokenAddress; + const makerAssetIdRight = erc721ProxyData.tokenId; + const takerAssetAddressLeft = makerAssetAddressRight; + const takerAssetIdLeft = makerAssetIdRight; + // Right Maker + _.remove(expectedNewERC721TokenIdsByOwner[makerAddressRight][makerAssetAddressRight], makerAssetIdRight); + // Left Maker + expectedNewERC721TokenIdsByOwner[makerAddressLeft][takerAssetAddressLeft].push(takerAssetIdLeft); + } + // Left Maker Fees + expectedNewERC20BalancesByOwner[makerAddressLeft][this._feeTokenAddress] = expectedNewERC20BalancesByOwner[ + makerAddressLeft + ][this._feeTokenAddress].minus(expectedTransferAmounts.feePaidByLeftMaker); + // Right Maker Fees + expectedNewERC20BalancesByOwner[makerAddressRight][this._feeTokenAddress] = expectedNewERC20BalancesByOwner[ + makerAddressRight + ][this._feeTokenAddress].minus(expectedTransferAmounts.feePaidByRightMaker); + // Taker Fees + expectedNewERC20BalancesByOwner[takerAddress][this._feeTokenAddress] = expectedNewERC20BalancesByOwner[ + takerAddress + ][this._feeTokenAddress].minus(expectedTransferAmounts.totalFeePaidByTaker); + // Left Fee Recipient Fees + expectedNewERC20BalancesByOwner[feeRecipientAddressLeft][ + this._feeTokenAddress + ] = expectedNewERC20BalancesByOwner[feeRecipientAddressLeft][this._feeTokenAddress].add( + expectedTransferAmounts.feeReceivedLeft, + ); + // Right Fee Recipient Fees + expectedNewERC20BalancesByOwner[feeRecipientAddressRight][ + this._feeTokenAddress + ] = expectedNewERC20BalancesByOwner[feeRecipientAddressRight][this._feeTokenAddress].add( + expectedTransferAmounts.feeReceivedRight, + ); + + return [expectedNewERC20BalancesByOwner, expectedNewERC721TokenIdsByOwner]; + } +} diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index e732c90db..8a3c91520 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -37,7 +37,7 @@ import { } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; -import { MatchOrderTester } from '../utils/match_order_tester'; +import { MatchOrderTester } from '../../src/utils/match_order_tester'; chaiSetup.configure(); const expect = chai.expect; diff --git a/packages/contracts/test/global_hooks.ts b/packages/contracts/test/global_hooks.ts index 509dc6837..8b48b030d 100644 --- a/packages/contracts/test/global_hooks.ts +++ b/packages/contracts/test/global_hooks.ts @@ -1,6 +1,6 @@ import { env, EnvVars } from '@0xproject/dev-utils'; -import { coverage } from './utils/coverage'; +import { coverage } from '../src/utils/coverage'; after('generate coverage report', async () => { if (env.parseBoolean(EnvVars.SolidityCoverage)) { diff --git a/packages/contracts/test/utils/coverage.ts b/packages/contracts/test/utils/coverage.ts deleted file mode 100644 index a37939464..000000000 --- a/packages/contracts/test/utils/coverage.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { devConstants } from '@0xproject/dev-utils'; -import { CoverageSubprovider, SolCompilerArtifactAdapter } from '@0xproject/sol-cov'; -import * as fs from 'fs'; -import * as _ from 'lodash'; - -let coverageSubprovider: CoverageSubprovider; - -export const coverage = { - getCoverageSubproviderSingleton(): CoverageSubprovider { - if (_.isUndefined(coverageSubprovider)) { - coverageSubprovider = coverage._getCoverageSubprovider(); - } - return coverageSubprovider; - }, - _getCoverageSubprovider(): CoverageSubprovider { - const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS; - const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter(); - const subprovider = new CoverageSubprovider(solCompilerArtifactAdapter, defaultFromAddress); - return subprovider; - }, -}; diff --git a/packages/contracts/test/utils/match_order_tester.ts b/packages/contracts/test/utils/match_order_tester.ts deleted file mode 100644 index 43196728c..000000000 --- a/packages/contracts/test/utils/match_order_tester.ts +++ /dev/null @@ -1,356 +0,0 @@ -import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { LogWithDecodedArgs } from '@0xproject/types'; -import { BigNumber } from '@0xproject/utils'; -import * as chai from 'chai'; -import ethUtil = require('ethereumjs-util'); -import * as _ from 'lodash'; - -import { DummyERC20TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c20_token'; -import { DummyERC721TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c721_token'; -import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c20_proxy'; -import { ERC721ProxyContract } from '../../src/contract_wrappers/generated/e_r_c721_proxy'; -import { - CancelContractEventArgs, - ExchangeContract, - FillContractEventArgs, -} from '../../src/contract_wrappers/generated/exchange'; -import { assetProxyUtils } from '../../src/utils/asset_proxy_utils'; -import { chaiSetup } from '../../src/utils/chai_setup'; -import { constants } from '../../src/utils/constants'; -import { crypto } from '../../src/utils/crypto'; -import { ERC20Wrapper } from '../../src/utils/erc20_wrapper'; -import { ERC721Wrapper } from '../../src/utils/erc721_wrapper'; -import { ExchangeWrapper } from '../../src/utils/exchange_wrapper'; -import { OrderFactory } from '../../src/utils/order_factory'; -import { orderUtils } from '../../src/utils/order_utils'; -import { - AssetProxyId, - ContractName, - ERC20BalancesByOwner, - ERC721TokenIdsByOwner, - ExchangeStatus, - SignedOrder, - TransferAmountsByMatchOrders as TransferAmounts, -} from '../../src/utils/types'; -import { provider, web3Wrapper } from '../../src/utils/web3_wrapper'; - -chaiSetup.configure(); -const expect = chai.expect; -const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); - -export class MatchOrderTester { - private _exchangeWrapper: ExchangeWrapper; - private _erc20Wrapper: ERC20Wrapper; - private _erc721Wrapper: ERC721Wrapper; - private _feeTokenAddress: string; - - /// @dev Compares a pair of ERC20 balances and a pair of ERC721 token owners. - /// @param expectedNewERC20BalancesByOwner Expected ERC20 balances. - /// @param realERC20BalancesByOwner Actual ERC20 balances. - /// @param expectedNewERC721TokenIdsByOwner Expected ERC721 token owners. - /// @param realERC721TokenIdsByOwner Actual ERC20 token owners. - /// @return True only if ERC20 balances match and ERC721 token owners match. - private static _compareExpectedAndRealBalances( - expectedNewERC20BalancesByOwner: ERC20BalancesByOwner, - realERC20BalancesByOwner: ERC20BalancesByOwner, - expectedNewERC721TokenIdsByOwner: ERC721TokenIdsByOwner, - realERC721TokenIdsByOwner: ERC721TokenIdsByOwner, - ): boolean { - // ERC20 Balances - const doesErc20BalancesMatch = _.isEqual(expectedNewERC20BalancesByOwner, realERC20BalancesByOwner); - if (!doesErc20BalancesMatch) { - return false; - } - // ERC721 Token Ids - const sortedExpectedNewERC721TokenIdsByOwner = _.mapValues( - expectedNewERC721TokenIdsByOwner, - tokenIdsByOwner => { - _.mapValues(tokenIdsByOwner, tokenIds => { - _.sortBy(tokenIds); - }); - }, - ); - const sortedNewERC721TokenIdsByOwner = _.mapValues(realERC721TokenIdsByOwner, tokenIdsByOwner => { - _.mapValues(tokenIdsByOwner, tokenIds => { - _.sortBy(tokenIds); - }); - }); - const doesErc721TokenIdsMatch = _.isEqual( - sortedExpectedNewERC721TokenIdsByOwner, - sortedNewERC721TokenIdsByOwner, - ); - return doesErc721TokenIdsMatch; - } - /// @dev Constructs new MatchOrderTester. - /// @param exchangeWrapper Used to call to the Exchange. - /// @param erc20Wrapper Used to fetch ERC20 balances. - /// @param erc721Wrapper Used to fetch ERC721 token owners. - /// @param feeTokenAddress Address of ERC20 fee token. - constructor( - exchangeWrapper: ExchangeWrapper, - erc20Wrapper: ERC20Wrapper, - erc721Wrapper: ERC721Wrapper, - feeTokenAddress: string, - ) { - this._exchangeWrapper = exchangeWrapper; - this._erc20Wrapper = erc20Wrapper; - this._erc721Wrapper = erc721Wrapper; - this._feeTokenAddress = feeTokenAddress; - } - /// @dev Matches two complementary orders and validates results. - /// Validation either succeeds or throws. - /// @param signedOrderLeft First matched order. - /// @param signedOrderRight Second matched order. - /// @param takerAddress Address of taker (the address who matched the two orders) - /// @param erc20BalancesByOwner Current ERC20 balances. - /// @param erc721TokenIdsByOwner Current ERC721 token owners. - /// @param initialTakerAssetFilledAmountLeft Current amount the left order has been filled. - /// @param initialTakerAssetFilledAmountRight Current amount the right order has been filled. - /// @return New ERC20 balances & ERC721 token owners. - public async matchOrdersAndVerifyBalancesAsync( - signedOrderLeft: SignedOrder, - signedOrderRight: SignedOrder, - takerAddress: string, - erc20BalancesByOwner: ERC20BalancesByOwner, - erc721TokenIdsByOwner: ERC721TokenIdsByOwner, - initialTakerAssetFilledAmountLeft?: BigNumber, - initialTakerAssetFilledAmountRight?: BigNumber, - ): Promise<[ERC20BalancesByOwner, ERC721TokenIdsByOwner]> { - // Test setup & verify preconditions - const makerAddressLeft = signedOrderLeft.makerAddress; - const makerAddressRight = signedOrderRight.makerAddress; - const feeRecipientAddressLeft = signedOrderLeft.feeRecipientAddress; - const feeRecipientAddressRight = signedOrderRight.feeRecipientAddress; - // Verify Left order preconditions - const orderTakerAssetFilledAmountLeft = await this._exchangeWrapper.getTakerAssetFilledAmountAsync( - orderUtils.getOrderHashHex(signedOrderLeft), - ); - const expectedOrderFilledAmountLeft = initialTakerAssetFilledAmountLeft - ? initialTakerAssetFilledAmountLeft - : new BigNumber(0); - expect(expectedOrderFilledAmountLeft).to.be.bignumber.equal(orderTakerAssetFilledAmountLeft); - // Verify Right order preconditions - const orderTakerAssetFilledAmountRight = await this._exchangeWrapper.getTakerAssetFilledAmountAsync( - orderUtils.getOrderHashHex(signedOrderRight), - ); - const expectedOrderFilledAmountRight = initialTakerAssetFilledAmountRight - ? initialTakerAssetFilledAmountRight - : new BigNumber(0); - expect(expectedOrderFilledAmountRight).to.be.bignumber.equal(orderTakerAssetFilledAmountRight); - // Match left & right orders - await this._exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress); - const newERC20BalancesByOwner = await this._erc20Wrapper.getBalancesAsync(); - const newERC721TokenIdsByOwner = await this._erc721Wrapper.getBalancesAsync(); - // Calculate expected balance changes - const expectedTransferAmounts = await this._calculateExpectedTransferAmountsAsync( - signedOrderLeft, - signedOrderRight, - orderTakerAssetFilledAmountLeft, - orderTakerAssetFilledAmountRight, - ); - let expectedERC20BalancesByOwner: ERC20BalancesByOwner; - let expectedERC721TokenIdsByOwner: ERC721TokenIdsByOwner; - [expectedERC20BalancesByOwner, expectedERC721TokenIdsByOwner] = this._calculateExpectedBalances( - signedOrderLeft, - signedOrderRight, - takerAddress, - erc20BalancesByOwner, - erc721TokenIdsByOwner, - expectedTransferAmounts, - ); - // Assert our expected balances are equal to the actual balances - const didExpectedBalancesMatchRealBalances = MatchOrderTester._compareExpectedAndRealBalances( - expectedERC20BalancesByOwner, - newERC20BalancesByOwner, - expectedERC721TokenIdsByOwner, - newERC721TokenIdsByOwner, - ); - expect(didExpectedBalancesMatchRealBalances).to.be.true(); - return [newERC20BalancesByOwner, newERC721TokenIdsByOwner]; - } - /// @dev Calculates expected transfer amounts between order makers, fee recipients, and - /// the taker when two orders are matched. - /// @param signedOrderLeft First matched order. - /// @param signedOrderRight Second matched order. - /// @param orderTakerAssetFilledAmountLeft How much left order has been filled, prior to matching orders. - /// @param orderTakerAssetFilledAmountRight How much the right order has been filled, prior to matching orders. - /// @return TransferAmounts A struct containing the expected transfer amounts. - private async _calculateExpectedTransferAmountsAsync( - signedOrderLeft: SignedOrder, - signedOrderRight: SignedOrder, - orderTakerAssetFilledAmountLeft: BigNumber, - orderTakerAssetFilledAmountRight: BigNumber, - ): Promise { - let amountBoughtByLeftMaker = await this._exchangeWrapper.getTakerAssetFilledAmountAsync( - orderUtils.getOrderHashHex(signedOrderLeft), - ); - amountBoughtByLeftMaker = amountBoughtByLeftMaker.minus(orderTakerAssetFilledAmountLeft); - const amountSoldByLeftMaker = amountBoughtByLeftMaker - .times(signedOrderLeft.makerAssetAmount) - .dividedToIntegerBy(signedOrderLeft.takerAssetAmount); - const amountReceivedByRightMaker = amountBoughtByLeftMaker - .times(signedOrderRight.takerAssetAmount) - .dividedToIntegerBy(signedOrderRight.makerAssetAmount); - const amountReceivedByTaker = amountSoldByLeftMaker.minus(amountReceivedByRightMaker); - let amountBoughtByRightMaker = await this._exchangeWrapper.getTakerAssetFilledAmountAsync( - orderUtils.getOrderHashHex(signedOrderRight), - ); - amountBoughtByRightMaker = amountBoughtByRightMaker.minus(orderTakerAssetFilledAmountRight); - const amountSoldByRightMaker = amountBoughtByRightMaker - .times(signedOrderRight.makerAssetAmount) - .dividedToIntegerBy(signedOrderRight.takerAssetAmount); - const amountReceivedByLeftMaker = amountSoldByRightMaker; - const feePaidByLeftMaker = signedOrderLeft.makerFee - .times(amountSoldByLeftMaker) - .dividedToIntegerBy(signedOrderLeft.makerAssetAmount); - const feePaidByRightMaker = signedOrderRight.makerFee - .times(amountSoldByRightMaker) - .dividedToIntegerBy(signedOrderRight.makerAssetAmount); - const feePaidByTakerLeft = signedOrderLeft.takerFee - .times(amountSoldByLeftMaker) - .dividedToIntegerBy(signedOrderLeft.makerAssetAmount); - const feePaidByTakerRight = signedOrderRight.takerFee - .times(amountSoldByRightMaker) - .dividedToIntegerBy(signedOrderRight.makerAssetAmount); - const totalFeePaidByTaker = feePaidByTakerLeft.add(feePaidByTakerRight); - const feeReceivedLeft = feePaidByLeftMaker.add(feePaidByTakerLeft); - const feeReceivedRight = feePaidByRightMaker.add(feePaidByTakerRight); - // Return values - const expectedTransferAmounts = { - // Left Maker - amountBoughtByLeftMaker, - amountSoldByLeftMaker, - amountReceivedByLeftMaker, - feePaidByLeftMaker, - // Right Maker - amountBoughtByRightMaker, - amountSoldByRightMaker, - amountReceivedByRightMaker, - feePaidByRightMaker, - // Taker - amountReceivedByTaker, - feePaidByTakerLeft, - feePaidByTakerRight, - totalFeePaidByTaker, - // Fee Recipients - feeReceivedLeft, - feeReceivedRight, - }; - return expectedTransferAmounts; - } - /// @dev Calculates the expected balances of order makers, fee recipients, and the taker, - /// as a result of matching two orders. - /// @param signedOrderLeft First matched order. - /// @param signedOrderRight Second matched order. - /// @param takerAddress Address of taker (the address who matched the two orders) - /// @param erc20BalancesByOwner Current ERC20 balances. - /// @param erc721TokenIdsByOwner Current ERC721 token owners. - /// @param expectedTransferAmounts A struct containing the expected transfer amounts. - /// @return Expected ERC20 balances & ERC721 token owners after orders have been matched. - private _calculateExpectedBalances( - signedOrderLeft: SignedOrder, - signedOrderRight: SignedOrder, - takerAddress: string, - erc20BalancesByOwner: ERC20BalancesByOwner, - erc721TokenIdsByOwner: ERC721TokenIdsByOwner, - expectedTransferAmounts: TransferAmounts, - ): [ERC20BalancesByOwner, ERC721TokenIdsByOwner] { - const makerAddressLeft = signedOrderLeft.makerAddress; - const makerAddressRight = signedOrderRight.makerAddress; - const feeRecipientAddressLeft = signedOrderLeft.feeRecipientAddress; - const feeRecipientAddressRight = signedOrderRight.feeRecipientAddress; - // Operations are performed on copies of the balances - const expectedNewERC20BalancesByOwner = _.cloneDeep(erc20BalancesByOwner); - const expectedNewERC721TokenIdsByOwner = _.cloneDeep(erc721TokenIdsByOwner); - // Left Maker Asset (Right Taker Asset) - const makerAssetProxyIdLeft = assetProxyUtils.decodeProxyDataId(signedOrderLeft.makerAssetData); - if (makerAssetProxyIdLeft === AssetProxyId.ERC20) { - // Decode asset data - const erc20ProxyData = assetProxyUtils.decodeERC20ProxyData(signedOrderLeft.makerAssetData); - const makerAssetAddressLeft = erc20ProxyData.tokenAddress; - const takerAssetAddressRight = makerAssetAddressLeft; - // Left Maker - expectedNewERC20BalancesByOwner[makerAddressLeft][makerAssetAddressLeft] = expectedNewERC20BalancesByOwner[ - makerAddressLeft - ][makerAssetAddressLeft].minus(expectedTransferAmounts.amountSoldByLeftMaker); - // Right Maker - expectedNewERC20BalancesByOwner[makerAddressRight][ - takerAssetAddressRight - ] = expectedNewERC20BalancesByOwner[makerAddressRight][takerAssetAddressRight].add( - expectedTransferAmounts.amountReceivedByRightMaker, - ); - // Taker - expectedNewERC20BalancesByOwner[takerAddress][makerAssetAddressLeft] = expectedNewERC20BalancesByOwner[ - takerAddress - ][makerAssetAddressLeft].add(expectedTransferAmounts.amountReceivedByTaker); - } else if (makerAssetProxyIdLeft === AssetProxyId.ERC721) { - // Decode asset data - const erc721ProxyData = assetProxyUtils.decodeERC721ProxyData(signedOrderLeft.makerAssetData); - const makerAssetAddressLeft = erc721ProxyData.tokenAddress; - const makerAssetIdLeft = erc721ProxyData.tokenId; - const takerAssetAddressRight = makerAssetAddressLeft; - const takerAssetIdRight = makerAssetIdLeft; - // Left Maker - _.remove(expectedNewERC721TokenIdsByOwner[makerAddressLeft][makerAssetAddressLeft], makerAssetIdLeft); - // Right Maker - expectedNewERC721TokenIdsByOwner[makerAddressRight][takerAssetAddressRight].push(takerAssetIdRight); - // Taker: Since there is only 1 asset transferred, the taker does not receive any of the left maker asset. - } - // Left Taker Asset (Right Maker Asset) - // Note: This exchange is only between the order makers: the Taker does not receive any of the left taker asset. - const takerAssetProxyIdLeft = assetProxyUtils.decodeProxyDataId(signedOrderLeft.takerAssetData); - if (takerAssetProxyIdLeft === AssetProxyId.ERC20) { - // Decode asset data - const erc20ProxyData = assetProxyUtils.decodeERC20ProxyData(signedOrderLeft.takerAssetData); - const takerAssetAddressLeft = erc20ProxyData.tokenAddress; - const makerAssetAddressRight = takerAssetAddressLeft; - // Left Maker - expectedNewERC20BalancesByOwner[makerAddressLeft][takerAssetAddressLeft] = expectedNewERC20BalancesByOwner[ - makerAddressLeft - ][takerAssetAddressLeft].add(expectedTransferAmounts.amountReceivedByLeftMaker); - // Right Maker - expectedNewERC20BalancesByOwner[makerAddressRight][ - makerAssetAddressRight - ] = expectedNewERC20BalancesByOwner[makerAddressRight][makerAssetAddressRight].minus( - expectedTransferAmounts.amountSoldByRightMaker, - ); - } else if (takerAssetProxyIdLeft === AssetProxyId.ERC721) { - // Decode asset data - const erc721ProxyData = assetProxyUtils.decodeERC721ProxyData(signedOrderRight.makerAssetData); - const makerAssetAddressRight = erc721ProxyData.tokenAddress; - const makerAssetIdRight = erc721ProxyData.tokenId; - const takerAssetAddressLeft = makerAssetAddressRight; - const takerAssetIdLeft = makerAssetIdRight; - // Right Maker - _.remove(expectedNewERC721TokenIdsByOwner[makerAddressRight][makerAssetAddressRight], makerAssetIdRight); - // Left Maker - expectedNewERC721TokenIdsByOwner[makerAddressLeft][takerAssetAddressLeft].push(takerAssetIdLeft); - } - // Left Maker Fees - expectedNewERC20BalancesByOwner[makerAddressLeft][this._feeTokenAddress] = expectedNewERC20BalancesByOwner[ - makerAddressLeft - ][this._feeTokenAddress].minus(expectedTransferAmounts.feePaidByLeftMaker); - // Right Maker Fees - expectedNewERC20BalancesByOwner[makerAddressRight][this._feeTokenAddress] = expectedNewERC20BalancesByOwner[ - makerAddressRight - ][this._feeTokenAddress].minus(expectedTransferAmounts.feePaidByRightMaker); - // Taker Fees - expectedNewERC20BalancesByOwner[takerAddress][this._feeTokenAddress] = expectedNewERC20BalancesByOwner[ - takerAddress - ][this._feeTokenAddress].minus(expectedTransferAmounts.totalFeePaidByTaker); - // Left Fee Recipient Fees - expectedNewERC20BalancesByOwner[feeRecipientAddressLeft][ - this._feeTokenAddress - ] = expectedNewERC20BalancesByOwner[feeRecipientAddressLeft][this._feeTokenAddress].add( - expectedTransferAmounts.feeReceivedLeft, - ); - // Right Fee Recipient Fees - expectedNewERC20BalancesByOwner[feeRecipientAddressRight][ - this._feeTokenAddress - ] = expectedNewERC20BalancesByOwner[feeRecipientAddressRight][this._feeTokenAddress].add( - expectedTransferAmounts.feeReceivedRight, - ); - - return [expectedNewERC20BalancesByOwner, expectedNewERC721TokenIdsByOwner]; - } -} -- cgit v1.2.3 From c9aef166495c0a1b1c34db01226602375c0b3547 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 23 May 2018 10:39:56 -0700 Subject: Fix linter issues --- packages/sol-cov/src/trace.ts | 3 ++- packages/utils/src/address_utils.ts | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/sol-cov/src/trace.ts b/packages/sol-cov/src/trace.ts index cb5410909..6caea1610 100644 --- a/packages/sol-cov/src/trace.ts +++ b/packages/sol-cov/src/trace.ts @@ -9,7 +9,8 @@ export interface TraceByContractAddress { } function getAddressFromStackEntry(stackEntry: string): string { - return addressUtils.padZeros(new BigNumber(addHexPrefix(stackEntry)).toString(16)); + const hexBase = 16; + return addressUtils.padZeros(new BigNumber(addHexPrefix(stackEntry)).toString(hexBase)); } export function getTracesByContractAddress(structLogs: StructLog[], startAddress: string): TraceByContractAddress { diff --git a/packages/utils/src/address_utils.ts b/packages/utils/src/address_utils.ts index cc43bd477..1fc960408 100644 --- a/packages/utils/src/address_utils.ts +++ b/packages/utils/src/address_utils.ts @@ -4,6 +4,7 @@ import * as _ from 'lodash'; const BASIC_ADDRESS_REGEX = /^(0x)?[0-9a-f]{40}$/i; const SAME_CASE_ADDRESS_REGEX = /^(0x)?([0-9a-f]{40}|[0-9A-F]{40})$/; +const ADDRESS_LENGTH = 40; export const addressUtils = { isChecksumAddress(address: string): boolean { @@ -11,8 +12,7 @@ export const addressUtils = { const unprefixedAddress = address.replace('0x', ''); const addressHash = jsSHA3.keccak256(unprefixedAddress.toLowerCase()); - const addressLength = 40; - for (let i = 0; i < addressLength; i++) { + for (let i = 0; i < ADDRESS_LENGTH; i++) { // The nth letter should be uppercase if the nth digit of casemap is 1 const hexBase = 16; const lowercaseRange = 7; @@ -41,6 +41,6 @@ export const addressUtils = { } }, padZeros(address: string): string { - return addHexPrefix(_.padStart(stripHexPrefix(address), 40, '0')); + return addHexPrefix(_.padStart(stripHexPrefix(address), ADDRESS_LENGTH, '0')); }, }; -- cgit v1.2.3 From 2ddd53b355c87e71d740344cb349ddbcf2a652c1 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 23 May 2018 10:49:08 -0700 Subject: Fix trace test --- packages/sol-cov/test/trace_test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sol-cov/test/trace_test.ts b/packages/sol-cov/test/trace_test.ts index 93696b04a..c140cba0d 100644 --- a/packages/sol-cov/test/trace_test.ts +++ b/packages/sol-cov/test/trace_test.ts @@ -32,7 +32,7 @@ describe('Trace', () => { const trace = [ { op: OpCode.DelegateCall, - stack: [delegateCallAddress, '0x', '0x', '0x', '0x'], + stack: [delegateCallAddress, '0x'], depth: 0, }, { -- cgit v1.2.3 From bf18a90da79d43e90901b0cd156f15398e215d91 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 23 May 2018 11:21:02 -0700 Subject: Upgrade solidity parser --- packages/sol-cov/package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index 74ffa72bd..f18315a26 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -59,7 +59,7 @@ "mkdirp": "^0.5.1", "rimraf": "^2.6.2", "semaphore-async-await": "^1.5.1", - "solidity-parser-antlr": "^0.2.8" + "solidity-parser-antlr": "^0.2.11" }, "devDependencies": { "@0xproject/monorepo-scripts": "^0.1.20", diff --git a/yarn.lock b/yarn.lock index 42c4fa025..8601e0338 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10507,9 +10507,9 @@ solc@^0.4.24: semver "^5.3.0" yargs "^4.7.1" -solidity-parser-antlr@^0.2.8: - version "0.2.8" - resolved "https://registry.yarnpkg.com/solidity-parser-antlr/-/solidity-parser-antlr-0.2.8.tgz#8eb8547a88dfeaf6cf4c7811e3824084214244d4" +solidity-parser-antlr@^0.2.11: + version "0.2.11" + resolved "https://registry.yarnpkg.com/solidity-parser-antlr/-/solidity-parser-antlr-0.2.11.tgz#b3e4d0aca0d15796e9b59da53a49137aab51c298" sort-keys@^1.0.0: version "1.1.2" -- cgit v1.2.3