Commit f9440aa8 authored by yann300's avatar yann300

dyn byte array decoding

parent 50b2b460
......@@ -57,4 +57,22 @@ DynamicByteArray.prototype.decodeFromMemory = function (offset, memory) {
}
}
DynamicByteArray.prototype.decodeLocals = function (stackHeight, stack, memory) {
if (stack.length - 1 < stackHeight) {
return {
value: '0x',
length: '0x'
}
} else {
var offset = stack[stack.length - 1 - stackHeight]
offset = 2 * parseInt(offset, 16)
var length = memory.substr(offset, 64)
length = parseInt(length, 16)
return {
length: 2 * length,
value: '0x' + memory.substr(offset + 64, 2 * length)
}
}
}
module.exports = DynamicByteArray
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment