Commit 612cf1de authored by ninabreznik's avatar ninabreznik

Add codeDepositCost and gasStation img in png

parent 47200304
File added
...@@ -172,10 +172,16 @@ class ContextView { ...@@ -172,10 +172,16 @@ class ContextView {
</div>` </div>`
function showGasEstimation () { function showGasEstimation () {
var estimatedGas = self._api.contextualListener.gasEstimation(node) + ' gas' var result = self._api.contextualListener.gasEstimation(node)
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>` var executionCost = 'Execution cost: ' + result.executionCost + ' gas'
return el 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 { ...@@ -99,6 +99,7 @@ class ContextualListener {
if (this.estimationObj.external) this.externalFunctions = Object.keys(this.estimationObj.external) if (this.estimationObj.external) this.externalFunctions = Object.keys(this.estimationObj.external)
if (this.estimationObj.internal) this.internalFunctions = Object.keys(this.estimationObj.internal) if (this.estimationObj.internal) this.internalFunctions = Object.keys(this.estimationObj.internal)
this.creationCost = this.estimationObj.creation.totalCost this.creationCost = this.estimationObj.creation.totalCost
this.codeDepositCost = this.estimationObj.creation.codeDepositCost
} }
gasEstimation (node) { gasEstimation (node) {
...@@ -106,13 +107,13 @@ class ContextualListener { ...@@ -106,13 +107,13 @@ class ContextualListener {
if (!node.attributes.isConstructor) { if (!node.attributes.isConstructor) {
var functionName = node.attributes.name var functionName = node.attributes.name
if (this.externalFunctions) { 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) { if (this.internalFunctions) {
return this.estimationObj.internal[this._getFn(this.internalFunctions, functionName)] return {executionCost: this.estimationObj.internal[this._getFn(this.internalFunctions, functionName)]}
} }
} else { } else {
return this.creationCost return {executionCost: this.creationCost, codeDepositCost: this.codeDepositCost}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment