app

package
v0.0.0-...-9c6423c Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const Simnet = Regtest

The DEX recognizes only three networks. Simnet is an alias of Regtest.

View Source
const (
	UnsupportedScriptError = ErrorKind("unsupported script type")
)

Variables

This section is empty.

Functions

func BipIDSymbol

func BipIDSymbol(id uint32) string

BipIDSymbol returns the BIP ID for a given symbol.

func BipSymbolID

func BipSymbolID(symbol string) (uint32, bool)

BipSymbolID returns the asset ID associated with a given ticker symbol. While there are a number of duplicate ticker symbols in the BIP ID list (cpc, cmt, xrd, dst, one, ask, ...), those are disambiguated in the bipIDs map here, so must be referenced with their bracketed suffix.

func LockTimeMaker

func LockTimeMaker(network Network) time.Duration

LockTimeMaker returns the maker locktime value that should be used by both client and server for the specified network. Mainnet uses a constant value while test networks support setting a custom value during build.

func LockTimeTaker

func LockTimeTaker(network Network) time.Duration

LockTimeTaker returns the taker locktime value that should be used by both client and server for the specified network. Mainnet uses a constant value while test networks support setting a custom value during build.

func MarketName

func MarketName(base, quote uint32) (string, error)

MarketName creates the string representation of a DEX market (e.g. "dcr_btc") given the base and quote asset indexes defined in BIP-0044. See also BipIDSymbol.

Types

type Asset

type Asset struct {
	ID           uint32 `json:"id"`
	Symbol       string `json:"symbol"`
	LotSize      uint64 `json:"lotSize"`
	RateStep     uint64 `json:"rateStep"`
	MaxFeeRate   uint64 `json:"maxFeeRate"`
	SwapSize     uint64 `json:"swapSize"`
	SwapSizeBase uint64 `json:"swapSizeBase"`
	SwapConf     uint32 `json:"swapConf"`
}

Asset is the configurable asset variables.

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error pairs an error with details.

func NewError

func NewError(err error, detail string) Error

NewError wraps the provided Error with details in a Error, facilitating the use of errors.Is and errors.As via errors.Unwrap.

func (Error) Error

func (e Error) Error() string

Error satisfies the error interface, combining the wrapped error message with the details.

func (Error) Unwrap

func (e Error) Unwrap() error

Unwrap returns the wrapped error, allowing errors.Is and errors.As to work.

type ErrorKind

type ErrorKind string

ErrorKind identifies a kind of error that can be used to define new errors via const SomeError = dex.ErrorKind("something").

func (ErrorKind) Error

func (e ErrorKind) Error() string

Error satisfies the error interface and prints human-readable errors.

type MarketInfo

type MarketInfo struct {
	Name                   string
	Base                   uint32
	Quote                  uint32
	LotSize                uint64
	EpochDuration          uint64 // msec
	MarketBuyBuffer        float64
	MaxUserCancelsPerEpoch uint32
	BookedLotLimit         uint32
}

MarketInfo specifies a market that the Archiver must support.

func NewMarketInfo

func NewMarketInfo(base, quote uint32, lotSize, epochDuration uint64, marketBuyBuffer float64) (*MarketInfo, error)

NewMarketInfo creates a new market configuration (MarketInfo) from the given base and quote asset indexes, order lot size, and epoch duration in milliseconds. See also MarketName.

type Network

type Network uint8

Network flags passed to asset backends to signify which network to use.

const (
	Mainnet Network = iota
	Testnet
	Regtest
)

func NetFromString

func NetFromString(net string) (Network, error)

NetFromString returns the Network for the given network name.

func (Network) String

func (n Network) String() string

String returns the string representation of a Network.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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