mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-25 12:57:17 +00:00
30 lines
608 B
Go
30 lines
608 B
Go
package ethpipe
|
|
|
|
import "github.com/ethereum/eth-go/ethutil"
|
|
|
|
var cnfCtr = ethutil.Hex2Bytes("661005d2720d855f1d9976f88bb10c1a3398c77f")
|
|
|
|
type config struct {
|
|
pipe *Pipe
|
|
}
|
|
|
|
func (self *config) Get(name string) *object {
|
|
configCtrl := self.pipe.World().safeGet(cnfCtr)
|
|
var addr []byte
|
|
|
|
switch name {
|
|
case "NameReg":
|
|
addr = []byte{0}
|
|
default:
|
|
addr = ethutil.RightPadBytes([]byte(name), 32)
|
|
}
|
|
|
|
objectAddr := configCtrl.GetStorage(ethutil.BigD(addr))
|
|
|
|
return &object{self.pipe.World().safeGet(objectAddr.Bytes())}
|
|
}
|
|
|
|
func (self *config) Exist() bool {
|
|
return self.pipe.World().Get(cnfCtr) != nil
|
|
}
|