ethpipe => xeth (eXtended ETHereum)

This commit is contained in:
obscuren
2014-10-31 14:30:08 +01:00
parent 8826e9694c
commit 0ed1a8b50a
19 changed files with 112 additions and 108 deletions

26
xeth/object.go Normal file
View File

@ -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))
}