Documentation ¶
Index ¶
- Constants
- Variables
- func IsDApp(data []byte) bool
- type AssignmentNode
- type BooleanNode
- type BytesNode
- type ConditionalNode
- type DAppResult
- type DAppScript
- type Environment
- func (e *Environment) ChooseSizeCheck(v int)
- func (e *Environment) SetInvoke(tx *proto.InvokeScriptWithProofs, v int) error
- func (e *Environment) SetLastBlock(info *proto.BlockInfo)
- func (e *Environment) SetThisFromAddress(addr proto.Address)
- func (e *Environment) SetThisFromAssetInfo(info *proto.AssetInfo)
- func (e *Environment) SetThisFromFullAssetInfo(info *proto.FullAssetInfo)
- func (e *Environment) SetTransaction(tx proto.Transaction) error
- func (e *Environment) SetTransactionFromOrder(order proto.Order) error
- func (e *Environment) SetTransactionFromScriptAction(action proto.ScriptAction, pk crypto.PublicKey, id crypto.Digest, ts uint64) error
- func (e *Environment) SetTransactionFromScriptTransfer(transfer *proto.FullScriptTransfer)
- func (e *Environment) SetTransactionWithoutProofs(tx proto.Transaction) error
- type FunctionCallNode
- type FunctionDeclarationNode
- type LongNode
- type Node
- type PropertyNode
- type ReferenceNode
- type RideEnvironment
- type RideResult
- type RideScript
- type ScriptMeta
- type ScriptResult
- type SimpleScript
- type StringNode
- type Tree
- type TreeEstimation
Constants ¶
View Source
const ( OpHalt byte = iota //00 - Halts program execution. No parameters. OpReturn //01 - Returns from declaration to stored position. No parameters. OpPush //02 - Put constant on stack. One parameter: constant ID. OpPop //03 - Removes value from stack. No parameters. OpTrue //04 - Put True value on stack. No parameters. OpFalse //05 - Put False value on stack. No parameters. OpJump //06 - Moves instruction pointer to new position. One parameter: new position. OpJumpIfFalse //07 - Moves instruction pointer to new position if value on stack is False. One parameter: new position. OpProperty //08 - Puts value of object's property on stack. One parameter: constant ID that holds name of the property. OpExternalCall //09 - Call a standard library function. Two parameters: function ID, number of arguments. OpCall //0a - Call a function declared at given address. Two parameters: position of function declaration, number of arguments. OpGlobal //0b - Load global constant. One parameter: global constant ID. OpLoad //0c - Evaluates an expression that declared at address. One parameter: position of declaration. OpLoadLocal //0d - Load an argument of function call on stack. One parameter: argument number. OpRef //0e - Put reference to expression/function on stack. One parameter: position of declaration. )
Variables ¶
View Source
var CatalogueV2 = map[string]int{"!": 11, "!=": 26, "-": 9, "0": 1, "1": 1, "100": 1, "1000": 100, "1001": 100, "1003": 100, "101": 1, "102": 1, "103": 1, "104": 1, "1040": 10, "1041": 10, "1042": 10, "1043": 10, "105": 1, "1050": 100, "1051": 100, "1052": 100, "1053": 100, "106": 1, "1060": 100, "107": 1, "2": 1, "200": 1, "201": 1, "202": 1, "203": 10, "300": 10, "303": 1, "304": 1, "305": 1, "400": 2, "401": 2, "410": 1, "411": 1, "412": 1, "420": 1, "421": 1, "500": 100, "501": 10, "502": 10, "503": 10, "600": 10, "601": 10, "602": 10, "603": 10, "Address": 1, "Alias": 1, "AssetPair": 2, "DataEntry": 2, "DataTransaction": 9, "addressFromPublicKey": 82, "addressFromString": 124, "dropRight": 19, "dropRightBytes": 19, "extract": 13, "getBinary": 30, "getBoolean": 30, "getInteger": 30, "getString": 30, "isDefined": 35, "takeRight": 19, "takeRightBytes": 19, "throw": 2, "wavesBalance": 109}
View Source
var CatalogueV3 = map[string]int{} /* 128 elements not displayed */
View Source
var CatalogueV4 = map[string]int{} /* 224 elements not displayed */
View Source
var ConstantsV1 = []string{"height", "tx", "unit"}
View Source
var ConstantsV2 = []string{"Buy", "CEILING", "DOWN", "FLOOR", "HALFDOWN", "HALFEVEN", "HALFUP", "Sell", "UP", "height", "nil", "tx", "unit"}
View Source
var ConstantsV3 = []string{"Buy", "CEILING", "DOWN", "FLOOR", "HALFDOWN", "HALFEVEN", "HALFUP", "MD5", "NOALG", "SHA1", "SHA224", "SHA256", "SHA3224", "SHA3256", "SHA3384", "SHA3512", "SHA384", "SHA512", "Sell", "UP", "height", "lastBlock", "nil", "this", "tx", "unit"}
View Source
var ConstantsV4 = []string{"Buy", "CEILING", "DOWN", "FLOOR", "HALFDOWN", "HALFEVEN", "HALFUP", "MD5", "NOALG", "SHA1", "SHA224", "SHA256", "SHA3224", "SHA3256", "SHA3384", "SHA3512", "SHA384", "SHA512", "Sell", "UP", "height", "lastBlock", "nil", "this", "tx", "unit"}
Functions ¶
Types ¶
type AssignmentNode ¶
func NewAssignmentNode ¶
func NewAssignmentNode(name string, expression, block Node) *AssignmentNode
func (*AssignmentNode) SetBlock ¶
func (n *AssignmentNode) SetBlock(node Node)
type BooleanNode ¶
type BooleanNode struct {
Value bool
}
func NewBooleanNode ¶
func NewBooleanNode(v bool) *BooleanNode
func (*BooleanNode) SetBlock ¶
func (*BooleanNode) SetBlock(Node)
type ConditionalNode ¶
func NewConditionalNode ¶
func NewConditionalNode(condition, trueExpression, falseExpression Node) *ConditionalNode
func (*ConditionalNode) SetBlock ¶
func (*ConditionalNode) SetBlock(Node)
type DAppResult ¶
type DAppResult struct {
// contains filtered or unexported fields
}
func (DAppResult) Result ¶
func (r DAppResult) Result() bool
func (DAppResult) ScriptActions ¶
func (r DAppResult) ScriptActions() []proto.ScriptAction
func (DAppResult) UserError ¶
func (r DAppResult) UserError() string
type DAppScript ¶
type DAppScript struct { LibVersion int Code []byte Constants []rideType EntryPoints map[string]callable }
func (*DAppScript) Run ¶
func (s *DAppScript) Run(env RideEnvironment) (RideResult, error)
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
func NewEnvironment ¶
func NewEnvironment(scheme proto.Scheme, state types.SmartState) (*Environment, error)
func (*Environment) ChooseSizeCheck ¶
func (e *Environment) ChooseSizeCheck(v int)
func (*Environment) SetInvoke ¶
func (e *Environment) SetInvoke(tx *proto.InvokeScriptWithProofs, v int) error
func (*Environment) SetLastBlock ¶
func (e *Environment) SetLastBlock(info *proto.BlockInfo)
func (*Environment) SetThisFromAddress ¶
func (e *Environment) SetThisFromAddress(addr proto.Address)
func (*Environment) SetThisFromAssetInfo ¶
func (e *Environment) SetThisFromAssetInfo(info *proto.AssetInfo)
func (*Environment) SetThisFromFullAssetInfo ¶
func (e *Environment) SetThisFromFullAssetInfo(info *proto.FullAssetInfo)
func (*Environment) SetTransaction ¶
func (e *Environment) SetTransaction(tx proto.Transaction) error
func (*Environment) SetTransactionFromOrder ¶
func (e *Environment) SetTransactionFromOrder(order proto.Order) error
func (*Environment) SetTransactionFromScriptAction ¶
func (e *Environment) SetTransactionFromScriptAction(action proto.ScriptAction, pk crypto.PublicKey, id crypto.Digest, ts uint64) error
func (*Environment) SetTransactionFromScriptTransfer ¶
func (e *Environment) SetTransactionFromScriptTransfer(transfer *proto.FullScriptTransfer)
func (*Environment) SetTransactionWithoutProofs ¶
func (e *Environment) SetTransactionWithoutProofs(tx proto.Transaction) error
type FunctionCallNode ¶
func NewFunctionCallNode ¶
func NewFunctionCallNode(name string, arguments []Node) *FunctionCallNode
func (*FunctionCallNode) SetBlock ¶
func (*FunctionCallNode) SetBlock(Node)
type FunctionDeclarationNode ¶
type FunctionDeclarationNode struct { Name string Arguments []string Body Node Block Node // contains filtered or unexported fields }
func NewFunctionDeclarationNode ¶
func NewFunctionDeclarationNode(name string, arguments []string, body, block Node) *FunctionDeclarationNode
func (*FunctionDeclarationNode) SetBlock ¶
func (n *FunctionDeclarationNode) SetBlock(node Node)
type PropertyNode ¶
func NewPropertyNode ¶
func NewPropertyNode(name string, object Node) *PropertyNode
func (*PropertyNode) SetBlock ¶
func (*PropertyNode) SetBlock(Node)
type ReferenceNode ¶
type ReferenceNode struct {
Name string
}
func NewReferenceNode ¶
func NewReferenceNode(name string) *ReferenceNode
func (*ReferenceNode) SetBlock ¶
func (*ReferenceNode) SetBlock(Node)
type RideEnvironment ¶
type RideEnvironment interface {
// contains filtered or unexported methods
}
type RideResult ¶
type RideResult interface { Result() bool UserError() string ScriptActions() []proto.ScriptAction }
func CallFunction ¶
func CallFunction(env RideEnvironment, tree *Tree, name string, args proto.Arguments) (RideResult, error)
func CallVerifier ¶
func CallVerifier(env RideEnvironment, tree *Tree) (RideResult, error)
type RideScript ¶
type RideScript interface { Run(env RideEnvironment) (RideResult, error) // contains filtered or unexported methods }
func Compile ¶
func Compile(tree *Tree) (RideScript, error)
type ScriptMeta ¶
type ScriptResult ¶
type ScriptResult struct {
// contains filtered or unexported fields
}
func (ScriptResult) Result ¶
func (r ScriptResult) Result() bool
func (ScriptResult) ScriptActions ¶
func (r ScriptResult) ScriptActions() []proto.ScriptAction
func (ScriptResult) UserError ¶
func (r ScriptResult) UserError() string
type SimpleScript ¶
func (*SimpleScript) Run ¶
func (s *SimpleScript) Run(env RideEnvironment) (RideResult, error)
type StringNode ¶
type StringNode struct {
Value string
}
func NewStringNode ¶
func NewStringNode(v string) *StringNode
func (*StringNode) SetBlock ¶
func (*StringNode) SetBlock(Node)
type Tree ¶
type Tree struct { Digest [32]byte AppVersion int LibVersion int HasBlockV2 bool Meta ScriptMeta Declarations []Node Functions []Node Verifier Node }
func (*Tree) HasVerifier ¶
type TreeEstimation ¶
type TreeEstimation struct { Estimation int `cbor:"0,keyasint"` Verifier int `cbor:"1,keyasint,omitempty"` Functions map[string]int `cbor:"2,keyasint,omitempty"` }
func EstimateTree ¶
func EstimateTree(tree *Tree, v int) (TreeEstimation, error)
Source Files ¶
- compiler.go
- constants.go
- constructors.go
- converters.go
- environment.go
- functions.go
- functions_boolean.go
- functions_bytes.go
- functions_common.go
- functions_generated.go
- functions_int.go
- functions_list.go
- functions_proto.go
- functions_strings.go
- opcodes.go
- parser.go
- program.go
- result.go
- runtime.go
- selectors.go
- tree.go
- tree_estimation.go
- tree_estimatorV1.go
- tree_estimatorV2.go
- tree_estimatorV3.go
- tree_evaluation.go
- tree_evaluator.go
- tuples.go
- vm.go
Click to show internal directories.
Click to hide internal directories.