|
|
@ -5,6 +5,7 @@ import ( |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"github.com/ethereum/eth-go/ethutil" |
|
|
|
"github.com/ethereum/eth-go/ethutil" |
|
|
|
_ "github.com/obscuren/secp256k1-go" |
|
|
|
_ "github.com/obscuren/secp256k1-go" |
|
|
|
|
|
|
|
"log" |
|
|
|
_ "math" |
|
|
|
_ "math" |
|
|
|
"math/big" |
|
|
|
"math/big" |
|
|
|
) |
|
|
|
) |
|
|
@ -53,6 +54,7 @@ type RuntimeVars struct { |
|
|
|
Time int64 |
|
|
|
Time int64 |
|
|
|
Diff *big.Int |
|
|
|
Diff *big.Int |
|
|
|
TxData []string |
|
|
|
TxData []string |
|
|
|
|
|
|
|
Value *big.Int |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func NewVm(state *State, stateManager *StateManager, vars RuntimeVars) *Vm { |
|
|
|
func NewVm(state *State, stateManager *StateManager, vars RuntimeVars) *Vm { |
|
|
@ -324,8 +326,8 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro |
|
|
|
case oCALLER: |
|
|
|
case oCALLER: |
|
|
|
stack.Push(ethutil.BigD(closure.Callee().Address())) |
|
|
|
stack.Push(ethutil.BigD(closure.Callee().Address())) |
|
|
|
case oCALLVALUE: |
|
|
|
case oCALLVALUE: |
|
|
|
// FIXME: Original value of the call, not the current value
|
|
|
|
log.Println("Value:", vm.vars.Value) |
|
|
|
stack.Push(closure.Value) |
|
|
|
stack.Push(vm.vars.Value) |
|
|
|
case oCALLDATALOAD: |
|
|
|
case oCALLDATALOAD: |
|
|
|
require(1) |
|
|
|
require(1) |
|
|
|
offset := stack.Pop().Int64() |
|
|
|
offset := stack.Pop().Int64() |
|
|
|