actioncontext

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotSupport = "not support"
)

assert msg

Variables

This section is empty.

Functions

func IsNormativeName

func IsNormativeName(str string) bool

Types

type APIs

type APIs struct {
	Auth     AuthorizationApi
	Sys      SystemApi
	Assert   AssertApi
	Console  ConsoleApi
	Crypto   CryptoApi
	Producer ProducerApi
	Act      ActionApi
	Db       DatabaseApi
	MemDb    BlockMemDbApi
	Contract ContractApi
	Result   ResultApi
	Call     CallApi
	Types    TypesApi
}

func NewAPIs

func NewAPIs(ctx *Context) *APIs

func (*APIs) SetInterpreter

func (self *APIs) SetInterpreter(interpreter Interpreter)

type ActionApi

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

func (*ActionApi) Contract

func (self *ActionApi) Contract() types.Address

func (*ActionApi) Sender

func (self *ActionApi) Sender() types.Address

func (*ActionApi) SetCtx

func (self *ActionApi) SetCtx(ctx *Context)

type AssertApi

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

func (*AssertApi) Assert

func (self *AssertApi) Assert(test bool, msg string)

func (*AssertApi) SetCtx

func (self *AssertApi) SetCtx(ctx *Context)

type AuthorizationApi

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

func (*AuthorizationApi) IsAccount

func (self *AuthorizationApi) IsAccount(address string) bool

func (*AuthorizationApi) IsContract

func (self *AuthorizationApi) IsContract(address string) bool

func (*AuthorizationApi) IsHexAddress

func (self *AuthorizationApi) IsHexAddress(address string) bool

func (*AuthorizationApi) RequireAuth

func (self *AuthorizationApi) RequireAuth(address string) bool

func (*AuthorizationApi) SetCtx

func (self *AuthorizationApi) SetCtx(ctx *Context)

type BlockContext

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

func NewBlockContext

func NewBlockContext(state *state.StateDB, db, tmpDb database.IDatabase, number *big.Int, minerAddress types.Address) *BlockContext

func (*BlockContext) GetState

func (ctx *BlockContext) GetState() *state.StateDB

type BlockMemDbApi

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

block memory database api

func (*BlockMemDbApi) Emplace

func (self *BlockMemDbApi) Emplace(key []byte, val []byte)

func (*BlockMemDbApi) Erase

func (self *BlockMemDbApi) Erase(key []byte)

func (*BlockMemDbApi) Find

func (self *BlockMemDbApi) Find(key []byte) []byte

func (*BlockMemDbApi) Get

func (self *BlockMemDbApi) Get(key []byte) []byte

func (*BlockMemDbApi) Modify

func (self *BlockMemDbApi) Modify(key []byte, val []byte)

func (*BlockMemDbApi) Set

func (self *BlockMemDbApi) Set(key []byte, val []byte)

func (*BlockMemDbApi) SetCtx

func (self *BlockMemDbApi) SetCtx(ctx *Context)

type CallApi

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

func (*CallApi) Call

func (self *CallApi) Call(act *transaction.Action)

func (*CallApi) InnerCall

func (self *CallApi) InnerCall(act *transaction.Action)

func (*CallApi) SetCtx

func (self *CallApi) SetCtx(ctx *Context)

func (*CallApi) SetInterpreter

func (self *CallApi) SetInterpreter(interpreter Interpreter)

type ConsoleApi

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

func (*ConsoleApi) Printf

func (self *ConsoleApi) Printf(str string)

func (*ConsoleApi) SetCtx

func (self *ConsoleApi) SetCtx(ctx *Context)

type Context

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

func NewContext

func NewContext(sender types.Address, action *transaction.Action, blkCtx *BlockContext) *Context

func (*Context) ActionResult

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

func (*Context) AppendContract

func (ctx *Context) AppendContract(addr types.Address)

func (*Context) Code

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

func (*Context) ContractAddress

func (ctx *Context) ContractAddress() types.Address

func (*Context) Exec

func (ctx *Context) Exec(in Interpreter) error

func (*Context) ExecAsync

func (ctx *Context) ExecAsync(in Interpreter) error

func (*Context) GetContracts

func (ctx *Context) GetContracts() []types.Address

func (*Context) InitForTest

func (ctx *Context) InitForTest()

func (*Context) InterpreterId

