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
da4cba07
Commit
da4cba07
authored
Nov 28, 2016
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renaming extractHexByte -> extractHexValue
parent
bdf77eb7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
8 deletions
+8
-8
Address.js
src/solidity/types/Address.js
+1
-1
Bool.js
src/solidity/types/Bool.js
+1
-1
DynamicByteArray.js
src/solidity/types/DynamicByteArray.js
+1
-1
Enum.js
src/solidity/types/Enum.js
+1
-1
FixedByteArray.js
src/solidity/types/FixedByteArray.js
+1
-1
util.js
src/solidity/types/util.js
+3
-3
No files found.
src/solidity/types/Address.js
View file @
da4cba07
...
...
@@ -8,7 +8,7 @@ function Address () {
}
Address
.
prototype
.
decodeFromStorage
=
function
(
location
,
storageContent
)
{
var
value
=
util
.
extractHex
Byt
e
(
location
,
storageContent
,
this
.
storageBytes
)
var
value
=
util
.
extractHex
Valu
e
(
location
,
storageContent
,
this
.
storageBytes
)
return
'0x'
+
value
.
toUpperCase
()
}
...
...
src/solidity/types/Bool.js
View file @
da4cba07
...
...
@@ -8,7 +8,7 @@ function Bool () {
}
Bool
.
prototype
.
decodeFromStorage
=
function
(
location
,
storageContent
)
{
var
value
=
util
.
extractHex
Byt
e
(
location
,
storageContent
,
this
.
storageBytes
)
var
value
=
util
.
extractHex
Valu
e
(
location
,
storageContent
,
this
.
storageBytes
)
return
value
!==
'00'
}
...
...
src/solidity/types/DynamicByteArray.js
View file @
da4cba07
...
...
@@ -9,7 +9,7 @@ function DynamicByteArray () {
}
DynamicByteArray
.
prototype
.
decodeFromStorage
=
function
(
location
,
storageContent
)
{
var
value
=
util
.
extractHex
Byt
e
(
location
,
storageContent
,
this
.
storageBytes
)
var
value
=
util
.
extractHex
Valu
e
(
location
,
storageContent
,
this
.
storageBytes
)
var
bn
=
new
BN
(
value
,
16
)
if
(
bn
.
testn
(
0
))
{
var
length
=
bn
.
div
(
new
BN
(
2
))
...
...
src/solidity/types/Enum.js
View file @
da4cba07
...
...
@@ -14,7 +14,7 @@ function Enum (enumDef) {
}
Enum
.
prototype
.
decodeFromStorage
=
function
(
location
,
storageContent
)
{
var
value
=
util
.
extractHex
Byt
e
(
location
,
storageContent
,
this
.
storageBytes
)
var
value
=
util
.
extractHex
Valu
e
(
location
,
storageContent
,
this
.
storageBytes
)
value
=
parseInt
(
value
,
16
)
if
(
this
.
enumDef
.
children
.
length
>
value
)
{
return
this
.
enumDef
.
children
[
value
].
attributes
.
name
...
...
src/solidity/types/FixedByteArray.js
View file @
da4cba07
...
...
@@ -8,7 +8,7 @@ function FixedByteArray (storageBytes) {
}
FixedByteArray
.
prototype
.
decodeFromStorage
=
function
(
location
,
storageContent
)
{
var
value
=
util
.
extractHex
Byt
e
(
location
,
storageContent
,
this
.
storageBytes
)
var
value
=
util
.
extractHex
Valu
e
(
location
,
storageContent
,
this
.
storageBytes
)
return
'0x'
+
value
.
toUpperCase
()
}
...
...
src/solidity/types/util.js
View file @
da4cba07
...
...
@@ -5,7 +5,7 @@ var BN = require('ethereumjs-util').BN
module
.
exports
=
{
readFromStorage
:
readFromStorage
,
decodeInt
:
decodeInt
,
extractHex
Byte
:
extractHexByt
e
,
extractHex
Value
:
extractHexValu
e
,
sha3
:
sha3
}
...
...
@@ -29,7 +29,7 @@ function readFromStorage (slot, storageContent) {
if
(
storageContent
[
hexSlot
]
!==
undefined
)
{
ret
=
storageContent
[
hexSlot
].
replace
(
/^0x/
,
''
)
}
else
{
ret
=
'000000000000000000000000000000000000000000000000000000000000000
0
'
ret
=
'000000000000000000000000000000000000000000000000000000000000000'
}
}
if
(
ret
.
length
<
64
)
{
...
...
@@ -57,7 +57,7 @@ function extractHexByteSlice (slotValue, byteLength, offsetFromLSB) {
* @param {Object} storageContent - full storage mapping.
* @param {Int} byteLength - Length of the byte slice to extract
*/
function
extractHex
Byt
e
(
location
,
storageContent
,
byteLength
)
{
function
extractHex
Valu
e
(
location
,
storageContent
,
byteLength
)
{
var
slotvalue
=
readFromStorage
(
location
.
slot
,
storageContent
)
return
extractHexByteSlice
(
slotvalue
,
byteLength
,
location
.
offset
)
}
...
...
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