aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/sqlvm
diff options
context:
space:
mode:
authorJM <jm@dexon.org>2019-01-31 15:12:57 +0800
committerJhih-Ming Huang <jm.huang@cobinhood.com>2019-05-06 10:44:03 +0800
commit9b8cd76237318e173147a7c32763b6b9d9759951 (patch)
tree44f860e1ed7e63354f48096ee5df0fa475719cc9 /core/vm/sqlvm
parentd3b485a5af768db59bd648175849f961e25bc630 (diff)
downloaddexon-9b8cd76237318e173147a7c32763b6b9d9759951.tar
dexon-9b8cd76237318e173147a7c32763b6b9d9759951.tar.gz
dexon-9b8cd76237318e173147a7c32763b6b9d9759951.tar.bz2
dexon-9b8cd76237318e173147a7c32763b6b9d9759951.tar.lz
dexon-9b8cd76237318e173147a7c32763b6b9d9759951.tar.xz
dexon-9b8cd76237318e173147a7c32763b6b9d9759951.tar.zst
dexon-9b8cd76237318e173147a7c32763b6b9d9759951.zip
core: vm: vm interface (#164)
Diffstat (limited to 'core/vm/sqlvm')
-rw-r--r--core/vm/sqlvm/sqlvm.go45
1 files changed, 31 insertions, 14 deletions
diff --git a/core/vm/sqlvm/sqlvm.go b/core/vm/sqlvm/sqlvm.go
index 258a65d01..fe2eee42b 100644
--- a/core/vm/sqlvm/sqlvm.go
+++ b/core/vm/sqlvm/sqlvm.go
@@ -5,7 +5,6 @@ import (
"github.com/dexon-foundation/dexon/common"
"github.com/dexon-foundation/dexon/core/vm"
- "github.com/dexon-foundation/dexon/crypto"
"github.com/dexon-foundation/dexon/params"
)
@@ -30,21 +29,39 @@ type SQLVM struct {
callGasTemp uint64
}
-func (sqlvm *SQLVM) Create(caller vm.ContractRef, code []byte, gas uint64,
- value *big.Int) (ret []byte, contractAddr common.Address,
- leftOverGas uint64, err error) {
+func init() {
+ vm.Register(vm.SQLVM, &SQLVM{})
+}
- contractAddr = crypto.CreateAddress(caller.Address(), sqlvm.StateDB.GetNonce(caller.Address()))
- return sqlvm.create(caller, &vm.CodeAndHash{Code: code}, gas, value, contractAddr)
+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
}
-// create creates a new contract using code as deployment code.
-func (sqlvm *SQLVM) create(caller vm.ContractRef, codeAndHash *vm.CodeAndHash, gas uint64,
- value *big.Int, address common.Address) ([]byte, common.Address, uint64, error) {
- // Depth check execution. Fail if we're trying to execute above the
- if sqlvm.depth > int(params.CallCreateDepth) {
- return nil, common.Address{}, gas, vm.ErrDepth
- }
- // TODO (JM) implement create database contract function
+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
+}