mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-12 21:10:36 +00:00
interop/engine: update documentation
This commit is contained in:
parent
10abac4362
commit
78b2387640
1 changed files with 33 additions and 11 deletions
|
@ -1,34 +1,56 @@
|
||||||
|
/*
|
||||||
|
Package engine provides access to VM execution metadata and allows to make contract calls.
|
||||||
|
It's roughly similar in function to ExecutionEngine class in the Neo .net
|
||||||
|
framework.
|
||||||
|
*/
|
||||||
package engine
|
package engine
|
||||||
|
|
||||||
import "github.com/nspcc-dev/neo-go/pkg/interop/transaction"
|
import "github.com/nspcc-dev/neo-go/pkg/interop/transaction"
|
||||||
|
|
||||||
// Package engine provides function signatures that can be used inside
|
// GetScriptContainer returns the transaction that initially triggered current
|
||||||
// smart contracts that are written in the neo-go framework.
|
// execution context. It never changes in a single execution, no matter how deep
|
||||||
|
// this execution goes. See `transaction` package for details on how to use the
|
||||||
// GetScriptContainer returns the transaction that is in the execution context.
|
// returned value. This function uses `System.ExecutionEngine.GetScriptContainer`
|
||||||
|
// syscall.
|
||||||
func GetScriptContainer() transaction.Transaction {
|
func GetScriptContainer() transaction.Transaction {
|
||||||
return transaction.Transaction{}
|
return transaction.Transaction{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetExecutingScriptHash returns the script hash of the contract that is
|
// GetExecutingScriptHash returns script hash (160 bit in BE form represented
|
||||||
// currently being executed.
|
// as 20-byte slice) of the contract that is currently being executed. Any
|
||||||
|
// AppCall can change the value returned by this function if it calls a
|
||||||
|
// different contract. This function uses
|
||||||
|
// `System.ExecutionEngine.GetExecutingScriptHash` syscall.
|
||||||
func GetExecutingScriptHash() []byte {
|
func GetExecutingScriptHash() []byte {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCallingScriptHash returns the script hash of the contract that started
|
// GetCallingScriptHash returns script hash (160 bit in BE form represented
|
||||||
// the execution of the current script.
|
// as 20-byte slice) of the contract that started the execution of the currently
|
||||||
|
// running context (caller of current contract or function), so it's one level
|
||||||
|
// above the GetExecutingScriptHash in the call stack. It uses
|
||||||
|
// `System.ExecutionEngine.GetCallingScriptHash` syscall.
|
||||||
func GetCallingScriptHash() []byte {
|
func GetCallingScriptHash() []byte {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetEntryScriptHash returns the script hash of the contract that started the
|
// GetEntryScriptHash returns script hash (160 bit in BE form represented
|
||||||
// execution from the start.
|
// as 20-byte slice) of the contract that initially started current execution
|
||||||
|
// (this is a script that is contained in a transaction returned by
|
||||||
|
// GetScriptContainer) execution from the start. This function uses
|
||||||
|
// `System.ExecutionEngine.GetEntryScriptHash` syscall.
|
||||||
func GetEntryScriptHash() []byte {
|
func GetEntryScriptHash() []byte {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppCall executes script with specified hash using provided arguments.
|
// AppCall executes previously deployed blockchain contract with specified hash
|
||||||
|
// (160 bit in BE form represented as 20-byte slice) using provided arguments.
|
||||||
|
// It returns whatever this contract returns. Even though this function accepts
|
||||||
|
// a slice for scriptHash you can only use it for contracts known at
|
||||||
|
// compile time, because there is a significant difference between static and
|
||||||
|
// dynamic calls in Neo (contracts should have a special property declared
|
||||||
|
// and paid for to be able to use dynamic calls). This function uses `APPCALL`
|
||||||
|
// opcode.
|
||||||
func AppCall(scriptHash []byte, args ...interface{}) interface{} {
|
func AppCall(scriptHash []byte, args ...interface{}) interface{} {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue