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) {