From 2de6db593600b38518fa2791cd41f8d1cf3eaf3b Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Fri, 8 Dec 2017 22:49:55 +0700 Subject: [PATCH 01/18] First draft --- src/app/editor/contextView.js | 16 ++++++++++++++++ src/app/editor/contextualListener.js | 25 ++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/app/editor/contextView.js b/src/app/editor/contextView.js index 9622a5bc13..3d9a9f1def 100644 --- a/src/app/editor/contextView.js +++ b/src/app/editor/contextView.js @@ -42,6 +42,15 @@ var css = csjs` float : right; margin-left : 15px; } + .gasEstimation { + margin-left: 15px; + display: flex; + align-items: center; + } + .gasStationIcon { + height: 13px; + margin-right: 5px; + } ` /* @@ -159,7 +168,14 @@ class ContextView { ${references} + ${showGasEstimation()} ` + + function showGasEstimation () { + var estimatedGas = self._api.contextualListener.gasEstimation(node) + ' gas' + if (node.name === 'FunctionDefinition' && !node.attributes.isConstructor) var el = yo`
${estimatedGas}
` + return el + } } } diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index 914d16bcb8..ec3e7b0686 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -39,9 +39,6 @@ class ContextualListener { getActiveHighlights () { return [...this._activeHighlights] - // return [...this._activeHighlights].sort((a,b) => { - // return a.position.start - b.position.start - // }) } declarationOf (node) { @@ -94,6 +91,27 @@ class ContextualListener { } } + _getGasEstimation (results) { + this.contractName = Object.keys(results.data.contracts[results.source.target])[0] + this.target = results.data.contracts[results.source.target] + this.functions = Object.keys(this.target[this.contractName].evm.gasEstimates.external) + } + + gasEstimation (node) { + if (node.name === 'FunctionDefinition') { + var functionName = node.attributes.name + var fn + for (var x in this.functions) { + if (!!~this.functions[x].indexOf(functionName)) { + fn = this.functions[x] + break + } + } + var estimation = this.target[this.contractName].evm.gasEstimates.external[fn] + return estimation + } + } + _highlight (node, compilationResult) { if (!node) return var position = this.sourceMappingDecoder.decode(node.src) @@ -122,6 +140,7 @@ class ContextualListener { highlights(node.id) this._highlight(node, compilationResult) } + this._getGasEstimation(compilationResult) } _stopHighlighting () { From 5aab884e8f92105f9de0b94642ea9e30c7e10fce Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Sun, 10 Dec 2017 22:02:56 +0700 Subject: [PATCH 02/18] Add gas estimation for constructor --- src/app/editor/contextView.js | 2 +- src/app/editor/contextualListener.js | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/app/editor/contextView.js b/src/app/editor/contextView.js index 3d9a9f1def..a19d1be30e 100644 --- a/src/app/editor/contextView.js +++ b/src/app/editor/contextView.js @@ -173,7 +173,7 @@ class ContextView { function showGasEstimation () { var estimatedGas = self._api.contextualListener.gasEstimation(node) + ' gas' - if (node.name === 'FunctionDefinition' && !node.attributes.isConstructor) var el = yo`
${estimatedGas}
` + if (node.name === 'FunctionDefinition') var el = yo`
${estimatedGas}
` return el } } diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index ec3e7b0686..64984281e4 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -92,24 +92,31 @@ class ContextualListener { } _getGasEstimation (results) { + this.results = results this.contractName = Object.keys(results.data.contracts[results.source.target])[0] this.target = results.data.contracts[results.source.target] this.functions = Object.keys(this.target[this.contractName].evm.gasEstimates.external) + this.creationCost = this.target[this.contractName].evm.gasEstimates.creation.totalCost } gasEstimation (node) { if (node.name === 'FunctionDefinition') { - var functionName = node.attributes.name - var fn - for (var x in this.functions) { - if (!!~this.functions[x].indexOf(functionName)) { - fn = this.functions[x] - break + var estimation + if (!node.attributes.isConstructor) { + var functionName = node.attributes.name + var fn + for (var x in this.functions) { + if (!!~this.functions[x].indexOf(functionName)) { + fn = this.functions[x] + break + } } + estimation = this.target[this.contractName].evm.gasEstimates.external[fn] + } else { + estimation = this.creationCost } - var estimation = this.target[this.contractName].evm.gasEstimates.external[fn] - return estimation } + return estimation } _highlight (node, compilationResult) { From 96a80993fbb1a9cdde85a8bf50cb2cf7a0683c60 Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Mon, 11 Dec 2017 01:13:16 +0700 Subject: [PATCH 03/18] Include internal functions --- src/app/editor/contextualListener.js | 34 +++++++++++++++++----------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index 64984281e4..d1ca121276 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -92,31 +92,39 @@ class ContextualListener { } _getGasEstimation (results) { - this.results = results this.contractName = Object.keys(results.data.contracts[results.source.target])[0] this.target = results.data.contracts[results.source.target] - this.functions = Object.keys(this.target[this.contractName].evm.gasEstimates.external) - this.creationCost = this.target[this.contractName].evm.gasEstimates.creation.totalCost + this.contract = this.target[this.contractName] + this.estimationObj = this.contract.evm.gasEstimates + 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 } gasEstimation (node) { if (node.name === 'FunctionDefinition') { - var estimation if (!node.attributes.isConstructor) { var functionName = node.attributes.name - var fn - for (var x in this.functions) { - if (!!~this.functions[x].indexOf(functionName)) { - fn = this.functions[x] - break - } + if (this.externalFunctions) { + return this.estimationObj.external[this._getFn(this.externalFunctions, functionName)] + } + if (this.internalFunctions) { + return this.estimationObj.internal[this._getFn(this.internalFunctions, functionName)] } - estimation = this.target[this.contractName].evm.gasEstimates.external[fn] } else { - estimation = this.creationCost + return this.creationCost + } + } + } + + _getFn (functions, name) { + for (var x in functions) { + if (!!~functions[x].indexOf(name)) { + var fn = functions[x] + break } } - return estimation + return fn } _highlight (node, compilationResult) { From 77bd51bf44fcc82ed9a10f7665f0efa1e8fbd0d3 Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Mon, 11 Dec 2017 23:10:53 +0700 Subject: [PATCH 04/18] Add codeDepositCost and gasStation img in png --- .DS_Store | Bin 0 -> 8196 bytes assets/.DS_Store | Bin 0 -> 6148 bytes assets/img/.DS_Store | Bin 0 -> 6148 bytes assets/img/gasStation_50.png | Bin 0 -> 960 bytes src/app/editor/contextView.js | 12 +++++++++--- src/app/editor/contextualListener.js | 7 ++++--- 6 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 .DS_Store create mode 100644 assets/.DS_Store create mode 100644 assets/img/.DS_Store create mode 100644 assets/img/gasStation_50.png diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..21e42f8ebdb9a8355d9050597005a33cceae41a7 GIT binary patch literal 8196 zcmeHML2lDP6#dht;H0f+C8T!g4HApCYLQA72q~oPq7ooP5G(+-c487!*REoxX$e8u zaEEdPZo&i^i!&5sY0h1LeX*EWjJh2 z+mW)0PD0U1=#hoaP=p*EJXgX=)ReWYRlq7Ru7G+0utq+4sJZ;zj}jkn{yIHCz57cR z>7Ybw)TWR!&hvA)uLiDijsvz$F(r665EMCL$>7X_lL6<^F<2>%PU(;$gZ0^9-2gtt zCjd7!us{EX_510OUcop2C<@bTef_(bnl8=Uxal|*r!rr8+vp_yM&@O`wC;6Z^U*Ue z>-f6=B1xi)zURLTgZ|#a?X4uvyf6;Bk{q@IK;FCx<5tqIC%w3pNb1K^{2;uVK-f;Hc*@jvPC|{MRs_nA!%OBcI1tfakRabOJ^P zb06DTyk_C#)?A^-v`bsGLrm;<+}2oC@?Bg!{}VgiMr%RnFdF{k^FO~60AZVRf5vIhs`@0 z?}i_RwQ3x6^5wUu4^}|kqRPDQ3p{K@TdV?COo3@NpJmSfcP798zhbkt)3FLz1^%T1 zqO{%EuEXQ`PfF7{=h`mnJ}MW+jg*xXG%_8BmFYO_#UF;~yMQvMrtL^soI&~TF9ML! N*yq2L-Zs}*f#2m;q%Hse literal 0 HcmV?d00001 diff --git a/assets/.DS_Store b/assets/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e3562e55f6482ff65267714d687da39948a8d5ec GIT binary patch literal 6148 zcmeHK%}&BV5T4~n7mSgE2_Abf@xTF0kb^O45D(r=YV@E6TR>=1x`q~sBBqa_kKmj5 z20o6?{$PUO)xXRnv)}CO%x?E=rz80b49Itvh89E+9R@S+Zx=_l-jt|~WZ?<~gb>d~K7Wc#gAaY^&d$e*i=(_z zbZx$x7wh zM$N+dz6fL24?6>u?6*4@a(?QEZ855gVc3q;JdPgVJjZj*LUBCau2xG{wK6GL<65m; zvUX~<$t1^%o0Yx8%l_@%_JtV4+I14JI1Z(SeOB0T46jR)V(r`A4**1JO2^XhaVR z)2WC$m6;NQnc9KrbR4%$e4Y5PhpD0yeP`%Pp;f5v**E5DV-4fM`?>;gS=LV!40EU#aiytjd{d6_FX3 zeRH!jv%3#&KLCX3)6E1J0T@z+K}L_r-P^TOf`uX1*x(8q+@Zy~r_f(?Y3}=|Iqyfz zIrp#mFK~)ujB(Gk)E7;Ay=>Ygqeay#_2?}NE#LqTxW$Sqf58F`*I!drVS*F-496Vf zd8^jhw_3TNH_m`F;0!ne&cKf`z%yGi+%xpn8E^)iflmgsKSZjqDwquO*1<;CXY~(+ z656^T3uD2mU@~M6C0HuaQbT!S1WTtsmbj{5GPHDrJTmK)kv|?UA&*Xf%;5-?p|{R} zGtgyV*FHx&|Ihi$^gi;tDgNaQI0OHTfiRfOXHzb!oUL2S(^(s-msE-3k_-y%&Lw~! h+D8s^r}anKjH?PJLsgMKrxX1mkO}d|8TbVT-T@X8F023m literal 0 HcmV?d00001 diff --git a/assets/img/gasStation_50.png b/assets/img/gasStation_50.png new file mode 100644 index 0000000000000000000000000000000000000000..67586093854531f693190b8a27449d9d50f7876b GIT binary patch literal 960 zcmV;x13&zUP)(^b8FWQhbW?9;ba!ELWdL_~cP?peYja~^ zaAhuUa%Y?FJQ@H113gJZK~!jg)!I#{RaF!R@SpG5Q}e433(Aj|AH9K)ghVfC&?F3+ zgfz5)1&x#@=|ub}90Vl|BE(V9CpkdvRXKur z_mjkvGe9CMpY*EJvkG*dfz}xsD(v9J3EXXTUCj#dR zbQ^G3Zn+o)B4v01A7sKH6M=1bjlm}ZALFrhL>AtMhI?J-LhNWq3P0uKhw)rw^HL=L7+2DdH2%v1GTS4Yqozk?TuAe?XIJn* zszjCu_m_FQQ#dB9{CRzR^^g=1*j>Z-3YL;)ijv_yt(kC)2DWHT`|ly85h2`v>=H8K z%zjch9vY90H{yGo5#9uvX(Bh8ZJ)wN!Un4di-hCW(zlAv^r7=r<;}8=R$)lZHw$JE imG|joNO`h%gnt2xeAGv9m7x6q0000` 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} } } } From a68d401bc1c3d1909e7e37765fdd8a33d14cf43d Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Mon, 11 Dec 2017 23:18:53 +0700 Subject: [PATCH 05/18] Add if (node.name === FunctionDefinition) --- src/app/editor/contextView.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/app/editor/contextView.js b/src/app/editor/contextView.js index bd771eb2be..cb37e0103c 100644 --- a/src/app/editor/contextView.js +++ b/src/app/editor/contextView.js @@ -172,16 +172,17 @@ class ContextView { ` function showGasEstimation () { - 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`
+ if (node.name === 'FunctionDefinition') { + 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} -
` +
` + } } - } } From be77a5984fb99eb2a4b878faa72842a6d7784aff Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Fri, 8 Dec 2017 22:49:55 +0700 Subject: [PATCH 06/18] First draft --- src/app/editor/contextView.js | 16 ++++++++++++++++ src/app/editor/contextualListener.js | 25 ++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/app/editor/contextView.js b/src/app/editor/contextView.js index b4a3df4485..ef957b079e 100644 --- a/src/app/editor/contextView.js +++ b/src/app/editor/contextView.js @@ -42,6 +42,15 @@ var css = csjs` float : right; margin-left : 15px; } + .gasEstimation { + margin-left: 15px; + display: flex; + align-items: center; + } + .gasStationIcon { + height: 13px; + margin-right: 5px; + } ` /* @@ -159,7 +168,14 @@ class ContextView { ${references} + ${showGasEstimation()} ` + + function showGasEstimation () { + var estimatedGas = self._api.contextualListener.gasEstimation(node) + ' gas' + if (node.name === 'FunctionDefinition' && !node.attributes.isConstructor) var el = yo`
${estimatedGas}
` + return el + } } } diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index 914d16bcb8..ec3e7b0686 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -39,9 +39,6 @@ class ContextualListener { getActiveHighlights () { return [...this._activeHighlights] - // return [...this._activeHighlights].sort((a,b) => { - // return a.position.start - b.position.start - // }) } declarationOf (node) { @@ -94,6 +91,27 @@ class ContextualListener { } } + _getGasEstimation (results) { + this.contractName = Object.keys(results.data.contracts[results.source.target])[0] + this.target = results.data.contracts[results.source.target] + this.functions = Object.keys(this.target[this.contractName].evm.gasEstimates.external) + } + + gasEstimation (node) { + if (node.name === 'FunctionDefinition') { + var functionName = node.attributes.name + var fn + for (var x in this.functions) { + if (!!~this.functions[x].indexOf(functionName)) { + fn = this.functions[x] + break + } + } + var estimation = this.target[this.contractName].evm.gasEstimates.external[fn] + return estimation + } + } + _highlight (node, compilationResult) { if (!node) return var position = this.sourceMappingDecoder.decode(node.src) @@ -122,6 +140,7 @@ class ContextualListener { highlights(node.id) this._highlight(node, compilationResult) } + this._getGasEstimation(compilationResult) } _stopHighlighting () { From 502ac9c8cbb6676ebf2ef186561a73fe2f752e5c Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Sun, 10 Dec 2017 22:02:56 +0700 Subject: [PATCH 07/18] Add gas estimation for constructor --- src/app/editor/contextView.js | 2 +- src/app/editor/contextualListener.js | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/app/editor/contextView.js b/src/app/editor/contextView.js index ef957b079e..a5e982d5b7 100644 --- a/src/app/editor/contextView.js +++ b/src/app/editor/contextView.js @@ -173,7 +173,7 @@ class ContextView { function showGasEstimation () { var estimatedGas = self._api.contextualListener.gasEstimation(node) + ' gas' - if (node.name === 'FunctionDefinition' && !node.attributes.isConstructor) var el = yo`
${estimatedGas}
` + if (node.name === 'FunctionDefinition') var el = yo`
${estimatedGas}
` return el } } diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index ec3e7b0686..64984281e4 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -92,24 +92,31 @@ class ContextualListener { } _getGasEstimation (results) { + this.results = results this.contractName = Object.keys(results.data.contracts[results.source.target])[0] this.target = results.data.contracts[results.source.target] this.functions = Object.keys(this.target[this.contractName].evm.gasEstimates.external) + this.creationCost = this.target[this.contractName].evm.gasEstimates.creation.totalCost } gasEstimation (node) { if (node.name === 'FunctionDefinition') { - var functionName = node.attributes.name - var fn - for (var x in this.functions) { - if (!!~this.functions[x].indexOf(functionName)) { - fn = this.functions[x] - break + var estimation + if (!node.attributes.isConstructor) { + var functionName = node.attributes.name + var fn + for (var x in this.functions) { + if (!!~this.functions[x].indexOf(functionName)) { + fn = this.functions[x] + break + } } + estimation = this.target[this.contractName].evm.gasEstimates.external[fn] + } else { + estimation = this.creationCost } - var estimation = this.target[this.contractName].evm.gasEstimates.external[fn] - return estimation } + return estimation } _highlight (node, compilationResult) { From a383f2b67949e34d3977317342ced2b3ce0c5b27 Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Mon, 11 Dec 2017 01:13:16 +0700 Subject: [PATCH 08/18] Include internal functions --- src/app/editor/contextualListener.js | 34 +++++++++++++++++----------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index 64984281e4..d1ca121276 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -92,31 +92,39 @@ class ContextualListener { } _getGasEstimation (results) { - this.results = results this.contractName = Object.keys(results.data.contracts[results.source.target])[0] this.target = results.data.contracts[results.source.target] - this.functions = Object.keys(this.target[this.contractName].evm.gasEstimates.external) - this.creationCost = this.target[this.contractName].evm.gasEstimates.creation.totalCost + this.contract = this.target[this.contractName] + this.estimationObj = this.contract.evm.gasEstimates + 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 } gasEstimation (node) { if (node.name === 'FunctionDefinition') { - var estimation if (!node.attributes.isConstructor) { var functionName = node.attributes.name - var fn - for (var x in this.functions) { - if (!!~this.functions[x].indexOf(functionName)) { - fn = this.functions[x] - break - } + if (this.externalFunctions) { + return this.estimationObj.external[this._getFn(this.externalFunctions, functionName)] + } + if (this.internalFunctions) { + return this.estimationObj.internal[this._getFn(this.internalFunctions, functionName)] } - estimation = this.target[this.contractName].evm.gasEstimates.external[fn] } else { - estimation = this.creationCost + return this.creationCost + } + } + } + + _getFn (functions, name) { + for (var x in functions) { + if (!!~functions[x].indexOf(name)) { + var fn = functions[x] + break } } - return estimation + return fn } _highlight (node, compilationResult) { From aa844166b743fce7b1afcd50a5730e96c4ffa45b Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Mon, 11 Dec 2017 23:10:53 +0700 Subject: [PATCH 09/18] Add codeDepositCost and gasStation img in png --- .DS_Store | Bin 0 -> 8196 bytes assets/.DS_Store | Bin 0 -> 6148 bytes assets/img/.DS_Store | Bin 0 -> 6148 bytes assets/img/gasStation_50.png | Bin 0 -> 960 bytes src/app/editor/contextView.js | 12 +++++++++--- src/app/editor/contextualListener.js | 7 ++++--- 6 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 .DS_Store create mode 100644 assets/.DS_Store create mode 100644 assets/img/.DS_Store create mode 100644 assets/img/gasStation_50.png diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..21e42f8ebdb9a8355d9050597005a33cceae41a7 GIT binary patch literal 8196 zcmeHML2lDP6#dht;H0f+C8T!g4HApCYLQA72q~oPq7ooP5G(+-c487!*REoxX$e8u zaEEdPZo&i^i!&5sY0h1LeX*EWjJh2 z+mW)0PD0U1=#hoaP=p*EJXgX=)ReWYRlq7Ru7G+0utq+4sJZ;zj}jkn{yIHCz57cR z>7Ybw)TWR!&hvA)uLiDijsvz$F(r665EMCL$>7X_lL6<^F<2>%PU(;$gZ0^9-2gtt zCjd7!us{EX_510OUcop2C<@bTef_(bnl8=Uxal|*r!rr8+vp_yM&@O`wC;6Z^U*Ue z>-f6=B1xi)zURLTgZ|#a?X4uvyf6;Bk{q@IK;FCx<5tqIC%w3pNb1K^{2;uVK-f;Hc*@jvPC|{MRs_nA!%OBcI1tfakRabOJ^P zb06DTyk_C#)?A^-v`bsGLrm;<+}2oC@?Bg!{}VgiMr%RnFdF{k^FO~60AZVRf5vIhs`@0 z?}i_RwQ3x6^5wUu4^}|kqRPDQ3p{K@TdV?COo3@NpJmSfcP798zhbkt)3FLz1^%T1 zqO{%EuEXQ`PfF7{=h`mnJ}MW+jg*xXG%_8BmFYO_#UF;~yMQvMrtL^soI&~TF9ML! N*yq2L-Zs}*f#2m;q%Hse literal 0 HcmV?d00001 diff --git a/assets/.DS_Store b/assets/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e3562e55f6482ff65267714d687da39948a8d5ec GIT binary patch literal 6148 zcmeHK%}&BV5T4~n7mSgE2_Abf@xTF0kb^O45D(r=YV@E6TR>=1x`q~sBBqa_kKmj5 z20o6?{$PUO)xXRnv)}CO%x?E=rz80b49Itvh89E+9R@S+Zx=_l-jt|~WZ?<~gb>d~K7Wc#gAaY^&d$e*i=(_z zbZx$x7wh zM$N+dz6fL24?6>u?6*4@a(?QEZ855gVc3q;JdPgVJjZj*LUBCau2xG{wK6GL<65m; zvUX~<$t1^%o0Yx8%l_@%_JtV4+I14JI1Z(SeOB0T46jR)V(r`A4**1JO2^XhaVR z)2WC$m6;NQnc9KrbR4%$e4Y5PhpD0yeP`%Pp;f5v**E5DV-4fM`?>;gS=LV!40EU#aiytjd{d6_FX3 zeRH!jv%3#&KLCX3)6E1J0T@z+K}L_r-P^TOf`uX1*x(8q+@Zy~r_f(?Y3}=|Iqyfz zIrp#mFK~)ujB(Gk)E7;Ay=>Ygqeay#_2?}NE#LqTxW$Sqf58F`*I!drVS*F-496Vf zd8^jhw_3TNH_m`F;0!ne&cKf`z%yGi+%xpn8E^)iflmgsKSZjqDwquO*1<;CXY~(+ z656^T3uD2mU@~M6C0HuaQbT!S1WTtsmbj{5GPHDrJTmK)kv|?UA&*Xf%;5-?p|{R} zGtgyV*FHx&|Ihi$^gi;tDgNaQI0OHTfiRfOXHzb!oUL2S(^(s-msE-3k_-y%&Lw~! h+D8s^r}anKjH?PJLsgMKrxX1mkO}d|8TbVT-T@X8F023m literal 0 HcmV?d00001 diff --git a/assets/img/gasStation_50.png b/assets/img/gasStation_50.png new file mode 100644 index 0000000000000000000000000000000000000000..67586093854531f693190b8a27449d9d50f7876b GIT binary patch literal 960 zcmV;x13&zUP)(^b8FWQhbW?9;ba!ELWdL_~cP?peYja~^ zaAhuUa%Y?FJQ@H113gJZK~!jg)!I#{RaF!R@SpG5Q}e433(Aj|AH9K)ghVfC&?F3+ zgfz5)1&x#@=|ub}90Vl|BE(V9CpkdvRXKur z_mjkvGe9CMpY*EJvkG*dfz}xsD(v9J3EXXTUCj#dR zbQ^G3Zn+o)B4v01A7sKH6M=1bjlm}ZALFrhL>AtMhI?J-LhNWq3P0uKhw)rw^HL=L7+2DdH2%v1GTS4Yqozk?TuAe?XIJn* zszjCu_m_FQQ#dB9{CRzR^^g=1*j>Z-3YL;)ijv_yt(kC)2DWHT`|ly85h2`v>=H8K z%zjch9vY90H{yGo5#9uvX(Bh8ZJ)wN!Un4di-hCW(zlAv^r7=r<;}8=R$)lZHw$JE imG|joNO`h%gnt2xeAGv9m7x6q0000` 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} } } } From 215bb65e4f9aa6e6e31b1672e62cbf2dc1f63474 Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Mon, 11 Dec 2017 23:18:53 +0700 Subject: [PATCH 10/18] Add if (node.name === FunctionDefinition) --- src/app/editor/contextView.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/app/editor/contextView.js b/src/app/editor/contextView.js index 4fb8511ae4..56beacaab5 100644 --- a/src/app/editor/contextView.js +++ b/src/app/editor/contextView.js @@ -172,16 +172,17 @@ class ContextView { ` function showGasEstimation () { - 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`
+ if (node.name === 'FunctionDefinition') { + 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} -
` +
` + } } - } } From 24759a529f4d2eb5107f871939b50f817a60dd86 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 11 Dec 2017 18:06:12 +0100 Subject: [PATCH 11/18] remove double negation --- src/app/editor/contextualListener.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index c580e9f685..4272caddb9 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -120,7 +120,7 @@ class ContextualListener { _getFn (functions, name) { for (var x in functions) { - if (!!~functions[x].indexOf(name)) { + if (~functions[x].indexOf(name)) { var fn = functions[x] break } From 3a28c29c615c1c5248f94d5badd593812fb5517a Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Thu, 14 Dec 2017 04:03:17 +0700 Subject: [PATCH 12/18] Add input params and construct entire signature --- src/app/editor/contextualListener.js | 104 ++++++++++++++------------- 1 file changed, 53 insertions(+), 51 deletions(-) diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index 9939e6f735..ea76e40e66 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -92,57 +92,6 @@ class ContextualListener { } } - _getGasEstimation (contract) { - this.contract = this.results.data.contracts[this.results.source.target][contract.attributes.name] - this.estimationObj = this.contract.evm.gasEstimates - 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 - } - - _getContract (node) { - for (var i in this.nodes) { - if (this.nodes[i].id === node.attributes.scope) { - var contract = this._getGasEstimation(this.nodes[i]) - break - } - } - return contract - } - - gasEstimation (node) { - this._getContract(node) - var executionCost - var codeDepositCost - if (node.name === 'FunctionDefinition') { - if (!node.attributes.isConstructor) { - var functionName = node.attributes.name - if (node.attributes.visibility === 'public') { - executionCost = this.estimationObj.external[this._getFn(this.externalFunctions, functionName)] - } else if (node.attributes.visibility === 'internal') { - executionCost = this.estimationObj.internal[this._getFn(this.internalFunctions, functionName)] - } - } else { - executionCost = this.creationCost - codeDepositCost = this.codeDepositCost - } - } else { - executionCost = '-' - } - return {executionCost, codeDepositCost} - } - - _getFn (functions, name) { - for (var x in functions) { - if (~functions[x].indexOf(name)) { - var fn = functions[x] - break - } - } - return fn - } - _highlight (node, compilationResult) { if (!node) return var position = this.sourceMappingDecoder.decode(node.src) @@ -180,6 +129,59 @@ class ContextualListener { } this._activeHighlights = [] } + + // GET GAS ESTIMATION + _getGasEstimation (contract) { + this.contract = this.results.data.contracts[this.results.source.target][contract.attributes.name] + this.estimationObj = this.contract.evm.gasEstimates + this.creationCost = this.estimationObj.creation.totalCost + this.codeDepositCost = this.estimationObj.creation.codeDepositCost + } + + gasEstimation (node) { + this._getContract(node) + var executionCost + var codeDepositCost + if (node.name === 'FunctionDefinition') { + if (!node.attributes.isConstructor) { + var fnName = node.attributes.name + var fn = fnName + this._getInputParams(fnName) + if (node.attributes.visibility === 'public') { + executionCost = this.estimationObj.external[fn] + } else if (node.attributes.visibility === 'internal') { + executionCost = this.estimationObj.internal[fn] + } + } else { + executionCost = this.creationCost + codeDepositCost = this.codeDepositCost + } + } else { + executionCost = '-' + } + return {executionCost, codeDepositCost} + } + + _getContract (node) { + for (var i in this.nodes) { + if (this.nodes[i].id === node.attributes.scope) { + var contract = this._getGasEstimation(this.nodes[i]) + break + } + } + return contract + } + + _getInputParams (fnName) { + var abi = this.contract.abi + for (var i in abi) { + if (abi[i].name === fnName) { + var inputs = abi[i].inputs + var inputParams = inputs.length ? '(' + inputs[0].type + ')' : '()' + break + } + } + return inputParams + } } module.exports = ContextualListener From c74f82fb72f177e5e5cf573e1557487ca2c35aee Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Thu, 14 Dec 2017 20:23:17 +0700 Subject: [PATCH 13/18] Update _getInputParams --- src/app/editor/contextualListener.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index ea76e40e66..7f1c8f7ea2 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -145,7 +145,7 @@ class ContextualListener { if (node.name === 'FunctionDefinition') { if (!node.attributes.isConstructor) { var fnName = node.attributes.name - var fn = fnName + this._getInputParams(fnName) + var fn = fnName + this._getInputParams(node) if (node.attributes.visibility === 'public') { executionCost = this.estimationObj.external[fn] } else if (node.attributes.visibility === 'internal') { @@ -171,16 +171,19 @@ class ContextualListener { return contract } - _getInputParams (fnName) { - var abi = this.contract.abi - for (var i in abi) { - if (abi[i].name === fnName) { - var inputs = abi[i].inputs - var inputParams = inputs.length ? '(' + inputs[0].type + ')' : '()' + _getInputParams (node) { + var list = [] + for (var i in node.children) { + if (node.children[i].name === 'ParameterList') { + list.push(node.children[i]) break } } - return inputParams + for (var j in list) { + var params = list[j].children.length ? list[j].children[0].attributes.type : '' + break + } + return '(' + params + ')' } } From db57fd5cc6959b29787c399dd55927ad9481648e Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Fri, 15 Dec 2017 01:04:22 +0700 Subject: [PATCH 14/18] Loop through VariableDeclaration in ParameterList --- src/app/editor/contextualListener.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index 7f1c8f7ea2..ff1bae6f00 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -172,6 +172,7 @@ class ContextualListener { } _getInputParams (node) { + var params var list = [] for (var i in node.children) { if (node.children[i].name === 'ParameterList') { @@ -179,9 +180,19 @@ class ContextualListener { break } } + debugger for (var j in list) { - var params = list[j].children.length ? list[j].children[0].attributes.type : '' - break + if (list[j].children.length) { + var children = list[j].children + for (var k in children) { + if (children[k].name === 'VariableDeclaration') { + params = children[k].attributes.type + break + } + } + } else { + params = '' + } } return '(' + params + ')' } From 9f7d54395b2b79129eb889c9b1f2d206bf62fa99 Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Fri, 15 Dec 2017 02:09:38 +0700 Subject: [PATCH 15/18] Refactor _getInputParams --- src/app/editor/contextualListener.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index ff1bae6f00..9893767724 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -172,29 +172,22 @@ class ContextualListener { } _getInputParams (node) { - var params - var list = [] + var params = [] for (var i in node.children) { if (node.children[i].name === 'ParameterList') { - list.push(node.children[i]) + var target = node.children[i] break } } - debugger - for (var j in list) { - if (list[j].children.length) { - var children = list[j].children - for (var k in children) { - if (children[k].name === 'VariableDeclaration') { - params = children[k].attributes.type - break - } + if (target) { + var children = target.children + for (var j in children) { + if (children[j].name === 'VariableDeclaration') { + params.push(children[j].attributes.type.split(' ')[0]) } - } else { - params = '' } } - return '(' + params + ')' + return '(' + params.toString() + ')' } } From b6a38c90331f23450e6b015ec364b6388f7ab60e Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Tue, 19 Dec 2017 02:39:53 +0700 Subject: [PATCH 16/18] Little fixes --- src/app/editor/contextualListener.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index 9893767724..2c2530fa38 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -148,7 +148,7 @@ class ContextualListener { var fn = fnName + this._getInputParams(node) if (node.attributes.visibility === 'public') { executionCost = this.estimationObj.external[fn] - } else if (node.attributes.visibility === 'internal') { + } else if (node.attributes.visibility === 'private') { executionCost = this.estimationObj.internal[fn] } } else { @@ -164,11 +164,9 @@ class ContextualListener { _getContract (node) { for (var i in this.nodes) { if (this.nodes[i].id === node.attributes.scope) { - var contract = this._getGasEstimation(this.nodes[i]) - break + return this._getGasEstimation(this.nodes[i]) } } - return contract } _getInputParams (node) { From 696bc990ef6d031d012169306c55ea74803fead3 Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Tue, 19 Dec 2017 17:38:17 +0700 Subject: [PATCH 17/18] Remove .DS_Store files --- .DS_Store | Bin 8196 -> 0 bytes .gitignore | 1 + assets/.DS_Store | Bin 6148 -> 0 bytes assets/img/.DS_Store | Bin 6148 -> 0 bytes src/app/editor/contextualListener.js | 5 +++-- 5 files changed, 4 insertions(+), 2 deletions(-) delete mode 100644 .DS_Store delete mode 100644 assets/.DS_Store delete mode 100644 assets/img/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 21e42f8ebdb9a8355d9050597005a33cceae41a7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHML2lDP6#dht;H0f+C8T!g4HApCYLQA72q~oPq7ooP5G(+-c487!*REoxX$e8u zaEEdPZo&i^i!&5sY0h1LeX*EWjJh2 z+mW)0PD0U1=#hoaP=p*EJXgX=)ReWYRlq7Ru7G+0utq+4sJZ;zj}jkn{yIHCz57cR z>7Ybw)TWR!&hvA)uLiDijsvz$F(r665EMCL$>7X_lL6<^F<2>%PU(;$gZ0^9-2gtt zCjd7!us{EX_510OUcop2C<@bTef_(bnl8=Uxal|*r!rr8+vp_yM&@O`wC;6Z^U*Ue z>-f6=B1xi)zURLTgZ|#a?X4uvyf6;Bk{q@IK;FCx<5tqIC%w3pNb1K^{2;uVK-f;Hc*@jvPC|{MRs_nA!%OBcI1tfakRabOJ^P zb06DTyk_C#)?A^-v`bsGLrm;<+}2oC@?Bg!{}VgiMr%RnFdF{k^FO~60AZVRf5vIhs`@0 z?}i_RwQ3x6^5wUu4^}|kqRPDQ3p{K@TdV?COo3@NpJmSfcP798zhbkt)3FLz1^%T1 zqO{%EuEXQ`PfF7{=h`mnJ}MW+jg*xXG%_8BmFYO_#UF;~yMQvMrtL^soI&~TF9ML! N*yq2L-Zs}*f#2m;q%Hse diff --git a/.gitignore b/.gitignore index 349416d020..99ccc8b448 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ npm-debug.log* babelify-src package-lock.json remix +.DS_Store diff --git a/assets/.DS_Store b/assets/.DS_Store deleted file mode 100644 index e3562e55f6482ff65267714d687da39948a8d5ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}&BV5T4~n7mSgE2_Abf@xTF0kb^O45D(r=YV@E6TR>=1x`q~sBBqa_kKmj5 z20o6?{$PUO)xXRnv)}CO%x?E=rz80b49Itvh89E+9R@S+Zx=_l-jt|~WZ?<~gb>d~K7Wc#gAaY^&d$e*i=(_z zbZx$x7wh zM$N+dz6fL24?6>u?6*4@a(?QEZ855gVc3q;JdPgVJjZj*LUBCau2xG{wK6GL<65m; zvUX~<$t1^%o0Yx8%l_@%_JtV4+I14JI1Z(SeOB0T46jR)V(r`A4**1JO2^XhaVR z)2WC$m6;NQnc9KrbR4%$e4Y5PhpD0yeP`%Pp;f5v**E5DV-4fM`?>;gS=LV!40EU#aiytjd{d6_FX3 zeRH!jv%3#&KLCX3)6E1J0T@z+K}L_r-P^TOf`uX1*x(8q+@Zy~r_f(?Y3}=|Iqyfz zIrp#mFK~)ujB(Gk)E7;Ay=>Ygqeay#_2?}NE#LqTxW$Sqf58F`*I!drVS*F-496Vf zd8^jhw_3TNH_m`F;0!ne&cKf`z%yGi+%xpn8E^)iflmgsKSZjqDwquO*1<;CXY~(+ z656^T3uD2mU@~M6C0HuaQbT!S1WTtsmbj{5GPHDrJTmK)kv|?UA&*Xf%;5-?p|{R} zGtgyV*FHx&|Ihi$^gi;tDgNaQI0OHTfiRfOXHzb!oUL2S(^(s-msE-3k_-y%&Lw~! h+D8s^r}anKjH?PJLsgMKrxX1mkO}d|8TbVT-T@X8F023m diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index 2c2530fa38..51bdec10f2 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -143,12 +143,13 @@ class ContextualListener { var executionCost var codeDepositCost if (node.name === 'FunctionDefinition') { + var visibility = node.attributes.visibility if (!node.attributes.isConstructor) { var fnName = node.attributes.name var fn = fnName + this._getInputParams(node) - if (node.attributes.visibility === 'public') { + if (visibility === 'public' || visibility === 'external') { executionCost = this.estimationObj.external[fn] - } else if (node.attributes.visibility === 'private') { + } else if (visibility === 'private' || visibility === 'internal') { executionCost = this.estimationObj.internal[fn] } } else { From 733cec2084d019109a62a829e18753ef9d1b8676 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 3 Jan 2018 15:28:50 +0100 Subject: [PATCH 18/18] small refactor --- src/app/editor/contextualListener.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/app/editor/contextualListener.js b/src/app/editor/contextualListener.js index 51bdec10f2..4f2ea3865d 100644 --- a/src/app/editor/contextualListener.js +++ b/src/app/editor/contextualListener.js @@ -130,16 +130,8 @@ class ContextualListener { this._activeHighlights = [] } - // GET GAS ESTIMATION - _getGasEstimation (contract) { - this.contract = this.results.data.contracts[this.results.source.target][contract.attributes.name] - this.estimationObj = this.contract.evm.gasEstimates - this.creationCost = this.estimationObj.creation.totalCost - this.codeDepositCost = this.estimationObj.creation.codeDepositCost - } - gasEstimation (node) { - this._getContract(node) + this._loadContractInfos(node) var executionCost var codeDepositCost if (node.name === 'FunctionDefinition') { @@ -162,10 +154,14 @@ class ContextualListener { return {executionCost, codeDepositCost} } - _getContract (node) { + _loadContractInfos (node) { for (var i in this.nodes) { if (this.nodes[i].id === node.attributes.scope) { - return this._getGasEstimation(this.nodes[i]) + var contract = this.nodes[i] + this.contract = this.results.data.contracts[this.results.source.target][contract.attributes.name] + this.estimationObj = this.contract.evm.gasEstimates + this.creationCost = this.estimationObj.creation.totalCost + this.codeDepositCost = this.estimationObj.creation.codeDepositCost } } } @@ -182,7 +178,7 @@ class ContextualListener { var children = target.children for (var j in children) { if (children[j].name === 'VariableDeclaration') { - params.push(children[j].attributes.type.split(' ')[0]) + params.push(children[j].attributes.type) } } }