diff --git a/libs/remix-simulator/src/VmProxy.ts b/libs/remix-simulator/src/VmProxy.ts index f7090d8b1d..f4e72c2efe 100644 --- a/libs/remix-simulator/src/VmProxy.ts +++ b/libs/remix-simulator/src/VmProxy.ts @@ -132,6 +132,7 @@ export class VmProxy { this.txs[this.processingHash] = tx this.txsReceipt[this.processingHash] = tx this.storageCache[this.processingHash] = {} + this.storageCache['after_' + this.processingHash] = {} if (data.to) { try { const storage = await this.vm.stateManager.dumpStorage(data.to) @@ -175,6 +176,17 @@ export class VmProxy { const status = data.execResult.exceptionError ? 0 : 1 this.txsReceipt[this.processingHash].status = `0x${status}` + const to = this.txs[this.processingHash].to + if (to) { + try { + const account = Address.fromString(to) + const storage = await this.vm.stateManager.dumpStorage(account) + this.storageCache['after_' + this.processingHash][to] = storage + } catch (e) { + console.log(e) + } + } + if (data.createdAddress) { const address = data.createdAddress.toString() this.vmTraces[this.processingHash].return = toChecksumAddress(address) @@ -308,8 +320,8 @@ export class VmProxy { - if (this.storageCache[txHash] && this.storageCache[txHash][address]) { - const storage = this.storageCache[txHash][address] + if (this.storageCache['after_' + txHash] && this.storageCache['after_' + txHash][address]) { + const storage = this.storageCache['after_' + txHash][address] return cb(null, { storage: JSON.parse(JSON.stringify(storage)), nextKey: null diff --git a/libs/remix-simulator/src/methods/blocks.ts b/libs/remix-simulator/src/methods/blocks.ts index e2594b05ac..1651499cd2 100644 --- a/libs/remix-simulator/src/methods/blocks.ts +++ b/libs/remix-simulator/src/methods/blocks.ts @@ -173,7 +173,7 @@ export class Blocks { } eth_getStorageAt (payload, cb) { - const [address, position, blockNumber] = payload.params + const [ address, position, blockNumber ] = payload.params this.vmContext.web3().debug.storageRangeAt(blockNumber, 'latest', address.toLowerCase(), position, 1, (err, result) => { if (err || (result.storage && Object.values(result.storage).length === 0)) {