aboutsummaryrefslogtreecommitdiffstats
path: root/vm/environment.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-22 01:18:19 +0800
committerobscuren <geffobscura@gmail.com>2015-03-22 01:18:19 +0800
commit7f85608f30a2e34005c8d15566849229c758c2f1 (patch)
tree7aeb9d8bdfda7ec10ea38688a96ed245028764ad /vm/environment.go
parent09766d1729f7530093aec7e9acd3e5339b2c2028 (diff)
parentfcacfabe1959c4aff6a63cb4e275f65328660601 (diff)
downloaddexon-7f85608f30a2e34005c8d15566849229c758c2f1.tar
dexon-7f85608f30a2e34005c8d15566849229c758c2f1.tar.gz
dexon-7f85608f30a2e34005c8d15566849229c758c2f1.tar.bz2
dexon-7f85608f30a2e34005c8d15566849229c758c2f1.tar.lz
dexon-7f85608f30a2e34005c8d15566849229c758c2f1.tar.xz
dexon-7f85608f30a2e34005c8d15566849229c758c2f1.tar.zst
dexon-7f85608f30a2e34005c8d15566849229c758c2f1.zip
Merge branch 'conversion' into develop
Diffstat (limited to 'vm/environment.go')
-rw-r--r--vm/environment.go32
1 files changed, 20 insertions, 12 deletions
diff --git a/vm/environment.go b/vm/environment.go
index 83faaa23e..5d493166c 100644
--- a/vm/environment.go
+++ b/vm/environment.go
@@ -3,19 +3,21 @@ package vm
import (
"errors"
"fmt"
+ "io"
"math/big"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/state"
)
type Environment interface {
State() *state.StateDB
- Origin() []byte
+ Origin() common.Address
BlockNumber() *big.Int
- GetHash(n uint64) []byte
- Coinbase() []byte
+ GetHash(n uint64) common.Hash
+ Coinbase() common.Address
Time() int64
Difficulty() *big.Int
GasLimit() *big.Int
@@ -27,16 +29,16 @@ type Environment interface {
Depth() int
SetDepth(i int)
- Call(me ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error)
- CallCode(me ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error)
- Create(me ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error, ContextRef)
+ Call(me ContextRef, addr common.Address, data []byte, gas, price, value *big.Int) ([]byte, error)
+ CallCode(me ContextRef, addr common.Address, data []byte, gas, price, value *big.Int) ([]byte, error)
+ Create(me ContextRef, addr *common.Address, data []byte, gas, price, value *big.Int) ([]byte, error, ContextRef)
}
type Account interface {
SubBalance(amount *big.Int)
AddBalance(amount *big.Int)
Balance() *big.Int
- Address() []byte
+ Address() common.Address
}
// generic transfer method
@@ -53,17 +55,17 @@ func Transfer(from, to Account, amount *big.Int) error {
}
type Log struct {
- address []byte
- topics [][]byte
+ address common.Address
+ topics []common.Hash
data []byte
log uint64
}
-func (self *Log) Address() []byte {
+func (self *Log) Address() common.Address {
return self.address
}
-func (self *Log) Topics() [][]byte {
+func (self *Log) Topics() []common.Hash {
return self.topics
}
@@ -75,10 +77,16 @@ func (self *Log) Number() uint64 {
return self.log
}
+func (self *Log) EncodeRLP(w io.Writer) error {
+ return rlp.Encode(w, []interface{}{self.address, self.topics, self.data})
+}
+
+/*
func (self *Log) RlpData() interface{} {
return []interface{}{self.address, common.ByteSliceToInterface(self.topics), self.data}
}
+*/
func (self *Log) String() string {
- return fmt.Sprintf("[A=%x T=%x D=%x]", self.address, self.topics, self.data)
+ return fmt.Sprintf("{%x %x %x}", self.address, self.data, self.topics)
}