smart

package
v0.0.0-...-b7062c8 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2017 License: LGPL-3.0-or-later Imports: 5 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// CallInit is a flag for calling init function of the contract
	CallInit = 0x01
	// CallCondition is a flag for calling condition function of the contract
	CallCondition = 0x02
	// CallAction is a flag for calling action function of the contract
	CallAction = 0x04
	// CallRollback is a flag for calling rollback function of the contract
	CallRollback = 0x08
)

Variables

This section is empty.

Functions

func ActivateContract

func ActivateContract(tblid int64, prefix string, active bool)

ActivateContract sets Active status of the contract in smartVM

func Compile

func Compile(src, prefix string, active bool, tblid int64) error

Compile compiles contract source code in smartVM

func CompileBlock

func CompileBlock(src, prefix string, active bool, tblid int64) (*script.Block, error)

CompileBlock calls CompileBlock for smartVM

func CompileEval

func CompileEval(src string, prefix uint32) error

CompileEval calls CompileEval for smartVM

func EvalIf

func EvalIf(src, prefix string, extend *map[string]interface{}) (bool, error)

EvalIf calls EvalIf for smartVM

func Extend

func Extend(ext *script.ExtendData)

Extend set extendeds variable and functions in smartVM

func ExtendCost

func ExtendCost(ext func(string) int64)

ExtendCost sets the cost of calling extended obj in smartVM

func ExternOff

func ExternOff()

ExternOff switches off the extern compiling mode in smartVM

func Float

func Float(v interface{}) (ret float64)

Float converts int64, string to float64

func FlushBlock

func FlushBlock(root *script.Block)

FlushBlock calls FlushBlock for smartVM

func GetUsedContracts

func GetUsedContracts(name string, state uint32, full bool) []string

GetUsedContracts returns the list of contracts which are called from the specified contract

func Run

func Run(block *script.Block, params []interface{}, extend *map[string]interface{}) (ret []interface{}, err error)

Run executes Block in smartVM

func TxJSON

func TxJSON(contract *Contract) string

TxJSON returns JSON data which has been generated from Tx data and extended variables

Types

type Contract

type Contract struct {
	Name          string
	Called        uint32
	FreeRequest   bool
	TxPrice       int64   // custom price for citizens
	TxGovAccount  int64   // state wallet
	EGSRate       float64 // money/EGS rate
	TableAccounts string
	StackCont     []string // Stack of called contracts
	Extend        *map[string]interface{}
	Block         *script.Block
}

Contract contains the information about the contract.

func GetContract

func GetContract(name string, state uint32) *Contract

GetContract returns true if the contract exists in smartVM

func GetContractByID

func GetContractByID(id int32) *Contract

GetContractByID returns true if the contract exists

func (*Contract) GetFunc

func (contract *Contract) GetFunc(name string) *script.Block

GetFunc returns the block of the specified function in the contract

Jump to

Keyboard shortcuts

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