diff --git a/src/app/debugger/debuggerUI/vmDebugger/SolidityState.js b/src/app/debugger/debuggerUI/vmDebugger/SolidityState.js
index 74dcba9548..cca90a0877 100644
--- a/src/app/debugger/debuggerUI/vmDebugger/SolidityState.js
+++ b/src/app/debugger/debuggerUI/vmDebugger/SolidityState.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) {
- this.view = yo`
+ if (this.view) return
+ this.view = yo`
${this.basicPanel.render()}
`
- }
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 {
- if (self.stateVariablesByAddresses[address]) {
- extractStateVariables(self, self.stateVariablesByAddresses[address], address)
- } else {
- self.solidityProxy.extractStateVariablesAt(index, function (error, stateVars) {
- if (error) {
- self.basicPanel.update({})
- console.log(error)
- } else {
- self.stateVariablesByAddresses[address] = stateVars
- extractStateVariables(self, stateVars, address)
- }
- })
- }
+ return self.basicPanel.update({})
+ }
+ if (self.stateVariablesByAddresses[address]) {
+ return extractStateVariables(self, self.stateVariablesByAddresses[address], address)
}
+ self.solidityProxy.extractStateVariablesAt(index, function (error, stateVars) {
+ if (error) {
+ 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
-
diff --git a/src/app/debugger/debuggerUI/vmDebugger/StepDetail.js b/src/app/debugger/debuggerUI/vmDebugger/StepDetail.js
index 25c90a373f..fcfa13612c 100644
--- a/src/app/debugger/debuggerUI/vmDebugger/StepDetail.js
+++ b/src/app/debugger/debuggerUI/vmDebugger/StepDetail.js
@@ -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)
}