types

package
v0.0.0-...-c8ab65e Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_CHAIN_LENGTH = 12

Arbitrary, but a chain ID hex address should never be more than 8 digits (plus leading 0x).

Variables

This section is empty.

Functions

func PositionTypeForLiq

func PositionTypeForLiq(loc LiquidityLocation) string

Types

type BookLocation

type BookLocation struct {
	PoolLocation
	LiquidityLocation
}

func (BookLocation) ToClaimLoc

func (l BookLocation) ToClaimLoc(user EthAddress, pivotTime int) KOClaimLocation

func (BookLocation) ToPositionLocation

func (l BookLocation) ToPositionLocation(user EthAddress) PositionLocation

type ChainId

type ChainId string

func IntToChainId

func IntToChainId(num int) ChainId

func ValidateChainId

func ValidateChainId(arg string) ChainId

type EthAddress

type EthAddress string

func RequireEthAddr

func RequireEthAddr(arg string) EthAddress

func ValidateEthAddr

func ValidateEthAddr(arg string) EthAddress

type EthStorageHash

type EthStorageHash string

type EthTxHash

type EthTxHash string

func ValidateEthHash

func ValidateEthHash(arg string) EthTxHash

type EthTxHeader

type EthTxHeader struct {
	BlockNum int        `json:"blockNum"`
	TxHash   EthTxHash  `json:"txHash"`
	TxTime   int        `json:"txTime"`
	User     EthAddress `json:"user"`
}

type KOClaimLocation

type KOClaimLocation struct {
	PositionLocation
	PivotTime int `json:"pivotTime"`
}

type LiquidityLocation

type LiquidityLocation struct {
	BidTick int  `json:"bidTick"`
	AskTick int  `json:"askTick"`
	IsBid   bool `json:"isBid"` // Defaults to false if not valid
}

func AmbientLiquidityLocation

func AmbientLiquidityLocation() LiquidityLocation

func KnockoutRangeLocation

func KnockoutRangeLocation(bidTick int, askTick int, isBid bool) LiquidityLocation

func KnockoutTickLocation

func KnockoutTickLocation(tick int, isBid bool, tickWidth int) LiquidityLocation

func RangeLiquidityLocation

func RangeLiquidityLocation(bidTick int, askTick int) LiquidityLocation

func (LiquidityLocation) PivotTick

func (l LiquidityLocation) PivotTick() int

type NetworkName

type NetworkName string

type PoolEventDescriptor

type PoolEventDescriptor struct {
	EntityType   string `json:"entityType"`
	ChangeType   string `json:"changeType"`
	PositionType string `json:"positionType"`
}

type PoolEventFlow

type PoolEventFlow struct {
	BaseFlow  float64 `json:"baseFlow"`
	QuoteFlow float64 `json:"quoteFlow"`
}

type PoolLocation

type PoolLocation struct {
	ChainId ChainId    `json:"chainId"`
	Base    EthAddress `json:"base"`
	Quote   EthAddress `json:"quote"`
	PoolIdx int        `json:"poolIdx"`
}

type PoolPriceLiq

type PoolPriceLiq struct {
	PriceNonDisp  float64 `json:"priceNonDisp"`
	PriceDisplay  float64 `json:"priceDisplay"`
	PoolLiquidity big.Int `json:"poolLiquidity"`
}

type PoolRangeFields

type PoolRangeFields struct {
	BidTick   int  `json:"bidTick"`
	AskTick   int  `json:"askTick"`
	IsBuy     bool `json:"isBuy"`
	InBaseQty bool `json:"inBaseQty"`
}

type PositionLocation

type PositionLocation struct {
	PoolLocation
	LiquidityLocation
	User EthAddress `json:"user"`
}

func (PositionLocation) ToBookLoc

func (l PositionLocation) ToBookLoc() BookLocation

func (PositionLocation) ToClaimLoc

func (l PositionLocation) ToClaimLoc(pivot int) KOClaimLocation

type TokenMetadata

type TokenMetadata struct {
	Decimals int    `json:"decimals"`
	Symbol   string `json:"symbol"`
}

type TokenPairMetadata

type TokenPairMetadata struct {
	BaseDecimals  int    `json:"baseDecimals"`
	BaseSymbol    string `json:"baseSymbol"`
	QuoteDecimals int    `json:"quoteDecimals"`
	QuoteSymbol   string `json:"quoteSymbol"`
}

func PairTokenMetadata

func PairTokenMetadata(base TokenMetadata, quote TokenMetadata) TokenPairMetadata

type UserBalance

type UserBalance struct {
	Token   EthAddress `json:"token"`
	Balance big.Int    `json:"balance"`
}

Jump to

Keyboard shortcuts

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