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
589925d1
Commit
589925d1
authored
Feb 01, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
distinguish array of mapping
parent
cccfc472
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
decodeInfo.js
src/solidity/decodeInfo.js
+4
-3
util.js
src/solidity/types/util.js
+6
-1
No files found.
src/solidity/decodeInfo.js
View file @
589925d1
...
...
@@ -254,12 +254,13 @@ function getStructMembers (type, stateDefinitions, contractName, location) {
* @return {String} returns the token type (used to instanciate the right decoder) (uint[2] storage ref[2] will return 'array', uint256 will return uintX)
*/
function
typeClass
(
fullType
)
{
fullType
=
util
.
removeLocation
(
fullType
)
if
(
fullType
.
lastIndexOf
(
']'
)
===
fullType
.
length
-
1
)
{
return
'array'
}
if
(
fullType
.
indexOf
(
'mapping'
)
===
0
)
{
return
'mapping'
}
if
(
fullType
.
indexOf
(
']'
)
!==
-
1
)
{
return
'array'
}
if
(
fullType
.
indexOf
(
' '
)
!==
-
1
)
{
fullType
=
fullType
.
split
(
' '
)[
0
]
}
...
...
src/solidity/types/util.js
View file @
589925d1
...
...
@@ -11,7 +11,8 @@ module.exports = {
sha3
:
sha3
,
toBN
:
toBN
,
add
:
add
,
extractLocation
:
extractLocation
extractLocation
:
extractLocation
,
removeLocation
:
removeLocation
}
function
decodeInt
(
location
,
storageContent
,
byteLength
,
signed
)
{
...
...
@@ -93,6 +94,10 @@ function add (value1, value2) {
return
toBN
(
value1
).
add
(
toBN
(
value2
))
}
function
removeLocation
(
type
)
{
return
type
.
replace
(
/
(
storage ref| storage pointer| memory| calldata
)
/g
,
''
)
}
function
extractLocation
(
type
)
{
var
match
=
type
.
match
(
/
(
storage ref| storage pointer| memory| calldata
)?
$/
)
if
(
match
[
1
]
!==
''
)
{
...
...
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