aboutsummaryrefslogtreecommitdiffstats
path: root/ethpub
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-07-24 20:16:04 +0800
committerobscuren <geffobscura@gmail.com>2014-07-24 20:16:04 +0800
commit702cf5a3e19e33616e7e98ec8ab7a00d56dd7e85 (patch)
treecf025478adbc2243a5b11d4c5e1dda7acf0d3086 /ethpub
parent92b16618edf6bbb6d98659050d8bf0d538285491 (diff)
parentdcf4fad97156f431612ed3915e167ce5a5314588 (diff)
downloadgo-tangerine-702cf5a3e19e33616e7e98ec8ab7a00d56dd7e85.tar
go-tangerine-702cf5a3e19e33616e7e98ec8ab7a00d56dd7e85.tar.gz
go-tangerine-702cf5a3e19e33616e7e98ec8ab7a00d56dd7e85.tar.bz2
go-tangerine-702cf5a3e19e33616e7e98ec8ab7a00d56dd7e85.tar.lz
go-tangerine-702cf5a3e19e33616e7e98ec8ab7a00d56dd7e85.tar.xz
go-tangerine-702cf5a3e19e33616e7e98ec8ab7a00d56dd7e85.tar.zst
go-tangerine-702cf5a3e19e33616e7e98ec8ab7a00d56dd7e85.zip
Merge branch 'feature/refactor_vm' into develop
Diffstat (limited to 'ethpub')
-rw-r--r--ethpub/pub.go11
-rw-r--r--ethpub/types.go15
2 files changed, 17 insertions, 9 deletions
diff --git a/ethpub/pub.go b/ethpub/pub.go
index 5d01a7a44..7cc7cf6ce 100644
--- a/ethpub/pub.go
+++ b/ethpub/pub.go
@@ -6,6 +6,7 @@ import (
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethcrypto"
"github.com/ethereum/eth-go/ethlog"
+ "github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethutil"
"math/big"
"strings"
@@ -24,11 +25,11 @@ type helper struct {
func EthereumConfig(stateManager *ethchain.StateManager) helper {
return helper{stateManager}
}
-func (self helper) obj() *ethchain.StateObject {
+func (self helper) obj() *ethstate.StateObject {
return self.sm.CurrentState().GetStateObject(cnfCtr)
}
-func (self helper) NameReg() *ethchain.StateObject {
+func (self helper) NameReg() *ethstate.StateObject {
if self.obj() != nil {
addr := self.obj().GetStorage(big.NewInt(0))
if len(addr.Bytes()) > 0 {
@@ -48,6 +49,12 @@ type PEthereum struct {
}
func NewPEthereum(manager ethchain.EthManager) *PEthereum {
+ logger.Warnln("DEPRECATED: ethpub.New should be used in favour of ethpub.NewPEthereum")
+
+ return New(manager)
+}
+
+func New(manager ethchain.EthManager) *PEthereum {
return &PEthereum{
manager,
manager.StateManager(),
diff --git a/ethpub/types.go b/ethpub/types.go
index 52ea5a6bb..5cfa2705e 100644
--- a/ethpub/types.go
+++ b/ethpub/types.go
@@ -5,6 +5,7 @@ import (
"fmt"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethcrypto"
+ "github.com/ethereum/eth-go/ethstate"
"github.com/ethereum/eth-go/ethtrie"
"github.com/ethereum/eth-go/ethutil"
"strings"
@@ -154,10 +155,10 @@ func NewPReciept(contractCreation bool, creationAddress, hash, address []byte) *
}
type PStateObject struct {
- object *ethchain.StateObject
+ object *ethstate.StateObject
}
-func NewPStateObject(object *ethchain.StateObject) *PStateObject {
+func NewPStateObject(object *ethstate.StateObject) *PStateObject {
return &PStateObject{object: object}
}
@@ -200,7 +201,7 @@ func (c *PStateObject) Nonce() int {
func (c *PStateObject) Root() string {
if c.object != nil {
- return ethutil.Bytes2Hex(ethutil.NewValue(c.object.State().Root()).Bytes())
+ return ethutil.Bytes2Hex(ethutil.NewValue(c.object.State.Root()).Bytes())
}
return "<err>"
@@ -208,7 +209,7 @@ func (c *PStateObject) Root() string {
func (c *PStateObject) IsContract() bool {
if c.object != nil {
- return len(c.object.Script()) > 0
+ return len(c.object.Code) > 0
}
return false
@@ -245,7 +246,7 @@ func (c *PStateObject) StateKeyVal(asJson bool) interface{} {
func (c *PStateObject) Script() string {
if c.object != nil {
- return strings.Join(ethchain.Disassemble(c.object.Script()), " ")
+ return strings.Join(ethchain.Disassemble(c.object.Code), " ")
}
return ""
@@ -253,7 +254,7 @@ func (c *PStateObject) Script() string {
func (c *PStateObject) HexScript() string {
if c.object != nil {
- return ethutil.Bytes2Hex(c.object.Script())
+ return ethutil.Bytes2Hex(c.object.Code)
}
return ""
@@ -265,6 +266,6 @@ type PStorageState struct {
Value string
}
-func NewPStorageState(storageObject *ethchain.StorageState) *PStorageState {
+func NewPStorageState(storageObject *ethstate.StorageState) *PStorageState {
return &PStorageState{ethutil.Bytes2Hex(storageObject.StateAddress), ethutil.Bytes2Hex(storageObject.Address), storageObject.Value.String()}
}