tanka

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: BlueOak-1.0.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxReputationEntries = 100
	TierIncrement        = 20
	MaxScore             = MaxReputationEntries
	EpochLength          = time.Second * 15
)
View Source
const PeerIDLength = secp256k1.PubKeyBytesLenCompressed

Variables

This section is empty.

Functions

This section is empty.

Types

type Bond

type Bond struct {
	PeerID     PeerID    `json:"peerID"`
	AssetID    uint32    `json:"assetID"`
	CoinID     dex.Bytes `json:"coinID"`
	Strength   uint64    `json:"strength"`
	Expiration time.Time `json:"expiration"`
}

type HTLCAudit

type HTLCAudit struct{}

type ID32

type ID32 [32]byte

func (ID32) String

func (i ID32) String() string

type MarketParameters

type MarketParameters struct {
	BaseID  uint32 `json:"baseID"`
	QuoteID uint32 `json:"quoteID"`
}

type Match

type Match struct {
	From    PeerID    `json:"from"`
	OrderID ID32      `json:"orderID"`
	Qty     uint64    `json:"qty"`
	Stamp   time.Time `json:"stamp"`
}

func (*Match) ID

func (m *Match) ID() ID32

type MatchAcceptance

type MatchAcceptance struct {
	OrderID ID32 `json:"orderID"`
	MatchID ID32 `json:"matchID"`
}

type Order

type Order struct {
	From    PeerID `json:"from"`
	BaseID  uint32 `json:"baseID"`
	QuoteID uint32 `json:"quoteID"`
	Sell    bool   `json:"sell"`
	Qty     uint64 `json:"qty"`
	Rate    uint64 `json:"rate"`
	// LotSize: Tatankanet does not prescribe a lot size. Instead, users must
	// select their own minimum minimum lot size. The user's UI should ignore
	// orderbook orders that don't have the requisite lot size. The UI should
	// show lot size selection in terms of a sliding scale of fee exposure.
	// Lot sizes can only be powers of 2.
	LotSize uint64 `json:"lotSize"`
	// MinFeeRate: Tatankanet does not prescribe a fee rate on an order, but it
	// does supply a suggested fee rate that is updated periodically. The user's
	// UI should ignore an order from the order book if its MinFeeRate falls
	// below the Tatnkanet suggested rate.
	MinFeeRate uint64    `json:"minFeeRate"`
	Stamp      time.Time `json:"stamp"`
	Expiration time.Time `json:"expiration"`
}

func (*Order) ID

func (ord *Order) ID() [32]byte

type Peer

type Peer struct {
	ID         PeerID               `json:"-"`
	PubKey     *secp256k1.PublicKey `json:"-"`
	Bonds      []*Bond              `json:"-"`
	Reputation *Reputation          `json:"reputation"`
}

Peer is a network peer, which could be a client or a server node.

func (*Peer) BondTier

func (p *Peer) BondTier() (tier uint64)

BondTier sums the tier of the current bond set.

type PeerID

type PeerID [PeerIDLength]byte

PeerID is the primary identifier for both clients and servers on Tatanka Mesh. The PeerID is the compressed-format serialized secp256k1.PublicKey.

func (PeerID) String

func (p PeerID) String() string

type Reputation

type Reputation struct {
	Score  int16
	Points []int8
}

type Sender

type Sender interface {
	Send(*msgjson.Message) error
	SendRaw([]byte) error
	Request(msg *msgjson.Message, respHandler func(*msgjson.Message)) error
	RequestRaw(msgID uint64, rawMsg []byte, respHandler func(*msgjson.Message)) error
	SetPeerID(PeerID)
	PeerID() PeerID
	Disconnect()
}

Sender is an interface that is implemented by all network connections.

type Subject

type Subject string

type Topic

type Topic string

Jump to

Keyboard shortcuts

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