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
9ab63997
Commit
9ab63997
authored
Nov 28, 2016
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix array
parent
3ff04e10
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
14 deletions
+5
-14
ArrayType.js
src/solidity/types/ArrayType.js
+5
-14
No files found.
src/solidity/types/ArrayType.js
View file @
9ab63997
...
@@ -24,9 +24,6 @@ ArrayType.prototype.decodeFromStorage = function (location, storageContent) {
...
@@ -24,9 +24,6 @@ ArrayType.prototype.decodeFromStorage = function (location, storageContent) {
var
ret
=
[]
var
ret
=
[]
var
size
=
null
var
size
=
null
var
slotValue
=
util
.
extractHexValue
(
location
,
storageContent
,
this
.
storageBytes
)
var
slotValue
=
util
.
extractHexValue
(
location
,
storageContent
,
this
.
storageBytes
)
if
(
!
slotValue
)
{
return
[]
}
var
currentLocation
=
{
var
currentLocation
=
{
offset
:
0
,
offset
:
0
,
slot
:
location
.
slot
slot
:
location
.
slot
...
@@ -34,28 +31,22 @@ ArrayType.prototype.decodeFromStorage = function (location, storageContent) {
...
@@ -34,28 +31,22 @@ ArrayType.prototype.decodeFromStorage = function (location, storageContent) {
if
(
this
.
arraySize
===
'dynamic'
)
{
if
(
this
.
arraySize
===
'dynamic'
)
{
size
=
util
.
toBN
(
'0x'
+
slotValue
)
size
=
util
.
toBN
(
'0x'
+
slotValue
)
currentLocation
.
slot
=
util
.
sha3
(
location
.
slot
)
currentLocation
.
slot
=
util
.
sha3
(
location
.
slot
)
if
(
!
storageContent
[
currentLocation
.
slot
])
{
return
[]
}
}
else
{
}
else
{
size
=
new
BN
(
this
.
arraySize
)
size
=
new
BN
(
this
.
arraySize
)
}
}
var
k
=
util
.
toBN
(
0
)
var
k
=
util
.
toBN
(
0
)
var
one
=
util
.
toBN
(
1
)
for
(;
k
.
lt
(
size
)
&&
k
.
ltn
(
300
);
k
.
iaddn
(
1
))
{
var
max
=
new
BN
(
300
)
while
(
k
.
lt
(
size
)
&&
k
.
lt
(
max
))
{
if
(
currentLocation
.
offset
+
this
.
underlyingType
.
storageBytes
>
32
)
{
currentLocation
.
offset
=
0
currentLocation
.
slot
=
'0x'
+
util
.
add
(
currentLocation
.
slot
,
one
).
toString
(
16
)
}
ret
.
push
(
this
.
underlyingType
.
decodeFromStorage
(
currentLocation
,
storageContent
))
ret
.
push
(
this
.
underlyingType
.
decodeFromStorage
(
currentLocation
,
storageContent
))
if
(
this
.
underlyingType
.
storageSlots
===
1
&&
location
.
offset
+
this
.
underlyingType
.
storageBytes
<=
32
)
{
if
(
this
.
underlyingType
.
storageSlots
===
1
&&
location
.
offset
+
this
.
underlyingType
.
storageBytes
<=
32
)
{
currentLocation
.
offset
+=
this
.
underlyingType
.
storageBytes
currentLocation
.
offset
+=
this
.
underlyingType
.
storageBytes
if
(
currentLocation
.
offset
+
this
.
underlyingType
.
storageBytes
>
32
)
{
currentLocation
.
offset
=
0
currentLocation
.
slot
=
'0x'
+
util
.
add
(
currentLocation
.
slot
,
1
).
toString
(
16
)
}
}
else
{
}
else
{
currentLocation
.
slot
=
'0x'
+
util
.
add
(
currentLocation
.
slot
,
this
.
underlyingType
.
storageSlots
).
toString
(
16
)
currentLocation
.
slot
=
'0x'
+
util
.
add
(
currentLocation
.
slot
,
this
.
underlyingType
.
storageSlots
).
toString
(
16
)
currentLocation
.
offset
=
0
currentLocation
.
offset
=
0
}
}
k
=
k
.
add
(
one
)
}
}
return
{
return
{
value
:
ret
,
value
:
ret
,
...
...
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