basics

package
v0.0.0-...-7d4e23b Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: AGPL-3.0 Imports: 22 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// Offline indicates that the associated account receives rewards but does not participate in the consensus.
	Offline Status = iota
	// Online indicates that the associated account participates in the consensus and receive rewards.
	Online
	// NotParticipating indicates that the associated account neither participates in the consensus, nor receives rewards.
	// Accounts that are marked as NotParticipating cannot change their status, but can receive and send Algos to other accounts.
	// Two special accounts that are defined as NotParticipating are the incentive pool (also know as rewards pool) and the fee sink.
	// These two accounts also have additional Algo transfer restrictions.
	NotParticipating

	// EncodedMaxAppLocalStates is the decoder limit for number of opted-in apps in a single account.
	// It is verified in TestEncodedAccountAllocationBounds to align with
	// config.Consensus[protocol.ConsensusCurrentVersion].MaxAppsOptedIn
	EncodedMaxAppLocalStates = 64

	// EncodedMaxAppParams is the decoder limit for number of created apps in a single account.
	// It is verified in TestEncodedAccountAllocationBounds to align with
	// config.Consensus[protocol.ConsensusCurrentVersion].MaxAppsCreated
	EncodedMaxAppParams = 64

	// EncodedMaxKeyValueEntries is the decoder limit for the length of a key/value store.
	// It is verified in TestEncodedAccountAllocationBounds to align with
	// config.Consensus[protocol.ConsensusCurrentVersion].MaxLocalSchemaEntries and
	// config.Consensus[protocol.ConsensusCurrentVersion].MaxGlobalSchemaEntries
	EncodedMaxKeyValueEntries = 1024
)
View Source
const (
	// ErrIndexOutOfBound returned when an index is out of the array's bound
	ErrIndexOutOfBound = "pos %d past end %d"
)

Variables

This section is empty.

Functions

func AccountDataMaxSize

func AccountDataMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func AddSaturate

func AddSaturate[T constraints.Unsigned](a, b T) T

AddSaturate adds 2 values with saturation on overflow

func AddressMaxSize

func AddressMaxSize() int

MaxSize returns a maximum valid message size for this message type

func Annotate

func Annotate(err error, pairs ...any) error

Annotate adds additional attributes to an existing error, even if the error is deep in the error chain. If the supplied error is nil, nil is returned so that callers can annotate errors without checking if they are non-nil. If the error is not a structured error, it is wrapped in one using its existing message and the new attributes. Just like append() for slices, callers should re-assign, like this `err = serr.Annotate(err, "x", 100)`

func AppIndexMaxSize

func AppIndexMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func AppLocalStateMaxSize

func AppLocalStateMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func AppParamsMaxSize

func AppParamsMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func AssetHoldingMaxSize

func AssetHoldingMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func AssetIndexMaxSize

func AssetIndexMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func AssetParamsMaxSize

func AssetParamsMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func Attributes

func Attributes(err error) map[string]any

Attributes returns the attributes of a structured error, or nil/empty.

func BalanceRecordMaxSize

func BalanceRecordMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func CreatableIndexMaxSize

func CreatableIndexMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func CreatableTypeMaxSize

func CreatableTypeMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func DeltaActionMaxSize

func DeltaActionMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func DivCeil

func DivCeil[T constraints.Integer](numerator, denominator T) T

DivCeil provides `math.Ceil` semantics using integer division. The technique avoids slower floating point operations as suggested in https://stackoverflow.com/a/2745086.

The method assumes both numbers are positive and does _not_ check for divide-by-zero.

func MicroAlgosMaxSize

func MicroAlgosMaxSize() (s int)

MicroAlgosMaxSize returns maximum possible msgp encoded size of MicroAlgos in bytes. It is expected by msgp generated MaxSize functions

func MulSaturate

func MulSaturate[T constraints.Unsigned](a, b T) T

MulSaturate multiplies 2 values with saturation on overflow

func Muldiv

func Muldiv(a uint64, b uint64, c uint64) (res uint64, overflow bool)

Muldiv computes a*b/c. The overflow flag indicates that the result was 2^64 or greater.

func NormalizedOnlineAccountBalance

func NormalizedOnlineAccountBalance(status Status, rewardsBase uint64, microAlgos MicroAlgos, genesisProto config.ConsensusParams) uint64

NormalizedOnlineAccountBalance returns a “normalized” balance for an account with the given parameters.

The normalization compensates for rewards that have not yet been applied, by computing a balance normalized to round 0. To normalize, we estimate the microalgo balance that an account should have had at round 0, in order to end up at its current balance when rewards are included.

The benefit of the normalization procedure is that an account's normalized balance does not change over time (unlike the actual algo balance that includes rewards). This makes it possible to compare normalized balances between two accounts, to sort them, and get results that are close to what we would get if we computed the exact algo balance of the accounts at a given round number.

The normalization can lead to some inconsistencies in comparisons between account balances, because the growth rate of rewards for accounts depends on how recently the account has been touched (our rewards do not implement compounding). However, online accounts have to periodically renew participation keys, so the scale of the inconsistency is small.

func OAdd

func OAdd[T constraints.Unsigned](a, b T) (res T, overflowed bool)

OAdd adds 2 values with overflow detection

func OMul

func OMul[T constraints.Unsigned](a, b T) (res T, overflowed bool)

OMul multiplies 2 values with overflow detection

func OSub

func OSub[T constraints.Unsigned](a, b T) (res T, overflowed bool)

OSub subtracts b from a with overflow detection

func OneTimeIDForRound

func OneTimeIDForRound(round Round, keyDilution uint64) crypto.OneTimeSignatureIdentifier

OneTimeIDForRound maps a round to the identifier for which ephemeral key should be used for that round. keyDilution specifies the number of keys in the bottom-level of the two-level key structure.

func ParticipantMaxSize

func ParticipantMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func RoundIntervalMaxSize

func RoundIntervalMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func RoundMaxSize

func RoundMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func StateDeltaMaxSize

func StateDeltaMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func StateSchemaMaxSize

func StateSchemaMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func StateSchemasMaxSize

func StateSchemasMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func StatusMaxSize

func StatusMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func SubSaturate

func SubSaturate[T constraints.Unsigned](a, b T) T

SubSaturate subtracts 2 values with saturation on underflow

func TealKeyValueMaxSize

func TealKeyValueMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func TealTypeMaxSize

func TealTypeMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func TealValueMaxSize

func TealValueMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func ValueDeltaMaxSize

func ValueDeltaMaxSize() (s int)

MaxSize returns a maximum valid message size for this message type

func WithUpdatedRewards

func WithUpdatedRewards(
	proto config.ConsensusParams, status Status, microAlgosIn MicroAlgos, rewardedMicroAlgosIn MicroAlgos, rewardsBaseIn uint64, rewardsLevelIn uint64,
) (MicroAlgos, MicroAlgos, uint64)

WithUpdatedRewards returns an updated number of algos, total rewards and new rewards base to reflect rewards up to some rewards level.

func Wrap

func Wrap(err error, msg string, field string, pairs ...any) error

Wrap is used to "demote" an existing error to a field in a new structured error. The wrapped error message is added as $field-msg, and if the error is structured, the attributes are added under $field-attrs.

Types

type AccountData

type AccountData struct {
	Status     Status     `codec:"onl"`
	MicroAlgos MicroAlgos `codec:"algo"`

	// RewardsBase is used to implement rewards.
	// This is not meaningful for accounts with Status=NotParticipating.
	//
	// Every block assigns some amount of rewards (algos) to every
	// participating account.  The amount is the product of how much
	// block.RewardsLevel increased from the previous block and
	// how many whole config.Protocol.RewardUnit algos this
	// account holds.
	//
	// For performance reasons, we do not want to walk over every
	// account to apply these rewards to AccountData.MicroAlgos.  Instead,
	// we defer applying the rewards until some other transaction
	// touches that participating account, and at that point, apply all
	// of the rewards to the account's AccountData.MicroAlgos.
	//
	// For correctness, we need to be able to determine how many
	// total algos are present in the system, including deferred
	// rewards (deferred in the sense that they have not been
	// reflected in the account's AccountData.MicroAlgos, as described
	// above).  To compute this total efficiently, we avoid
	// compounding rewards (i.e., no rewards on rewards) until
	// they are applied to AccountData.MicroAlgos.
	//
	// Mechanically, RewardsBase stores the block.RewardsLevel
	// whose rewards are already reflected in AccountData.MicroAlgos.
	// If the account is Status=Offline or Status=Online, its
	// effective balance (if a transaction were to be issued
	// against this account) may be higher, as computed by
	// AccountData.Money().  That function calls
	// AccountData.WithUpdatedRewards() to apply the deferred
	// rewards to AccountData.MicroAlgos.
	RewardsBase uint64 `codec:"ebase"`

	// RewardedMicroAlgos is used to track how many algos were given
	// to this account since the account was first created.
	//
	// This field is updated along with RewardBase; note that
	// it won't answer the question "how many algos did I make in
	// the past week".
	RewardedMicroAlgos MicroAlgos `codec:"ern"`

	VoteID       crypto.OneTimeSignatureVerifier `codec:"vote"`
	SelectionID  crypto.VRFVerifier              `codec:"sel"`
	StateProofID merklesignature.Commitment      `codec:"stprf"`

	VoteFirstValid  Round  `codec:"voteFst"`
	VoteLastValid   Round  `codec:"voteLst"`
	VoteKeyDilution uint64 `codec:"voteKD"`

	// LastProposed is the last round that the account is known to have
	// proposed. It is updated at the start of the _next_ round.
	LastProposed Round `codec:"lpr"`
	// LastHeartbeat is the last round an account has indicated it is ready to
	// vote by sending a heartbeat transaction, signed by its partkey.
	LastHeartbeat Round `codec:"lhb"`

	// If this account created an asset, AssetParams stores
	// the parameters defining that asset.  The params are indexed
	// by the Index of the AssetID; the Creator is this account's address.
	//
	// An account with any asset in AssetParams cannot be
	// closed, until the asset is destroyed.  An asset can
	// be destroyed if this account holds AssetParams.Total units
	// of that asset (in the Assets array below).
	//
	// NOTE: do not modify this value in-place in existing AccountData
	// structs; allocate a copy and modify that instead.  AccountData
	// is expected to have copy-by-value semantics.
	AssetParams map[AssetIndex]AssetParams `codec:"apar,allocbound=encodedMaxAssetsPerAccount"`

	// Assets is the set of assets that can be held by this
	// account.  Assets (i.e., slots in this map) are explicitly
	// added and removed from an account by special transactions.
	// The map is keyed by the AssetID, which is the address of
	// the account that created the asset plus a unique counter
	// to distinguish re-created assets.
	//
	// Each asset bumps the required MinBalance in this account.
	//
	// An account that creates an asset must have its own asset
	// in the Assets map until that asset is destroyed.
	//
	// NOTE: do not modify this value in-place in existing AccountData
	// structs; allocate a copy and modify that instead.  AccountData
	// is expected to have copy-by-value semantics.
	Assets map[AssetIndex]AssetHolding `codec:"asset,allocbound=encodedMaxAssetsPerAccount"`

	// AuthAddr is the address against which signatures/multisigs/logicsigs should be checked.
	// If empty, the address of the account whose AccountData this is is used.
	// A transaction may change an account's AuthAddr to "re-key" the account.
	// This allows key rotation, changing the members in a multisig, etc.
	AuthAddr Address `codec:"spend"`

	// IncentiveEligible indicates whether the account came online with the
	// extra fee required to be eligible for block incentives. At proposal time,
	// balance limits must also be met to receive incentives.
	IncentiveEligible bool `codec:"ie"`

	// AppLocalStates stores the local states associated with any applications
	// that this account has opted in to.
	AppLocalStates map[AppIndex]AppLocalState `codec:"appl,allocbound=EncodedMaxAppLocalStates"`

	// AppParams stores the global parameters and state associated with any
	// applications that this account has created.
	AppParams map[AppIndex]AppParams `codec:"appp,allocbound=EncodedMaxAppParams"`

	// TotalAppSchema stores the sum of all of the LocalStateSchemas
	// and GlobalStateSchemas in this account (global for applications
	// we created local for applications we opted in to), so that we don't
	// have to iterate over all of them to compute MinBalance.
	TotalAppSchema StateSchema `codec:"tsch"`

	// TotalExtraAppPages stores the extra length in pages (MaxAppProgramLen bytes per page)
	// requested for app program by this account
	TotalExtraAppPages uint32 `codec:"teap"`

	// Total number of boxes associated with this account, which implies it is an app account.
	TotalBoxes uint64 `codec:"tbx"`

	// TotalBoxBytes stores the sum of all len(keys) and len(values) of Boxes
	TotalBoxBytes uint64 `codec:"tbxb"`
	// contains filtered or unexported fields
}

AccountData contains the data associated with a given address.

