pull/3094/head
Iuri Matias 6 years ago committed by yann300
parent cf0e99b036
commit d60ee76ffb
  1. 35
      src/app/debugger/debuggerUI/vmDebugger/SolidityState.js
  2. 12
      src/app/debugger/debuggerUI/vmDebugger/StepDetail.js

@ -13,6 +13,7 @@ function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) {
this.solidityProxy = _solidityProxy
this.basicPanel = new DropdownPanel('Solidity State', {
json: true,
// TODO: used by TreeView ui
formatSelf: solidityTypeFormatter.formatSelf,
extractData: solidityTypeFormatter.extractData
})
@ -24,11 +25,10 @@ function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) {
}
SolidityState.prototype.render = function () {
if (!this.view) {
if (this.view) return
this.view = yo`<div id='soliditystate' >
${this.basicPanel.render()}
</div>`
}
return this.view
}
@ -63,41 +63,30 @@ SolidityState.prototype.init = function () {
function decode (self, index) {
self.traceManager.getCurrentCalledAddressAt(self.parent.currentStepIndex, (error, address) => {
if (error) {
self.basicPanel.update({})
console.log(error)
} else {
return self.basicPanel.update({})
}
if (self.stateVariablesByAddresses[address]) {
extractStateVariables(self, self.stateVariablesByAddresses[address], address)
} else {
return extractStateVariables(self, self.stateVariablesByAddresses[address], address)
}
self.solidityProxy.extractStateVariablesAt(index, function (error, stateVars) {
if (error) {
self.basicPanel.update({})
console.log(error)
} else {
return self.basicPanel.update({})
}
self.stateVariablesByAddresses[address] = stateVars
extractStateVariables(self, stateVars, address)
}
})
}
}
})
}
function extractStateVariables (self, stateVars, address) {
var storageViewer = new StorageViewer({
stepIndex: self.parent.currentStepIndex,
tx: self.parent.tx,
address: address
}, self.storageResolver, self.traceManager)
var storageViewer = new StorageViewer({ stepIndex: self.parent.currentStepIndex, tx: self.parent.tx, address: address }, self.storageResolver, self.traceManager)
stateDecoder.decodeState(stateVars, storageViewer).then((result) => {
self.basicPanel.setMessage('')
if (!result.error) {
self.basicPanel.update(result)
} else {
self.basicPanel.setMessage(result.error)
if (result.error) {
return self.basicPanel.setMessage(result.error)
}
self.basicPanel.update(result)
})
}
module.exports = SolidityState

@ -1,19 +1,13 @@
var yo = require('yo-yo')
var DropdownPanel = require('./DropdownPanel')
function StepDetail (_parentUI, _traceManager) {
function StepDetail () {
this.basicPanel = new DropdownPanel('Step detail', {json: true, displayContentOnly: true})
this.detail = {
'vm trace step': '-', 'execution step': '-', 'add memory': '', 'gas': '', 'remaining gas': '-', 'loaded address': '-'
}
this.view
this.detail = { 'vm trace step': '-', 'execution step': '-', 'add memory': '', 'gas': '', 'remaining gas': '-', 'loaded address': '-' }
}
StepDetail.prototype.reset = function () {
this.detail = {
'vm trace step': '-', 'execution step': '-', 'add memory': '', 'gas': '', 'remaining gas': '-', 'loaded address': '-'
}
this.detail = { 'vm trace step': '-', 'execution step': '-', 'add memory': '', 'gas': '', 'remaining gas': '-', 'loaded address': '-' }
this.basicPanel.update(this.detail)
}

Loading…
Cancel
Save