aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/world.go
blob: cdceec50d4d1b26b640b953060a1f0e0b8a86197 (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
27
28
29
30
31
32
package xeth

import "github.com/ethereum/go-ethereum/state"

type State struct {
    xeth *XEth
}

func NewState(xeth *XEth) *State {
    return &State{xeth}
}

func (self *State) State() *state.StateDB {
    return self.xeth.chainManager.State()
}

func (self *State) Get(addr string) *Object {
    return &Object{self.State().GetStateObject(fromHex(addr))}
}

func (self *State) SafeGet(addr string) *Object {
    return &Object{self.safeGet(addr)}
}

func (self *State) safeGet(addr string) *state.StateObject {
    object := self.State().GetStateObject(fromHex(addr))
    if object == nil {
        object = state.NewStateObject(fromHex(addr), self.xeth.eth.Db())
    }

    return object
}