aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-05-05 19:01:02 +0800
committerMaran <maran.hidskes@gmail.com>2014-05-05 19:01:02 +0800
commit39b8c83ba66d429d04fa8b9be62813c848f0d606 (patch)
treec30a3e6d8ed47ee3fa7152cc795550c120007658
parent4f20e8f649a19168718a7f0fe7619e3bdb626aa8 (diff)
downloadgo-tangerine-39b8c83ba66d429d04fa8b9be62813c848f0d606.tar
go-tangerine-39b8c83ba66d429d04fa8b9be62813c848f0d606.tar.gz
go-tangerine-39b8c83ba66d429d04fa8b9be62813c848f0d606.tar.bz2
go-tangerine-39b8c83ba66d429d04fa8b9be62813c848f0d606.tar.lz
go-tangerine-39b8c83ba66d429d04fa8b9be62813c848f0d606.tar.xz
go-tangerine-39b8c83ba66d429d04fa8b9be62813c848f0d606.tar.zst
go-tangerine-39b8c83ba66d429d04fa8b9be62813c848f0d606.zip
Impelemented GetStorageAt
-rw-r--r--etherpc/packages.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/etherpc/packages.go b/etherpc/packages.go
index 271a59879..85306d3d7 100644
--- a/etherpc/packages.go
+++ b/etherpc/packages.go
@@ -115,9 +115,6 @@ func (a *NewTxArgs) requirementsContract() error {
if a.GasPrice == "" {
return NewErrorResponse("Create requires a 'gasprice' value as argument")
}
- if a.Init == "" {
- return NewErrorResponse("Create requires a 'init' value as argument")
- }
if a.Body == "" {
return NewErrorResponse("Create requires a 'body' value as argument")
}
@@ -144,7 +141,8 @@ func (p *MainPackage) Create(args *NewTxArgs, reply *string) error {
return nil
}
-func (p *MainPackage) getKey(args interface{}, reply *string) error {
+func (p *MainPackage) GetKey(args interface{}, reply *string) error {
+ *reply = NewSuccessRes(p.ethp.GetKey())
return nil
}
@@ -163,11 +161,20 @@ func (a *GetStorageArgs) requirements() error {
return nil
}
-func (p *MainPackage) getStorageAt(args *GetStorageArgs, reply *string) error {
+type GetStorageAtRes struct {
+ Key string `json:"key"`
+ Value string `json:"value"`
+ Address string `json:"address"`
+}
+
+func (p *MainPackage) GetStorageAt(args *GetStorageArgs, reply *string) error {
err := args.requirements()
if err != nil {
return err
}
+ state := p.ethp.GetStateObject(args.Address)
+ value := state.GetStorage(args.Key)
+ *reply = NewSuccessRes(&GetStorageAtRes{Address: args.Address, Key: args.Key, Value: value})
return nil
}