Commit 616066a5 authored by obscuren's avatar obscuren

rework vm

parent 1bce02ef
...@@ -5,11 +5,10 @@ import ( ...@@ -5,11 +5,10 @@ import (
"math/big" "math/big"
"github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
) )
type Environment interface { type Environment interface {
State() *state.State //State() *state.State
Origin() []byte Origin() []byte
BlockNumber() *big.Int BlockNumber() *big.Int
...@@ -19,8 +18,16 @@ type Environment interface { ...@@ -19,8 +18,16 @@ type Environment interface {
Difficulty() *big.Int Difficulty() *big.Int
BlockHash() []byte BlockHash() []byte
GasLimit() *big.Int GasLimit() *big.Int
Transfer(from, to Account, amount *big.Int) error Transfer(from, to Account, amount *big.Int) error
AddLog(*state.Log) AddLog(addr []byte, topics [][]byte, data []byte)
DeleteAccount(addr []byte)
SetState(addr, key, value []byte)
GetState(addr, key []byte) []byte
Balance(addr []byte) *big.Int
AddBalance(addr []byte, balance *big.Int)
GetCode(addr []byte) []byte
Refund(addr []byte, gas, price *big.Int)
} }
type Object interface { type Object interface {
...@@ -43,9 +50,5 @@ func Transfer(from, to Account, amount *big.Int) error { ...@@ -43,9 +50,5 @@ func Transfer(from, to Account, amount *big.Int) error {
from.SubBalance(amount) from.SubBalance(amount)
to.AddBalance(amount) to.AddBalance(amount)
// Add default LOG. Default = big(sender.addr) + 1
//addr := ethutil.BigD(receiver.Address())
//tx.addLog(vm.Log{sender.Address(), [][]byte{ethutil.U256(addr.Add(addr, ethutil.Big1)).Bytes()}, nil})
return nil return nil
} }
...@@ -90,6 +90,6 @@ func (self *Execution) exec(code, caddr []byte, caller ClosureRef) (ret []byte, ...@@ -90,6 +90,6 @@ func (self *Execution) exec(code, caddr []byte, caller ClosureRef) (ret []byte,
return return
} }
func (self *Execution) Create(caller ClosureRef) (ret []byte, err error) { func (self *Execution) Create(caller []byte) (ret []byte, err error) {
return self.exec(self.input, nil, caller) return self.exec(self.input, nil, caller)
} }
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment