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
c85a49ec
Commit
c85a49ec
authored
Jul 03, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display <constant> if state var is constant
parent
91b834b6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
decodeInfo.js
src/solidity/decodeInfo.js
+12
-9
stateDecoder.js
src/solidity/stateDecoder.js
+6
-1
No files found.
src/solidity/decodeInfo.js
View file @
c85a49ec
...
@@ -336,26 +336,29 @@ function computeOffsets (types, stateDefinitions, contractName, location) {
...
@@ -336,26 +336,29 @@ function computeOffsets (types, stateDefinitions, contractName, location) {
console
.
log
(
'unable to retrieve decode info of '
+
variable
.
attributes
.
type
)
console
.
log
(
'unable to retrieve decode info of '
+
variable
.
attributes
.
type
)
return
null
return
null
}
}
if
(
storagelocation
.
offset
+
type
.
storageBytes
>
32
)
{
if
(
!
variable
.
attributes
.
constant
&&
storagelocation
.
offset
+
type
.
storageBytes
>
32
)
{
storagelocation
.
slot
++
storagelocation
.
slot
++
storagelocation
.
offset
=
0
storagelocation
.
offset
=
0
}
}
ret
.
push
({
ret
.
push
({
name
:
variable
.
attributes
.
name
,
name
:
variable
.
attributes
.
name
,
type
:
type
,
type
:
type
,
constant
:
variable
.
attributes
.
constant
,
storagelocation
:
{
storagelocation
:
{
offset
:
storagelocation
.
offset
,
offset
:
variable
.
attributes
.
constant
?
0
:
storagelocation
.
offset
,
slot
:
storagelocation
.
slot
slot
:
variable
.
attributes
.
constant
?
0
:
storagelocation
.
slot
}
}
})
})
if
(
type
.
storageSlots
===
1
&&
storagelocation
.
offset
+
type
.
storageBytes
<=
32
)
{
if
(
!
variable
.
attributes
.
constant
)
{
storagelocation
.
offset
+=
type
.
storageBytes
if
(
type
.
storageSlots
===
1
&&
storagelocation
.
offset
+
type
.
storageBytes
<=
32
)
{
}
else
{
storagelocation
.
offset
+=
type
.
storageBytes
storagelocation
.
slot
+=
type
.
storageSlots
}
else
{
storagelocation
.
offset
=
0
storagelocation
.
slot
+=
type
.
storageSlots
storagelocation
.
offset
=
0
}
}
}
}
}
if
(
storagelocation
.
offset
>
0
)
{
if
(
!
variable
.
attributes
.
constant
&&
storagelocation
.
offset
>
0
)
{
storagelocation
.
slot
++
storagelocation
.
slot
++
}
}
return
{
return
{
...
...
src/solidity/stateDecoder.js
View file @
c85a49ec
...
@@ -13,7 +13,12 @@ async function decodeState (stateVars, storageResolver) {
...
@@ -13,7 +13,12 @@ async function decodeState (stateVars, storageResolver) {
for
(
var
k
in
stateVars
)
{
for
(
var
k
in
stateVars
)
{
var
stateVar
=
stateVars
[
k
]
var
stateVar
=
stateVars
[
k
]
try
{
try
{
ret
[
stateVar
.
name
]
=
await
stateVar
.
type
.
decodeFromStorage
(
stateVar
.
storagelocation
,
storageResolver
)
var
decoded
=
await
stateVar
.
type
.
decodeFromStorage
(
stateVar
.
storagelocation
,
storageResolver
)
decoded
.
constant
=
stateVar
.
constant
if
(
decoded
.
constant
)
{
decoded
.
value
=
'<constant>'
}
ret
[
stateVar
.
name
]
=
decoded
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
)
console
.
log
(
e
)
ret
[
stateVar
.
name
]
=
'<decoding failed - '
+
e
.
message
+
'>'
ret
[
stateVar
.
name
]
=
'<decoding failed - '
+
e
.
message
+
'>'
...
...
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