Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
d7c98951
Commit
d7c98951
authored
May 20, 2016
by
Alex Beregszaszi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display cost for inter-contract calls separately
parent
a7e3d9d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
universal-dapp.js
src/universal-dapp.js
+10
-4
No files found.
src/universal-dapp.js
View file @
d7c98951
...
...
@@ -313,12 +313,18 @@ UniversalDApp.prototype.getCallButton = function(args) {
return
$
(
'<div class="'
+
returnCls
+
'">'
).
html
(
'<strong>'
+
returnName
+
':</strong> '
+
JSON
.
stringify
(
result
,
null
,
2
)
);
};
var
getGasUsedOutput
=
function
(
result
)
{
var
getGasUsedOutput
=
function
(
result
,
vmResult
)
{
var
$gasUsed
=
$
(
'<div class="gasUsed">'
);
var
caveat
=
lookupOnly
?
'<em>(<span class="caveat" title="Cost only applies when called by a contract">caveat</span>)</em>'
:
''
;
if
(
result
.
gasUsed
)
{
var
gas
=
result
.
gasUsed
.
toString
(
10
);
$gasUsed
.
html
(
'<strong>Cost:</strong> '
+
gas
+
' gas. '
+
caveat
);
$gasUsed
.
html
(
'<strong>Transaction cost:</strong> '
+
gas
+
' gas. '
+
caveat
);
}
if
(
vmResult
.
gasUsed
)
{
var
$callGasUsed
=
$
(
'<div class="gasUsed">'
);
var
gas
=
vmResult
.
gasUsed
.
toString
(
10
);
$callGasUsed
.
append
(
'<strong>Execution cost:</strong> '
+
gas
+
' gas.'
);
$gasUsed
.
append
(
$callGasUsed
);
}
return
$gasUsed
;
};
...
...
@@ -409,12 +415,12 @@ UniversalDApp.prototype.getCallButton = function(args) {
}
else
if
(
self
.
options
.
vm
&&
result
.
vm
.
return
===
undefined
)
{
replaceOutput
(
$result
,
$
(
'<span/>'
).
text
(
'Exception during execution.'
).
addClass
(
'error'
));
}
else
if
(
self
.
options
.
vm
&&
isConstructor
)
{
replaceOutput
(
$result
,
getGasUsedOutput
(
result
));
replaceOutput
(
$result
,
getGasUsedOutput
(
result
,
result
.
vm
));
args
.
appendFunctions
(
result
.
createdAddress
);
}
else
if
(
self
.
options
.
vm
){
var
outputObj
=
'0x'
+
result
.
vm
.
return
.
toString
(
'hex'
);
clearOutput
(
$result
);
$result
.
append
(
getReturnOutput
(
outputObj
)).
append
(
getGasUsedOutput
(
result
));
$result
.
append
(
getReturnOutput
(
outputObj
)).
append
(
getGasUsedOutput
(
result
,
result
.
vm
));
// Only decode if there supposed to be fields
if
(
args
.
abi
.
outputs
.
length
>
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment