views

package
v0.0.0-...-7abe34b Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdditionalPoolStatsFields

type AdditionalPoolStatsFields struct {
	*types.PoolLocation
	PriceSwap24hAgo   *float64 `json:"priceSwap24hAgo,omitempty"`
	PriceLiq24hAgo    *float64 `json:"priceLiq24hAgo,omitempty"`
	PriceIndic24hAgo  *float64 `json:"priceIndic24hAgo,omitempty"`
	BaseVolume24hAgo  *float64 `json:"baseVolume24hAgo,omitempty"`
	QuoteVolume24hAgo *float64 `json:"quoteVolume24hAgo,omitempty"`
	BaseFees24hAgo    *float64 `json:"baseFees24hAgo,omitempty"`
	QuoteFees24hAgo   *float64 `json:"quoteFees24hAgo,omitempty"`
}

type CandleRangeArgs

type CandleRangeArgs struct {
	N         int  // Number of candles
	Period    int  // Candle size in seconds
	StartTime *int // If nil serve most recent
}

type HistoricUserPosition

type HistoricUserPosition struct {
	types.PositionLocation
	PositionType  tables.PosType           `json:"positionType"`
	TimeFirstMint int                      `json:"timeFirstMint"`
	FirstMintTx   string                   `json:"firstMintTx"`
	PositionId    string                   `json:"positionId"`
	Liq           *big.Int                 `json:"liq"`
	BaseTokens    *big.Int                 `json:"baseTokens"`
	QuoteTokens   *big.Int                 `json:"quoteTokens"`
	PoolPrice     float64                  `json:"poolPrice"`
	LiqHist       model.LiquidityDeltaHist `json:"liqHist"`
}

type IViews

type IViews interface {
	QueryUserTokens(chainId types.ChainId, user types.EthAddress) UserTokensResponse

	QueryUserPositions(chainId types.ChainId, user types.EthAddress) []UserPosition
	QueryPoolPositions(chainId types.ChainId, base types.EthAddress, quote types.EthAddress,
		poolIdx int, nResults int, omitEmpty bool, afterTime int, beforeTime int) []UserPosition
	QueryPoolApyLeaders(chainId types.ChainId, base types.EthAddress, quote types.EthAddress,
		poolIdx int, nResults int, omitEmpty bool) []UserPosition
	QueryUserPoolPositions(chainId types.ChainId, user types.EthAddress,
		base types.EthAddress, quote types.EthAddress, poolIdx int) []UserPosition
	QuerySinglePosition(chainId types.ChainId, user types.EthAddress,
		base types.EthAddress, quote types.EthAddress,
		poolIdx int, bidTick int, askTick int) *UserPosition
	QueryHistoricPositions(chainId types.ChainId, base types.EthAddress, quote types.EthAddress,
		poolIdx int, time int, user types.EthAddress, omitEmpty bool) []HistoricUserPosition

	QueryUserLimits(chainId types.ChainId, user types.EthAddress) []UserLimitOrder
	QueryPoolLimits(chainId types.ChainId, base types.EthAddress, quote types.EthAddress, poolIdx int,
		nResults int, afterTime int, beforeTime int) []UserLimitOrder
	QueryUserPoolLimits(chainId types.ChainId, user types.EthAddress,
		base types.EthAddress, quote types.EthAddress, poolIdx int) []UserLimitOrder
	QueryUserPoolTxHist(chainId types.ChainId, user types.EthAddress,
		base types.EthAddress, quote types.EthAddress, poolIdx int,
		nResults int, afterTime int, beforeTime int) []UserTxHistory
	QuerySingleLimit(chainId types.ChainId, user types.EthAddress,
		base types.EthAddress, quote types.EthAddress,
		poolIdx int, bidTick int, askTick int, isBid bool, pivotTime int) *UserLimitOrder

	QueryUserTxHist(chainId types.ChainId, user types.EthAddress,
		nResults int, afterTime int, beforeTime int) []UserTxHistory
	QueryPoolTxHist(chainId types.ChainId, base types.EthAddress, quote types.EthAddress, poolIdx int,
		nResults int, afterTime int, beforeTime int) []UserTxHistory
	QueryPoolLiquidityCurve(chainId types.ChainId, base types.EthAddress, quote types.EthAddress,
		poolIdx int) PoolLiqCurve

	QueryPoolStats(chainId types.ChainId, base types.EthAddress, quote types.EthAddress,
		poolIdx int, with24hPrices bool) PoolStats
	QueryPoolStatsFrom(chainId types.ChainId, base types.EthAddress, quote types.EthAddress,
		poolIdx int, histTime int) PoolStats
	QueryAllPoolStats(chainId types.ChainId, histTime int, with24hPrices bool) []PoolStats
	QueryChainStats(chainId types.ChainId, nResults int) []TokenDexAgg

	QueryPoolCandles(chainId types.ChainId, base types.EthAddress, quote types.EthAddress, poolIdx int,
		timeRange CandleRangeArgs) []model.Candle

	QueryPoolSet(chainId types.ChainId) []types.PoolLocation

	QueryPlumeUserTask(user types.EthAddress, task string) PlumeTaskStatus
}

