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
8b22007c
Commit
8b22007c
authored
Nov 28, 2016
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add comments
parent
25b7f8e8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
util.js
src/solidity/types/util.js
+14
-0
astWalker.js
src/util/astWalker.js
+5
-5
No files found.
src/solidity/types/util.js
View file @
8b22007c
...
...
@@ -33,6 +33,13 @@ function readFromStorage (slot, storageContent) {
}
}
/**
* @returns a hex encoded byte slice of length @arg byteLength from inside @arg slotValue.
*
* @param {String} slotValue - right aligned hex encoded value to extract the byte slice from (can have 0x prefix)
* @param {Int} byteLength - Length of the byte slice to extract
* @param {Int} offsetFromLSB - byte distance from the right end slot value to the right end of the byte slice
*/
function
extractHexByteSlice
(
slotValue
,
byteLength
,
offsetFromLSB
)
{
slotValue
=
slotValue
.
replace
(
'0x'
,
''
)
if
(
slotValue
.
length
<
64
)
{
...
...
@@ -42,6 +49,13 @@ function extractHexByteSlice (slotValue, byteLength, offsetFromLSB) {
return
slotValue
.
substr
(
offset
,
2
*
byteLength
)
}
/**
* @returns a hex encoded storage content at the given @arg location. it does not have Ox prefix but always has the full length.
*
* @param {Object} location - object containing the slot and offset of the data to extract.
* @param {Object} storageContent - full storage mapping.
* @param {Int} byteLength - Length of the byte slice to extract
*/
function
extractHexByte
(
location
,
storageContent
,
byteLength
)
{
var
slotvalue
=
readFromStorage
(
location
.
slot
,
storageContent
)
return
extractHexByteSlice
(
slotvalue
,
byteLength
,
location
.
offset
)
...
...
src/util/astWalker.js
View file @
8b22007c
...
...
@@ -31,11 +31,11 @@ AstWalker.prototype.walk = function (ast, callback) {
}
/**
+
* walk the given @astList
+
*
+
* @param {Object} sourcesList - sources list (containing root AST node)
+
* @param {Function} - callback used by AstWalker to compute response
+
*/
* walk the given @astList
*
* @param {Object} sourcesList - sources list (containing root AST node)
* @param {Function} - callback used by AstWalker to compute response
*/
AstWalker
.
prototype
.
walkAstList
=
function
(
sourcesList
,
callback
)
{
var
walker
=
new
AstWalker
()
for
(
var
k
in
sourcesList
)
{
...
...
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