diff --git a/libs/remix-debug/src/storage/mappingPreimages.ts b/libs/remix-debug/src/storage/mappingPreimages.ts index 5978946083..a28e7f9208 100644 --- a/libs/remix-debug/src/storage/mappingPreimages.ts +++ b/libs/remix-debug/src/storage/mappingPreimages.ts @@ -1,4 +1,4 @@ -const util = require('../solidity-decoder/types/util') +import { sub } from '../solidity-decoder/types/util' /** * extract the mappings location from the storage @@ -17,7 +17,7 @@ export async function decodeMappingsKeys (web3, storage, corrections) { try { const key = storage[hashedLoc].key for (let k in corrections) { - const corrected = util.sub(key, corrections[k].slot).toString(16) + const corrected = sub(key, corrections[k].slot).toString(16) preimage = await getPreimage(web3, '0x' + corrected) if (preimage) break } diff --git a/libs/remix-debug/src/storage/storageResolver.ts b/libs/remix-debug/src/storage/storageResolver.ts index 060657e0e1..998eb84b3e 100644 --- a/libs/remix-debug/src/storage/storageResolver.ts +++ b/libs/remix-debug/src/storage/storageResolver.ts @@ -1,6 +1,6 @@ 'use strict' -const traceHelper = require('../trace/traceHelper') -const mappingPreimages = require('./mappingPreimages') +import { isContractCreation } from '../trace/traceHelper' +import { decodeMappingsKeys } from './mappingPreimages' /** * Basically one instance is created for one debugging session. @@ -50,7 +50,7 @@ export class StorageResolver { return this.preimagesMappingByAddress[address] } const storage = await this.storageRange(tx, stepIndex, address) - const mappings = mappingPreimages.decodeMappingsKeys(this.web3, storage, corrections) + const mappings = decodeMappingsKeys(this.web3, storage, corrections) this.preimagesMappingByAddress[address] = mappings return mappings } @@ -130,7 +130,7 @@ export class StorageResolver { storageRangeWeb3Call (tx, address, start, maxSize): Promise> { return new Promise((resolve, reject) => { - if (traceHelper.isContractCreation(address)) { + if (isContractCreation(address)) { resolve([{}, null]) } else { this.web3.debug.storageRangeAt( diff --git a/libs/remix-debug/src/storage/storageViewer.ts b/libs/remix-debug/src/storage/storageViewer.ts index b26da0a864..502b636cfb 100644 --- a/libs/remix-debug/src/storage/storageViewer.ts +++ b/libs/remix-debug/src/storage/storageViewer.ts @@ -1,7 +1,6 @@ 'use strict' -const remixLib = require('@remix-project/remix-lib') -const util = remixLib.util -const mappingPreimages = require('./mappingPreimages') +import { util } from '@remix-project/remix-lib' +import { decodeMappingsKeys } from './mappingPreimages' /** * easier access to the storage resolver @@ -102,7 +101,7 @@ export class StorageViewer { if (this.mappingsLocationChanges) { return this.mappingsLocationChanges } - const mappings = mappingPreimages.decodeMappingsKeys(this.web3, storageChanges, corrections) + const mappings = decodeMappingsKeys(this.web3, storageChanges, corrections) this.mappingsLocationChanges = mappings return this.mappingsLocationChanges }