This includes the account balance, cryptographic public keys, consensus status, asset params (for assets made by this account), asset holdings (for assets the account is opted into), and application data (globals if account created, locals if opted-in). This can be thought of as the fully "hydrated" structure and could take an arbitrary number of db queries to fill. As such, it is mostly used only for shuttling complete accounts into the ledger (genesis, catchpoints, REST API). And a lot of legacy tests.

func (*AccountData) CanMarshalMsg

func (_ *AccountData) CanMarshalMsg(z interface{}) bool

func (*AccountData) CanUnmarshalMsg

func (_ *AccountData) CanUnmarshalMsg(z interface{}) bool

func (AccountData) IsZero

func (u AccountData) IsZero() bool

IsZero checks if an AccountData value is the same as its zero value.

func (*AccountData) MarshalMsg

func (z *AccountData) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (AccountData) MinBalance

func (u AccountData) MinBalance(proto *config.ConsensusParams) MicroAlgos

MinBalance computes the minimum balance requirements for an account based on some consensus parameters. MinBalance should correspond roughly to how much storage the account is allowed to store on disk.

func (AccountData) Money

func (u AccountData) Money(proto config.ConsensusParams, rewardsLevel uint64) (money MicroAlgos, rewards MicroAlgos)

Money returns the amount of MicroAlgos associated with the user's account

func (*AccountData) MsgIsZero

func (z *AccountData) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*AccountData) Msgsize

func (z *AccountData) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (AccountData) NormalizedOnlineBalance

func (u AccountData) NormalizedOnlineBalance(proto config.ConsensusParams) uint64

NormalizedOnlineBalance returns a “normalized” balance for this account.

The normalization compensates for rewards that have not yet been applied, by computing a balance normalized to round 0. To normalize, we estimate the microalgo balance that an account should have had at round 0, in order to end up at its current balance when rewards are included.

The benefit of the normalization procedure is that an account's normalized balance does not change over time (unlike the actual algo balance that includes rewards). This makes it possible to compare normalized balances between two accounts, to sort them, and get results that are close to what we would get if we computed the exact algo balance of the accounts at a given round number.

The normalization can lead to some inconsistencies in comparisons between account balances, because the growth rate of rewards for accounts depends on how recently the account has been touched (our rewards do not implement compounding). However, online accounts have to periodically renew participation keys, so the scale of the inconsistency is small.

func (AccountData) OnlineAccountData

func (u AccountData) OnlineAccountData() OnlineAccountData

OnlineAccountData returns subset of AccountData as OnlineAccountData data structure. Account is expected to be Online otherwise its is cleared out

func (*AccountData) UnmarshalMsg

func (z *AccountData) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*AccountData) UnmarshalMsgWithState

func (z *AccountData) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

func (AccountData) WithUpdatedRewards

func (u AccountData) WithUpdatedRewards(proto config.ConsensusParams, rewardsLevel uint64) AccountData

WithUpdatedRewards returns an updated number of algos in an AccountData to reflect rewards up to some rewards level.

type AccountDetail

type AccountDetail struct {
	Address Address
	Algos   MicroAlgos
	Status  Status
}

AccountDetail encapsulates meaningful details about a given account, for external consumption

type Address

type Address crypto.Digest

Address is a unique identifier corresponding to ownership of money

func UnmarshalChecksumAddress

func UnmarshalChecksumAddress(address string) (Address, error)

UnmarshalChecksumAddress tries to unmarshal the checksummed address string. Algorand strings addresses ( base32 encoded ) have a postamble which serves as the checksum of the address. When converted to an Address object representation, that checksum is dropped (after validation).

func (*Address) CanMarshalMsg

func (_ *Address) CanMarshalMsg(z interface{}) bool

func (*Address) CanUnmarshalMsg

func (_ *Address) CanUnmarshalMsg(z interface{}) bool

func (Address) GetChecksum

func (addr Address) GetChecksum() []byte

GetChecksum returns the checksum as []byte Checksum in Algorand are the last 4 bytes of the shortAddress Hash. H(Address)[28:]

func (Address) GetUserAddress

func (addr Address) GetUserAddress() string

GetUserAddress returns the human-readable, checksummed version of the address

func (Address) IsZero

func (addr Address) IsZero() bool

IsZero checks if an address is the zero value.

func (*Address) MarshalMsg

func (z *Address) MarshalMsg(b []byte) []byte

MarshalMsg implements msgp.Marshaler

func (Address) MarshalText

func (addr Address) MarshalText() ([]byte, error)

MarshalText returns the address string as an array of bytes

func (*Address) MsgIsZero

func (z *Address) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*Address) Msgsize

func (z *Address) Msgsize() int

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Address) String

func (addr Address) String() string

String returns a string representation of Address

func (*Address) UnmarshalMsg

func (z *Address) UnmarshalMsg(bts []byte) ([]byte, error)

UnmarshalMsg implements msgp.Unmarshaler

func (*Address) UnmarshalMsgWithState

func (z *Address) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) ([]byte, error)

func (*Address) UnmarshalText

func (addr *Address) UnmarshalText(text []byte) error

UnmarshalText initializes the Address from an array of bytes.

type AppIndex

type AppIndex uint64

AppIndex is the unique integer index of an application that can be used to look up the creator of the application, whose balance record contains the AppParams

func (AppIndex) Address

func (app AppIndex) Address() Address

Address yields the "app address" of the app

func (AppIndex) CanMarshalMsg

func (_ AppIndex) CanMarshalMsg(z interface{}) bool

func (*AppIndex) CanUnmarshalMsg

func (_ *AppIndex) CanUnmarshalMsg(z interface{}) bool

func (AppIndex) MarshalMsg

func (z AppIndex) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (AppIndex) MsgIsZero

func (z AppIndex) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (AppIndex) Msgsize

func (z AppIndex) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (AppIndex) ToBeHashed

func (app AppIndex) ToBeHashed() (protocol.HashID, []byte)

ToBeHashed implements crypto.Hashable

func (*AppIndex) UnmarshalMsg

func (z *AppIndex) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*AppIndex) UnmarshalMsgWithState

func (z *AppIndex) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AppLocalState

type AppLocalState struct {
	Schema   StateSchema  `codec:"hsch"`
	KeyValue TealKeyValue `codec:"tkv"`
	// contains filtered or unexported fields
}

AppLocalState stores the LocalState associated with an application. It also stores a cached copy of the application's LocalStateSchema so that MinBalance requirements may be computed 1. without looking up the AppParams and 2. even if the application has been deleted

func (*AppLocalState) CanMarshalMsg

func (_ *AppLocalState) CanMarshalMsg(z interface{}) bool

func (*AppLocalState) CanUnmarshalMsg

func (_ *AppLocalState) CanUnmarshalMsg(z interface{}) bool

func (*AppLocalState) Clone

func (al *AppLocalState) Clone() (res AppLocalState)

Clone returns a copy of some AppLocalState that may be modified without affecting the original

func (*AppLocalState) MarshalMsg

func (z *AppLocalState) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*AppLocalState) MsgIsZero

func (z *AppLocalState) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*AppLocalState) Msgsize

func (z *AppLocalState) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AppLocalState) UnmarshalMsg

func (z *AppLocalState) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*AppLocalState) UnmarshalMsgWithState

func (z *AppLocalState) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AppParams

type AppParams struct {
	ApprovalProgram   []byte       `codec:"approv,allocbound=config.MaxAvailableAppProgramLen"`
	ClearStateProgram []byte       `codec:"clearp,allocbound=config.MaxAvailableAppProgramLen"`
	GlobalState       TealKeyValue `codec:"gs"`
	StateSchemas
	ExtraProgramPages uint32 `codec:"epp"`
	// contains filtered or unexported fields
}

AppParams stores the global information associated with an application

func (*AppParams) CanMarshalMsg

func (_ *AppParams) CanMarshalMsg(z interface{}) bool

func (*AppParams) CanUnmarshalMsg

func (_ *AppParams) CanUnmarshalMsg(z interface{}) bool

func (*AppParams) Clone

func (ap *AppParams) Clone() (res AppParams)

Clone returns a copy of some AppParams that may be modified without affecting the original

func (*AppParams) MarshalMsg

func (z *AppParams) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*AppParams) MsgIsZero

func (z *AppParams) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*AppParams) Msgsize

func (z *AppParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AppParams) UnmarshalMsg

func (z *AppParams) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*AppParams) UnmarshalMsgWithState

func (z *AppParams) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AssetHolding

type AssetHolding struct {
	Amount uint64 `codec:"a"`
	Frozen bool   `codec:"f"`
	// contains filtered or unexported fields
}

AssetHolding describes an asset held by an account.

func (*AssetHolding) CanMarshalMsg

func (_ *AssetHolding) CanMarshalMsg(z interface{}) bool

func (*AssetHolding) CanUnmarshalMsg

func (_ *AssetHolding) CanUnmarshalMsg(z interface{}) bool

func (*AssetHolding) MarshalMsg

func (z *AssetHolding) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*AssetHolding) MsgIsZero

func (z *AssetHolding) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*AssetHolding) Msgsize

func (z *AssetHolding) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AssetHolding) UnmarshalMsg

func (z *AssetHolding) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*AssetHolding) UnmarshalMsgWithState

func (z *AssetHolding) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AssetIndex

type AssetIndex uint64

AssetIndex is the unique integer index of an asset that can be used to look up the creator of the asset, whose balance record contains the AssetParams

func (AssetIndex) CanMarshalMsg

func (_ AssetIndex) CanMarshalMsg(z interface{}) bool

func (*AssetIndex) CanUnmarshalMsg

func (_ *AssetIndex) CanUnmarshalMsg(z interface{}) bool

func (AssetIndex) MarshalMsg

func (z AssetIndex) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (AssetIndex) MsgIsZero

func (z AssetIndex) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (AssetIndex) Msgsize

func (z AssetIndex) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AssetIndex) UnmarshalMsg

func (z *AssetIndex) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*AssetIndex) UnmarshalMsgWithState

func (z *AssetIndex) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AssetParams

type AssetParams struct {

	// Total specifies the total number of units of this asset
	// created.
	Total uint64 `codec:"t"`

	// Decimals specifies the number of digits to display after the decimal
	// place when displaying this asset. A value of 0 represents an asset
	// that is not divisible, a value of 1 represents an asset divisible
	// into tenths, and so on. This value must be between 0 and 19
	// (inclusive).
	Decimals uint32 `codec:"dc"`

	// DefaultFrozen specifies whether slots for this asset
	// in user accounts are frozen by default or not.
	DefaultFrozen bool `codec:"df"`

	// UnitName specifies a hint for the name of a unit of
	// this asset.
	UnitName string `codec:"un,allocbound=config.MaxAssetUnitNameBytes"`

	// AssetName specifies a hint for the name of the asset.
	AssetName string `codec:"an,allocbound=config.MaxAssetNameBytes"`

	// URL specifies a URL where more information about the asset can be
	// retrieved
	URL string `codec:"au,allocbound=config.MaxAssetURLBytes"`

	// MetadataHash specifies a commitment to some unspecified asset
	// metadata. The format of this metadata is up to the application.
	MetadataHash [32]byte `codec:"am"`

	// Manager specifies an account that is allowed to change the
	// non-zero addresses in this AssetParams.
	Manager Address `codec:"m"`

	// Reserve specifies an account whose holdings of this asset
	// should be reported as "not minted".
	Reserve Address `codec:"r"`

	// Freeze specifies an account that is allowed to change the
	// frozen state of holdings of this asset.
	Freeze Address `codec:"f"`

	// Clawback specifies an account that is allowed to take units
	// of this asset from any account.
	Clawback Address `codec:"c"`
	// contains filtered or unexported fields
}

AssetParams describes the parameters of an asset.

func (*AssetParams) CanMarshalMsg

func (_ *AssetParams) CanMarshalMsg(z interface{}) bool

func (*AssetParams) CanUnmarshalMsg

func (_ *AssetParams) CanUnmarshalMsg(z interface{}) bool

func (*AssetParams) MarshalMsg

func (z *AssetParams) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*AssetParams) MsgIsZero

func (z *AssetParams) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*AssetParams) Msgsize

func (z *AssetParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AssetParams) UnmarshalMsg

func (z *AssetParams) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*AssetParams) UnmarshalMsgWithState

func (z *AssetParams) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BalanceDetail

type BalanceDetail struct {
	Round       Round
	TotalMoney  MicroAlgos
	OnlineMoney MicroAlgos
	Accounts    []AccountDetail
}

BalanceDetail encapsulates meaningful details about the current balances of the ledger, for external consumption

type BalanceRecord

type BalanceRecord struct {
	Addr Address `codec:"addr"`

	AccountData
	// contains filtered or unexported fields
}

BalanceRecord pairs an account's address with its associated data.

func (*BalanceRecord) CanMarshalMsg

func (_ *BalanceRecord) CanMarshalMsg(z interface{}) bool

func (*BalanceRecord) CanUnmarshalMsg

func (_ *BalanceRecord) CanUnmarshalMsg(z interface{}) bool

func (*BalanceRecord) MarshalMsg

