program

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OP_APUSH            = byte(iota + 1)
	OP_BUMP             // <value_to_bump: any> <any>*N <int N> => <any>*N <value_to_bump>
	OP_DELETE           // <value: not funding>
	OP_IADD             // <number> + <number> => <number>
	OP_ISUB             // <number> - <number> => <number>
	OP_PRINT            // <any>
	OP_FAIL             //
	OP_ASSET            // <asset | monetary | funding> => <asset>
	OP_MONETARY_NEW     // <asset> <number> => <monetary>
	OP_MONETARY_ADD     // <monetary> + <monetary> => <monetary>   // panics if not same asset
	OP_MONETARY_SUB     // <monetary> - <monetary> => <monetary>   // panics if not same asset
	OP_MAKE_ALLOTMENT   // <portion>*N <int N> => <allotment(N)>
	OP_TAKE_ALL         // <source: account> <overdraft: monetary> => <funding>
	OP_TAKE_ALWAYS      // <source: account> <monetary> => <funding>   // takes amount from account unconditionally
	OP_TAKE             // <funding> <monetary> => <remaining: funding> <taken: funding> // fails with EXIT_INSUFFICIENT_FUNDS if not enough
	OP_TAKE_MAX         // <funding> <monetary> => <missing: monetary> <remaining: funding> <taken: funding> // Doesn't fail on insufficient funds. Either missing or remaining is zero.
	OP_FUNDING_ASSEMBLE // <funding>*N <int N> => <funding> (first has highest priority)
	OP_FUNDING_SUM      // <funding> => <funding> <sum: monetary>
	OP_FUNDING_REVERSE  // <funding> => <funding>
	OP_REPAY            // <funding>
	OP_ALLOC            // <monetary> <allotment(N)> => <monetary>*N
	OP_SEND             // <funding> <account>
	OP_TX_META          //
	OP_ACCOUNT_META     //
)

Variables

This section is empty.

Functions

func OpcodeName

func OpcodeName(op byte) string

Types

type Constant

type Constant struct {
	Inner core.Value
}

func (Constant) GetType

func (c Constant) GetType() core.Type

func (Constant) String

func (c Constant) String() string

type Monetary

type Monetary struct {
	Asset  core.Address
	Amount *core.MonetaryInt
}

func (Monetary) GetType

func (a Monetary) GetType() core.Type

func (Monetary) String

func (a Monetary) String() string

type Program

type Program struct {
	Instructions   []byte
	Resources      []Resource
	NeededBalances map[core.Address]map[core.Address]struct{}
}

func (*Program) ParseVariables

func (p *Program) ParseVariables(vars map[string]core.Value) (map[string]core.Value, error)

func (*Program) ParseVariablesJSON

func (p *Program) ParseVariablesJSON(vars map[string]json.RawMessage) (map[string]core.Value, error)

func (Program) String

func (p Program) String() string

type Resource

type Resource interface {
	GetType() core.Type
}

type Variable

type Variable struct {
	Typ  core.Type
	Name string
}

func (Variable) GetType

func (p Variable) GetType() core.Type

func (Variable) String

func (p Variable) String() string

type VariableAccountBalance

type VariableAccountBalance struct {
	Name    string
	Account core.Address
	Asset   core.Address
}

func (VariableAccountBalance) GetType

func (a VariableAccountBalance) GetType() core.Type

func (VariableAccountBalance) String

func (a VariableAccountBalance) String() string

type VariableAccountMetadata

type VariableAccountMetadata struct {
	Typ     core.Type
	Name    string
	Account core.Address
	Key     string
}

func (VariableAccountMetadata) GetType

func (m VariableAccountMetadata) GetType() core.Type

func (VariableAccountMetadata) String

func (m VariableAccountMetadata) String() string

Jump to

Keyboard shortcuts

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