dyn byte array decoding

pull/7/head
yann300 8 years ago
parent 50b2b4606a
commit f9440aa86d
  1. 18
      src/solidity/types/DynamicByteArray.js

@ -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 module.exports = DynamicByteArray

Loading…
Cancel
Save