loader

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LatestSubgraphTime

func LatestSubgraphTime(cfg SyncChannelConfig) (int, error)

Types

type ChainConfig

type ChainConfig struct {
	NetworkName       string
	ChainID           int    `json:"chain_id"`
	RPCEndpoint       string `json:"rpc"`
	Subgraph          string `json:"subgraph"`
	QueryContract     string `json:"query_contract"`
	QueryContractABI  string `json:"query_contract_abi"`
	KnockoutTickWidth int    `json:"knockout_tick_width"`
}

type CrocQuery

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

func NewCrocQuery

func NewCrocQuery(chain *OnChainLoader) *CrocQuery

func (*CrocQuery) QueryAmbientLiq

func (q *CrocQuery) QueryAmbientLiq(pos types.PositionLocation) (*big.Int, error)

func (*CrocQuery) QueryKnockoutLiq

func (q *CrocQuery) QueryKnockoutLiq(pos types.KOClaimLocation) (*big.Int, error)

func (*CrocQuery) QueryKnockoutPivot

func (q *CrocQuery) QueryKnockoutPivot(pos types.PositionLocation) (uint32, error)

func (*CrocQuery) QueryRangeLiquidity

func (q *CrocQuery) QueryRangeLiquidity(pos types.PositionLocation) (*big.Int, error)

func (*CrocQuery) QueryRangeRewardsLiq

func (q *CrocQuery) QueryRangeRewardsLiq(pos types.PositionLocation) (*big.Int, error)

type GraphReqVars

type GraphReqVars struct {
	Order   string `json:"orderDir"`
	MinTime int    `json:"minTime"`
	MaxTime int    `json:"maxTime"`
}

type GraphRequest

type GraphRequest struct {
	Query     SubgraphQuery `json:"query"`
	Variables GraphReqVars  `json:"variables"`
}

type NetworkConfig

type NetworkConfig map[types.NetworkName]ChainConfig

func LoadNetworkConfig

func LoadNetworkConfig(path string) NetworkConfig

func (*NetworkConfig) ChainConfig

func (c *NetworkConfig) ChainConfig(chainId types.ChainId) (ChainConfig, bool)

func (*NetworkConfig) ChainIDForNetwork

func (c *NetworkConfig) ChainIDForNetwork(network types.NetworkName) (types.ChainId, bool)

func (*NetworkConfig) NetworkForChainID

func (c *NetworkConfig) NetworkForChainID(chainId types.ChainId) (types.NetworkName, bool)

func (*NetworkConfig) RequireChainID

func (c *NetworkConfig) RequireChainID(network types.NetworkName) types.ChainId

type OnChainLoader

type OnChainLoader struct {
	Cfg NetworkConfig
}

type SubgraphQuery

type SubgraphQuery string

type SyncChannel

type SyncChannel[R any, S any] struct {
	LastObserved     int
	EarliestObserved int
	RowsIngested     int
	// contains filtered or unexported fields
}

func NewSyncChannel

func NewSyncChannel[R any, S any](tbl tables.ITable[R, S], config SyncChannelConfig,
	consumeFn func(R)) SyncChannel[R, S]

func (*SyncChannel[R, S]) SyncTableToSubgraph

func (s *SyncChannel[R, S]) SyncTableToSubgraph(isAsc bool, startTime int, endTime int) (int, error)

type SyncChannelConfig

type SyncChannelConfig struct {
	Chain   ChainConfig
	Network types.NetworkName
	Query   string
}

Jump to

Keyboard shortcuts

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