diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000..21e42f8ebd Binary files /dev/null and b/.DS_Store differ diff --git a/assets/.DS_Store b/assets/.DS_Store new file mode 100644 index 0000000000..e3562e55f6 Binary files /dev/null and b/assets/.DS_Store differ diff --git a/assets/img/.DS_Store b/assets/img/.DS_Store new file mode 100644 index 0000000000..f32e783fd6 Binary files /dev/null and b/assets/img/.DS_Store differ diff --git a/assets/img/gasStation_50.png b/assets/img/gasStation_50.png new file mode 100644 index 0000000000..6758609385 Binary files /dev/null and b/assets/img/gasStation_50.png differ diff --git a/src/app/editor/contextView.js b/src/app/editor/contextView.js index a19d1be30e..bd771eb2be 100644 --- a/src/app/editor/contextView.js +++ b/src/app/editor/contextView.js @@ -172,10 +172,16 @@ class ContextView { ` function showGasEstimation () { - var estimatedGas = self._api.contextualListener.gasEstimation(node) + ' gas' - if (node.name === 'FunctionDefinition') var el = yo`
${estimatedGas}
` - 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`
+ + ${estimatedGas} +
` } + } } diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index d1ca121276..c580e9f685 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -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} } } }