forked from skip-mev/connect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interfaces.go
41 lines (36 loc) · 1.08 KB
/
interfaces.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package oracle
import (
"context"
"time"
"github.com/skip-mev/slinky/oracle/types"
mmtypes "github.com/skip-mev/slinky/x/marketmap/types"
)
// Oracle defines the expected interface for an oracle. It is consumed by the oracle server.
//
//go:generate mockery --name Oracle --filename mock_oracle.go
type Oracle interface {
IsRunning() bool
GetLastSyncTime() time.Time
GetPrices() types.Prices
GetMarketMap() mmtypes.MarketMap
Start(ctx context.Context) error
Stop()
}
// PriceAggregator is an interface for aggregating prices from multiple providers. Implementations of PriceAggregator
// should be made safe for concurrent use.
//
//go:generate mockery --name PriceAggregator
type PriceAggregator interface {
SetProviderPrices(provider string, prices types.Prices)
UpdateMarketMap(mmtypes.MarketMap)
AggregatePrices()
GetPrices() types.Prices
Reset()
}
// generalProvider is an interface for a provider that implements the base provider.
type generalProvider interface {
// Start starts the provider.
Start(ctx context.Context) error
// Name is the provider's name.
Name() string
}