Skip to content

Commit

Permalink
Merge branch 'main' into fix/compute-gov-addr-after-config-changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Johnson authored Apr 9, 2024
2 parents a6fe26d + f83c9eb commit 252e6c6
Show file tree
Hide file tree
Showing 41 changed files with 4,215 additions and 257 deletions.
13 changes: 0 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,3 @@ To test these numbers yourself, spin up the the oracle server following the inst
* [Data Provider Queries](./providers/base/metrics/README.md#usage): Provides general insight into how often price feeds are updated by status (success/failure), provider (binance, coinbase, etc.), price feed (BTC/USD, ETH/USD), and provider type (api/websocket).
* [Websocket Performance Queries](./providers/base/websocket/metrics/README.md#usage): Provides insight into how often websocket providers are successfully updating their data. This is a combination of metrics related to the underlying connection as well as the data handler which is responsible for processing the data received from the Websocket connection.
* [API Performance Queries](./providers/base/api/metrics/README.md#usage): Provides insight into how often API providers are successfully updating their data.

## DEFI
- Defi providers are currently an experimental feature, to generate local configs to run the defi providers locally, run
```bash
$ DEFI_PROVIDERS_ENABLED=true SOLANA_NODE_ENDPOINT=<SOLANA_NODE> make update-local-configs
```
Then, to run
```bash
$ make run-oracle-server
```
## Future Work

The oracle side car is a combination of the oracle and provider packages. This is being moved to a [separate repository](https://github.com/skip-mev/slinky-sidecar).
2 changes: 1 addition & 1 deletion cmd/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var (

// Set up a connection to the server.
url := fmt.Sprintf("%s:%s", host, port)
conn, err := grpc.Dial(url, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
conn, err := grpc.NewClient(url, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
if err != nil {
log.Fatalf("did not connect: %v", err)
}
Expand Down
38 changes: 21 additions & 17 deletions cmd/slinky-config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"io"
"os"
"strings"
"time"
Expand All @@ -12,9 +13,11 @@ import (
"github.com/skip-mev/slinky/oracle/config"
"github.com/skip-mev/slinky/oracle/constants"
"github.com/skip-mev/slinky/oracle/types"
slinkytypes "github.com/skip-mev/slinky/pkg/types"
"github.com/skip-mev/slinky/providers/apis/binance"
coinbaseapi "github.com/skip-mev/slinky/providers/apis/coinbase"
"github.com/skip-mev/slinky/providers/apis/coingecko"
raydium "github.com/skip-mev/slinky/providers/apis/defi/raydium"
"github.com/skip-mev/slinky/providers/apis/dydx"
"github.com/skip-mev/slinky/providers/apis/geckoterminal"
krakenapi "github.com/skip-mev/slinky/providers/apis/kraken"
Expand All @@ -32,13 +35,10 @@ import (
"github.com/skip-mev/slinky/providers/websockets/okx"
mmclienttypes "github.com/skip-mev/slinky/service/clients/marketmap/types"
mmtypes "github.com/skip-mev/slinky/x/marketmap/types"
slinkytypes "github.com/skip-mev/slinky/pkg/types"
raydium "github.com/skip-mev/slinky/providers/apis/defi/raydium"
"io"
)

const (
// raydiumPairsFixture is the path to the fixture file containing all raydium markets
// raydiumPairsFixture is the path to the fixture file containing all raydium markets.
raydiumPairsFixture = "./cmd/slinky-config/fixtures/raydium_pairs.json"
)

Expand Down Expand Up @@ -87,11 +87,11 @@ var (
// maxPriceAge is the maximum age of a price that the oracle will accept.
maxPriceAge time.Duration

// raydium-enabled determine whether or not the raydium defi provider will be configured
// raydium-enabled determine whether or not the raydium defi provider will be configured.
raydiumEnabled bool

// solana node url is the solana node that the raydium provider will connect to
solanaNodeURL string
// solana node url is the solana node that the raydium provider will connect to.
solanaNodeURLs []string

// ProviderToMarkets defines a map of provider names to their respective market
// configurations. This is used to generate the local market config file.
Expand Down Expand Up @@ -322,12 +322,12 @@ func init() {
false,
"whether or not to enable raydium support",
)
rootCmd.Flags().StringVarP(
&solanaNodeURL,
rootCmd.Flags().StringSliceVarP(
&solanaNodeURLs,
"solana-node-endpoint",
"",
"",
"The HTTP endpoint of the solana node endpoint the raydium provider will be configured to use",
nil,
"The HTTP endpoints of the solana node endpoint the raydium provider will be configured to use. If multiple are given they must be comma delimited",
)
}

Expand Down Expand Up @@ -375,7 +375,11 @@ func createOracleConfig() error {
// add raydium provider to the list of providers if enabled
if raydiumEnabled {
cfg := raydium.DefaultAPIConfig
cfg.URL = solanaNodeURL
for _, node := range solanaNodeURLs {
cfg.Endpoints = append(cfg.Endpoints, config.Endpoint{
URL: node,
})
}

LocalOracleConfig.Providers = append(LocalOracleConfig.Providers, config.ProviderConfig{
Name: raydium.Name,
Expand Down Expand Up @@ -564,13 +568,13 @@ func addRaydiumMarkets(providerToMarkets map[string]map[mmtypes.Ticker]mmtypes.P
providerToMarkets[raydium.Name] = make(map[mmtypes.Ticker]mmtypes.ProviderConfig)
for _, pair := range raydiumPairs {
providerToMarkets[raydium.Name][mmtypes.Ticker{
CurrencyPair: pair.Cp,
Decimals: 18,
CurrencyPair: pair.Cp,
Decimals: 18,
MinProviderCount: 1,
Enabled: true,
Metadata_JSON: marshalToJSONString(pair.TickerMetaData),
Enabled: true,
Metadata_JSON: marshalToJSONString(pair.TickerMetaData),
}] = mmtypes.ProviderConfig{
Name: raydium.Name,
Name: raydium.Name,
OffChainTicker: pair.Cp.String(),
}
}
Expand Down
33 changes: 22 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ require (
github.com/cosmos/cosmos-sdk v0.50.5
github.com/cosmos/gogogateway v1.2.0
github.com/cosmos/gogoproto v1.4.12
github.com/gagliardetto/binary v0.7.7
github.com/gagliardetto/solana-go v1.9.3
github.com/ethereum/go-ethereum v1.13.14
github.com/gagliardetto/binary v0.8.0
github.com/gagliardetto/solana-go v1.10.0
github.com/gogo/protobuf v1.3.2
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.4
Expand Down Expand Up @@ -61,7 +62,6 @@ require (
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.6 // indirect
cloud.google.com/go/storage v1.36.0 // indirect
contrib.go.opencensus.io/exporter/stackdriver v0.13.4 // indirect
cosmossdk.io/errors v1.0.1 // indirect
filippo.io/edwards25519 v1.0.0 // indirect
github.com/4meepo/tagalign v1.3.3 // indirect
Expand All @@ -77,7 +77,9 @@ require (
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/alecthomas/assert/v2 v2.6.0 // indirect
github.com/alecthomas/go-check-sumtype v0.1.4 // indirect
github.com/alexkohler/nakedret/v2 v2.0.4 // indirect
Expand Down Expand Up @@ -116,27 +118,31 @@ require (
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft-db v0.9.1 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/iavl v1.0.1 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
github.com/creachadair/atomicfile v0.3.1 // indirect
github.com/creachadair/tomledit v0.0.24 // indirect
github.com/curioswitch/go-reassign v0.2.0 // indirect
github.com/daixiang0/gci v0.12.3 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/denis-tingaikin/go-header v0.5.0 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/dfuse-io/logging v0.0.0-20201110202154-26697de88c79 // indirect
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.6.0 // indirect
github.com/emicklei/dot v1.6.1 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/ettle/strcase v0.2.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fatih/structtag v1.2.0 // indirect
Expand All @@ -153,6 +159,7 @@ require (
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-toolsmith/astcast v1.1.0 // indirect
github.com/go-toolsmith/astcopy v1.1.0 // indirect
github.com/go-toolsmith/astequal v1.2.0 // indirect
Expand All @@ -168,7 +175,7 @@ require (
github.com/gogo/googleapis v1.4.1 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect
github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e // indirect
github.com/golangci/misspell v0.4.1 // indirect
Expand Down Expand Up @@ -204,6 +211,7 @@ require (
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/huandu/skiplist v1.2.0 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
Expand Down Expand Up @@ -242,12 +250,13 @@ require (
github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mgechev/revive v1.3.7 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/moricho/tparallel v0.3.1 // indirect
Expand All @@ -274,6 +283,7 @@ require (
github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/rs/cors v1.8.3 // indirect
github.com/rs/zerolog v1.32.0 // indirect
Expand All @@ -288,6 +298,7 @@ require (
github.com/sashamelentyev/usestdlibvars v1.25.0 // indirect
github.com/securego/gosec/v2 v2.19.0 // indirect
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sivchari/containedctx v1.0.3 // indirect
github.com/sivchari/tenv v1.7.1 // indirect
Expand All @@ -297,21 +308,20 @@ require (
github.com/spf13/afero v1.11.0 // indirect
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect
github.com/streamingfast/logging v0.0.0-20220405224725-2755dab2ce75 // indirect
github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect
github.com/tdakkota/asciicheck v0.2.0 // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125 // indirect
github.com/tetafro/godot v1.4.16 // indirect
github.com/tidwall/btree v1.7.0 // indirect
github.com/tidwall/gjson v1.9.3 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect
github.com/timonwong/loggercheck v0.9.4 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/tomarrell/wrapcheck/v2 v2.8.3 // indirect
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
Expand Down Expand Up @@ -359,6 +369,7 @@ require (
mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14 // indirect
nhooyr.io/websocket v1.8.6 // indirect
pgregory.net/rapid v1.1.0 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

Expand Down
Loading

0 comments on commit 252e6c6

Please sign in to comment.