func (ctx *Context) InterpreterId() types.Hash

func (*Context) InterpreterName

func (ctx *Context) InterpreterName() string

func (*Context) Param

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

func (*Context) ResultCh

func (ctx *Context) ResultCh() chan error

func (*Context) SetActionResult

func (self *Context) SetActionResult(data []byte)

func (*Context) SetCreatorForTest

func (ctx *Context) SetCreatorForTest(addr types.Address)

func (*Context) TTL

func (ctx *Context) TTL() time.Duration

type ContractApi

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

func (*ContractApi) Create

func (self *ContractApi) Create(creator string, code string) (addr types.Address)

func (*ContractApi) Creator

func (self *ContractApi) Creator() types.Address

func (*ContractApi) EmitEvent

func (self *ContractApi) EmitEvent(topics []string, data [][]byte)

func (*ContractApi) SetCtx

func (self *ContractApi) SetCtx(ctx *Context)

type CryptoApi

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

func (*CryptoApi) Recover

func (self *CryptoApi) Recover(msg []byte, sig []byte) (pubkey []byte, err error)

Recover recovers public key through signature and msg data. var testAddrHex = "970e8128ab834e8eac17ab8e3812f010678cf791" var testPrivHex = "289c2857d4598e37fb9647507e47a309d6133539bf21a8b9cb6df88fd5232032" key, _ := crypto.HexToECDSA(testPrivHex) msg := crypto.Keccak256([]byte("foo")) sig, err := crypto.Sign(msg, key)

func (*CryptoApi) SetCtx

func (self *CryptoApi) SetCtx(ctx *Context)

func (*CryptoApi) Sha1

func (self *CryptoApi) Sha1(val []byte) [20]byte

func (*CryptoApi) Sha256

func (self *CryptoApi) Sha256(val []byte) [32]byte

func (*CryptoApi) Sha512

func (self *CryptoApi) Sha512(val []byte) [64]byte

type DatabaseApi

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

func (*DatabaseApi) Emplace

func (self *DatabaseApi) Emplace(key []byte, val []byte)

func (*DatabaseApi) Erase

func (self *DatabaseApi) Erase(key []byte)

func (*DatabaseApi) Find

func (self *DatabaseApi) Find(key []byte) []byte

func (*DatabaseApi) Get

func (self *DatabaseApi) Get(key []byte) []byte

func (*DatabaseApi) Modify

func (self *DatabaseApi) Modify(key []byte, val []byte)

func (*DatabaseApi) Set

func (self *DatabaseApi) Set(key []byte, val []byte)

func (*DatabaseApi) SetCtx

func (self *DatabaseApi) SetCtx(ctx *Context)

type Interpreter

type Interpreter interface {
	Exec(ctx *Context) error
	ExecAsync(ctx *Context) error
}

type Name

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

func StringToName

func StringToName(str string) (ret Name)

Converts a base32 string to a uint64.

func (Name) Str

func (n Name) Str() string

type ProducerApi

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

func (*ProducerApi) Producer

func (self *ProducerApi) Producer() types.Address

func (*ProducerApi) SetCtx

func (self *ProducerApi) SetCtx(ctx *Context)

type ResultApi

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

func (*ResultApi) SetActionResult

func (self *ResultApi) SetActionResult(data []byte)

func (*ResultApi) SetCtx

func (self *ResultApi) SetCtx(ctx *Context)

type SystemApi

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

func (*SystemApi) BytesToInt

func (self *SystemApi) BytesToInt(src []byte) uint64

func (*SystemApi) GetBlockMiner

func (self *SystemApi) GetBlockMiner() types.Address

func (*SystemApi) GetBlockNumber

func (self *SystemApi) GetBlockNumber() *big.Int

func (*SystemApi) IntToBytes

func (self *SystemApi) IntToBytes(i uint64) []byte

func (*SystemApi) SetCtx

func (self *SystemApi) SetCtx(ctx *Context)

type TypesApi

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

func (*TypesApi) Name

func (self *TypesApi) Name(str string) uint64

func (*TypesApi) SetCtx

func (self *TypesApi) SetCtx(ctx *Context)

type Visitor

type Visitor interface {
	InterpreterId() types.Hash
	InterpreterName() string
	Code() []byte
	Param() []byte
	TTL() time.Duration
}

Jump to

Keyboard shortcuts

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