func (z *BalanceRecord) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*BalanceRecord) MsgIsZero

func (z *BalanceRecord) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*BalanceRecord) Msgsize

func (z *BalanceRecord) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (BalanceRecord) ToBeHashed

func (u BalanceRecord) ToBeHashed() (protocol.HashID, []byte)

ToBeHashed implements the crypto.Hashable interface

func (*BalanceRecord) UnmarshalMsg

func (z *BalanceRecord) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*BalanceRecord) UnmarshalMsgWithState

func (z *BalanceRecord) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type CreatableIndex

type CreatableIndex uint64

CreatableIndex represents either an AssetIndex or AppIndex, which come from the same namespace of indices as each other (both assets and apps are "creatables")

func (CreatableIndex) CanMarshalMsg

func (_ CreatableIndex) CanMarshalMsg(z interface{}) bool

func (*CreatableIndex) CanUnmarshalMsg

func (_ *CreatableIndex) CanUnmarshalMsg(z interface{}) bool

func (CreatableIndex) MarshalMsg

func (z CreatableIndex) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (CreatableIndex) MsgIsZero

func (z CreatableIndex) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (CreatableIndex) Msgsize

func (z CreatableIndex) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*CreatableIndex) UnmarshalMsg

func (z *CreatableIndex) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*CreatableIndex) UnmarshalMsgWithState

func (z *CreatableIndex) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type CreatableLocator

type CreatableLocator struct {
	Type    CreatableType
	Creator Address
	Index   CreatableIndex
}

CreatableLocator stores both the creator, whose balance record contains the asset/app parameters, and the creatable index, which is the key into those parameters

type CreatableType

type CreatableType uint64

CreatableType is an enum representing whether or not a given creatable is an application or an asset

const (
	// AssetCreatable is the CreatableType corresponding to assets
	// This value must be 0 to align with the applications database
	// upgrade. At migration time, we set the default 'ctype' column of the
	// creators table to 0 so that existing assets have the correct type.
	AssetCreatable CreatableType = 0

	// AppCreatable is the CreatableType corresponds to apps
	AppCreatable CreatableType = 1
)

func (CreatableType) CanMarshalMsg

func (_ CreatableType) CanMarshalMsg(z interface{}) bool

func (*CreatableType) CanUnmarshalMsg

func (_ *CreatableType) CanUnmarshalMsg(z interface{}) bool

func (CreatableType) MarshalMsg

func (z CreatableType) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (CreatableType) MsgIsZero

func (z CreatableType) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (CreatableType) Msgsize

func (z CreatableType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*CreatableType) UnmarshalMsg

func (z *CreatableType) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*CreatableType) UnmarshalMsgWithState

func (z *CreatableType) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type DeltaAction

type DeltaAction uint64

DeltaAction is an enum of actions that may be performed when applying a delta to a TEAL key/value store

const (
	// SetBytesAction indicates that a TEAL byte slice should be stored at a key
	SetBytesAction DeltaAction = 1

	// SetUintAction indicates that a Uint should be stored at a key
	SetUintAction DeltaAction = 2

	// DeleteAction indicates that the value for a particular key should be deleted
	DeleteAction DeltaAction = 3
)

func (DeltaAction) CanMarshalMsg

func (_ DeltaAction) CanMarshalMsg(z interface{}) bool

func (*DeltaAction) CanUnmarshalMsg

func (_ *DeltaAction) CanUnmarshalMsg(z interface{}) bool

func (DeltaAction) MarshalMsg

func (z DeltaAction) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (DeltaAction) MsgIsZero

func (z DeltaAction) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (DeltaAction) Msgsize

func (z DeltaAction) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*DeltaAction) UnmarshalMsg

func (z *DeltaAction) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*DeltaAction) UnmarshalMsgWithState

func (z *DeltaAction) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Fraction

type Fraction struct {
	Numerator   uint64
	Denominator uint64
}

Fraction represents the mathematical notion of rational number, but is much simpler than `big.Rat`. It only supports numerators and denominators of uint64.

func NewFraction

func NewFraction(numerator uint64, denominator uint64) Fraction

NewFraction creates the obvious Fraction, and checks that is not improper, nor divides by zero.

func NewPercent

func NewPercent(pct uint64) Fraction

NewPercent creates a fraction reflecting the given percentage.

func (Fraction) Divvy

func (frac Fraction) Divvy(q uint64) (uint64, uint64)

Divvy separates a quantity into two parts according to the fraction. The first value is floor(q * frac), the second is q - first.

func (Fraction) DivvyAlgos

func (frac Fraction) DivvyAlgos(q MicroAlgos) (MicroAlgos, MicroAlgos)

DivvyAlgos is Divvy, but operates on MicroAlgos

func (Fraction) String

func (frac Fraction) String() string

String returns a string representation of Fraction

type MicroAlgos

type MicroAlgos struct {
	Raw uint64
}

MicroAlgos is our unit of currency. It is wrapped in a struct to nudge developers to use an overflow-checking library for any arithmetic.

func Algos

func Algos(algos uint64) MicroAlgos

Algos is a convenience function so that whole Algos can be written easily. It panics on overflow because it should only be used for constants - things that are best human-readable in source code - not used on arbitrary values from, say, transactions.

func MinA

func MinA(a, b MicroAlgos) MicroAlgos

MinA returns the smaller of 2 MicroAlgos values

func MinBalance

func MinBalance(
	proto *config.ConsensusParams,
	totalAssets uint64,
	totalAppSchema StateSchema,
	totalAppParams uint64, totalAppLocalStates uint64,
	totalExtraAppPages uint64,
	totalBoxes uint64, totalBoxBytes uint64,
) MicroAlgos

MinBalance computes the minimum balance requirements for an account based on some consensus parameters. MinBalance should correspond roughly to how much storage the account is allowed to store on disk.

func MulAIntSaturate

func MulAIntSaturate(a MicroAlgos, b int) MicroAlgos

MulAIntSaturate uses MulSaturate to multiply b (int) with a (MicroAlgos)

func OAddA

func OAddA(a, b MicroAlgos) (res MicroAlgos, overflowed bool)

OAddA adds 2 MicroAlgos values with overflow tracking

func OSubA

func OSubA(a, b MicroAlgos) (res MicroAlgos, overflowed bool)

OSubA subtracts b from a with overflow tracking

func PendingRewards

func PendingRewards(ot *OverflowTracker, proto config.ConsensusParams, microAlgos MicroAlgos, rewardsBase uint64, rewardsLevel uint64) MicroAlgos

PendingRewards computes the amount of rewards (in microalgos) that have yet to be added to the account balance.

