tables

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggEvent

type AggEvent struct {
	ID            string  `json:"id" db:"id"`
	Network       string  `json:"network" db:"network"`
	Base          string  `json:"base" db:"base"`
	Quote         string  `json:"quote" db:"quote"`
	PoolIdx       int     `json:"poolIdx" db:"poolIdx"`
	Block         int     `json:"block" db:"block"`
	Time          int     `json:"time" db:"time"`
	BidTick       int     `json:"bidTick" db:"bidTick"`
	AskTick       int     `json:"askTick" db:"askTick"`
	IsFeeChange   bool    `json:"isFeeChange" db:"isFeeChange"`
	IsSwap        bool    `json:"isSwap" db:"isSwap"`
	IsLiq         bool    `json:"isLiq" db:"isLiq"`
	IsTickSkewed  bool    `json:"isTickSkewed" db:"isTickSkewed"`
	FlowsAtMarket bool    `json:"flowsAtMarket" db:"flowsAtMarket"`
	InBaseQty     bool    `json:"inBaseQty" db:"inBaseQty"`
	BaseFlow      float64 `json:"baseFlow" db:"baseFlow"`
	QuoteFlow     float64 `json:"quoteFlow" db:"quoteFlow"`
	FeeRate       int     `json:"feeRate" db:"feeRate"`
	EventIndex    int     `json:"eventIndex" db:"eventIndex"`
}

type AggEventSubGraph

type AggEventSubGraph struct {
	ID            string       `json:"id"`
	Pool          SubGraphPool `json:"pool"`
	Block         string       `json:"block"`
	Time          string       `json:"time"`
	BidTick       int          `json:"bidTick"`
	AskTick       int          `json:"askTick"`
	InBaseQty     bool         `json:"inBaseQty"`
	IsSwap        bool         `json:"isSwap"`
	IsLiq         bool         `json:"isLiq"`
	IsFeeChange   bool         `json:"isFeeChange"`
	IsTickSkewed  bool         `json:"isTickSkewed"`
	FlowsAtMarket bool         `json:"flowsAtMarket"`
	BaseFlow      string       `json:"baseFlow"`
	QuoteFlow     string       `json:"quoteFlow"`
	FeeRate       int          `json:"feeRate"`
	EventIndex    int          `json:"eventIndex"`
}

type AggEventSubGraphData

type AggEventSubGraphData struct {
	AggEvents []AggEventSubGraph `json:"aggEvents"`
}

type AggEventSubGraphResp

type AggEventSubGraphResp struct {
	Data AggEventSubGraphData `json:"data"`
}

type AggEventsTable

type AggEventsTable struct{}

func (AggEventsTable) ConvertSubGraphRow

func (tbl AggEventsTable) ConvertSubGraphRow(r AggEventSubGraph, network string) AggEvent

func (AggEventsTable) GetBlock

func (tbl AggEventsTable) GetBlock(r AggEvent) int

func (AggEventsTable) GetID

func (tbl AggEventsTable) GetID(r AggEvent) string

func (AggEventsTable) GetTime

func (tbl AggEventsTable) GetTime(r AggEvent) int

func (AggEventsTable) ParseSubGraphResp

func (tbl AggEventsTable) ParseSubGraphResp(body []byte) ([]AggEventSubGraph, error)

func (AggEventsTable) ParseSubGraphRespUnwrapped

func (tbl AggEventsTable) ParseSubGraphRespUnwrapped(body []byte) ([]AggEventSubGraph, error)

func (AggEventsTable) SqlTableName

func (tbl AggEventsTable) SqlTableName() string

type Balance

type Balance struct {
	ID      string `db:"id"`
	Network string `db:"network"`
	Tx      string `db:"tx"`
	Block   int    `db:"block"`
	Time    int    `db:"time"`
	User    string `db:"user"`
	Token   string `db:"token"`
}

type BalanceSubGrapData

type BalanceSubGrapData struct {
	UserBalances []BalanceSubGraph `json:"userBalances"`
}

type BalanceSubGraph

type BalanceSubGraph struct {
	ID              string `json:"id"`
	TransactionHash string `json:"transactionHash"`
	Block           string `json:"block"`
	Time            string `json:"time"`
	User            string `json:"user"`
	Token           string `json:"token"`
}

type BalanceSubGraphResp

type BalanceSubGraphResp struct {
	Data BalanceSubGrapData `json:"data"`
}

type BalanceTable

type BalanceTable struct{}

func (BalanceTable) ConvertSubGraphRow

func (tbl BalanceTable) ConvertSubGraphRow(r BalanceSubGraph, network string) Balance

func (BalanceTable) GetBlock

func (tbl BalanceTable) GetBlock(r Balance) int

func (BalanceTable) GetID

