Commit da4cba07 authored by yann300's avatar yann300

renaming extractHexByte -> extractHexValue

parent bdf77eb7
...@@ -8,7 +8,7 @@ function Address () { ...@@ -8,7 +8,7 @@ function Address () {
} }
Address.prototype.decodeFromStorage = function (location, storageContent) { Address.prototype.decodeFromStorage = function (location, storageContent) {
var value = util.extractHexByte(location, storageContent, this.storageBytes) var value = util.extractHexValue(location, storageContent, this.storageBytes)
return '0x' + value.toUpperCase() return '0x' + value.toUpperCase()
} }
......
...@@ -8,7 +8,7 @@ function Bool () { ...@@ -8,7 +8,7 @@ function Bool () {
} }
Bool.prototype.decodeFromStorage = function (location, storageContent) { Bool.prototype.decodeFromStorage = function (location, storageContent) {
var value = util.extractHexByte(location, storageContent, this.storageBytes) var value = util.extractHexValue(location, storageContent, this.storageBytes)
return value !== '00' return value !== '00'
} }
......
...@@ -9,7 +9,7 @@ function DynamicByteArray () { ...@@ -9,7 +9,7 @@ function DynamicByteArray () {
} }
DynamicByteArray.prototype.decodeFromStorage = function (location, storageContent) { DynamicByteArray.prototype.decodeFromStorage = function (location, storageContent) {
var value = util.extractHexByte(location, storageContent, this.storageBytes) var value = util.extractHexValue(location, storageContent, this.storageBytes)
var bn = new BN(value, 16) var bn = new BN(value, 16)
if (bn.testn(0)) { if (bn.testn(0)) {
var length = bn.div(new BN(2)) var length = bn.div(new BN(2))
......
...@@ -14,7 +14,7 @@ function Enum (enumDef) { ...@@ -14,7 +14,7 @@ function Enum (enumDef) {
} }
Enum.prototype.decodeFromStorage = function (location, storageContent) { Enum.prototype.decodeFromStorage = function (location, storageContent) {
var value = util.extractHexByte(location, storageContent, this.storageBytes) var value = util.extractHexValue(location, storageContent, this.storageBytes)
value = parseInt(value, 16) value = parseInt(value, 16)
if (this.enumDef.children.length > value) { if (this.enumDef.children.length > value) {
return this.enumDef.children[value].attributes.name return this.enumDef.children[value].attributes.name
......
...@@ -8,7 +8,7 @@ function FixedByteArray (storageBytes) { ...@@ -8,7 +8,7 @@ function FixedByteArray (storageBytes) {
} }
FixedByteArray.prototype.decodeFromStorage = function (location, storageContent) { FixedByteArray.prototype.decodeFromStorage = function (location, storageContent) {
var value = util.extractHexByte(location, storageContent, this.storageBytes) var value = util.extractHexValue(location, storageContent, this.storageBytes)
return '0x' + value.toUpperCase() return '0x' + value.toUpperCase()
} }
......
...@@ -5,7 +5,7 @@ var BN = require('ethereumjs-util').BN ...@@ -5,7 +5,7 @@ var BN = require('ethereumjs-util').BN
module.exports = { module.exports = {
readFromStorage: readFromStorage, readFromStorage: readFromStorage,
decodeInt: decodeInt, decodeInt: decodeInt,
extractHexByte: extractHexByte, extractHexValue: extractHexValue,
sha3: sha3 sha3: sha3
} }
...@@ -29,7 +29,7 @@ function readFromStorage (slot, storageContent) { ...@@ -29,7 +29,7 @@ function readFromStorage (slot, storageContent) {
if (storageContent[hexSlot] !== undefined) { if (storageContent[hexSlot] !== undefined) {
ret = storageContent[hexSlot].replace(/^0x/, '') ret = storageContent[hexSlot].replace(/^0x/, '')
} else { } else {
ret = '0000000000000000000000000000000000000000000000000000000000000000' ret = '000000000000000000000000000000000000000000000000000000000000000'
} }
} }
if (ret.length < 64) { if (ret.length < 64) {
...@@ -57,7 +57,7 @@ function extractHexByteSlice (slotValue, byteLength, offsetFromLSB) { ...@@ -57,7 +57,7 @@ function extractHexByteSlice (slotValue, byteLength, offsetFromLSB) {
* @param {Object} storageContent - full storage mapping. * @param {Object} storageContent - full storage mapping.
* @param {Int} byteLength - Length of the byte slice to extract * @param {Int} byteLength - Length of the byte slice to extract
*/ */
function extractHexByte (location, storageContent, byteLength) { function extractHexValue (location, storageContent, byteLength) {
var slotvalue = readFromStorage(location.slot, storageContent) var slotvalue = readFromStorage(location.slot, storageContent)
return extractHexByteSlice(slotvalue, byteLength, location.offset) return extractHexByteSlice(slotvalue, byteLength, location.offset)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment