aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov/src/coverage_manager.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-04-19 04:22:39 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-05-07 16:23:08 +0800
commit72b2a1c66fa9fb85ea8515645b97332eee204550 (patch)
tree8a4504ea2fdbc554f5b62f2b46088bea3e5b6324 /packages/sol-cov/src/coverage_manager.ts
parent69a6166b6a1d39afc24b8dd950ec5d8539a03420 (diff)
downloaddexon-0x-contracts-72b2a1c66fa9fb85ea8515645b97332eee204550.tar.gz
dexon-0x-contracts-72b2a1c66fa9fb85ea8515645b97332eee204550.tar.zst
dexon-0x-contracts-72b2a1c66fa9fb85ea8515645b97332eee204550.zip
Implement new artifacts format
Diffstat (limited to 'packages/sol-cov/src/coverage_manager.ts')
-rw-r--r--packages/sol-cov/src/coverage_manager.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts
index 230ccc3c9..509c1cb99 100644
--- a/packages/sol-cov/src/coverage_manager.ts
+++ b/packages/sol-cov/src/coverage_manager.ts
@@ -130,7 +130,10 @@ export class CoverageManager {
for (const traceInfo of this._traceInfos) {
if (traceInfo.address !== constants.NEW_CONTRACT) {
// Runtime transaction
- const runtimeBytecode = (traceInfo as TraceInfoExistingContract).runtimeBytecode;
+ let runtimeBytecode = (traceInfo as TraceInfoExistingContract).runtimeBytecode;
+ if (runtimeBytecode.startsWith('0x')) {
+ runtimeBytecode = runtimeBytecode.slice(2);
+ }
const contractData = _.find(this._contractsData, { runtimeBytecode }) as ContractData;
if (_.isUndefined(contractData)) {
throw new Error(`Transaction to an unknown address: ${traceInfo.address}`);
@@ -154,7 +157,10 @@ export class CoverageManager {
}
} else {
// Contract creation transaction
- const bytecode = (traceInfo as TraceInfoNewContract).bytecode;
+ let bytecode = (traceInfo as TraceInfoNewContract).bytecode;
+ if (bytecode.startsWith('0x')) {
+ bytecode = bytecode.slice(2);
+ }
const contractData = _.find(this._contractsData, contractDataCandidate =>
bytecode.startsWith(contractDataCandidate.bytecode),
) as ContractData;