func (MicroAlgos) CanMarshalMsg

func (MicroAlgos) CanMarshalMsg(z interface{}) bool

CanMarshalMsg implements msgp.Marshaler

func (*MicroAlgos) CanUnmarshalMsg

func (*MicroAlgos) CanUnmarshalMsg(z interface{}) bool

CanUnmarshalMsg implements msgp.Unmarshaler

func (*MicroAlgos) CodecDecodeSelf

func (a *MicroAlgos) CodecDecodeSelf(dec *codec.Decoder)

CodecDecodeSelf implements codec.Selfer to decode MicroAlgos as a simple int

func (MicroAlgos) CodecEncodeSelf

func (a MicroAlgos) CodecEncodeSelf(enc *codec.Encoder)

CodecEncodeSelf implements codec.Selfer to encode MicroAlgos as a simple int

func (MicroAlgos) GreaterThan

func (a MicroAlgos) GreaterThan(b MicroAlgos) bool

GreaterThan implements arithmetic comparison for MicroAlgos

func (MicroAlgos) IsZero

func (a MicroAlgos) IsZero() bool

IsZero implements arithmetic comparison for MicroAlgos

func (MicroAlgos) LessThan

func (a MicroAlgos) LessThan(b MicroAlgos) bool

LessThan implements arithmetic comparison for MicroAlgos

func (MicroAlgos) MarshalMsg

func (a MicroAlgos) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (MicroAlgos) MsgIsZero

func (a MicroAlgos) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (MicroAlgos) Msgsize

func (a MicroAlgos) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (MicroAlgos) RewardUnits

func (a MicroAlgos) RewardUnits(proto config.ConsensusParams) uint64

RewardUnits returns the number of reward units in some number of algos

func (MicroAlgos) ToUint64

func (a MicroAlgos) ToUint64() uint64

ToUint64 converts the amount of algos to uint64

func (*MicroAlgos) UnmarshalMsg

func (a *MicroAlgos) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

func (*MicroAlgos) UnmarshalMsgWithState

func (a *MicroAlgos) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsgWithState implements msgp.Unmarshaler

type OnlineAccountData

type OnlineAccountData struct {
	MicroAlgosWithRewards MicroAlgos
	VotingData
	IncentiveEligible bool
}

OnlineAccountData contains the voting information for a single account.

func (OnlineAccountData) KeyDilution

func (u OnlineAccountData) KeyDilution(proto config.ConsensusParams) uint64

KeyDilution returns the key dilution for this account, returning the default key dilution if not explicitly specified.

func (OnlineAccountData) VotingStake

func (u OnlineAccountData) VotingStake() MicroAlgos

VotingStake returns the amount of MicroAlgos associated with the user's account for the purpose of participating in the Algorand protocol. It assumes the caller has already updated rewards appropriately using WithUpdatedRewards().

type OverflowTracker

type OverflowTracker struct {
	Overflowed bool
}

OverflowTracker is used to track when an operation causes an overflow

func (*OverflowTracker) Add

func (t *OverflowTracker) Add(a, b uint64) uint64

Add adds 2 values with overflow detection

func (*OverflowTracker) AddA

func (t *OverflowTracker) AddA(a, b MicroAlgos) MicroAlgos

AddA adds 2 MicroAlgos values with overflow tracking

func (*OverflowTracker) Mul

func (t *OverflowTracker) Mul(a, b uint64) uint64

Mul multiplies b by a with overflow detection

func (*OverflowTracker) ScalarMulA

func (t *OverflowTracker) ScalarMulA(a MicroAlgos, b uint64) MicroAlgos

ScalarMulA multiplies an Algo amount by a scalar

func (*OverflowTracker) Sub

func (t *OverflowTracker) Sub(a, b uint64) uint64

Sub subtracts b from a with overflow detection

func (*OverflowTracker) SubA

func (t *OverflowTracker) SubA(a, b MicroAlgos) MicroAlgos

SubA subtracts b from a with overflow tracking

type Participant

type Participant struct {

	// PK is the identifier used to verify the signature for a specific participant
	PK merklesignature.Verifier `codec:"p"`

	// Weight is AccountData.MicroAlgos.
	Weight uint64 `codec:"w"`
	// contains filtered or unexported fields
}

A Participant corresponds to an account whose AccountData.Status is Online, and for which the expected sigRound satisfies AccountData.VoteFirstValid <= sigRound <= AccountData.VoteLastValid.

In the Algorand ledger, it is possible for multiple accounts to have the same PK. Thus, the PK is not necessarily unique among Participants. However, each account will produce a unique Participant struct, to avoid potential DoS attacks where one account claims to have the same VoteID PK as another account.

func (*Participant) CanMarshalMsg

func (_ *Participant) CanMarshalMsg(z interface{}) bool

func (*Participant) CanUnmarshalMsg

func (_ *Participant) CanUnmarshalMsg(z interface{}) bool

func (*Participant) MarshalMsg

func (z *Participant) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*Participant) MsgIsZero

func (z *Participant) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*Participant) Msgsize

func (z *Participant) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Participant) ToBeHashed

func (p Participant) ToBeHashed() (protocol.HashID, []byte)

ToBeHashed implements the crypto.Hashable interface. In order to create a more SNARK-friendly commitments on the signature we must avoid using the msgpack infrastructure. msgpack creates a compressed representation of the struct which might be varied in length, which will be bad for creating SNARK

func (*Participant) UnmarshalMsg

func (z *Participant) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*Participant) UnmarshalMsgWithState

func (z *Participant) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ParticipantsArray

type ParticipantsArray []Participant

ParticipantsArray implements merklearray.Array and is used to commit to a Merkle tree of online accounts.

func (ParticipantsArray) Length

func (p ParticipantsArray) Length() uint64

Length returns the ledger of the array.

func (ParticipantsArray) Marshal

func (p ParticipantsArray) Marshal(pos uint64) (crypto.Hashable, error)

Marshal Returns the hash for the given position.

type Round

type Round uint64

Round represents a protocol round index

func (Round) CanMarshalMsg

func (_ Round) CanMarshalMsg(z interface{}) bool

func (*Round) CanUnmarshalMsg

func (_ *Round) CanUnmarshalMsg(z interface{}) bool

func (Round) MarshalMsg

func (z Round) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (Round) MsgIsZero

func (z Round) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (Round) Msgsize

func (z Round) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Round) RoundDownToMultipleOf

func (round Round) RoundDownToMultipleOf(n Round) Round

RoundDownToMultipleOf rounds down round to a multiple of n.

