aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/object.go
diff options
context:
space:
mode:
Diffstat (limited to 'xeth/object.go')
-rw-r--r--xeth/object.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/xeth/object.go b/xeth/object.go
new file mode 100644
index 000000000..fe4e84a4a
--- /dev/null
+++ b/xeth/object.go
@@ -0,0 +1,26 @@
+package xeth
+
+import (
+ "github.com/ethereum/go-ethereum/ethstate"
+ "github.com/ethereum/go-ethereum/ethutil"
+)
+
+type Object struct {
+ *ethstate.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))
+}