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
4c09db37
Commit
4c09db37
authored
Jan 12, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move storageStore memoryStore to function class
parent
f346b2b1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
13 deletions
+21
-13
RefType.js
src/solidity/types/RefType.js
+21
-3
util.js
src/solidity/types/util.js
+0
-10
No files found.
src/solidity/types/RefType.js
View file @
4c09db37
'use strict'
'use strict'
var
util
=
require
(
'./util'
)
class
RefType
{
class
RefType
{
constructor
(
storageSlots
,
storageBytes
,
typeName
,
location
)
{
constructor
(
storageSlots
,
storageBytes
,
typeName
,
location
)
{
...
@@ -39,15 +38,34 @@ class RefType {
...
@@ -39,15 +38,34 @@ class RefType {
offset
=
parseInt
(
offset
,
16
)
offset
=
parseInt
(
offset
,
16
)
return
decodeInternal
(
this
,
offset
,
memory
,
storage
)
return
decodeInternal
(
this
,
offset
,
memory
,
storage
)
}
}
/**
* current type defined in storage
*
* @return {Bool} - return true if the type is defined in the storage
*/
storageStore
()
{
return
this
.
location
.
indexOf
(
'storage'
)
===
0
}
/**
* current type defined in memory
*
* @return {Bool} - return true if the type is defined in the memory
*/
memoryStore
()
{
return
this
.
location
.
indexOf
(
'memory'
)
===
0
}
}
}
function
decodeInternal
(
self
,
offset
,
memory
,
storage
)
{
function
decodeInternal
(
self
,
offset
,
memory
,
storage
)
{
if
(
!
storage
)
{
if
(
!
storage
)
{
storage
=
{}
// TODO this is a fallback, should manage properly locals store in storage
storage
=
{}
// TODO this is a fallback, should manage properly locals store in storage
}
}
if
(
util
.
storageStore
(
self
))
{
if
(
self
.
storageStore
(
))
{
return
self
.
decodeFromStorage
({
offset
:
0
,
slot
:
offset
},
storage
)
return
self
.
decodeFromStorage
({
offset
:
0
,
slot
:
offset
},
storage
)
}
else
if
(
util
.
memoryStore
(
self
))
{
}
else
if
(
self
.
memoryStore
(
))
{
return
self
.
decodeFromMemory
(
offset
,
memory
)
return
self
.
decodeFromMemory
(
offset
,
memory
)
}
else
{
}
else
{
return
{
error
:
'<decoding failed - no decoder for '
+
self
.
location
+
'>'
}
return
{
error
:
'<decoding failed - no decoder for '
+
self
.
location
+
'>'
}
...
...
src/solidity/types/util.js
View file @
4c09db37
...
@@ -11,8 +11,6 @@ module.exports = {
...
@@ -11,8 +11,6 @@ module.exports = {
sha3
:
sha3
,
sha3
:
sha3
,
toBN
:
toBN
,
toBN
:
toBN
,
add
:
add
,
add
:
add
,
storageStore
:
storageStore
,
memoryStore
:
memoryStore
,
extractLocation
:
extractLocation
extractLocation
:
extractLocation
}
}
...
@@ -103,11 +101,3 @@ function extractLocation (type) {
...
@@ -103,11 +101,3 @@ function extractLocation (type) {
return
null
return
null
}
}
}
}
function
storageStore
(
type
)
{
return
type
.
location
.
indexOf
(
'storage'
)
===
0
}
function
memoryStore
(
type
)
{
return
type
.
location
.
indexOf
(
'memory'
)
===
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