aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/world.go
diff options
context:
space:
mode:
Diffstat (limited to 'xeth/world.go')
-rw-r--r--xeth/world.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/xeth/world.go b/xeth/world.go
new file mode 100644
index 000000000..9cbdd9461
--- /dev/null
+++ b/xeth/world.go
@@ -0,0 +1,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.TransState()
+}
+
+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
+}