8000 chore: backport https://github.com/skip-mev/connect/pull/743 by aljo242 · Pull Request #867 · skip-mev/connect · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This reposi 8000 tory was archived by the owner on Mar 24, 2025. It is now read-only.

chore: backport https://github.com/skip-mev/connect/pull/743 #867

Merged
merged 2 commits into from
Dec 12, 2024
Merged
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
90 changes: 90 additions & 0 deletions cmd/constants/marketmaps/markets.go
Original file line number Diff line number Diff line change
Expand Up @@ -9754,6 +9754,95 @@ var (
}
}
}`

// ForexMarketMap is used to initialize the forex market map. This only includes
// forex markets quoted in usdt.
ForexMarketMap mmtypes.MarketMap

// ForexMarketMapJSON is the JSON representation of ForexMarketMap.
ForexMarketMapJSON = `
{
"markets": {
"TRY/USDT": {
"ticker": {
"currency_pair": {
"Base": "TRY",
"Quote": "USDT"
},
"decimals": 11,
"min_provider_count": 1,
"enabled": false,
"metadata_JSON": "{\"reference_price\":2935133548,\"liquidity\":1504939,\"aggregate_ids\":[{\"venue\":\"coinmarketcap\",\"ID\":\"2810\"}]}"
},
"provider_configs": [
{
"name": "binance_ws",
"off_chain_ticker": "USDTTRY",
"invert": true,
"metadata_JSON": ""
},
{
"name": "okx_ws",
"off_chain_ticker": "TRY-USDT",
"invert": false,
"metadata_JSON": ""
}
]
},
"EUR/USDT": {
"ticker": {
"currency_pair": {
"Base": "EUR",
"Quote": "USDT"
},
"decimals": 9,
"min_provider_count": 1,
"enabled": false,
"metadata_JSON": "{\"reference_price\":1100800000,\"liquidity\":3843298,\"aggregate_ids\":[{\"venue\":\"coinmarketcap\",\"ID\":\"2790\"}]}"
},
"provider_configs": [
{
"name": "binance_ws",
"off_chain_ticker": "EURUSDT",
"invert": false,
"metadata_JSON": ""
},
{
"name": "okx_ws",
"off_chain_ticker": "EUR-USDT",
"invert": false,
"metadata_JSON": ""
}
]
},
"BRL/USDT": {
"ticker": {
"currency_pair": {
"Base": "BRL",
"Quote": "USDT"
},
"decimals": 10,
"min_provider_count": 1,
"enabled": false,
"metadata_JSON": "{\"reference_price\":1760563380,\"liquidity\":2479974,\"aggregate_ids\":[{\"venue\":\"coinmarketcap\",\"ID\":\"2783\"}]}"
},
"provider_configs": [
{
"name": "binance_ws",
"off_chain_ticker": "USDTBRL",
"invert": true,
"metadata_JSON": ""
},
{
"name": "okx_ws",
"off_chain_ticker": "BRL-USDT",
"invert": false,
"metadata_JSON": ""
}
]
}
}
}`
)

func init() {
Expand All @@ -9765,6 +9854,7 @@ func init() {
unmarshalValidate("CoinGecko", CoinGeckoMarketMapJSON, &CoinGeckoMarketMap),
unmarshalValidate("Osmosis", OsmosisMarketMapJSON, &OsmosisMarketMap),
unmarshalValidate("Polymarket", PolymarketMarketMapJSON, &PolymarketMarketMap),
unmarshalValidate("Forex", ForexMarketMapJSON, &ForexMarketMap),
)
if err != nil {
panic(err)
Expand Down
1 change: 1 addition & 0 deletions cmd/constants/marketmaps/markets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func TestMarkets(t *testing.T) {
marketmaps.CoinGeckoMarketMap.Markets,
marketmaps.OsmosisMarketMap.Markets,
marketmaps.PolymarketMarketMap.Markets,
marketmaps.ForexMarketMap.Markets,
}
for _, m := range markets {
require.NotEmpty(t, m)
Expand Down
6 changes: 6 additions & 0 deletions scripts/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
useCoinMarketCap = flag.Bool("use-coinmarketcap", false, "use coinmarketcap markets")
useOsmosis = flag.Bool("use-osmosis", false, "use osmosis markets")
usePolymarket = flag.Bool("use-polymarket", false, "use polymarket markets")
useForex = flag.Bool("use-forex", false, "use forex markets")
tempFile = flag.String("temp-file", "markets.json", "temporary file to store the market map")
)

Expand Down Expand Up @@ -99,6 +100,11 @@
marketMap = mergeMarketMaps(marketMap, marketmaps.PolymarketMarketMap)
}

if *useForex {
fmt.Fprintf(flag.CommandLine.Output(), "Using forex markets\n")
marketMap = mergeMarketMaps(marketMap, marketmaps.ForexMarketMap)
}

Check warning on line 106 in scripts/genesis.go

View check run for this annotation

Codecov / codecov/patch

scripts/genesis.go#L103-L106

Added lines #L103 - L106 were not covered by tests

if err := marketMap.ValidateBasic(); err != nil {
fmt.Fprintf(flag.CommandLine.Output(), "failed to validate market map: %s\n", err)
panic(err)
Expand Down
Loading
0