views

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: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_POOL_POSITIONS = 100

Variables

This section is empty.

Functions

This section is empty.

Types

type CandleRangeArgs

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

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) []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

	QueryUserLimits(chainId types.ChainId, user types.EthAddress) []UserLimitOrder
	QueryPoolLimits(chainId types.ChainId, base types.EthAddress, quote types.EthAddress,
		poolIdx int, nResults int) []UserLimitOrder
	QueryUserPoolLimits(chainId types.ChainId, user types.EthAddress,
		base types.EthAddress, quote types.EthAddress,
		poolIdx int) []UserLimitOrder
	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) []UserTxHistory
	QueryPoolTxHist(chainId types.ChainId, base types.EthAddress, quote types.EthAddress,
		poolIdx int, nResults int) []UserTxHistory
	QueryPoolTxHistFrom(chainId types.ChainId, base types.EthAddress, quote types.EthAddress,
		poolIdx int, nResults int, time int, period 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) model.AccumPoolStats
	QueryPoolStatsFrom(chainId types.ChainId, base types.EthAddress, quote types.EthAddress,
		poolIdx int, histTime int) model.AccumPoolStats
	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
}

type PoolLiqCurve

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

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) QueryChainStats

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

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) []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) []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) model.AccumPoolStats

func (*Views) QueryPoolStatsFrom

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

func (*Views) QueryPoolTxHist

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

func (*Views) QueryPoolTxHistFrom

func (v *Views) QueryPoolTxHistFrom(chainId types.ChainId,
	base types.EthAddress, quote types.EthAddress, poolIdx int, nResults int,
	time int, period 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) 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) []UserTxHistory

Jump to

Keyboard shortcuts

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