type PlumeTaskStatus

type PlumeTaskStatus struct {
	Completed *bool  `json:"completed,omitempty"`
	Error     string `json:"error,omitempty"`
	Code      int    `json:"code"`
}

type PoolLiqCurve

type PoolLiqCurve struct {
	AmbientLiq float64                `json:"ambientLiq"`
	Bumps      []*model.LiquidityBump `json:"liquidityBumps"`
}

type PoolStats

type PoolStats struct {
	*AdditionalPoolStatsFields // Optional, only set when all pool stats are requested
	model.AccumPoolStats
	InitTime int `json:"initTime"`
	Events   int `json:"events"`
}

type TokenDexAgg

type TokenDexAgg struct {
	TokenAddr  types.EthAddress `json:"tokenAddr"`
	DexVolume  float64          `json:"dexVolume"`
	DexFees    float64          `json:"dexFees"`
	DexTvl     float64          `json:"dexTvl"`
	LatestTime int              `json:"latestTime"`
}

type UserLimitOrder

type UserLimitOrder struct {
	types.KOClaimLocation
	model.PositionLiquidity
	// contains filtered or unexported fields
}

type UserPosition

type UserPosition struct {
	types.PositionLocation
	model.PositionTracker
	model.APRCalcResult
	PositionId string `json:"positionId"`
}

type UserTokensResponse

type UserTokensResponse struct {
	ChainId types.ChainId      `json:"chainId"`
	User    types.EthAddress   `json:"user"`
	Block   int64              `json:"block"`
	Tokens  []types.EthAddress `json:"tokens"`
}

type UserTxHistory

type UserTxHistory struct {
	types.PoolTxEvent
	EventId string `json:"txId"`
}

type Views

type Views struct {
	Cache   *cache.MemoryCache
	OnChain *loader.OnChainLoader
}

func (*Views) QueryAllPoolStats

func (v *Views) QueryAllPoolStats(chainId types.ChainId, histTime int, with24hPrices bool) (result []PoolStats)

func (*Views) QueryChainStats

func (v *Views) QueryChainStats(chainId types.ChainId, nResults int) []TokenDexAgg

func (*Views) QueryHistoricPositions

func (v *Views) QueryHistoricPositions(chainId types.ChainId, base types.EthAddress, quote types.EthAddress,
	poolIdx int, time int, user types.EthAddress, omitEmpty bool) []HistoricUserPosition

func (*Views) QueryPlumeUserTask

func (v *Views) QueryPlumeUserTask(user types.EthAddress, task string) (status PlumeTaskStatus)

func (*Views) QueryPoolApyLeaders

