From da4cba07593f6c5edba2d0ff7249ab909321bd79 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 28 Nov 2016 12:50:56 +0100 Subject: [PATCH] renaming extractHexByte -> extractHexValue --- src/solidity/types/Address.js | 2 +- src/solidity/types/Bool.js | 2 +- src/solidity/types/DynamicByteArray.js | 2 +- src/solidity/types/Enum.js | 2 +- src/solidity/types/FixedByteArray.js | 2 +- src/solidity/types/util.js | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/solidity/types/Address.js b/src/solidity/types/Address.js index 370dfc7dc1..9ff6d84cf6 100644 --- a/src/solidity/types/Address.js +++ b/src/solidity/types/Address.js @@ -8,7 +8,7 @@ function Address () { } 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() } diff --git a/src/solidity/types/Bool.js b/src/solidity/types/Bool.js index 7ec6caf17a..6889b909da 100644 --- a/src/solidity/types/Bool.js +++ b/src/solidity/types/Bool.js @@ -8,7 +8,7 @@ function Bool () { } 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' } diff --git a/src/solidity/types/DynamicByteArray.js b/src/solidity/types/DynamicByteArray.js index 934ff58d4a..c09b41b189 100644 --- a/src/solidity/types/DynamicByteArray.js +++ b/src/solidity/types/DynamicByteArray.js @@ -9,7 +9,7 @@ function DynamicByteArray () { } 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) if (bn.testn(0)) { var length = bn.div(new BN(2)) diff --git a/src/solidity/types/Enum.js b/src/solidity/types/Enum.js index 14d6c139ef..e8aca6a9cd 100644 --- a/src/solidity/types/Enum.js +++ b/src/solidity/types/Enum.js @@ -14,7 +14,7 @@ function Enum (enumDef) { } 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) if (this.enumDef.children.length > value) { return this.enumDef.children[value].attributes.name diff --git a/src/solidity/types/FixedByteArray.js b/src/solidity/types/FixedByteArray.js index 8022a983b0..36c9cdd7d1 100644 --- a/src/solidity/types/FixedByteArray.js +++ b/src/solidity/types/FixedByteArray.js @@ -8,7 +8,7 @@ function FixedByteArray (storageBytes) { } 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() } diff --git a/src/solidity/types/util.js b/src/solidity/types/util.js index 8855fa40a3..cf8c2659c8 100644 --- a/src/solidity/types/util.js +++ b/src/solidity/types/util.js @@ -5,7 +5,7 @@ var BN = require('ethereumjs-util').BN module.exports = { readFromStorage: readFromStorage, decodeInt: decodeInt, - extractHexByte: extractHexByte, + extractHexValue: extractHexValue, sha3: sha3 } @@ -29,7 +29,7 @@ function readFromStorage (slot, storageContent) { if (storageContent[hexSlot] !== undefined) { ret = storageContent[hexSlot].replace(/^0x/, '') } else { - ret = '0000000000000000000000000000000000000000000000000000000000000000' + 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 extractHexByte (location, storageContent, byteLength) { +function extractHexValue (location, storageContent, byteLength) { var slotvalue = readFromStorage(location.slot, storageContent) return extractHexByteSlice(slotvalue, byteLength, location.offset) }