use normalizeHexAddress

pull/7/head
yann300 7 years ago
parent c0664b630c
commit 74d19ed8ce
  1. 2
      remix-lib/src/helpers/traceHelper.js
  2. 12
      remix-lib/src/helpers/uiHelper.js
  3. 2
      remix-lib/src/web3Provider/web3VmProvider.js

@ -8,7 +8,7 @@ module.exports = {
return this.contractCreationToken(vmTraceIndex)
} else if (this.isCallInstruction(step)) {
var stack = step.stack // callcode, delegatecall, ...
return ui.normalizeHex(stack[stack.length - 2])
return ui.normalizeHexAddress(stack[stack.length - 2])
}
return undefined
},

@ -68,6 +68,18 @@ module.exports = {
return '0x' + hex
},
normalizeHexAddress: function (hex) {
if (hex.indexOf('0x') === 0) hex = hex.replace('0x', '')
if (hex.length >= 40) {
var reg = /(.{40})$/.exec(hex)
if (reg) {
return '0x' + reg[0]
}
} else {
return '0x' + (new Array(40 - hex.length + 1).join('0')) + hex
}
},
runInBrowser: function () {
return typeof window !== 'undefined'
}

@ -168,7 +168,7 @@ web3VmProvider.prototype.pushTrace = function (self, data) {
this.processingAddress = traceHelper.contractCreationToken(this.processingIndex)
this.storageCache[this.processingHash][this.processingAddress] = {}
} else {
this.processingAddress = uiutil.normalizeHex(step.stack[step.stack.length - 2])
this.processingAddress = uiutil.normalizeHexAddress(step.stack[step.stack.length - 2])
if (!self.storageCache[self.processingHash][this.processingAddress]) {
self.vm.stateManager.dumpStorage(this.processingAddress, function (storage) {
self.storageCache[self.processingHash][self.processingAddress] = storage

Loading…
Cancel
Save