forked from cerc-io/plugeth
Renamed object to Object
This commit is contained in:
parent
4f0bda403e
commit
e71b198e3d
@ -8,7 +8,7 @@ type config struct {
|
|||||||
pipe *Pipe
|
pipe *Pipe
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *config) Get(name string) *object {
|
func (self *config) Get(name string) *Object {
|
||||||
configCtrl := self.pipe.World().safeGet(cnfCtr)
|
configCtrl := self.pipe.World().safeGet(cnfCtr)
|
||||||
var addr []byte
|
var addr []byte
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ func (self *config) Get(name string) *object {
|
|||||||
|
|
||||||
objectAddr := configCtrl.GetStorage(ethutil.BigD(addr))
|
objectAddr := configCtrl.GetStorage(ethutil.BigD(addr))
|
||||||
|
|
||||||
return &object{self.pipe.World().safeGet(objectAddr.Bytes())}
|
return &Object{self.pipe.World().safeGet(objectAddr.Bytes())}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *config) Exist() bool {
|
func (self *config) Exist() bool {
|
||||||
|
@ -5,11 +5,11 @@ import (
|
|||||||
"github.com/ethereum/eth-go/ethutil"
|
"github.com/ethereum/eth-go/ethutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
type object struct {
|
type Object struct {
|
||||||
*ethstate.StateObject
|
*ethstate.StateObject
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *object) StorageString(str string) *ethutil.Value {
|
func (self *Object) StorageString(str string) *ethutil.Value {
|
||||||
if ethutil.IsHex(str) {
|
if ethutil.IsHex(str) {
|
||||||
return self.Storage(ethutil.Hex2Bytes(str[2:]))
|
return self.Storage(ethutil.Hex2Bytes(str[2:]))
|
||||||
} else {
|
} 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())
|
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))
|
return self.StateObject.GetStorage(ethutil.BigD(addr))
|
||||||
}
|
}
|
||||||
|
@ -46,10 +46,10 @@ func (self *Pipe) Nonce(addr []byte) uint64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *Pipe) Execute(addr []byte, data []byte, value, gas, price *ethutil.Value) ([]byte, error) {
|
func (self *Pipe) Execute(addr []byte, data []byte, value, gas, price *ethutil.Value) ([]byte, error) {
|
||||||
return self.ExecuteObject(&object{self.World().safeGet(addr)}, data, value, gas, price)
|
return self.ExecuteObject(&Object{self.World().safeGet(addr)}, data, value, gas, price)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Pipe) ExecuteObject(object *object, data []byte, value, gas, price *ethutil.Value) ([]byte, error) {
|
func (self *Pipe) ExecuteObject(object *Object, data []byte, value, gas, price *ethutil.Value) ([]byte, error) {
|
||||||
var (
|
var (
|
||||||
initiator = ethstate.NewStateObject([]byte{0})
|
initiator = ethstate.NewStateObject([]byte{0})
|
||||||
block = self.blockChain.CurrentBlock
|
block = self.blockChain.CurrentBlock
|
||||||
|
@ -26,8 +26,8 @@ func (self *world) State() *ethstate.State {
|
|||||||
return self.pipe.stateManager.CurrentState()
|
return self.pipe.stateManager.CurrentState()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *world) Get(addr []byte) *object {
|
func (self *world) Get(addr []byte) *Object {
|
||||||
return &object{self.State().GetStateObject(addr)}
|
return &Object{self.State().GetStateObject(addr)}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *world) safeGet(addr []byte) *ethstate.StateObject {
|
func (self *world) safeGet(addr []byte) *ethstate.StateObject {
|
||||||
|
Loading…
Reference in New Issue
Block a user