currency

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

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

Go to latest
Published: Nov 1, 2024 License: GPL-3.0 Imports: 13 Imported by: 21

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")
	DesignStateValueHint  = hint.MustNewHint("currency-design-state-value-v0.0.1")
)
View Source
var (
	AccountStateKeySuffix = ":account"
	BalanceStateKeySuffix = ":balance"
	DesignStateKeyPrefix  = "currencydesign:"
)

Functions

func AccountStateKey

func AccountStateKey(a base.Address) string

func BalanceStateKey

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

func BalanceStateKeyPrefix

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

func DesignStateKey

func DesignStateKey(cid types.CurrencyID) string

func GetAccountKeysFromState

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

func GetDesignFromState

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

func IsAccountStateKey

func IsAccountStateKey(key string) bool

func IsBalanceStateKey

func IsBalanceStateKey(key string) bool

func IsDesignStateKey

func IsDesignStateKey(key string) bool

func LoadAccountStateValue

func LoadAccountStateValue(st base.State) (*types.Account, error)

func StateBalanceValue

func StateBalanceValue(st base.State) (types.Amount, 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 CurrencyDesignStateValueJSONUnmarshaler

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

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

type DesignStateValue

type DesignStateValue struct {
	hint.BaseHinter
	Design types.CurrencyDesign
}

func NewCurrencyDesignStateValue

func NewCurrencyDesignStateValue(currencyDesign types.CurrencyDesign) DesignStateValue

func (*DesignStateValue) DecodeBSON

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

func (*DesignStateValue) DecodeJSON

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

func (DesignStateValue) HashBytes

func (c DesignStateValue) HashBytes() []byte

func (DesignStateValue) Hint

func (c DesignStateValue) Hint() hint.Hint

func (DesignStateValue) IsValid

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

func (DesignStateValue) MarshalBSON

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

func (DesignStateValue) MarshalJSON

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

type DesignStateValueBSONUnmarshaler

type DesignStateValueBSONUnmarshaler struct {
	Hint           string   `bson:"_hint"`
	CurrencyDesign bson.Raw `bson:"currency_design"`
}

type DesignStateValueJSONMarshaler

type DesignStateValueJSONMarshaler struct {
	hint.BaseHinter
	CurrencyDesign types.CurrencyDesign `json:"currency_design"`
}

Jump to

Keyboard shortcuts

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