diff --git a/src/solidity/types/Address.js b/src/solidity/types/Address.js index 3492010489..edea15e5f4 100644 --- a/src/solidity/types/Address.js +++ b/src/solidity/types/Address.js @@ -13,7 +13,7 @@ Address.prototype.decodeFromStorage = function (location, storageContent) { } Address.prototype.decodeLocals = function (stackHeight, stack, memory) { - if (stack.length < stackHeight) { + if (stack.length - 1 < stackHeight) { return '0x0000000000000000000000000000000000000000' } else { return '0x' + util.extractHexByteSlice(stack[stack.length - 1 - stackHeight], this.storageBytes, 0) diff --git a/src/solidity/types/Int.js b/src/solidity/types/Int.js index 3d4c1e6a09..36839868ee 100644 --- a/src/solidity/types/Int.js +++ b/src/solidity/types/Int.js @@ -12,7 +12,7 @@ Int.prototype.decodeFromStorage = function (location, storageContent) { } Int.prototype.decodeLocals = function (stackHeight, stack, memory) { - if (stack.length < stackHeight) { + if (stack.length - 1 < stackHeight) { return '0' } else { return util.decodeIntFromHex(stack[stack.length - 1 - stackHeight].replace('0x', ''), 32, true) diff --git a/src/solidity/types/Uint.js b/src/solidity/types/Uint.js index 95fa2880a2..c5d65bf6a7 100644 --- a/src/solidity/types/Uint.js +++ b/src/solidity/types/Uint.js @@ -12,7 +12,7 @@ Uint.prototype.decodeFromStorage = function (location, storageContent) { } Uint.prototype.decodeLocals = function (stackHeight, stack, memory) { - if (stack.length < stackHeight) { + if (stack.length - 1 < stackHeight) { return '0' } else { return util.decodeIntFromHex(stack[stack.length - 1 - stackHeight].replace('0x', ''), this.storageBytes, false)