dyn byte array decoding

pull/7/head
yann300 8 years ago
parent 58e603c7f1
commit e2413efbf9
  1. 18
      src/solidity/types/DynamicByteArray.js

@ -35,4 +35,22 @@ DynamicByteArray.prototype.decodeFromStorage = function (location, storageConten
}
}
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

Loading…
Cancel
Save