Add codeDepositCost and gasStation img in png

pull/1/head
ninabreznik 7 years ago
parent e07c3a51ee
commit d9c50a8e96
  1. BIN
      .DS_Store
  2. BIN
      assets/.DS_Store
  3. BIN
      assets/img/.DS_Store
  4. BIN
      assets/img/gasStation_50.png
  5. 12
      src/app/editor/contextView.js
  6. 7
      src/app/editor/contextualListener.js

BIN
.DS_Store vendored

Binary file not shown.

BIN
assets/.DS_Store vendored

Binary file not shown.

BIN
assets/img/.DS_Store vendored

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 B

@ -172,10 +172,16 @@ class ContextView {
</div>`
function showGasEstimation () {
var estimatedGas = self._api.contextualListener.gasEstimation(node) + ' gas'
if (node.name === 'FunctionDefinition') var el = yo`<div class=${css.gasEstimation}> <img class=${css.gasStationIcon} title='Estimated gas price' src='https://png.icons8.com/gas-station/win8/50/000000'> ${estimatedGas}</div>`
return el
var result = self._api.contextualListener.gasEstimation(node)
var executionCost = 'Execution cost: ' + result.executionCost + ' gas'
var codeDepositCost = 'Code deposit cost: ' + result.codeDepositCost + ' gas'
var estimatedGas = result.codeDepositCost ? `${codeDepositCost}, ${executionCost}` : `${executionCost}`
return yo`<div class=${css.gasEstimation}>
<img class=${css.gasStationIcon} title='Gas estimation' src='assets/img/gasStation_50.png'>
${estimatedGas}
</div>`
}
}
}

@ -99,6 +99,7 @@ class ContextualListener {
if (this.estimationObj.external) this.externalFunctions = Object.keys(this.estimationObj.external)
if (this.estimationObj.internal) this.internalFunctions = Object.keys(this.estimationObj.internal)
this.creationCost = this.estimationObj.creation.totalCost
this.codeDepositCost = this.estimationObj.creation.codeDepositCost
}
gasEstimation (node) {
@ -106,13 +107,13 @@ class ContextualListener {
if (!node.attributes.isConstructor) {
var functionName = node.attributes.name
if (this.externalFunctions) {
return this.estimationObj.external[this._getFn(this.externalFunctions, functionName)]
return {executionCost: this.estimationObj.external[this._getFn(this.externalFunctions, functionName)]}
}
if (this.internalFunctions) {
return this.estimationObj.internal[this._getFn(this.internalFunctions, functionName)]
return {executionCost: this.estimationObj.internal[this._getFn(this.internalFunctions, functionName)]}
}
} else {
return this.creationCost
return {executionCost: this.creationCost, codeDepositCost: this.codeDepositCost}
}
}
}

Loading…
Cancel
Save