1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
package sqlvm
import (
"math/big"
"github.com/dexon-foundation/dexon/common"
"github.com/dexon-foundation/dexon/core/vm"
"github.com/dexon-foundation/dexon/params"
)
type SQLVM struct {
// Context provides auxiliary blockchain related information
vm.Context
// StateDB gives access to the underlying state
StateDB vm.StateDB
// Depth is the current call stack
depth int
// chainConfig contains information about the current chain
chainConfig *params.ChainConfig
// chain rules contains the chain rules for the current epoch
chainRules params.Rules
// abort is used to abort the SQLVM calling operations
// NOTE: must be set atomically
abort int32
// callGasTemp holds the gas available for the current call. This is needed because the
// available gas is calculated in gasCall* according to the 63/64 rule and later
// applied in opCall*.
callGasTemp uint64
}
func init() {
vm.Register(vm.SQLVM, &SQLVM{})
}
func (sqlvm *SQLVM) Create(caller vm.ContractRef, code []byte, gas uint64, value *big.Int,
in vm.Interpreter) ([]byte, common.Address, uint64, error) {
// todo (jm) need to implemnt
return nil, common.Address{}, gas, nil
}
func (sqlvm *SQLVM) Create2(caller vm.ContractRef, code []byte, gas uint64, endowment *big.Int, salt *big.Int,
in vm.Interpreter) ([]byte, common.Address, uint64, error) {
// todo (jm) need to implemnt
return nil, common.Address{}, gas, nil
}
func (sqlvm *SQLVM) Call(caller vm.ContractRef, addr common.Address, input []byte, gas uint64, value *big.Int,
in vm.Interpreter) ([]byte, uint64, error) {
// todo (jm) need to implemnt
return nil, gas, nil
}
func (sqlvm *SQLVM) CallCode(caller vm.ContractRef, addr common.Address, input []byte, gas uint64,
value *big.Int, in vm.Interpreter) ([]byte, uint64, error) {
// todo (jm) need to implemnt
return nil, gas, nil
}
func (sqlvm *SQLVM) DelegateCall(caller vm.ContractRef, addr common.Address, input []byte, gas uint64,
in vm.Interpreter) ([]byte, uint64, error) {
// todo (jm) need to implemnt
return nil, gas, nil
}
func (sqlvm *SQLVM) StaticCall(caller vm.ContractRef, addr common.Address, input []byte, gas uint64,
in vm.Interpreter) ([]byte, uint64, error) {
// todo (jm) need to implemnt
return nil, gas, nil
}
|