account

package
v1.0.0-rc3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	PrivKeySize   = secp256k1.PrivKeyBytesLen
	PubKeySize    = secp256k1.PubKeyBytesLenCompressed
	HashSize      = blake256.Size
	PrepaidBondID = math.MaxInt32
)

Variables

View Source
var HashFunc = blake256.Sum256

HashFunc is the hash function used to generate account IDs from pubkeys.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID     AccountID
	PubKey *secp256k1.PublicKey
}

Account represents a dex client account.

func NewAccountFromPubKey

func NewAccountFromPubKey(pk []byte) (*Account, error)

NewAccountFromPubKey creates a dex client account from the provided public key bytes.

type AccountID

type AccountID [HashSize]byte

AccountID is a DEX account identifier.

func NewID

func NewID(pk []byte) AccountID

NewID generates a unique account id with the provided public key bytes.

func (AccountID) MarshalJSON

func (aid AccountID) MarshalJSON() ([]byte, error)

MarshalJSON satisfies the json.Marshaller interface, and will marshal the id to a hex string.

func (*AccountID) Scan

func (aid *AccountID) Scan(src any) error

Scan implements the sql.Scanner interface.

func (AccountID) String

func (aid AccountID) String() string

String returns a hexadecimal representation of the AccountID. String implements fmt.Stringer.

func (AccountID) Value

func (aid AccountID) Value() (driver.Value, error)

Value implements the sql/driver.Valuer interface.

type PrivateKey added in v0.6.0

type PrivateKey = secp256k1.PrivateKey

PrivateKey is the private key type used by DEX.

type Reputation added in v1.0.0

type Reputation struct {
	// BondedTier is the tier indicated by the user's active bonds. BondedTier
	// does not account for penalties.
	BondedTier int64 `json:"bondedTier"`
	// Penalties are the number of tiers that are currently revoked due to low
	// user score.
	Penalties uint16 `json:"penalties"`
	// Score is the user's current score. Score must be evaluated against a
	// server's configured penalty threshold to calculate penalties.
	Score int32 `json:"score"`
}

Reputation is a part of a number of server-originating messages. It was introduced with the v2 ConnectResult.

func (*Reputation) EffectiveTier added in v1.0.0

func (r *Reputation) EffectiveTier() int64

Effective calculates the effective tier for trading limit calculations.

type Rule

type Rule uint8

Rule represents a rule of community conduct.

const (
	// NoRule indicates that no rules have been broken. This may be an invalid
	// value in some contexts.
	NoRule Rule = iota
	// PreimageReveal means an account failed to respond with a valid preimage
	// for their order during epoch processing.
	PreimageReveal
	// FailureToAct means that an account has not followed through on one of their
	// swap negotiation steps.
	FailureToAct
	// CancellationRate means the account's cancellation rate  has dropped below
	// the acceptable level.
	CancellationRate
	// LowFees means an account made a transaction that didn't pay fees at the
	// requisite level.
	LowFees
	// MaxRule in not an actual rule. It is a placeholder that is used to
	// determine the total number of rules. It must always be the last
	// definition in this list.
	MaxRule
)

func (Rule) Description

func (r Rule) Description() string

Description returns a description of the rule.

func (Rule) Punishable

func (r Rule) Punishable() bool

Punishable returns whether breaking this rule incurs a penalty.

func (Rule) String

func (r Rule) String() string

String satisfies the Stringer interface.

Jump to

Keyboard shortcuts

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