Documentation ¶
Index ¶
- Constants
- Variables
- func Accrue(ctx iscp.Sandbox, target *iscp.AgentID, tokens colored.Balances) error
- type VMContext
- func (vmctx *VMContext) AccountID() *iscp.AgentID
- func (vmctx *VMContext) BlockContext(ctx iscp.Sandbox, construct func(ctx iscp.Sandbox) interface{}, ...) interface{}
- func (vmctx *VMContext) BuildTransactionEssence(stateHash hashing.HashValue, timestamp time.Time) (*ledgerstate.TransactionEssence, error)
- func (vmctx *VMContext) Call(targetContract, epCode iscp.Hname, params dict.Dict, transfer colored.Balances) (dict.Dict, error)
- func (vmctx *VMContext) Caller() *iscp.AgentID
- func (vmctx *VMContext) ChainID() *iscp.ChainID
- func (vmctx *VMContext) ChainOwnerID() *iscp.AgentID
- func (vmctx *VMContext) CloseVMContext(numRequests, numSuccess, numOffLedger uint16) (uint32, hashing.HashValue, time.Time, ledgerstate.Address)
- func (vmctx *VMContext) ContractCreator() *iscp.AgentID
- func (vmctx *VMContext) CurrentContractHname() iscp.Hname
- func (vmctx *VMContext) Debugf(format string, params ...interface{})
- func (vmctx *VMContext) DeployContract(programHash hashing.HashValue, name, description string, initParams dict.Dict) error
- func (vmctx *VMContext) Entropy() hashing.HashValue
- func (vmctx *VMContext) GetBalance(col colored.Color) uint64
- func (vmctx *VMContext) GetIncoming() colored.Balances
- func (vmctx *VMContext) GetMyBalances() colored.Balances
- func (vmctx *VMContext) GetResult() (dict.Dict, colored.Balances, error, bool)
- func (vmctx *VMContext) GoverningAddress() ledgerstate.Address
- func (vmctx *VMContext) Infof(format string, params ...interface{})
- func (vmctx *VMContext) IsRequestContext() bool
- func (vmctx *VMContext) Minted() colored.Balances
- func (vmctx *VMContext) MustSaveEvent(contract iscp.Hname, msg string)
- func (vmctx *VMContext) MyAgentID() *iscp.AgentID
- func (vmctx *VMContext) OutputID() ledgerstate.OutputID
- func (vmctx *VMContext) Panicf(format string, params ...interface{})
- func (vmctx *VMContext) Params() dict.Dict
- func (vmctx *VMContext) Request() iscp.Request
- func (vmctx *VMContext) RunTheRequest(req iscp.Request, requestIndex uint16)
- func (vmctx *VMContext) Send(target ledgerstate.Address, tokens colored.Balances, ...) bool
- func (vmctx *VMContext) State() kv.KVStore
- func (vmctx *VMContext) StateAddress() ledgerstate.Address
- func (vmctx *VMContext) StateHash() hashing.HashValue
- func (vmctx *VMContext) StateIndex() uint32
- func (vmctx *VMContext) Timestamp() int64
Constants ¶
const OffLedgerNonceStrictOrderTolerance = 10000
TODO temporary place for the constant. In the future must be shared with pruning module
the number is approximate assumed maximum number of requests in the batch The node must guarantee at least this number of last requests processed recorded in the state for each address
Variables ¶
var ( NewSandbox func(vmctx *VMContext) iscp.Sandbox NewSandboxView func(vmctx *VMContext) iscp.SandboxView )
var ( MaxBlockOutputCount = uint8(ledgerstate.MaxOutputCount - 1) // -1 for the chain transition output MaxBlockInputCount = uint8(ledgerstate.MaxInputCount - 2) // // 125 (126 limit -1 for the previous state utxo) )
var ErrContractNotFound = errors.New("contract not found")
Functions ¶
Types ¶
type VMContext ¶
type VMContext struct {
// contains filtered or unexported fields
}
VMContext represents state of the chain during one run of the VM while processing a batch of requests. VMContext object mutates with each request in the bathc. The VMContext is created from immutable vm.VMTask object and UTXO state of the chain address contained in the statetxbuilder.Builder
func CreateVMContext ¶ added in v0.2.0
CreateVMContext creates a context for the whole batch run
func (*VMContext) BlockContext ¶ added in v0.2.0
func (*VMContext) BuildTransactionEssence ¶ added in v0.2.0
func (vmctx *VMContext) BuildTransactionEssence(stateHash hashing.HashValue, timestamp time.Time) (*ledgerstate.TransactionEssence, error)
func (*VMContext) Call ¶
func (vmctx *VMContext) Call(targetContract, epCode iscp.Hname, params dict.Dict, transfer colored.Balances) (dict.Dict, error)
Call
func (*VMContext) ChainOwnerID ¶
func (*VMContext) CloseVMContext ¶ added in v0.2.0
func (vmctx *VMContext) CloseVMContext(numRequests, numSuccess, numOffLedger uint16) (uint32, hashing.HashValue, time.Time, ledgerstate.Address)
CloseVMContext does the closing actions on the block return nil for normal block and rotation address for rotation block
func (*VMContext) ContractCreator ¶
func (*VMContext) CurrentContractHname ¶
func (*VMContext) DeployContract ¶
func (vmctx *VMContext) DeployContract(programHash hashing.HashValue, name, description string, initParams dict.Dict) error
DeployContract deploys contract by its program hash - if called from 'root' contract only loads VM from binary - otherwise calls 'root' contract 'DeployContract' entry point to do the job.
func (*VMContext) GetIncoming ¶
func (*VMContext) GetMyBalances ¶
func (*VMContext) GoverningAddress ¶ added in v0.2.0
func (vmctx *VMContext) GoverningAddress() ledgerstate.Address
func (*VMContext) IsRequestContext ¶
func (*VMContext) MustSaveEvent ¶ added in v0.2.0
func (*VMContext) OutputID ¶ added in v0.2.0
func (vmctx *VMContext) OutputID() ledgerstate.OutputID
func (*VMContext) RunTheRequest ¶
RunTheRequest processes any request based on the Extended output, even if it doesn't parse correctly as a SC request
func (*VMContext) Send ¶ added in v0.2.0
func (vmctx *VMContext) Send(target ledgerstate.Address, tokens colored.Balances, metadata *iscp.SendMetadata, options ...iscp.SendOptions) bool
func (*VMContext) StateAddress ¶ added in v0.2.0
func (vmctx *VMContext) StateAddress() ledgerstate.Address
- anchor properties