From ce16924682542c5b410dc1baee49e61bca436465 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 22 May 2017 15:31:09 +0200 Subject: [PATCH] use helper --- src/solidity/types/Mapping.js | 4 ++-- src/solidity/types/util.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/solidity/types/Mapping.js b/src/solidity/types/Mapping.js index ae21c774c..e540a6c6a 100644 --- a/src/solidity/types/Mapping.js +++ b/src/solidity/types/Mapping.js @@ -19,8 +19,8 @@ class Mapping extends RefType { type: this.type } } - var mapSlot = util.toBN(location.slot).toString(16) - mapSlot = ethutil.setLengthLeft('0x' + mapSlot, 32).toString('hex') + var mapSlot = util.normalizeHex(ethutil.bufferToHex(location.slot)) + console.log(mapSlot, mappingsPreimages) var mappingPreimages = mappingsPreimages[mapSlot] var ret = {} for (var i in mappingPreimages) { diff --git a/src/solidity/types/util.js b/src/solidity/types/util.js index 3bf63f03d..35918aedb 100644 --- a/src/solidity/types/util.js +++ b/src/solidity/types/util.js @@ -10,7 +10,8 @@ module.exports = { toBN: toBN, add: add, extractLocation: extractLocation, - removeLocation: removeLocation + removeLocation: removeLocation, + normalizeHex: normalizeHex } function decodeIntFromHex (value, byteLength, signed) {