apply

package
v0.0.0-...-76c1feb Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplicationCall

func ApplicationCall(ac transactions.ApplicationCallTxnFields, header transactions.Header, balances Balances, ad *transactions.ApplyData, evalParams *logic.EvalParams, txnCounter uint64) (err error)

ApplicationCall evaluates ApplicationCall transaction

func AssetConfig

AssetConfig applies an AssetConfig transaction using the Balances interface.

func AssetFreeze

AssetFreeze applies an AssetFreeze transaction using the Balances interface.

func AssetTransfer

AssetTransfer applies an AssetTransfer transaction using the Balances interface.

func Keyreg

Keyreg applies a KeyRegistration transaction using the Balances interface.

func Payment

Payment changes the balances according to this transaction. The ApplyData argument should reflect the changes made by apply(). It may already include changes made by the caller (i.e., Transaction.Apply), so apply() must update it rather than overwriting it. For example, Transaction.Apply() may have updated ad.SenderRewards, and this function should only add to ad.SenderRewards (if needed), but not overwrite it.

Types

type Balances

type Balances interface {
	// Get looks up the account data for an address, ignoring application state
	// If the account is known to be empty, then err should be nil and the returned balance record should have the given address and empty AccountData
	// withPendingRewards specifies whether pending rewards should be applied.
	// A non-nil error means the lookup is impossible (e.g., if the database doesn't have necessary state anymore)
	Get(addr basics.Address, withPendingRewards bool) (basics.AccountData, error)

	Put(basics.Address, basics.AccountData) error

	// PutWithCreatable is like Put, but should be used when creating or deleting an asset or application.
	PutWithCreatable(addr basics.Address, acct basics.AccountData, newCreatable *basics.CreatableLocator, deletedCreatable *basics.CreatableLocator) error

	// GetCreator gets the address of the account that created a given creatable
	GetCreator(cidx basics.CreatableIndex, ctype basics.CreatableType) (basics.Address, bool, error)

	// Allocate or Deallocate either global or address-local app storage.
	//
	// PutWithCreatable(...) and then {Allocate/Deallocate}(..., ..., global=true)
	// creates/destroys an application.
	//
	// Put(...) and then {Allocate/Deallocate}(..., ..., global=false)
	// opts into/closes out of an application.
	Allocate(addr basics.Address, aidx basics.AppIndex, global bool, space basics.StateSchema) error
	Deallocate(addr basics.Address, aidx basics.AppIndex, global bool) error

	// StatefulEval executes a TEAL program in stateful mode on the balances.
	// It returns whether the program passed and its error.  It alo returns
	// an EvalDelta that contains the changes made by the program.
	StatefulEval(params logic.EvalParams, aidx basics.AppIndex, program []byte) (passed bool, evalDelta basics.EvalDelta, err error)

	// Move MicroAlgos from one account to another, doing all necessary overflow checking (convenience method)
	// TODO: Does this need to be part of the balances interface, or can it just be implemented here as a function that calls Put and Get?
	Move(src, dst basics.Address, amount basics.MicroAlgos, srcRewards *basics.MicroAlgos, dstRewards *basics.MicroAlgos) error

	// Balances correspond to a Round, which mean that they also correspond
	// to a ConsensusParams.  This returns those parameters.
	ConsensusParams() config.ConsensusParams
}

Balances allow to move MicroAlgos from one address to another and to update balance records, or to access and modify individual balance records After a call to Put (or Move), future calls to Get or Move will reflect the updated balance record(s)

Jump to

Keyboard shortcuts

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