diff --git a/src/solidity/types/Enum.js b/src/solidity/types/Enum.js index f8950209b5..b2aad9e05e 100644 --- a/src/solidity/types/Enum.js +++ b/src/solidity/types/Enum.js @@ -30,6 +30,13 @@ Enum.prototype.decodeLocals = function (stackHeight, stack, memory) { return output(defaultValue, this.enumDef) } +Enum.prototype.decodeFromMemory = function (offset, memory) { + var value = memory.substr(offset, 64) + value = util.extractHexByteSlice(value, this.storageBytes, 0) + value = parseInt(value, 16) + return output(value, this.enumDef) +} + function output (value, enumDef) { if (enumDef.children.length > value) { return enumDef.children[value].attributes.name diff --git a/src/solidity/types/Int.js b/src/solidity/types/Int.js index 36839868ee..87934a2cb6 100644 --- a/src/solidity/types/Int.js +++ b/src/solidity/types/Int.js @@ -19,4 +19,9 @@ Int.prototype.decodeLocals = function (stackHeight, stack, memory) { } } +Int.prototype.decodeFromMemory = function (offset, memory) { + var value = memory.substr(offset, 64) + return util.decodeIntFromHex(value, 32, true) +} + module.exports = Int diff --git a/src/solidity/types/Uint.js b/src/solidity/types/Uint.js index c5d65bf6a7..815b2c8e6a 100644 --- a/src/solidity/types/Uint.js +++ b/src/solidity/types/Uint.js @@ -19,4 +19,9 @@ Uint.prototype.decodeLocals = function (stackHeight, stack, memory) { } } +Uint.prototype.decodeFromMemory = function (offset, memory) { + var value = memory.substr(offset, 64) + return util.decodeIntFromHex(value, this.storageBytes, false) +} + module.exports = Uint