func (v *Views) QueryPoolApyLeaders(chainId types.ChainId,
	base types.EthAddress, quote types.EthAddress, poolIdx int, nResults int,
	omitEmpty bool) []UserPosition

func (*Views) QueryPoolCandles

func (v *Views) QueryPoolCandles(chainId types.ChainId, base types.EthAddress, quote types.EthAddress, poolIdx int,
	timeRange CandleRangeArgs) []model.Candle

func (*Views) QueryPoolLimits

func (v *Views) QueryPoolLimits(chainId types.ChainId,
	base types.EthAddress, quote types.EthAddress, poolIdx int,
	nResults int, afterTime int, beforeTime int) []UserLimitOrder

func (*Views) QueryPoolLiquidityCurve

func (v *Views) QueryPoolLiquidityCurve(chainId types.ChainId,
	base types.EthAddress, quote types.EthAddress, poolIdx int) PoolLiqCurve

func (*Views) QueryPoolPositions

func (v *Views) QueryPoolPositions(chainId types.ChainId,
	base types.EthAddress, quote types.EthAddress, poolIdx int, nResults int,
	omitEmpty bool, afterTime int, beforeTime int) []UserPosition

func (*Views) QueryPoolSet

func (v *Views) QueryPoolSet(chainId types.ChainId) []types.PoolLocation

func (*Views) QueryPoolStats

func (v *Views) QueryPoolStats(chainId types.ChainId,
	base types.EthAddress, quote types.EthAddress, poolIdx int, with24hPrices bool) PoolStats

func (*Views) QueryPoolStatsFrom

func (v *Views) QueryPoolStatsFrom(chainId types.ChainId,
	base types.EthAddress, quote types.EthAddress, poolIdx int, histTime int) PoolStats

func (*Views) QueryPoolTxHist

func (v *Views) QueryPoolTxHist(chainId types.ChainId,
	base types.EthAddress, quote types.EthAddress, poolIdx int, nResults int, afterTime int, beforeTime int) []UserTxHistory

func (*Views) QuerySingleLimit

func (v *Views) QuerySingleLimit(chainId types.ChainId, user types.EthAddress,
	base types.EthAddress, quote types.EthAddress, poolIdx int,
	bidTick int, askTick int, isBid bool, pivotTime int) *UserLimitOrder

func (*Views) QuerySinglePosition

func (v *Views) QuerySinglePosition(chainId types.ChainId, user types.EthAddress,
	base types.EthAddress, quote types.EthAddress, poolIdx int, bidTick int, askTick int) *UserPosition

func (*Views) QueryUserLimits

func (v *Views) QueryUserLimits(chainId types.ChainId, user types.EthAddress) []UserLimitOrder

func (*Views) QueryUserPoolLimits

func (v *Views) QueryUserPoolLimits(chainId types.ChainId, user types.EthAddress,
	base types.EthAddress, quote types.EthAddress, poolIdx int) []UserLimitOrder

func (*Views) QueryUserPoolPositions

func (v *Views) QueryUserPoolPositions(chainId types.ChainId, user types.EthAddress,
	base types.EthAddress, quote types.EthAddress, poolIdx int) []UserPosition

func (*Views) QueryUserPoolTxHist

func (v *Views) QueryUserPoolTxHist(chainId types.ChainId, user types.EthAddress, base types.EthAddress, quote types.EthAddress, poolIdx int, nResults int, afterTime int, beforeTime int) []UserTxHistory

func (*Views) QueryUserPositions

func (v *Views) QueryUserPositions(chainId types.ChainId, user types.EthAddress) []UserPosition

func (*Views) QueryUserTokens

func (v *Views) QueryUserTokens(chainId types.ChainId, user types.EthAddress) UserTokensResponse

func (*Views) QueryUserTxHist

func (v *Views) QueryUserTxHist(chainId types.ChainId, user types.EthAddress, nResults int, afterTime int, beforeTime int) []UserTxHistory

Jump to

Keyboard shortcuts

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