func (tbl BalanceTable) GetID(r Balance) string

func (BalanceTable) GetTime

func (tbl BalanceTable) GetTime(r Balance) int

func (BalanceTable) ParseSubGraphResp

func (tbl BalanceTable) ParseSubGraphResp(body []byte) ([]BalanceSubGraph, error)

func (BalanceTable) ParseSubGraphRespUnwrapped

func (tbl BalanceTable) ParseSubGraphRespUnwrapped(body []byte) ([]BalanceSubGraph, error)

func (BalanceTable) ReadSqlRow

func (tbl BalanceTable) ReadSqlRow(rows *sql.Rows) Balance

func (BalanceTable) SqlTableName

func (tbl BalanceTable) SqlTableName() string

type ChangeType

type ChangeType int8
const (
	ChangeTypeUnknown ChangeType = iota
	ChangeTypeMint
	ChangeTypeBurn
	ChangeTypeCross
	ChangeTypeRecover
	ChangeTypeClaim
	ChangeTypeHarvest
	ChangeTypeSwap
)

func (ChangeType) MarshalJSON

func (c ChangeType) MarshalJSON() ([]byte, error)

type EntityType

type EntityType int8
const (
	EntityTypeUnknown EntityType = iota
	EntityTypeSwap
	EntityTypeLimit
	EntityTypeLiqChange
)

func (EntityType) MarshalJSON

func (e EntityType) MarshalJSON() ([]byte, error)

type FeeChange

type FeeChange struct {
	ID        string `json:"id" db:"id"`
	CallIndex int    `json:"callIndex" db:"callIndex"`
	Network   string `json:"network" db:"network"`
	Tx        string `json:"tx" db:"tx"`
	Block     int    `json:"block" db:"block"`
	Time      int    `json:"time" db:"time"`
	Base      string `json:"base" db:"base"`
	Quote     string `json:"quote" db:"quote"`
	PoolIdx   int    `json:"poolIdx" db:"poolIdx"`
	PoolHash  string `json:"poolHash" db:"poolHash"`
	FeeRate   int    `json:"feeRate" db:"feeRate"`
}

type FeeChangeSubGraph

type FeeChangeSubGraph struct {
	ID              string `json:"id"`
	TransactionHash string `json:"transactionHash"`
	CallIndex       int    `json:"callIndex"`
	Block           string `json:"block"`
	Time            string `json:"time"`
	Pool            struct {
		Base    string `json:"base"`
		Quote   string `json:"quote"`
		PoolIdx string `json:"poolIdx"`
	} `json:"pool"`
	FeeRate int `json:"feeRate"`
}

type FeeChangeSubGraphData

type FeeChangeSubGraphData struct {
	FeeChanges []FeeChangeSubGraph `json:"feeChanges"`
}

type FeeChangeSubGraphResp

type FeeChangeSubGraphResp struct {
	Data FeeChangeSubGraphData `json:"data"`
}

type FeeTable

type FeeTable struct{}

func (FeeTable) ConvertSubGraphRow

func (tbl FeeTable) ConvertSubGraphRow(r FeeChangeSubGraph, network string) FeeChange

func (FeeTable) GetBlock

func (tbl FeeTable) GetBlock(r FeeChange) int

func (FeeTable) GetID

func (tbl FeeTable) GetID(r FeeChange) string

func (FeeTable) GetTime

func (tbl FeeTable) GetTime(r FeeChange) int

func (FeeTable) ParseSubGraphResp

func (tbl FeeTable) ParseSubGraphResp(body []byte) ([]FeeChangeSubGraph, error)

func (FeeTable) ParseSubGraphRespUnwrapped

func (tbl FeeTable) ParseSubGraphRespUnwrapped(body []byte) ([]FeeChangeSubGraph, error)

func (FeeTable) ReadSqlRow

func (tbl FeeTable) ReadSqlRow(rows *sql.Rows) FeeChange

func (FeeTable) SqlTableName

func (tbl FeeTable) SqlTableName() string

type ITable

type ITable[Row any, SubGraphRow any] interface {
	GetID(r Row) string
	GetTime(r Row) int
	GetBlock(r Row) int
	ConvertSubGraphRow(SubGraphRow, string) Row
	SqlTableName() string
	ParseSubGraphResp(body []byte) ([]SubGraphRow, error)
	ParseSubGraphRespUnwrapped(body []byte) ([]SubGraphRow, error)
}

type KnockoutCross

