currency

package
v3.0.0-alpha.0...-e5a6d49 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: GPL-3.0 Imports: 13 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AccountStateValueHint        = hint.MustNewHint("account-state-value-v0.0.1")
	BalanceStateValueHint        = hint.MustNewHint("balance-state-value-v0.0.1")
	CurrencyDesignStateValueHint = hint.MustNewHint("currency-design-state-value-v0.0.1")
)
View Source
var (
	StateKeyAccountSuffix        = ":account"
	StateKeyBalanceSuffix        = ":balance"
	StateKeyCurrencyDesignPrefix = "currencydesign:"
)

Functions

func IsStateAccountKey

func IsStateAccountKey(key string) bool

func IsStateBalanceKey

func IsStateBalanceKey(key string) bool

func IsStateCurrencyDesignKey

func IsStateCurrencyDesignKey(key string) bool

func LoadStateAccountValue

func LoadStateAccountValue(st base.State) (types.Account, error)

func StateBalanceKeyPrefix

func StateBalanceKeyPrefix(a base.Address, cid types.CurrencyID) string

func StateBalanceValue

func StateBalanceValue(st base.State) (types.Amount, error)

func StateCurrencyDesignValue

func StateCurrencyDesignValue(st base.State) (types.CurrencyDesign, error)

func StateKeyAccount

func StateKeyAccount(a base.Address) string

func StateKeyBalance

func StateKeyBalance(a base.Address, cid types.CurrencyID) string

func StateKeyCurrencyDesign

func StateKeyCurrencyDesign(cid types.CurrencyID) string

func StateKeysValue

func StateKeysValue(st base.State) (types.AccountKeys, error)

Types

type AccountStateValue

type AccountStateValue struct {
	hint.BaseHinter
	Account types.Account
}

func NewAccountStateValue

func NewAccountStateValue(account types.Account) AccountStateValue

func (*AccountStateValue) DecodeBSON

func (a *AccountStateValue) DecodeBSON(b []byte, enc *bsonenc.Encoder) error

func (*AccountStateValue) DecodeJSON

func (a *AccountStateValue) DecodeJSON(b []byte, enc encoder.Encoder) error

func (AccountStateValue) HashBytes

func (a AccountStateValue) HashBytes() []byte

func (AccountStateValue) Hint

func (a AccountStateValue) Hint() hint.Hint

func (AccountStateValue) IsValid

func (a AccountStateValue) IsValid([]byte) error

func (AccountStateValue) MarshalBSON

func (a AccountStateValue) MarshalBSON() ([]byte, error)

func (AccountStateValue) MarshalJSON

func (a AccountStateValue) MarshalJSON() ([]byte, error)

type AccountStateValueBSONUnmarshaler

type AccountStateValueBSONUnmarshaler struct {
	Hint    string   `bson:"_hint"`
	Account bson.Raw `bson:"account"`
}

type AccountStateValueJSONMarshaler

type AccountStateValueJSONMarshaler struct {
	hint.BaseHinter
	Account types.Account `json:"account"`
}

type AccountStateValueJSONUnmarshaler

type AccountStateValueJSONUnmarshaler struct {
	AC json.RawMessage `json:"account"`
}

type AddBalanceStateValue

type AddBalanceStateValue struct {
	Amount types.Amount
}

func NewAddBalanceStateValue

func NewAddBalanceStateValue(amount types.Amount) AddBalanceStateValue

func (AddBalanceStateValue) HashBytes

func (b AddBalanceStateValue) HashBytes() []byte

func (AddBalanceStateValue) IsValid

func (b AddBalanceStateValue) IsValid([]byte) error

type BalanceStateValue

type BalanceStateValue struct {
	hint.BaseHinter
	Amount types.Amount
}

func NewBalanceStateValue

func NewBalanceStateValue(amount types.Amount) BalanceStateValue

func (*BalanceStateValue) DecodeBSON

func (b *BalanceStateValue) DecodeBSON(v []byte, enc *bsonenc.Encoder) error

func (*BalanceStateValue) DecodeJSON

func (b *BalanceStateValue) DecodeJSON(v []byte, enc encoder.Encoder) error