func (Round) RoundUpToMultipleOf

func (round Round) RoundUpToMultipleOf(n Round) Round

RoundUpToMultipleOf rounds up round to the next multiple of n.

func (Round) SubSaturate

func (round Round) SubSaturate(x Round) Round

SubSaturate subtracts x rounds with saturation arithmetic that does not wrap around past zero, and instead returns 0 on underflow.

func (*Round) UnmarshalMsg

func (z *Round) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*Round) UnmarshalMsgWithState

func (z *Round) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type RoundInterval

type RoundInterval uint64

RoundInterval is a number of rounds

func (RoundInterval) CanMarshalMsg

func (_ RoundInterval) CanMarshalMsg(z interface{}) bool

func (*RoundInterval) CanUnmarshalMsg

func (_ *RoundInterval) CanUnmarshalMsg(z interface{}) bool

func (RoundInterval) MarshalMsg

func (z RoundInterval) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (RoundInterval) MsgIsZero

func (z RoundInterval) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (RoundInterval) Msgsize

func (z RoundInterval) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*RoundInterval) UnmarshalMsg

func (z *RoundInterval) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*RoundInterval) UnmarshalMsgWithState

func (z *RoundInterval) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type SError

type SError struct {
	Msg     string
	Attrs   map[string]any
	Wrapped error
}

SError is a structured error object. It contains a message and an arbitrary set of attributes. If the message contains "%A", it will be replaced by the attributes (in no guaranteed order), when SError() is called.

func New

func New(msg string, pairs ...any) *SError

New creates a new structured error object using the supplied message and attributes. If the message contains "%A", it will be replaced by the attributes when Error() is called.

func (*SError) AttributesAsString

func (e *SError) AttributesAsString() string

AttributesAsString returns the attributes the same way that slog serializes attributes to text in a log message, in no guaranteed order.

func (*SError) Error

func (e *SError) Error() string

Error returns either the exact supplied message, or the serialized attributes if the supplied message was blank, or substituted for %A.

func (*SError) Unwrap

func (e *SError) Unwrap() error

Unwrap returns the inner error, if it exists.

type SortAddress

type SortAddress []Address

SortAddress implements sorting by Address keys for canonical encoding of maps in msgpack format.

func (SortAddress) Len

func (a SortAddress) Len() int

func (SortAddress) Less

func (a SortAddress) Less(i, j int) bool

func (SortAddress) Swap

func (a SortAddress) Swap(i, j int)

type SortAppIndex

type SortAppIndex []AppIndex

SortAppIndex implements sorting by AppIndex keys for canonical encoding of maps in msgpack format.

func (SortAppIndex) Len

func (a SortAppIndex) Len() int

func (SortAppIndex) Less

func (a SortAppIndex) Less(i, j int) bool

func (SortAppIndex) Swap

func (a SortAppIndex) Swap(i, j int)

type SortAssetIndex

type SortAssetIndex []AssetIndex

SortAssetIndex implements sorting by AssetIndex keys for canonical encoding of maps in msgpack format.

func (SortAssetIndex) Len

func (a SortAssetIndex) Len() int

func (SortAssetIndex) Less

func (a SortAssetIndex) Less(i, j int) bool

func (SortAssetIndex) Swap

func (a SortAssetIndex) Swap(i, j int)

type SortString

type SortString []string

SortString implements sorting by string keys for canonical encoding of maps in msgpack format.

func (SortString) Len

func (a SortString) Len() int

func (SortString) Less

func (a SortString) Less(i, j int) bool

func (SortString) Swap

func (a SortString) Swap(i, j int)

type SortUint64

type SortUint64 []uint64

SortUint64 implements sorting by uint64 keys for canonical encoding of maps in msgpack format.

func (SortUint64) Len

func (a SortUint64) Len() int

func (SortUint64) Less

func (a SortUint64) Less(i, j int) bool

func (SortUint64) Swap

func (a SortUint64) Swap(i, j int)

type StateDelta

type StateDelta map[string]ValueDelta

StateDelta is a map from key/value store keys to ValueDeltas, indicating what should happen for that key

func (StateDelta) CanMarshalMsg

func (_ StateDelta) CanMarshalMsg(z interface{}) bool

func (*StateDelta) CanUnmarshalMsg

func (_ *StateDelta) CanUnmarshalMsg(z interface{}) bool

func (StateDelta) Equal

func (sd StateDelta) Equal(o StateDelta) bool

Equal checks whether two StateDeltas are equal. We don't check for nilness equality because an empty map will encode/decode as nil. So if our generated map is empty but not nil, we want to equal a decoded nil off the wire.

func (StateDelta) MarshalMsg

func (z StateDelta) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (StateDelta) MsgIsZero

func (z StateDelta) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (StateDelta) Msgsize

func (z StateDelta) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*StateDelta) UnmarshalMsg

func (z *StateDelta) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*StateDelta) UnmarshalMsgWithState

func (z *StateDelta) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

func (StateDelta) Valid

func (sd StateDelta) Valid(proto *config.ConsensusParams) error

Valid checks whether the keys and values in a StateDelta conform to the consensus parameters' maximum lengths

type StateSchema

type StateSchema struct {
	NumUint      uint64 `codec:"nui"`
	NumByteSlice uint64 `codec:"nbs"`
	// contains filtered or unexported fields
}

StateSchema sets maximums on the number of each type that may be stored

func (StateSchema) AddSchema

func (sm StateSchema) AddSchema(osm StateSchema) (out StateSchema)

AddSchema adds two StateSchemas together

func (*StateSchema) CanMarshalMsg

func (_ *StateSchema) CanMarshalMsg(z interface{}) bool

func (*StateSchema) CanUnmarshalMsg

func (_ *StateSchema) CanUnmarshalMsg(z interface{}) bool

func (*StateSchema) MarshalMsg

func (z *StateSchema) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (StateSchema) MinBalance

func (sm StateSchema) MinBalance(proto *config.ConsensusParams) (res MicroAlgos)

MinBalance computes the MinBalance requirements for a StateSchema based on the consensus parameters

func (*StateSchema) MsgIsZero

func (z *StateSchema) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*StateSchema) Msgsize

func (z *StateSchema) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (StateSchema) NumEntries

func (sm StateSchema) NumEntries() (tot uint64)

NumEntries counts the total number of values that may be stored for particular schema

func (StateSchema) SubSchema

func (sm StateSchema) SubSchema(osm StateSchema) (out StateSchema)

SubSchema subtracts one StateSchema from another

func (*StateSchema) UnmarshalMsg

func (z *StateSchema) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*StateSchema) UnmarshalMsgWithState

