aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/config.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-10-31 21:30:08 +0800
committerobscuren <geffobscura@gmail.com>2014-10-31 21:30:08 +0800
commit0ed1a8b50a9b9726cd57a2731d0405f6949c6188 (patch)
tree9f877ecdc89b784cd2820db8ca3f1de6e9c4d3e9 /xeth/config.go
parent8826e9694c3a8d4f480f0a021d8c02f7f61612c6 (diff)
downloaddexon-0ed1a8b50a9b9726cd57a2731d0405f6949c6188.tar.gz
dexon-0ed1a8b50a9b9726cd57a2731d0405f6949c6188.tar.zst
dexon-0ed1a8b50a9b9726cd57a2731d0405f6949c6188.zip
ethpipe => xeth (eXtended ETHereum)
Diffstat (limited to 'xeth/config.go')
-rw-r--r--xeth/config.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/xeth/config.go b/xeth/config.go
new file mode 100644
index 000000000..34aa9e32d
--- /dev/null
+++ b/xeth/config.go
@@ -0,0 +1,33 @@
+package xeth
+
+import "github.com/ethereum/go-ethereum/ethutil"
+
+var cnfCtr = ethutil.Hex2Bytes("661005d2720d855f1d9976f88bb10c1a3398c77f")
+
+type Config struct {
+ pipe *XEth
+}
+
+func (self *Config) Get(name string) *Object {
+ configCtrl := self.pipe.World().safeGet(cnfCtr)
+ var addr []byte
+
+ switch name {
+ case "NameReg":
+ addr = []byte{0}
+ case "DnsReg":
+ objectAddr := configCtrl.GetStorage(ethutil.BigD([]byte{0}))
+ domainAddr := (&Object{self.pipe.World().safeGet(objectAddr.Bytes())}).StorageString("DnsReg").Bytes()
+ return &Object{self.pipe.World().safeGet(domainAddr)}
+ 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
+}