Documentation
¶
Index ¶
- Constants
- func LatestSubgraphBlock(cfg SyncChannelConfig) (int, error)
- type Call3InputType
- type Call3OutputType
- type CallJob
- type ChainConfig
- type CombinedData
- type CombinedGraphReqVars
- type CrocQuery
- func (q *CrocQuery) QueryAmbientLiq(pos types.PositionLocation) (*big.Int, error)
- func (q *CrocQuery) QueryKnockoutLiq(pos types.KOClaimLocation) (resp KnockoutLiqResp, err error)
- func (q *CrocQuery) QueryKnockoutPivot(pos types.PositionLocation) (uint32, error)
- func (q *CrocQuery) QueryLevel(pool types.PoolLocation, tick int) (result LevelResp, err error)
- func (q *CrocQuery) QueryPoolPrice(pool types.PoolLocation, blockNumber *big.Int) (price float64, err error)
- func (q *CrocQuery) QueryRangeLiquidity(pos types.PositionLocation) (*big.Int, error)
- func (q *CrocQuery) QueryRangeRewardsLiq(pos types.PositionLocation) (*big.Int, error)
- type GraphReqVars
- type GraphRequest
- type ICrocQuery
- type Ingester
- type KnockoutLiqResp
- type LevelResp
- type NetworkConfig
- func (c *NetworkConfig) ChainConfig(chainId types.ChainId) (ChainConfig, bool)
- func (c *NetworkConfig) ChainIDForNetwork(network types.NetworkName) (types.ChainId, bool)
- func (c *NetworkConfig) NetworkForChainID(chainId types.ChainId) (types.NetworkName, bool)
- func (c *NetworkConfig) RequireChainID(network types.NetworkName) types.ChainId
- type NonCrocQuery
- func (q *NonCrocQuery) QueryAmbientLiq(pos types.PositionLocation) (*big.Int, error)
- func (q *NonCrocQuery) QueryKnockoutLiq(pos types.KOClaimLocation) (KnockoutLiqResp, error)
- func (q *NonCrocQuery) QueryKnockoutPivot(pos types.PositionLocation) (uint32, error)
- func (q *NonCrocQuery) QueryLevel(pool types.PoolLocation, tick int) (LevelResp, error)
- func (q *NonCrocQuery) QueryRangeLiquidity(pos types.PositionLocation) (*big.Int, error)
- func (q *NonCrocQuery) QueryRangeRewardsLiq(pos types.PositionLocation) (*big.Int, error)
- type OnChainLoader
- type SubgraphError
- type SubgraphQuery
- type SubgraphStartBlocks
- type SyncChannel
- func (s *SyncChannel[R, S]) IngestEntries(data []byte, queryStartBlock, queryEndBlock int) (lastObs int, hasMore bool, err error)
- func (s *SyncChannel[R, S]) SyncTableToSubgraph(startBlock int, endBlock int) (int, error)
- func (s *SyncChannel[R, S]) SyncTableToSubgraphWG(startBlock int, endBlock int, wg *sync.WaitGroup) (int, error)
- type SyncChannelConfig
Constants ¶
View Source
const MULTICALL_TIMEOUT_MS = 5000
View Source
const SUBGRAPH_RETRY_SECS = 5
Variables ¶
This section is empty.
Functions ¶
func LatestSubgraphBlock ¶
func LatestSubgraphBlock(cfg SyncChannelConfig) (int, error)
Types ¶
type Call3InputType ¶
type Call3OutputType ¶
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"`
MulticallDisabled bool `json:"multicall_disabled"`
MulticallContract string `json:"multicall_contract"`
MulticallMaxBatch int `json:"multicall_max_batch"`
MulticallIntervalMs int `json:"multicall_interval_ms"`
}
func (*ChainConfig) HexChainID ¶
func (c *ChainConfig) HexChainID() types.ChainId
type CombinedData ¶
type CombinedData struct {
Meta combinedEntry `json:"_meta"`
Swaps json.RawMessage `json:"swaps"`
Aggs json.RawMessage `json:"aggEvents"`
Liqs json.RawMessage `json:"liquidityChanges"`
Kos json.RawMessage `json:"knockoutCrosses"`
Fees json.RawMessage `json:"feeChanges"`
Bals json.RawMessage `json:"userBalances"`
}
func CombinedQuery ¶
func CombinedQuery(cfg SyncChannelConfig, minBlocks SubgraphStartBlocks, maxBlock int) (metaBlock int, combinedData *CombinedData, err error)
type CombinedGraphReqVars ¶
type CombinedGraphReqVars struct {
Order string `json:"orderDir"`
SwapMinBlock int `json:"swapMinBlock"`
SwapMaxBlock int `json:"swapMaxBlock"`
LiquidityMinBlock int `json:"liqMinBlock"`
LiquidityMaxBlock int `json:"liqMaxBlock"`
AggMinBlock int `json:"aggMinBlock"`
AggMaxBlock int `json:"aggMaxBlock"`
BalMinBlock int `json:"balMinBlock"`
BalMaxBlock int `json:"balMaxBlock"`
FeeMinBlock int `json:"feeMinBlock"`
FeeMaxBlock int `json:"feeMaxBlock"`
KoMinBlock int `json:"koMinBlock"`
KoMaxBlock int `json:"koMaxBlock"`
}
type CrocQuery ¶
type CrocQuery struct {
// contains filtered or unexported fields
}
func NewCrocQuery ¶
func NewCrocQuery(chain *OnChainLoader) *CrocQuery
func (*CrocQuery) QueryAmbientLiq ¶
func (*CrocQuery) QueryKnockoutLiq ¶
func (q *CrocQuery) QueryKnockoutLiq(pos types.KOClaimLocation) (resp KnockoutLiqResp, err error)
func (*CrocQuery) QueryKnockoutPivot ¶
func (q *CrocQuery) QueryKnockoutPivot(pos types.PositionLocation) (uint32, error)
func (*CrocQuery) QueryLevel ¶
func (*CrocQuery) QueryPoolPrice ¶
func (*CrocQuery) QueryRangeLiquidity ¶
func (*CrocQuery) QueryRangeRewardsLiq ¶
type GraphReqVars ¶
type GraphRequest ¶
type GraphRequest[V GraphReqVars | CombinedGraphReqVars] struct { Query SubgraphQuery `json:"query"` Variables V `json:"variables"` }
type ICrocQuery ¶
type ICrocQuery interface {
QueryAmbientLiq(pos types.PositionLocation) (*big.Int, error)
QueryRangeLiquidity(pos types.PositionLocation) (*big.Int, error)
QueryRangeRewardsLiq(pos types.PositionLocation) (*big.Int, error)
QueryKnockoutLiq(pos types.KOClaimLocation) (KnockoutLiqResp, error)
QueryKnockoutPivot(pos types.PositionLocation) (uint32, error)
QueryLevel(pool types.PoolLocation, tick int) (LevelResp, error)
}
type KnockoutLiqResp ¶
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 NonCrocQuery ¶
type NonCrocQuery struct{}
func (*NonCrocQuery) QueryAmbientLiq ¶
func (q *NonCrocQuery) QueryAmbientLiq(pos types.PositionLocation) (*big.Int, error)
func (*NonCrocQuery) QueryKnockoutLiq ¶
func (q *NonCrocQuery) QueryKnockoutLiq(pos types.KOClaimLocation) (KnockoutLiqResp, error)
func (*NonCrocQuery) QueryKnockoutPivot ¶
func (q *NonCrocQuery) QueryKnockoutPivot(pos types.PositionLocation) (uint32, error)
func (*NonCrocQuery) QueryLevel ¶
func (q *NonCrocQuery) QueryLevel(pool types.PoolLocation, tick int) (LevelResp, error)
func (*NonCrocQuery) QueryRangeLiquidity ¶
func (q *NonCrocQuery) QueryRangeLiquidity(pos types.PositionLocation) (*big.Int, error)
func (*NonCrocQuery) QueryRangeRewardsLiq ¶
func (q *NonCrocQuery) QueryRangeRewardsLiq(pos types.PositionLocation) (*big.Int, error)
type OnChainLoader ¶
type OnChainLoader struct {
Cfg NetworkConfig
// contains filtered or unexported fields
}
func NewOnChainLoader ¶
func NewOnChainLoader(cfg NetworkConfig) *OnChainLoader
type SubgraphError ¶
type SubgraphError struct {
Errors []struct {
Message string `json:"message"`
} `json:"errors"`
Data json.RawMessage `json:"data"`
}
type SubgraphQuery ¶
type SubgraphQuery string
type SubgraphStartBlocks ¶
type SyncChannel ¶
type SyncChannel[R any, S any] struct { 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]) IngestEntries ¶
func (*SyncChannel[R, S]) SyncTableToSubgraph ¶
func (s *SyncChannel[R, S]) SyncTableToSubgraph(startBlock int, endBlock int) (int, error)
func (*SyncChannel[R, S]) SyncTableToSubgraphWG ¶
type SyncChannelConfig ¶
type SyncChannelConfig struct {
Chain ChainConfig
Network types.NetworkName
Query string
}
Click to show internal directories.
Click to hide internal directories.