func (z *StateSchema) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type StateSchemas

type StateSchemas struct {
	LocalStateSchema  StateSchema `codec:"lsch"`
	GlobalStateSchema StateSchema `codec:"gsch"`
	// contains filtered or unexported fields
}

StateSchemas is a thin wrapper around the LocalStateSchema and the GlobalStateSchema, since they are often needed together

func (*StateSchemas) CanMarshalMsg

func (_ *StateSchemas) CanMarshalMsg(z interface{}) bool

func (*StateSchemas) CanUnmarshalMsg

func (_ *StateSchemas) CanUnmarshalMsg(z interface{}) bool

func (*StateSchemas) MarshalMsg

func (z *StateSchemas) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*StateSchemas) MsgIsZero

func (z *StateSchemas) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*StateSchemas) Msgsize

func (z *StateSchemas) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*StateSchemas) UnmarshalMsg

func (z *StateSchemas) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*StateSchemas) UnmarshalMsgWithState

func (z *StateSchemas) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Status

type Status byte

Status is the delegation status of an account's MicroAlgos

func UnmarshalStatus

func UnmarshalStatus(value string) (s Status, err error)

UnmarshalStatus decodes string status value back to Status constant

func (Status) CanMarshalMsg

func (_ Status) CanMarshalMsg(z interface{}) bool

func (*Status) CanUnmarshalMsg

func (_ *Status) CanUnmarshalMsg(z interface{}) bool

func (Status) MarshalMsg

func (z Status) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (Status) MsgIsZero

func (z Status) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (Status) Msgsize

func (z Status) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Status) String

func (s Status) String() string

func (*Status) UnmarshalMsg

func (z *Status) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*Status) UnmarshalMsgWithState

func (z *Status) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type SupplyDetail

type SupplyDetail struct {
	Round       Round
	TotalMoney  MicroAlgos
	OnlineMoney MicroAlgos
}

SupplyDetail encapsulates meaningful details about the ledger's current token supply

type TealKeyValue

type TealKeyValue map[string]TealValue

TealKeyValue represents a key/value store for use in an application's LocalState or GlobalState

func (TealKeyValue) CanMarshalMsg

func (_ TealKeyValue) CanMarshalMsg(z interface{}) bool

func (*TealKeyValue) CanUnmarshalMsg

func (_ *TealKeyValue) CanUnmarshalMsg(z interface{}) bool

func (TealKeyValue) Clone

func (tk TealKeyValue) Clone() TealKeyValue

Clone returns a copy of a TealKeyValue that may be modified without affecting the original

func (TealKeyValue) MarshalMsg

func (z TealKeyValue) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (TealKeyValue) MsgIsZero

func (z TealKeyValue) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (TealKeyValue) Msgsize

func (z TealKeyValue) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (TealKeyValue) ToStateSchema

func (tk TealKeyValue) ToStateSchema() (schema StateSchema, err error)

ToStateSchema calculates the number of each value type in a TealKeyValue and represents the result as a StateSchema

func (*TealKeyValue) UnmarshalMsg

func (z *TealKeyValue) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*TealKeyValue) UnmarshalMsgWithState

func (z *TealKeyValue) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type TealType

type TealType uint64

TealType is an enum of the types in a TEAL program: Bytes and Uint

const (
	// TealBytesType represents the type of byte slice in a TEAL program
	TealBytesType TealType = 1

	// TealUintType represents the type of uint in a TEAL program
	TealUintType TealType = 2
)

func (TealType) CanMarshalMsg

func (_ TealType) CanMarshalMsg(z interface{}) bool

func (*TealType) CanUnmarshalMsg

func (_ *TealType) CanUnmarshalMsg(z interface{}) bool

func (TealType) MarshalMsg

func (z TealType) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (TealType) MsgIsZero

func (z TealType) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (TealType) Msgsize

func (z TealType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (TealType) String

func (tt TealType) String() string

func (*TealType) UnmarshalMsg

func (z *TealType) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*TealType) UnmarshalMsgWithState

func (z *TealType) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type TealValue

type TealValue struct {
	Type  TealType `codec:"tt"`
	Bytes string   `codec:"tb"`
	Uint  uint64   `codec:"ui"`
	// contains filtered or unexported fields
}

TealValue contains type information and a value, representing a value in a TEAL program

func (*TealValue) CanMarshalMsg

func (_ *TealValue) CanMarshalMsg(z interface{}) bool

func (*TealValue) CanUnmarshalMsg

func (_ *TealValue) CanUnmarshalMsg(z interface{}) bool

func (*TealValue) MarshalMsg

func (z *TealValue) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*TealValue) MsgIsZero

func (z *TealValue) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*TealValue) Msgsize

func (z *TealValue) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*TealValue) String

func (tv *TealValue) String() string

func (*TealValue) ToValueDelta

func (tv *TealValue) ToValueDelta() (vd ValueDelta)

ToValueDelta creates ValueDelta from TealValue

func (*TealValue) UnmarshalMsg

func (z *TealValue) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*TealValue) UnmarshalMsgWithState

func (z *TealValue) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ValueDelta

type ValueDelta struct {
	Action DeltaAction `codec:"at"`
	Bytes  string      `codec:"bs,allocbound=config.MaxAppBytesValueLen"`
	Uint   uint64      `codec:"ui"`
	// contains filtered or unexported fields
}

ValueDelta links a DeltaAction with a value to be set

func (*ValueDelta) CanMarshalMsg

func (_ *ValueDelta) CanMarshalMsg(z interface{}) bool

func (*ValueDelta) CanUnmarshalMsg

func (_ *ValueDelta) CanUnmarshalMsg(z interface{}) bool

func (*ValueDelta) MarshalMsg

func (z *ValueDelta) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*ValueDelta) MsgIsZero

func (z *ValueDelta) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*ValueDelta) Msgsize

func (z *ValueDelta) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ValueDelta) ToTealValue

func (vd *ValueDelta) ToTealValue() (value TealValue, ok bool)

ToTealValue converts a ValueDelta into a TealValue if possible, and returns ok = false if the conversion is not possible.

func (*ValueDelta) UnmarshalMsg

func (z *ValueDelta) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*ValueDelta) UnmarshalMsgWithState

func (z *ValueDelta) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type VotingData

type VotingData struct {
	VoteID       crypto.OneTimeSignatureVerifier
	SelectionID  crypto.VRFVerifier
	StateProofID merklesignature.Commitment

	VoteFirstValid  Round
	VoteLastValid   Round
	VoteKeyDilution uint64
}

VotingData holds voting-related data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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