type KnockoutCross struct {
	ID         string  `json:"id" db:"id"`
	Network    string  `json:"network" db:"network"`
	Tx         string  `json:"tx" db:"tx"`
	Block      int     `json:"block" db:"block"`
	Time       int     `json:"time" db:"time"`
	Base       string  `json:"base" db:"base"`
	Quote      string  `json:"quote" db:"quote"`
	PoolIdx    int     `json:"poolIdx" db:"poolIdx"`
	PoolHash   string  `json:"poolHash" db:"poolHash"`
	Tick       int     `json:"tick" db:"tick"`
	IsBid      int     `json:"isBid" db:"isBid"`
	PivotTime  int     `json:"pivotTime" db:"pivotTime"`
	FeeMileage float64 `json:"feeMileage" db:"feeMileage"`
}

type KnockoutCrossSubGraph

type KnockoutCrossSubGraph struct {
	ID              string       `json:"id"`
	TransactionHash string       `json:"transactionHash"`
	Pool            SubGraphPool `json:"pool"`
	Block           string       `json:"block"`
	Time            string       `json:"time"`
	Tick            int          `json:"tick"`
	IsBid           bool         `json:"isBid"`
	PivotTime       string       `json:"pivotTime"`
	FeeMileage      string       `json:"feeMileage"`
}

type KnockoutCrossSubGraphData

type KnockoutCrossSubGraphData struct {
	KnockoutCrosses []KnockoutCrossSubGraph `json:"knockoutCrosses"`
}

type KnockoutCrossSubGraphResp

type KnockoutCrossSubGraphResp struct {
	Data KnockoutCrossSubGraphData `json:"data"`
}

type KnockoutTable

type KnockoutTable struct{}

func (KnockoutTable) ConvertSubGraphRow

func (tbl KnockoutTable) ConvertSubGraphRow(r KnockoutCrossSubGraph, network string) KnockoutCross

func (KnockoutTable) GetBlock

func (tbl KnockoutTable) GetBlock(r KnockoutCross) int

func (KnockoutTable) GetID

func (tbl KnockoutTable) GetID(r KnockoutCross) string

func (KnockoutTable) GetTime

func (tbl KnockoutTable) GetTime(r KnockoutCross) int

func (KnockoutTable) ParseSubGraphResp

func (tbl KnockoutTable) ParseSubGraphResp(body []byte) ([]KnockoutCrossSubGraph, error)

func (KnockoutTable) ParseSubGraphRespUnwrapped

func (tbl KnockoutTable) ParseSubGraphRespUnwrapped(body []byte) ([]KnockoutCrossSubGraph, error)

func (KnockoutTable) ReadSqlRow

func (tbl KnockoutTable) ReadSqlRow(rows *sql.Rows) KnockoutCross

func (KnockoutTable) SqlTableName

func (tbl KnockoutTable) SqlTableName() string

type LiqChange

type LiqChange struct {
	ID           string     `json:"id" db:"id"`
	CallIndex    int        `json:"callIndex" db:"callIndex"`
	Network      string     `json:"network" db:"network"`
	TX           string     `json:"tx" db:"tx"`
	Base         string     `json:"base" db:"base"`
	Quote        string     `json:"quote" db:"quote"`
	PoolIdx      int        `json:"poolIdx" db:"poolIdx"`
	PoolHash     string     `json:"poolHash" db:"poolHash"`
	User         string     `json:"user" db:"user"`
	Block        int        `json:"block" db:"block"`
	Time         int        `json:"time" db:"time"`
	PositionType PosType    `json:"positionType" db:"positionType"`
	ChangeType   ChangeType `json:"changeType" db:"changeType"`
	BidTick      int        `json:"bidTick" db:"bidTick"`
	AskTick      int        `json:"askTick" db:"askTick"`
	IsBid        int        `json:"isBid" db:"isBid"`
	Liq          *float64   `json:"liq" db:"liq"`
	BaseFlow     *float64   `json:"baseFlow" db:"baseFlow"`
	QuoteFlow    *float64   `json:"quoteFlow" db:"quoteFlow"`
	Source       string     `json:"source" db:"source"`
	PivotTime    *int       `json:"pivotTime" db:"pivotTime"`
}

type LiqChangeSubGraph

type LiqChangeSubGraph struct {
	ID              string       `json:"id"`
	TransactionHash string       `json:"transactionHash"`
	CallIndex       int          `json:"callIndex"`
	User            string       `json:"user"`
	Pool            SubGraphPool `json:"pool"`
	Block           string       `json:"block"`
	Time            string       `json:"time"`
	PositionType    string       `json:"positionType"`
	ChangeType      string       `json:"changeType"`
	BidTick         int          `json:"bidTick"`
	AskTick         int          `json:"askTick"`
	IsBid           bool         `json:"isBid"`
	Liq             string       `json:"liq"`
	BaseFlow        string       `json:"baseFlow"`
	QuoteFlow       string       `json:"quoteFlow"`
	PivotTime       string       `json:"pivotTime"`
}

type LiqChangeSubGraphData

