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
967f95d9
Commit
967f95d9
authored
Jul 04, 2017
by
yann300
Committed by
GitHub
Jul 04, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #526 from ethereum/constantState
show <constant> if the state variable is constant
parents
fae944fc
2cd2e262
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
10 deletions
+18
-10
decodeInfo.js
src/solidity/decodeInfo.js
+11
-8
stateDecoder.js
src/solidity/stateDecoder.js
+6
-1
SolidityTypeFormatter.js
src/ui/SolidityTypeFormatter.js
+1
-1
No files found.
src/solidity/decodeInfo.js
View file @
967f95d9
...
...
@@ -336,23 +336,26 @@ function computeOffsets (types, stateDefinitions, contractName, location) {
console
.
log
(
'unable to retrieve decode info of '
+
variable
.
attributes
.
type
)
return
null
}
if
(
storagelocation
.
offset
+
type
.
storageBytes
>
32
)
{
if
(
!
variable
.
attributes
.
constant
&&
storagelocation
.
offset
+
type
.
storageBytes
>
32
)
{
storagelocation
.
slot
++
storagelocation
.
offset
=
0
}
ret
.
push
({
name
:
variable
.
attributes
.
name
,
type
:
type
,
constant
:
variable
.
attributes
.
constant
,
storagelocation
:
{
offset
:
storagelocation
.
offset
,
slot
:
storagelocation
.
slot
offset
:
variable
.
attributes
.
constant
?
0
:
storagelocation
.
offset
,
slot
:
variable
.
attributes
.
constant
?
0
:
storagelocation
.
slot
}
})
if
(
type
.
storageSlots
===
1
&&
storagelocation
.
offset
+
type
.
storageBytes
<=
32
)
{
storagelocation
.
offset
+=
type
.
storageBytes
}
else
{
storagelocation
.
slot
+=
type
.
storageSlots
storagelocation
.
offset
=
0
if
(
!
variable
.
attributes
.
constant
)
{
if
(
type
.
storageSlots
===
1
&&
storagelocation
.
offset
+
type
.
storageBytes
<=
32
)
{
storagelocation
.
offset
+=
type
.
storageBytes
}
else
{
storagelocation
.
slot
+=
type
.
storageSlots
storagelocation
.
offset
=
0
}
}
}
if
(
storagelocation
.
offset
>
0
)
{
...
...
src/solidity/stateDecoder.js
View file @
967f95d9
...
...
@@ -13,7 +13,12 @@ async function decodeState (stateVars, storageResolver) {
for
(
var
k
in
stateVars
)
{
var
stateVar
=
stateVars
[
k
]
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
)
{
console
.
log
(
e
)
ret
[
stateVar
.
name
]
=
'<decoding failed - '
+
e
.
message
+
'>'
...
...
src/ui/SolidityTypeFormatter.js
View file @
967f95d9
...
...
@@ -13,7 +13,7 @@ function formatSelf (key, data) {
if
(
data
.
type
===
'string'
)
{
data
.
self
=
JSON
.
stringify
(
data
.
self
)
}
return
yo
`<label style=
${
keyStyle
}
>
${
key
}
: <label style=
${
style
}
>
${
data
.
self
}
</label><label style='font-style:italic'>
${
data
.
isProperty
?
''
:
data
.
type
}
</label></label>`
return
yo
`<label style=
${
keyStyle
}
>
${
key
}
: <label style=
${
style
}
>
${
data
.
self
}
</label><label style='font-style:italic'>
${
data
.
isProperty
?
''
:
' '
+
data
.
type
}
</label></label>`
}
function
extractData
(
item
,
parent
,
key
)
{
...
...
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