Documentation ¶
Index ¶
- Constants
- func CheckNonce(req isc.OffLedgerRequest, maxAssumedNonce uint64) error
- func NewSandbox(vmctx *VMContext) isc.Sandbox
- type StateUpdate
- type VMContext
- func (vmctx *VMContext) AccountID() isc.AgentID
- func (vmctx *VMContext) AgentID() isc.AgentID
- func (vmctx *VMContext) AllowanceAvailable() *isc.Assets
- func (vmctx *VMContext) AssertConsistentGasTotals()
- func (vmctx *VMContext) BlockContext() interface{}
- func (vmctx *VMContext) BuildTransactionEssence(stateCommitment *state.L1Commitment, assertTxbuilderBalanced bool) (*iotago.TransactionEssence, []byte)
- func (vmctx *VMContext) Call(targetContract, epCode isc.Hname, params dict.Dict, allowance *isc.Assets) dict.Dict
- func (vmctx *VMContext) Caller() isc.AgentID
- func (vmctx *VMContext) ChainID() isc.ChainID
- func (vmctx *VMContext) ChainInfo() *isc.ChainInfo
- func (vmctx *VMContext) ChainOwnerID() isc.AgentID
- func (vmctx *VMContext) CloseVMContext(numRequests, numSuccess, numOffLedger uint16) (uint32, *state.L1Commitment, time.Time, iotago.Address)
- func (vmctx *VMContext) CreateNewFoundry(scheme iotago.TokenScheme, metadata []byte) (uint32, uint64)
- func (vmctx *VMContext) CurrentContractHname() isc.Hname
- func (vmctx *VMContext) Debugf(format string, params ...interface{})
- func (vmctx *VMContext) DeployContract(programHash hashing.HashValue, name, description string, initParams dict.Dict)
- func (vmctx *VMContext) DestroyFoundry(sn uint32) uint64
- func (vmctx *VMContext) Entropy() hashing.HashValue
- func (vmctx *VMContext) EstimateRequiredStorageDeposit(par isc.RequestParameters) uint64
- func (vmctx *VMContext) GasBudgetLeft() uint64
- func (vmctx *VMContext) GasBurn(burnCode gas.BurnCode, par ...uint64)
- func (vmctx *VMContext) GasBurnEnable(enable bool)
- func (vmctx *VMContext) GasBurned() uint64
- func (vmctx *VMContext) GetAccountNFTs(agentID isc.AgentID) (ret []iotago.NFTID)
- func (vmctx *VMContext) GetBaseTokensBalance(agentID isc.AgentID) uint64
- func (vmctx *VMContext) GetContractRecord(contractHname isc.Hname) (ret *root.ContractRecord)
- func (vmctx *VMContext) GetNFTData(nftID iotago.NFTID) (ret *isc.NFT)
- func (vmctx *VMContext) GetNativeTokenBalance(agentID isc.AgentID, nativeTokenID iotago.NativeTokenID) *big.Int
- func (vmctx *VMContext) GetNativeTokenBalanceTotal(nativeTokenID iotago.NativeTokenID) *big.Int
- func (vmctx *VMContext) GetNativeTokens(agentID isc.AgentID) iotago.NativeTokens
- func (vmctx *VMContext) GetSenderTokenBalanceForFees() uint64
- func (vmctx *VMContext) HasEnoughForAllowance(agentID isc.AgentID, allowance *isc.Assets) bool
- func (vmctx *VMContext) Infof(format string, params ...interface{})
- func (vmctx *VMContext) IsCoreAccount(agentID isc.AgentID) bool
- func (vmctx *VMContext) LocateProgram(programHash hashing.HashValue) (vmtype string, binary []byte, err error)
- func (vmctx *VMContext) ModifyFoundrySupply(sn uint32, delta *big.Int) int64
- func (vmctx *VMContext) MustSaveEvent(contract isc.Hname, msg string)
- func (vmctx *VMContext) MyAgentID() isc.AgentID
- func (vmctx *VMContext) OpenBlockContexts()
- func (vmctx *VMContext) Panicf(format string, params ...interface{})
- func (vmctx *VMContext) Params() *isc.Params
- func (vmctx *VMContext) Processors() *processors.Cache
- func (vmctx *VMContext) RegisterError(messageFormat string) *isc.VMErrorTemplate
- func (vmctx *VMContext) RemoveUnprocessable(results []*vm.RequestResult)
- func (vmctx *VMContext) Request() isc.Calldata
- func (vmctx *VMContext) RetryUnprocessable(req isc.Request, blockIndex uint32, outputIndex uint16)
- func (vmctx *VMContext) RunTheRequest(req isc.Request, requestIndex uint16) (*vm.RequestResult, error)
- func (vmctx *VMContext) Send(par isc.RequestParameters)
- func (vmctx *VMContext) SetBlockContext(bctx interface{})
- func (vmctx *VMContext) State() kv.KVStore
- func (vmctx *VMContext) StateAnchor() *isc.StateAnchor
- func (vmctx *VMContext) StateMetadata(stateCommitment *state.L1Commitment) []byte
- func (vmctx *VMContext) StateReader() kv.KVStoreReader
- func (vmctx *VMContext) Timestamp() time.Time
- func (vmctx *VMContext) TransferAllowedFunds(target isc.AgentID, transfer ...*isc.Assets) *isc.Assets
- func (vmctx *VMContext) TryLoadContract(programHash hashing.HashValue) error
- func (vmctx *VMContext) Warnf(format string, params ...interface{})
Constants ¶
const ( // OffLedgerNonceStrictOrderTolerance how many steps back the nonce is considered too old // within this limit order of nonces is not checked OffLedgerNonceStrictOrderTolerance = 10_000 // ExpiryUnlockSafetyWindowDuration creates safety window around time assumption, // the UTXO won't be consumed to avoid race conditions ExpiryUnlockSafetyWindowDuration = 1 * time.Minute ExpiryUnlockSafetyWindowMilestone = 3 )
const MaxPostedOutputsInOneRequest = 4
Variables ¶
This section is empty.
Functions ¶
func CheckNonce ¶ added in v0.3.0
func CheckNonce(req isc.OffLedgerRequest, maxAssumedNonce uint64) error
func NewSandbox ¶
Types ¶
type StateUpdate ¶
func NewStateUpdate ¶
func NewStateUpdate() *StateUpdate
NewStateUpdate creates a state update with timestamp mutation, if provided
func (*StateUpdate) Bytes ¶
func (su *StateUpdate) Bytes() []byte
func (*StateUpdate) Clone ¶
func (su *StateUpdate) Clone() *StateUpdate
type VMContext ¶
type VMContext struct { NumPostedOutputs int // how many outputs has been posted in the request // 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 batch. 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) AllowanceAvailable ¶ added in v0.3.0
func (*VMContext) AssertConsistentGasTotals ¶ added in v0.3.0
func (vmctx *VMContext) AssertConsistentGasTotals()
func (*VMContext) BlockContext ¶ added in v0.2.0
func (vmctx *VMContext) BlockContext() interface{}
func (*VMContext) BuildTransactionEssence ¶ added in v0.2.0
func (vmctx *VMContext) BuildTransactionEssence(stateCommitment *state.L1Commitment, assertTxbuilderBalanced bool) (*iotago.TransactionEssence, []byte)
func (*VMContext) Call ¶
func (vmctx *VMContext) Call(targetContract, epCode isc.Hname, params dict.Dict, allowance *isc.Assets) dict.Dict
Call implements sandbox logic of the call between contracts on-chain
func (*VMContext) ChainOwnerID ¶
func (*VMContext) CloseVMContext ¶ added in v0.2.0
func (vmctx *VMContext) CloseVMContext(numRequests, numSuccess, numOffLedger uint16) (uint32, *state.L1Commitment, time.Time, iotago.Address)
CloseVMContext does the closing actions on the block return nil for normal block and rotation address for rotation block
func (*VMContext) CreateNewFoundry ¶ added in v0.3.0
func (*VMContext) CurrentContractHname ¶
func (*VMContext) DeployContract ¶
func (vmctx *VMContext) DeployContract(programHash hashing.HashValue, name, description string, initParams dict.Dict)
DeployContract deploys contract by its program hash with the name and description specific to the instance
func (*VMContext) DestroyFoundry ¶ added in v0.3.0
func (*VMContext) EstimateRequiredStorageDeposit ¶ added in v0.3.0
func (vmctx *VMContext) EstimateRequiredStorageDeposit(par isc.RequestParameters) uint64
func (*VMContext) GasBudgetLeft ¶ added in v0.3.0
func (*VMContext) GasBurnEnable ¶ added in v0.3.0
func (*VMContext) GetAccountNFTs ¶ added in v0.3.0
func (*VMContext) GetBaseTokensBalance ¶ added in v0.3.0
func (*VMContext) GetContractRecord ¶ added in v0.3.0
func (vmctx *VMContext) GetContractRecord(contractHname isc.Hname) (ret *root.ContractRecord)
func (*VMContext) GetNFTData ¶ added in v0.3.0
func (*VMContext) GetNativeTokenBalance ¶ added in v0.3.0
func (*VMContext) GetNativeTokenBalanceTotal ¶ added in v0.3.0
func (vmctx *VMContext) GetNativeTokenBalanceTotal(nativeTokenID iotago.NativeTokenID) *big.Int
func (*VMContext) GetNativeTokens ¶
func (vmctx *VMContext) GetNativeTokens(agentID isc.AgentID) iotago.NativeTokens
func (*VMContext) GetSenderTokenBalanceForFees ¶ added in v0.3.0
func (*VMContext) HasEnoughForAllowance ¶ added in v0.3.0
func (*VMContext) IsCoreAccount ¶ added in v0.3.0
func (*VMContext) LocateProgram ¶ added in v0.3.0
func (*VMContext) ModifyFoundrySupply ¶ added in v0.3.0
func (*VMContext) MustSaveEvent ¶ added in v0.2.0
func (*VMContext) OpenBlockContexts ¶ added in v0.3.0
func (vmctx *VMContext) OpenBlockContexts()
OpenBlockContexts calls the block context open function for all subscribed core contracts
func (*VMContext) Processors ¶ added in v0.3.0
func (vmctx *VMContext) Processors() *processors.Cache
func (*VMContext) RegisterError ¶ added in v0.3.0
func (vmctx *VMContext) RegisterError(messageFormat string) *isc.VMErrorTemplate
func (*VMContext) RemoveUnprocessable ¶
func (vmctx *VMContext) RemoveUnprocessable(results []*vm.RequestResult)
func (*VMContext) RetryUnprocessable ¶
func (*VMContext) RunTheRequest ¶
func (vmctx *VMContext) RunTheRequest(req isc.Request, requestIndex uint16) (*vm.RequestResult, error)
RunTheRequest processes each isc.Request in the batch
func (*VMContext) Send ¶ added in v0.2.0
func (vmctx *VMContext) Send(par isc.RequestParameters)
Send implements sandbox function of sending cross-chain request
func (*VMContext) SetBlockContext ¶ added in v0.3.0
func (vmctx *VMContext) SetBlockContext(bctx interface{})
func (*VMContext) StateAnchor ¶ added in v0.3.0
func (vmctx *VMContext) StateAnchor() *isc.StateAnchor
func (*VMContext) StateMetadata ¶
func (vmctx *VMContext) StateMetadata(stateCommitment *state.L1Commitment) []byte
func (*VMContext) StateReader ¶ added in v0.3.0
func (vmctx *VMContext) StateReader() kv.KVStoreReader
func (*VMContext) TransferAllowedFunds ¶ added in v0.3.0
func (vmctx *VMContext) TransferAllowedFunds(target isc.AgentID, transfer ...*isc.Assets) *isc.Assets
TransferAllowedFunds transfers funds within the budget set by the Allowance() to the existing target account on chain
func (*VMContext) TryLoadContract ¶ added in v0.3.0
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package vmtxbuilder implements AnchorTransactionBuilder, a transaction builder used by the VM to construct anchor transaction.
|
Package vmtxbuilder implements AnchorTransactionBuilder, a transaction builder used by the VM to construct anchor transaction. |