type LiqChangeSubGraphData struct {
	LiqChanges []LiqChangeSubGraph `json:"liquidityChanges"`
}

type LiqChangeSubGraphResp

type LiqChangeSubGraphResp struct {
	Data LiqChangeSubGraphData `json:"data"`
}

type LiqChangeTable

type LiqChangeTable struct{}

func (LiqChangeTable) ConvertSubGraphRow

func (tbl LiqChangeTable) ConvertSubGraphRow(r LiqChangeSubGraph, network string) LiqChange

func (LiqChangeTable) GetBlock

func (tbl LiqChangeTable) GetBlock(r LiqChange) int

func (LiqChangeTable) GetID

func (tbl LiqChangeTable) GetID(r LiqChange) string

func (LiqChangeTable) GetTime

func (tbl LiqChangeTable) GetTime(r LiqChange) int

func (LiqChangeTable) ParseSubGraphResp

func (tbl LiqChangeTable) ParseSubGraphResp(body []byte) ([]LiqChangeSubGraph, error)

func (LiqChangeTable) ParseSubGraphRespUnwrapped

func (tbl LiqChangeTable) ParseSubGraphRespUnwrapped(body []byte) ([]LiqChangeSubGraph, error)

func (LiqChangeTable) ReadSqlRow

func (tbl LiqChangeTable) ReadSqlRow(rows *sql.Rows) LiqChange

func (LiqChangeTable) SqlTableName

func (tbl LiqChangeTable) SqlTableName() string

type PosType

type PosType int8
const (
	PosTypeUnknown PosType = iota
	PosTypeAmbient
	PosTypeConcentrated
	PosTypeKnockout
	PosTypeSwap
)

func (PosType) MarshalJSON

func (p PosType) MarshalJSON() ([]byte, error)

type SubGraphPool

type SubGraphPool struct {
	Base    string `json:"base"`
	Quote   string `json:"quote"`
	PoolIdx string `json:"poolIdx"`
}

type Swap

type Swap struct {
	ID        string  `json:"id" db:"id"`
	CallIndex int     `json:"callIndex" db:"callIndex"`
	Network   string  `json:"network" db:"network"`
	TX        string  `json:"tx" db:"tx"`
	User      string  `json:"user" db:"user"`
	Block     int     `json:"block" db:"block"`
	Time      int     `json:"time" db:"time"`
	Base      string  `json:"base" db:"base"`
	Quote     string  `json:"quote" db:"quote"`
	PoolIdx   int     `json:"poolIdx" db:"poolIdx"`
	IsBuy     int     `json:"isBuy" db:"isBuy"`
	InBaseQty int     `json:"inBaseQty" db:"inBaseQty"`
	BaseFlow  float64 `json:"baseFlow" db:"baseFlow"`
	QuoteFlow float64 `json:"quoteFlow" db:"quoteFlow"`
}

type SwapSubGraph

type SwapSubGraph struct {
	ID              string       `json:"id"`
	TransactionHash string       `json:"transactionHash"`
	CallIndex       int          `json:"callIndex"`
	User            string       `json:"user"`
	Pool            SubGraphPool `json:"pool"`
	Block           string       `json:"block"`
	Time            string       `json:"time"`
	IsBuy           bool         `json:"isBuy"`
	InBaseQty       bool         `json:"inBaseQty"`
	BaseFlow        string       `json:"baseFlow"`
	QuoteFlow       string       `json:"quoteFlow"`
}

type SwapSubGraphData

type SwapSubGraphData struct {
	Swaps []SwapSubGraph `json:"swaps"`
}

type SwapSubGraphResp

type SwapSubGraphResp struct {
	Data SwapSubGraphData `json:"data"`
}

type SwapsTable

type SwapsTable struct{}

func (SwapsTable) ConvertSubGraphRow

func (tbl SwapsTable) ConvertSubGraphRow(r SwapSubGraph, network string) Swap

func (SwapsTable) GetBlock

func (tbl SwapsTable) GetBlock(r Swap) int

func (SwapsTable) GetID

func (tbl SwapsTable) GetID(r Swap) string

func (SwapsTable) GetTime

func (tbl SwapsTable) GetTime(r Swap) int

func (SwapsTable) ParseSubGraphResp

func (tbl SwapsTable) ParseSubGraphResp(body []byte) ([]SwapSubGraph, error)

func (SwapsTable) ParseSubGraphRespUnwrapped

func (tbl SwapsTable) ParseSubGraphRespUnwrapped(body []byte) ([]SwapSubGraph, error)

func (SwapsTable) ReadSqlRow

func (tbl SwapsTable) ReadSqlRow(rows *sql.Rows) Swap

func (SwapsTable) SqlTableName

func (tbl SwapsTable) SqlTableName() string

Jump to

Keyboard shortcuts

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