uc

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CoinCodeVerify

func CoinCodeVerify(cStr string) *errors.Error

Types

type Account

type Account struct {
	Owner   AccountOwner `bson:"owner" json:"owner"`
	Coin    Code         `bson:"code" json:"code"`
	Balance *Amount      `bson:"balance" json:"balance"`
}

type AccountLead

type AccountLead struct {
	Owner AccountOwner `bson:"owner" json:"owner"`
	Coin  Code         `bson:"coin" json:"coin"`
}

type AccountOwner

type AccountOwner = ki.ADR
const (
	ISSUER AccountOwner = "$"
)

type Alter

type Alter struct {
	ID           AlterID      `bson:"id" json:"id"`
	AlterType    AlterType    `bson:"alter_type" json:"alter_type"`
	AccountOwner AccountOwner `bson:"account_owner" json:"account_owner"`
	Side         AccountOwner `bson:"side" json:"side"`
	Coin         Code         `bson:"coin" json:"coin"`
	Amount       *Amount      `bson:"amount" json:"amount"`
	Yin          yn.YID       `bson:"yin" json:"yin"`
}

type AlterID

type AlterID string

func (AlterID) S

func (a AlterID) S() string

type AlterType

type AlterType string
const (
	INC AlterType = "+"
	DEC AlterType = "-"
)

type Amount

type Amount struct {
	Wei   WEI   `bson:"wei" json:"wei"`
	Left  int64 `bson:"left" json:"left"`
	Right int64 `bson:"right" json:"right"`
}

func NewAmount

func NewAmount(wei WEI, left int64, right int64) (*Amount, *errors.Error)

func NewAmountFloat64

func NewAmountFloat64(wei WEI, fVal float64) (*Amount, *errors.Error)

func (*Amount) Dec

func (a *Amount) Dec(decAmount *Amount) *Amount

func (*Amount) Inc

func (a *Amount) Inc(incAmount *Amount) *Amount

func (*Amount) Int64Round

func (a *Amount) Int64Round() int64

func (*Amount) Lt

func (a *Amount) Lt(b *Amount) bool

func (*Amount) Lte

func (a *Amount) Lte(b *Amount) bool

func (*Amount) String

func (a *Amount) String() string

type Code

type Code string
const (
	NilCoinCode Code = ""
	HTG         Code = "HTG"
	HTC         Code = "HTC"
)

func CoinCodeOf

func CoinCodeOf(cStr string) (Code, *errors.Error)

func (Code) S

func (c Code) S() string

type Coin

type Coin struct {
	Issuer      vn.ID   `bson:"issuer" json:"issuer"`
	Code        Code    `bson:"code" json:"code"`
	Wei         WEI     `bson:"wei" json:"wei"`
	Issuance    *Amount `bson:"issuance" json:"issuance"`
	Balance     *Amount `bson:"balance" json:"balance"`
	Circulation *Amount `bson:"circulation" json:"circulation"`
}

type WEI

type WEI int8
const (
	MaxWei     WEI = 16
	DefaultWei WEI = 10
)

Jump to

Keyboard shortcuts

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