pull/7/head
yann300 8 years ago
parent 3ea4abeb7b
commit ef848d4436
  1. 10
      src/solidity/decodeInfo.js
  2. 2
      src/solidity/types/Struct.js

@ -170,7 +170,7 @@ function getStructMembers (typeName, stateDefinitions) {
var offsets = computeOffsets(dec.children, stateDefinitions) var offsets = computeOffsets(dec.children, stateDefinitions)
return { return {
members: offsets.typesOffsets, members: offsets.typesOffsets,
storageBytes: offsets.endLocation.slot storageSlots: offsets.endLocation.slot
} }
} }
} }
@ -238,14 +238,14 @@ function computeOffsets (types, stateItems, cb) {
for (var i in types) { for (var i in types) {
var variable = types[i] var variable = types[i]
var type = parseType(variable.attributes.type, stateItems) var type = parseType(variable.attributes.type, stateItems)
if (location.offset + type.storageBytes > 32) {
location.slot++
location.offset = 0
}
if (!type) { if (!type) {
console.log('unable to retrieve decode info of ' + variable.attributes.type) console.log('unable to retrieve decode info of ' + variable.attributes.type)
return null return null
} }
if (location.offset + type.storageBytes > 32) {
location.slot++
location.offset = 0
}
ret.push({ ret.push({
name: variable.attributes.name, name: variable.attributes.name,
type: type, type: type,

@ -1,7 +1,7 @@
'use strict' 'use strict'
function Struct (memberDetails) { function Struct (memberDetails) {
this.storageSlots = memberDetails.storageBytes this.storageSlots = memberDetails.storageSlots
this.storageBytes = 32 this.storageBytes = 32
this.members = memberDetails.members this.members = memberDetails.members
this.typeName = 'struct' this.typeName = 'struct'

Loading…
Cancel
Save