Documentation ¶
Index ¶
- func GetOrDefault(slice []string, index int, defaultValue string) string
- func GetOrNil(slice []string, index int) *string
- type AppTokenService
- type AssetPlatform
- type CoinGeckoCoin
- type CoinGeckoOnChainService
- type CoinGeckoService
- type CoinsService
- type DefiLlamaService
- type DodoexRouteService
- type GeckoTerminalService
- type PriceResult
- type PriceService
- type RateLimiterService
- type SlackNotificationService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppTokenService ¶
type AppTokenService interface { GetAppTokenByToken(token string) (*schema.AppToken, error) GetAllAppTokens() ([]schema.AppToken, error) AddAppToken(appToken *schema.AppToken) error UpdateAppToken(appToken *schema.AppToken) error DeleteAppToken(token string) error }
func NewAppTokenService ¶
func NewAppTokenService(appTokenRepo repository.AppTokenRepository) AppTokenService
type AssetPlatform ¶
type CoinGeckoCoin ¶
type CoinGeckoOnChainService ¶
type CoinGeckoOnChainService interface { GetCoinGeckoOnChainNetwork(coingeckoAssetPlatformId string, isCache bool) (string, error) GetCurrentPriceOnChain(chainId, address string, symbol string, isCache bool) (*string, error) GetHistoricalPriceOnChain(chainId, address string, unixTimeStamp int64) (*string, error) GetBatchCurrentPricesOnChain(addresses []string, chainIds []string, symbols []string, networks []string, isCache bool) ([]PriceResult, error) GetBatchHistoricalPricesOnChain(addresses []string, chainIds []string, symbols []string, networks []string, unixTimeStamps []int64) ([]PriceResult, error) }
func NewCoinGeckoOnChainService ¶
func NewCoinGeckoOnChainService(cfg *koanf.Koanf, redisClient *shared.RedisClient, logger zerolog.Logger, coinRepository repository.CoinRepository, coinHistoricalPriceRepo repository.CoinHistoricalPriceRepository, coinGeckoService CoinGeckoService) CoinGeckoOnChainService
type CoinGeckoService ¶
type CoinGeckoService interface { CoinsList(useCache bool) ([]schema.Coins, error) GetCoinGeckoChainIdByAssetPlatformId(assetPlatformId string) (string, error) // get chain id by asset platform id GetAssetPlatformIdByChainId(chainId string) (string, error) SyncCoins() error GetBatchPrice(addresses []string, chainIds []string, symbols []string, networks []string, isCache bool) ([]PriceResult, error) GetBatchHistoricalPrices(addresses []string, chainIds []string, symbols []string, networks []string, dates []int64) ([]PriceResult, error) GetSinglePrice(chainID string, address string, symbol string, network string, isCache bool) (*string, error) GetSingleHistoricalPrice(date int64, chainID string, address string, symbol string, network string) (*string, error) // contains filtered or unexported methods }
func NewCoinGeckoService ¶
func NewCoinGeckoService(cfg *koanf.Koanf, coinRepository repository.CoinRepository, coinHistoricalPriceRepo repository.CoinHistoricalPriceRepository, redisClient *shared.RedisClient, logger zerolog.Logger) CoinGeckoService
type CoinsService ¶
type CoinsService interface { AddCoin(coin schema.Coins) error UpdateCoin(id string, updatedCoin schema.Coins) error DeleteCoin(id string) error GetCoinByID(id string) (*schema.Coins, error) RefreshAllCoinsCache() error RefreshCoinListCache(ids []string) error }
func NewCoinsService ¶
func NewCoinsService(coinsRepo repository.CoinRepository) CoinsService
type DefiLlamaService ¶
type DefiLlamaService interface { GetCurrentPrice(chainId, address string, isCache bool) (*string, error) GetHistoricalPrice(chainId, address string, unixTimeStamp int64) (*string, error) GetBatchCurrentPrices(addresses []string, chainIds []string, symbols []string, networks []string, isCache bool) ([]PriceResult, error) GetBatchHistoricalPrices(addresses []string, chainIds []string, symbols []string, networks []string, unixTimeStamps []int64) ([]PriceResult, error) }
func NewDefiLlamaService ¶
func NewDefiLlamaService(cfg *koanf.Koanf, redisClient *shared.RedisClient, logger zerolog.Logger, coinRepository repository.CoinRepository, coinHistoricalPriceRepo repository.CoinHistoricalPriceRepository) DefiLlamaService
type DodoexRouteService ¶
type DodoexRouteService interface { GetCurrentPrice(address string, chainId string, isCache bool) (*string, error) GetBatchCurrentPrices(addresses []string, chainIds []string, symbols []string, networks []string, isCache bool) ([]PriceResult, error) }
func NewDodoexRouteService ¶
func NewDodoexRouteService(cfg *koanf.Koanf, redisClient *shared.RedisClient, logger zerolog.Logger, coinRepository repository.CoinRepository, coinHistoricalPriceRepo repository.CoinHistoricalPriceRepository) DodoexRouteService
type GeckoTerminalService ¶
type GeckoTerminalService interface { GetCurrentPrice(chainId, address string, isCache bool) (*string, error) GetHistoricalPrice(chainId, address string, unixTimeStamp int64) (*string, error) GetBatchCurrentPrices(addresses []string, chainIds []string, symbols []string, networks []string, isCache bool) ([]PriceResult, error) GetBatchHistoricalPrices(addresses []string, chainIds []string, symbols []string, networks []string, unixTimeStamps []int64) ([]PriceResult, error) }
func NewGeckoTerminalService ¶
func NewGeckoTerminalService(cfg *koanf.Koanf, redisClient *shared.RedisClient, logger zerolog.Logger, coinRepository repository.CoinRepository, coinHistoricalPriceRepo repository.CoinHistoricalPriceRepository) GeckoTerminalService
type PriceResult ¶
type PriceResult struct { ChainID string `json:"chainId"` Address string `json:"address"` Price *string `json:"price"` Symbol *string `json:"symbol"` Network *string `json:"network"` TimeStamp string `json:"date"` RequestStatus *string `json:"-"` Serial int `json:"serial"` }
定义价格结果结构体
type PriceService ¶
type PriceService interface { GetPrice(chainId, address, symbol, network string, useCache bool, excludeRoute bool) (*string, error) GetHistoricalPrice(chainId, address, symbol, network string, unixTimeStamp int64) (*string, error) GetBatchPrice(ctx context.Context, chainIds []string, addresses []string, symbols []string, networks []string, useCache bool, excludeRoute bool) ([]PriceResult, error) GetBatchHistoricalPrice(chainIds []string, addresses []string, symbols []string, networks []string, unixTimeStamp []int64, datesStr []string) ([]PriceResult, error) }
func NewPriceService ¶
func NewPriceService(cfg *koanf.Koanf, slack SlackNotificationService, coinGeckoService CoinGeckoService, geckoTerminalService GeckoTerminalService, defiLlamaService DefiLlamaService, dodoexRouteService DodoexRouteService, coinGeckoOnChainService CoinGeckoOnChainService, coinRepository repository.CoinRepository, logger zerolog.Logger, throttler *shared.CoinsThrottler, redisClient *shared.RedisClient) PriceService
type RateLimiterService ¶
type RateLimiterService struct {
// contains filtered or unexported fields
}
func NewRateLimiterService ¶
func NewRateLimiterService(appTokenRepo repository.AppTokenRepository, redisClient *shared.RedisClient) *RateLimiterService
type SlackNotificationService ¶
type SlackNotificationService interface {
SaveLog(ctx context.Context, source, chainID, address, dateDay string, timestamp int64) error
}
func NewSlackNotificationService ¶
func NewSlackNotificationService(slackRepo repository.SlackNotificationRepository, redisClient *shared.RedisClient, logger zerolog.Logger) SlackNotificationService
Click to show internal directories.
Click to hide internal directories.