Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
evmListener "github.com/sprintertech/sprinter-signing/chains/evm/listener"
evmMessage "github.com/sprintertech/sprinter-signing/chains/evm/message"
"github.com/sprintertech/sprinter-signing/metrics"
"github.com/sprintertech/sprinter-signing/price"

lifiConfig "github.com/sprintertech/solver-sdk/pkg/config"
"github.com/sprintertech/sprinter-signing/chains/lighter"
Expand All @@ -49,7 +50,6 @@ import (
"github.com/sprintertech/sprinter-signing/config"
"github.com/sprintertech/sprinter-signing/jobs"
"github.com/sprintertech/sprinter-signing/keyshare"
"github.com/sprintertech/sprinter-signing/price"
"github.com/sprintertech/sprinter-signing/protocol/across"
"github.com/sprintertech/sprinter-signing/protocol/lifi"
lighterAPI "github.com/sprintertech/sprinter-signing/protocol/lighter"
Expand Down Expand Up @@ -141,9 +141,6 @@ func Run() error {
msgChan := make(chan []*message.Message)
sigChn := make(chan interface{})

priceAPI, err := price.NewPythPricer(ctx)
panicOnError(err)

signatureCache := cache.NewSignatureCache(communication, sygmaMetrics)
go signatureCache.Watch(ctx, sigChn)

Expand Down Expand Up @@ -176,7 +173,8 @@ func Run() error {

usdPricer := pyth.NewClient(ctx)
err = usdPricer.Start(ctx)
panicOnError(err)

priceAPI := price.NewPythPricer(usdPricer)
multiPricer := aggregator.New(usdPricer)
resolver := token.NewTokenResolver(solverConfig, multiPricer)

Expand Down
13 changes: 3 additions & 10 deletions price/pyth.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package price

import (
"context"
"fmt"
"strings"

Expand All @@ -12,16 +11,10 @@ type PythPricer struct {
client *pyth.PythClient
}

func NewPythPricer(ctx context.Context, opts ...pyth.PythClientOption) (*PythPricer, error) {
client := pyth.NewClient(ctx, opts...)
err := client.Start(ctx)
if err != nil {
return nil, err
}

func NewPythPricer(client *pyth.PythClient) *PythPricer {
return &PythPricer{
client: pyth.NewClient(ctx, opts...),
}, nil
client: client,
}
}

func (p *PythPricer) TokenPrice(symbol string) (float64, error) {
Expand Down
Loading