From 4f0bda403ea332eeb477f8e56457423628772b19 Mon Sep 17 00:00:00 2001
From: obscuren <geffobscura@gmail.com>
Date: Tue, 5 Aug 2014 11:10:24 +0200
Subject: Added vm options for object execution

---
 ethpipe/object.go | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 ethpipe/object.go

(limited to 'ethpipe/object.go')

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))
+}
-- 
cgit v1.2.3


From e71b198e3d8df1bd8b73bae9bc934b778a3115bf Mon Sep 17 00:00:00 2001
From: obscuren <geffobscura@gmail.com>
Date: Tue, 5 Aug 2014 11:26:12 +0200
Subject: Renamed object to Object

---
 ethpipe/object.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'ethpipe/object.go')

diff --git a/ethpipe/object.go b/ethpipe/object.go
index ebfb5b904..f0032992c 100644
--- a/ethpipe/object.go
+++ b/ethpipe/object.go
@@ -5,11 +5,11 @@ import (
 	"github.com/ethereum/eth-go/ethutil"
 )
 
-type object struct {
+type Object struct {
 	*ethstate.StateObject
 }
 
-func (self *object) StorageString(str string) *ethutil.Value {
+func (self *Object) StorageString(str string) *ethutil.Value {
 	if ethutil.IsHex(str) {
 		return self.Storage(ethutil.Hex2Bytes(str[2:]))
 	} else {
@@ -17,10 +17,10 @@ func (self *object) StorageString(str string) *ethutil.Value {
 	}
 }
 
-func (self *object) StorageValue(addr *ethutil.Value) *ethutil.Value {
+func (self *Object) StorageValue(addr *ethutil.Value) *ethutil.Value {
 	return self.Storage(addr.Bytes())
 }
 
-func (self *object) Storage(addr []byte) *ethutil.Value {
+func (self *Object) Storage(addr []byte) *ethutil.Value {
 	return self.StateObject.GetStorage(ethutil.BigD(addr))
 }
-- 
cgit v1.2.3