aboutsummaryrefslogtreecommitdiffstats
path: root/ethpipe/object.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-08-05 17:10:24 +0800
committerobscuren <geffobscura@gmail.com>2014-08-05 17:10:24 +0800
commit4f0bda403ea332eeb477f8e56457423628772b19 (patch)
treea601453b364160a3af94ee324e198fcb304fc5a4 /ethpipe/object.go
parentc215bbadf13ec70e4d1b65e67d4ff4568d644542 (diff)
downloaddexon-4f0bda403ea332eeb477f8e56457423628772b19.tar.gz
dexon-4f0bda403ea332eeb477f8e56457423628772b19.tar.zst
dexon-4f0bda403ea332eeb477f8e56457423628772b19.zip
Added vm options for object execution
Diffstat (limited to 'ethpipe/object.go')
-rw-r--r--ethpipe/object.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/ethpipe/object.go b/ethpipe/object.go
new file mode 100644
index 000000000..ebfb5b904
--- /dev/null
+++ b/ethpipe/object.go
@@ -0,0 +1,26 @@
+package ethpipe
+
+import (
+ "github.com/ethereum/eth-go/ethstate"
+ "github.com/ethereum/eth-go/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))
+}