aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/object.go
blob: a4ac41e8921d2499b739b22b15e06fa03661e80a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package xeth

import (
    "github.com/ethereum/go-ethereum/ethutil"
    "github.com/ethereum/go-ethereum/state"
)

type Object struct {
    *state.StateObject
}

func (self *Object) StorageString(str string) *ethutil.Value {
    if ethutil.IsHex(str) {
        return self.Storage(ethutil.Hex2Bytes(str[2:]))
    } else {
        return self.Storage(ethutil.RightPadBytes([]byte(str), 32))
    }
}

func (self *Object) StorageValue(addr *ethutil.Value) *ethutil.Value {
    return self.Storage(addr.Bytes())
}

func (self *Object) Storage(addr []byte) *ethutil.Value {
    return self.StateObject.GetStorage(ethutil.BigD(addr))
}