renaming extractHexByte -> extractHexValue

pull/7/head
yann300 8 years ago
parent bdf77eb7e8
commit da4cba0759
  1. 2
      src/solidity/types/Address.js
  2. 2
      src/solidity/types/Bool.js
  3. 2
      src/solidity/types/DynamicByteArray.js
  4. 2
      src/solidity/types/Enum.js
  5. 2
      src/solidity/types/FixedByteArray.js
  6. 6
      src/solidity/types/util.js

@ -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 () {
} }
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 () {
} }
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) {
} }
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) {
} }
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
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) {
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) {
* @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)
} }

Loading…
Cancel
Save