fetcher

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package fetcher provides fetchers to fetch data from Scribe, BridgeConfig, and Swap.

Index

Constants

View Source
const NoTokenID = "NO_TOKEN_ID"

NoTokenID is the string returned when a token id is not found (not an authentic token).

Variables

This section is empty.

Functions

func GetDefiLlamaData

func GetDefiLlamaData(ctx context.Context, timestamp int, coinGeckoID string) *float64

GetDefiLlamaData does a get request to defi llama for the symbol and price for a token.

Types

type CCTPService added in v0.0.156

type CCTPService interface {
	// GetTokenSymbol gets the token symbol from the cctp ref..
	GetTokenSymbol(ctx context.Context, tokenAddress common.Address) (*string, error)
}

CCTPService --output=mocks --case=underscore.

func NewCCTPFetcher added in v0.0.156

func NewCCTPFetcher(cctpAddress common.Address, backend bind.ContractBackend) (CCTPService, error)

NewCCTPFetcher creates a new cctp fetcher.

type PriceService added in v0.0.81

type PriceService interface {
	// GetDefiLlamaData historical price data
	GetDefiLlamaData(context.Context, int, string) *float64
}

PriceService --output=mocks --case=underscore.

type RFQService added in v0.4.4

type RFQService interface {
	// GetTokenSymbol gets the token symbol from the rfq ref..
	GetTokenSymbol(ctx context.Context, tokenAddress common.Address) (*string, error)
}

RFQService --output=mocks --case=underscore.

func NewRFQFetcher added in v0.4.4

func NewRFQFetcher(rfqAddress common.Address, backend bind.ContractBackend) (RFQService, error)

NewRFQFetcher creates a new rfq fetcher.

type ScribeFetcher

type ScribeFetcher interface {
	// FetchTxSender fetches the sender of a transaction.
	FetchTxSender(ctx context.Context, chainID uint32, txHash string) (string, error)
	// FetchLastIndexed fetches the last indexed block per contract.
	FetchLastIndexed(ctx context.Context, chainID uint32, contractAddress string) (uint64, error)
	// FetchLogsInRange fetches logs in a range with the GQL client.
	FetchLogsInRange(ctx context.Context, chainID uint32, startBlock, endBlock uint64, contractAddress common.Address) ([]ethTypes.Log, error)
	// FetchBlockTime fetches the timestamp of a block.
	FetchBlockTime(ctx context.Context, chainID int, blockNumber int) (*int, error)
	// FetchTx fetches the transaction.
	FetchTx(ctx context.Context, tx string, chainID int, blockNumber int) (*uint64, *string, error)
}

ScribeFetcher is the interface for fetching events. It uses GQL.

func NewFetcher

func NewFetcher(fetchClient *client.Client, handler metrics.Handler) ScribeFetcher

NewFetcher creates a new fetcher.

type Service added in v0.0.32

type Service interface {
	// GetTokenID gets the token id from the bridge config contract.
	GetTokenID(ctx context.Context, chainID *big.Int, tokenAddress common.Address) (tokenID *string, err error)
	// GetToken gets the token from the bridge config contract.
	GetToken(ctx context.Context, chainID uint32, tokenAddress common.Address) (token *bridgeconfig.BridgeConfigV3Token, err error)
}

Service is the interface for the fetcher service.

func NewBridgeConfigFetcher

func NewBridgeConfigFetcher(bridgeConfigAddress common.Address, bridgeConfigRef *bridgeconfig.BridgeConfigRef) (Service, error)

NewBridgeConfigFetcher creates a new config fetcher. Backend must be an archive backend.

type SwapService added in v0.0.43

type SwapService interface {
	// GetTokenMetaData gets the token from the erc20 token contract given a swap contract token id.
	GetTokenMetaData(ctx context.Context, tokenAddress common.Address) (*string, *uint8, error)
	// GetTokenAddress gets the token address from the swap contract given a swap contract token id.
	GetTokenAddress(ctx context.Context, tokenIndex uint8) (*common.Address, error)
}

SwapService --output=mocks --case=underscore.

func NewSwapFetcher

func NewSwapFetcher(swapAddress common.Address, backend bind.ContractBackend, isMetaSwap bool) (SwapService, error)

NewSwapFetcher creates a new swap fetcher. Backend must be an archive backend.

Directories

Path Synopsis
Package tokenprice contains the historical price data
Package tokenprice contains the historical price data

Jump to

Keyboard shortcuts

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