contract

package
v3.8.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const MaxDelegateDescriptionLen int = 128
View Source
const MaxDelegateLocationLen int = 32
View Source
const NativeContractExecTime uint64 = 100

Variables

This section is empty.

Functions

func CreateNativeContractAccount

func CreateNativeContractAccount(roleIntf role.RoleInterface) error

CreateNativeContractAccount is to create native contract account

func NativeContractInitChain

func NativeContractInitChain(ldb *db.DBService, roleIntf role.RoleInterface, ncIntf NativeContractInterface) error

NativeContractInitChain is to init

Types

type Context

type Context struct {
	// input params:
	RoleIntf     role.RoleInterface
	Trx          *types.Transaction
	CallContract string
	CallMethod   string
	//NoticeContract string
	DeepLimit   uint32
	MaxExecTime uint64

	//output prams:
	NoticeContractList []string
}

Context for contracts

func (*Context) GetTrxParam

func (ctx *Context) GetTrxParam() []byte

GetTrxParam for contracts

func (*Context) GetTrxParamSize

func (ctx *Context) GetTrxParamSize() uint32

GetTrxParamSize for contracts

type NativeContract

type NativeContract struct {
	//Config map[string]NativeContractMethod
	Config map[string]NativeContractMethodConfig
}

NativeContract is native contract handler

func (*NativeContract) ExecuteNativeContract

func (nc *NativeContract) ExecuteNativeContract(ctx *Context) (berr.ErrCode, uint64, uint64)

ExecuteNativeContract is to call native contract

func (*NativeContract) IsNativeContractMethod

func (nc *NativeContract) IsNativeContractMethod(contract string, method string) bool

IsNativeContractMethod is to check if the contract is native

type NativeContractInterface

type NativeContractInterface interface {
	IsNativeContractMethod(contract string, method string) bool
	ExecuteNativeContract(*Context) (berr.ErrCode, uint64, uint64)
}

NativeContractInterface is native contract interface

func NewNativeContract

func NewNativeContract(roleIntf role.RoleInterface) (NativeContractInterface, error)

NewNativeContract is to create a new native contract

func NewNativeContractHandler

func NewNativeContractHandler() (NativeContractInterface, error)

NewNativeContractHandler is native contract handler to handle different contracts

type NativeContractMethod

type NativeContractMethod func(*Context) berr.ErrCode

NativeContractMethod is native contract method

type NativeContractMethodConfig

type NativeContractMethodConfig struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL