aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov/src/coverage_manager.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-05-08 22:02:04 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-05-10 23:47:38 +0800
commit75d24dea0e10d098d3833488a420498410c22991 (patch)
treee079561d372d5480db59f798ebe4d853bd9ab692 /packages/sol-cov/src/coverage_manager.ts
parenta6f72de09d7b2c9738b78d2097baa9906838fbe9 (diff)
downloaddexon-sol-tools-75d24dea0e10d098d3833488a420498410c22991.tar
dexon-sol-tools-75d24dea0e10d098d3833488a420498410c22991.tar.gz
dexon-sol-tools-75d24dea0e10d098d3833488a420498410c22991.tar.bz2
dexon-sol-tools-75d24dea0e10d098d3833488a420498410c22991.tar.lz
dexon-sol-tools-75d24dea0e10d098d3833488a420498410c22991.tar.xz
dexon-sol-tools-75d24dea0e10d098d3833488a420498410c22991.tar.zst
dexon-sol-tools-75d24dea0e10d098d3833488a420498410c22991.zip
Fix linter issues
Diffstat (limited to 'packages/sol-cov/src/coverage_manager.ts')
-rw-r--r--packages/sol-cov/src/coverage_manager.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts
index 6a57d07c9..bf580025b 100644
--- a/packages/sol-cov/src/coverage_manager.ts
+++ b/packages/sol-cov/src/coverage_manager.ts
@@ -1,3 +1,4 @@
+import { addHexPrefix } from 'ethereumjs-util';
import * as fs from 'fs';
import { Collector } from 'istanbul';
import * as _ from 'lodash';
@@ -36,12 +37,11 @@ export class CoverageManager {
constructor(
artifactsPath: string,
sourcesPath: string,
- networkId: number,
getContractCodeAsync: (address: string) => Promise<string>,
) {
this._getContractCodeAsync = getContractCodeAsync;
this._sourcesPath = sourcesPath;
- this._contractsData = collectContractsData(artifactsPath, this._sourcesPath, networkId);
+ this._contractsData = collectContractsData(artifactsPath, this._sourcesPath);
}
public appendTraceInfo(traceInfo: TraceInfo): void {
this._traceInfos.push(traceInfo);
@@ -134,7 +134,7 @@ export class CoverageManager {
if (traceInfo.address !== constants.NEW_CONTRACT) {
// Runtime transaction
let runtimeBytecode = (traceInfo as TraceInfoExistingContract).runtimeBytecode;
- runtimeBytecode = utils.removeHexPrefix(runtimeBytecode);
+ runtimeBytecode = addHexPrefix(runtimeBytecode);
const contractData = _.find(this._contractsData, { runtimeBytecode }) as ContractData;
if (_.isUndefined(contractData)) {
throw new Error(`Transaction to an unknown address: ${traceInfo.address}`);
@@ -159,7 +159,7 @@ export class CoverageManager {
} else {
// Contract creation transaction
let bytecode = (traceInfo as TraceInfoNewContract).bytecode;
- bytecode = utils.removeHexPrefix(bytecode);
+ bytecode = addHexPrefix(bytecode);
const contractData = _.find(this._contractsData, contractDataCandidate =>
bytecode.startsWith(contractDataCandidate.bytecode),
) as ContractData;
@@ -185,7 +185,6 @@ export class CoverageManager {
}
}
}
- // TODO: Remove any cast as soon as https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24233 gets merged
- return (collector as any).getFinalCoverage();
+ return collector.getFinalCoverage();
}
}