Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
adamewozniak committed Nov 22, 2023
1 parent fc441d4 commit e3b8ba0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions oracle/provider/astroport.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func NewAstroportProvider(

go func() {
logger.Debug().Msg("starting ftx polling...")
err := provider.pollCache(ctx, pairs...)
err := provider.poll(ctx)
if err != nil {
logger.Err(err).Msg("astroport provider unable to poll new data")
}
Expand All @@ -109,7 +109,7 @@ func NewAstroportProvider(
}

// GetAvailablePairs return all available pair symbols.
func (p AstroportProvider) GetAvailablePairs() (map[string]struct{}, error) {
func (p *AstroportProvider) GetAvailablePairs() (map[string]struct{}, error) {
availablePairs, _, err := p.getTickerMaps()
if err != nil {
return nil, err
Expand Down Expand Up @@ -151,7 +151,7 @@ func (p *AstroportProvider) SubscribeCurrencyPairs(cps ...types.CurrencyPair) {

// StartConnections starts the websocket connections.
// This function is a no-op for the astroport provider.
func (p AstroportProvider) StartConnections() {}
func (p *AstroportProvider) StartConnections() {}

// AstroportTickerPairs is a struct to hold the AstroportTickersResponse and the
// corresponding pair. It satisfies the TickerPrice interface.
Expand Down Expand Up @@ -179,7 +179,7 @@ func (atr AstroportTickersResponse) toTickerPrice() (types.TickerPrice, error) {

// setTickers queries the Astroport API for the latest tickers and updates the
// priceStore.
func (p AstroportProvider) setTickers() error {
func (p *AstroportProvider) setTickers() error {
tickers, err := p.queryTickers()
if err != nil {
return err
Expand All @@ -192,7 +192,7 @@ func (p AstroportProvider) setTickers() error {

// findTickersForPairs returns a map of ticker IDs -> pairs, but filters out
// pairs that we are not subscribed to.
func (p AstroportProvider) findTickersForPairs() (map[string]types.CurrencyPair, error) {
func (p *AstroportProvider) findTickersForPairs() (map[string]types.CurrencyPair, error) {
queryingPairs := p.subscribedPairs
_, pairToTickerIDMap, err := p.getTickerMaps()
if err != nil {
Expand All @@ -211,7 +211,7 @@ func (p AstroportProvider) findTickersForPairs() (map[string]types.CurrencyPair,

// getTickerMaps returns all available assets from the api.
// It returns a map of ticker IDs -> pairs and a map of pairs -> ticker IDs.
func (p AstroportProvider) getTickerMaps() (map[string]types.CurrencyPair, map[string]string, error) {
func (p *AstroportProvider) getTickerMaps() (map[string]types.CurrencyPair, map[string]string, error) {
res, err := p.client.Get(p.endpoints.Rest + assetsURL)
if err != nil {
return nil, nil, err
Expand Down Expand Up @@ -247,7 +247,7 @@ func (p AstroportProvider) getTickerMaps() (map[string]types.CurrencyPair, map[s
}

// queryTickers returns the AstroportTickerPairs available from the API.
func (p AstroportProvider) queryTickers() ([]AstroportTickerPairs, error) {
func (p *AstroportProvider) queryTickers() ([]AstroportTickerPairs, error) {
res, err := p.client.Get(p.endpoints.Rest + tickersURL)
if err != nil {
return nil, err
Expand Down Expand Up @@ -285,7 +285,7 @@ func (p AstroportProvider) queryTickers() ([]AstroportTickerPairs, error) {
}

// This function periodically calls setTickers to update the priceStore.
func (p AstroportProvider) pollCache(ctx context.Context, pairs ...types.CurrencyPair) error {
func (p *AstroportProvider) poll(ctx context.Context) error {
for {
select {
case <-ctx.Done():
Expand Down

0 comments on commit e3b8ba0

Please sign in to comment.