added a transfer method to vm env

This commit is contained in:
obscuren
2014-10-22 15:22:21 +02:00
parent 27cb0750c1
commit b5beb1aac1
9 changed files with 59 additions and 36 deletions

View File

@ -50,11 +50,14 @@ func (self *Env) Difficulty() *big.Int { return self.difficulty }
func (self *Env) BlockHash() []byte { return nil }
func (self *Env) State() *ethstate.State { return self.state }
func (self *Env) GasLimit() *big.Int { return self.gasLimit }
func (self *Env) Transfer(from, to vm.Account, amount *big.Int) error {
return nil
}
func RunVm(state *ethstate.State, env, exec map[string]string) ([]byte, *big.Int, error) {
address := FromHex(exec["address"])
caller := state.GetOrNewStateObject(FromHex(exec["caller"]))
caller.Balance = ethutil.Big(exec["value"])
caller.SetBalance(ethutil.Big(exec["value"]))
evm := vm.New(NewEnvFromMap(state, env, exec), vm.DebugVmTy)