func (BalanceStateValue) HashBytes

func (b BalanceStateValue) HashBytes() []byte

func (BalanceStateValue) Hint

func (b BalanceStateValue) Hint() hint.Hint

func (BalanceStateValue) IsValid

func (b BalanceStateValue) IsValid([]byte) error

func (BalanceStateValue) MarshalBSON

func (b BalanceStateValue) MarshalBSON() ([]byte, error)

func (BalanceStateValue) MarshalJSON

func (b BalanceStateValue) MarshalJSON() ([]byte, error)

type BalanceStateValueBSONUnmarshaler

type BalanceStateValueBSONUnmarshaler struct {
	Hint   string   `bson:"_hint"`
	Amount bson.Raw `bson:"amount"`
}

type BalanceStateValueJSONMarshaler

type BalanceStateValueJSONMarshaler struct {
	hint.BaseHinter
	Amount types.Amount `json:"amount"`
}

type BalanceStateValueJSONUnmarshaler

type BalanceStateValueJSONUnmarshaler struct {
	AM json.RawMessage `json:"amount"`
}

type BalanceStateValueMerger

type BalanceStateValueMerger struct {
	*common.BaseStateValueMerger

	sync.Mutex
	// contains filtered or unexported fields
}

func NewBalanceStateValueMerger

func NewBalanceStateValueMerger(height base.Height, key string, currency types.CurrencyID, st base.State) *BalanceStateValueMerger

func (*BalanceStateValueMerger) CloseValue

func (s *BalanceStateValueMerger) CloseValue() (base.State, error)

func (*BalanceStateValueMerger) Merge

func (s *BalanceStateValueMerger) Merge(value base.StateValue, ops util.Hash) error

type CurrencyDesignStateValue

type CurrencyDesignStateValue struct {
	hint.BaseHinter
	CurrencyDesign types.CurrencyDesign
}

func NewCurrencyDesignStateValue

func NewCurrencyDesignStateValue(currencyDesign types.CurrencyDesign) CurrencyDesignStateValue

func (*CurrencyDesignStateValue) DecodeBSON

func (c *CurrencyDesignStateValue) DecodeBSON(b []byte, enc *bsonenc.Encoder) error

func (*CurrencyDesignStateValue) DecodeJSON

func (c *CurrencyDesignStateValue) DecodeJSON(b []byte, enc encoder.Encoder) error

func (CurrencyDesignStateValue) HashBytes

func (c CurrencyDesignStateValue) HashBytes() []byte

func (CurrencyDesignStateValue) Hint

func (CurrencyDesignStateValue) IsValid

func (c CurrencyDesignStateValue) IsValid([]byte) error

func (CurrencyDesignStateValue) MarshalBSON

func (c CurrencyDesignStateValue) MarshalBSON() ([]byte, error)

func (CurrencyDesignStateValue) MarshalJSON

func (c CurrencyDesignStateValue) MarshalJSON() ([]byte, error)

type CurrencyDesignStateValueBSONUnmarshaler

type CurrencyDesignStateValueBSONUnmarshaler struct {
	Hint           string   `bson:"_hint"`
	CurrencyDesign bson.Raw `bson:"currencydesign"`
}

type CurrencyDesignStateValueJSONMarshaler

type CurrencyDesignStateValueJSONMarshaler struct {
	hint.BaseHinter
	CurrencyDesign types.CurrencyDesign `json:"currencydesign"`
}

type CurrencyDesignStateValueJSONUnmarshaler

type CurrencyDesignStateValueJSONUnmarshaler struct {
	CD json.RawMessage `json:"currencydesign"`
}

type DeductBalanceStateValue

type DeductBalanceStateValue struct {
	Amount types.Amount
}

func NewDeductBalanceStateValue

func NewDeductBalanceStateValue(amount types.Amount) DeductBalanceStateValue

func (DeductBalanceStateValue) HashBytes

func (b DeductBalanceStateValue) HashBytes() []byte

func (DeductBalanceStateValue) IsValid

func (b DeductBalanceStateValue) IsValid([]byte) error

Jump to

Keyboard shortcuts

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