aboutsummaryrefslogblamecommitdiffstats
path: root/xeth/state.go
blob: 0f6a042b30990cddd70ddc1259a74c878ca83566 (plain) (tree)
1
2
3
4
5
6
7
8
9
            
 
                                              
 
                   

                            

 

                                                          

 
                                           
                         

 
                                             
                                                                

 
                                                 


                                          
                                                            
                                                          
                          
                                                                                     

         
                     
 
package xeth

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

type State struct {
    xeth  *XEth
    state *state.StateDB
}

func NewState(xeth *XEth, statedb *state.StateDB) *State {
    return &State{xeth, statedb}
}

func (self *State) State() *state.StateDB {
    return self.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.StateDb())
    }

    return object
}