Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add EIGEN,BOME as isolatd market in default test genesis #2651

Merged
merged 2 commits into from
Dec 13, 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
3 changes: 3 additions & 0 deletions protocol/scripts/genesis/prod_pregenesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ create_pregenesis_file() {
echo "Copying exchange config jsons to $TMP_EXCHANGE_CONFIG_JSON_DIR"
cp -R ./daemons/pricefeed/client/constants/testdata $TMP_EXCHANGE_CONFIG_JSON_DIR

echo "Running edit_genesis..."
edit_genesis "$VAL_CONFIG_DIR" "" "" "" "" "$TMP_EXCHANGE_CONFIG_JSON_DIR" "./testing/delaymsg_config" "STATUS_INITIALIZING" ""

echo "Oerwriting genesis params for production..."
overwrite_genesis_production
}

Expand Down
176 changes: 175 additions & 1 deletion protocol/scripts/genesis/sample_pregenesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,26 @@
"status": "STATUS_INITIALIZING",
"step_base_quantums": 1000000,
"subticks_per_tick": 1000000
},
{
"id": 300,
"perpetual_clob_metadata": {
"perpetual_id": 300
},
"quantum_conversion_exponent": -9,
"status": "STATUS_INITIALIZING",
"step_base_quantums": 1000000,
"subticks_per_tick": 1000000
},
{
"id": 301,
"perpetual_clob_metadata": {
"perpetual_id": 301
},
"quantum_conversion_exponent": -9,
"status": "STATUS_INITIALIZING",
"step_base_quantums": 1000000,
"subticks_per_tick": 1000000
}
],
"equity_tier_limit_config": {
Expand Down Expand Up @@ -1397,6 +1417,70 @@
"min_provider_count": 3
}
},
"BOME/USD": {
"provider_configs": [
{
"invert": false,
"metadata_JSON": "",
"name": "kucoin_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "BOME-USDT"
},
{
"invert": false,
"metadata_JSON": "",
"name": "huobi_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "bomeusdt"
},
{
"invert": false,
"metadata_JSON": "",
"name": "bybit_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "BOMEUSDT"
},
{
"invert": false,
"metadata_JSON": "{\"base_token_vault\":{\"token_vault_address\":\"FBba2XsQVhkoQDMfbNLVmo7dsvssdT39BMzVc2eFfE21\",\"token_decimals\":6},\"quote_token_vault\":{\"token_vault_address\":\"GuXKCb9ibwSeRSdSYqaCL3dcxBZ7jJcj6Y7rDwzmUBu9\",\"token_decimals\":9},\"amm_info_address\":\"DSUvc5qf5LJHHV5e2tD184ixotSnCnwj7i4jJa4Xsrmt\",\"open_orders_address\":\"38p42yoKFWgxw2LCbB96wAKa2LwAxiBArY3fc3eA9yWv\"}",
"name": "raydium_api",
"normalize_by_pair": {
"Base": "SOL",
"Quote": "USD"
},
"off_chain_ticker": "BOME,RAYDIUM,UKHH6C7MMYIWCF1B9PNWE25TSPKDDT3H5PQZGZ74J82/SOL,RAYDIUM,SO11111111111111111111111111111111111111112"
},
{
"invert": false,
"metadata_JSON": "",
"name": "okx_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "BOME-USDT"
}
],
"ticker": {
"currency_pair": {
"Base": "BOME",
"Quote": "USD"
},
"decimals": 12,
"enabled": true,
"metadata_JSON": "{\"reference_price\":6051284618,\"liquidity\":748591,\"aggregate_ids\":[{\"venue\":\"coinmarketcap\",\"ID\":\"29870\"}]}",
"min_provider_count": 1
}
},
Comment on lines +1420 to +1483
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Review min_provider_count for BOME market

The BOME market is configured with min_provider_count: 1, which is lower than the standard min_provider_count: 3 used by other markets. This could potentially impact price reliability.

Consider increasing the min_provider_count to 3 for better price accuracy and manipulation resistance:

   "ticker": {
     "currency_pair": {
       "Base": "BOME",
       "Quote": "USD"
     },
     "decimals": 12,
     "enabled": true,
     "metadata_JSON": "{\"reference_price\":6051284618,\"liquidity\":748591,\"aggregate_ids\":[{\"venue\":\"coinmarketcap\",\"ID\":\"29870\"}]}",
-    "min_provider_count": 1
+    "min_provider_count": 3
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"BOME/USD": {
"provider_configs": [
{
"invert": false,
"metadata_JSON": "",
"name": "kucoin_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "BOME-USDT"
},
{
"invert": false,
"metadata_JSON": "",
"name": "huobi_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "bomeusdt"
},
{
"invert": false,
"metadata_JSON": "",
"name": "bybit_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "BOMEUSDT"
},
{
"invert": false,
"metadata_JSON": "{\"base_token_vault\":{\"token_vault_address\":\"FBba2XsQVhkoQDMfbNLVmo7dsvssdT39BMzVc2eFfE21\",\"token_decimals\":6},\"quote_token_vault\":{\"token_vault_address\":\"GuXKCb9ibwSeRSdSYqaCL3dcxBZ7jJcj6Y7rDwzmUBu9\",\"token_decimals\":9},\"amm_info_address\":\"DSUvc5qf5LJHHV5e2tD184ixotSnCnwj7i4jJa4Xsrmt\",\"open_orders_address\":\"38p42yoKFWgxw2LCbB96wAKa2LwAxiBArY3fc3eA9yWv\"}",
"name": "raydium_api",
"normalize_by_pair": {
"Base": "SOL",
"Quote": "USD"
},
"off_chain_ticker": "BOME,RAYDIUM,UKHH6C7MMYIWCF1B9PNWE25TSPKDDT3H5PQZGZ74J82/SOL,RAYDIUM,SO11111111111111111111111111111111111111112"
},
{
"invert": false,
"metadata_JSON": "",
"name": "okx_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "BOME-USDT"
}
],
"ticker": {
"currency_pair": {
"Base": "BOME",
"Quote": "USD"
},
"decimals": 12,
"enabled": true,
"metadata_JSON": "{\"reference_price\":6051284618,\"liquidity\":748591,\"aggregate_ids\":[{\"venue\":\"coinmarketcap\",\"ID\":\"29870\"}]}",
"min_provider_count": 1
}
},
"BOME/USD": {
"provider_configs": [
{
"invert": false,
"metadata_JSON": "",
"name": "kucoin_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "BOME-USDT"
},
{
"invert": false,
"metadata_JSON": "",
"name": "huobi_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "bomeusdt"
},
{
"invert": false,
"metadata_JSON": "",
"name": "bybit_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "BOMEUSDT"
},
{
"invert": false,
"metadata_JSON": "{\"base_token_vault\":{\"token_vault_address\":\"FBba2XsQVhkoQDMfbNLVmo7dsvssdT39BMzVc2eFfE21\",\"token_decimals\":6},\"quote_token_vault\":{\"token_vault_address\":\"GuXKCb9ibwSeRSdSYqaCL3dcxBZ7jJcj6Y7rDwzmUBu9\",\"token_decimals\":9},\"amm_info_address\":\"DSUvc5qf5LJHHV5e2tD184ixotSnCnwj7i4jJa4Xsrmt\",\"open_orders_address\":\"38p42yoKFWgxw2LCbB96wAKa2LwAxiBArY3fc3eA9yWv\"}",
"name": "raydium_api",
"normalize_by_pair": {
"Base": "SOL",
"Quote": "USD"
},
"off_chain_ticker": "BOME,RAYDIUM,UKHH6C7MMYIWCF1B9PNWE25TSPKDDT3H5PQZGZ74J82/SOL,RAYDIUM,SO11111111111111111111111111111111111111112"
},
{
"invert": false,
"metadata_JSON": "",
"name": "okx_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "BOME-USDT"
}
],
"ticker": {
"currency_pair": {
"Base": "BOME",
"Quote": "USD"
},
"decimals": 12,
"enabled": true,
"metadata_JSON": "{\"reference_price\":6051284618,\"liquidity\":748591,\"aggregate_ids\":[{\"venue\":\"coinmarketcap\",\"ID\":\"29870\"}]}",
"min_provider_count": 3
}
},

"BTC/USD": {
"provider_configs": [
{
Expand Down Expand Up @@ -1739,6 +1823,50 @@
"min_provider_count": 3
}
},
"EIGEN/USD": {
"provider_configs": [
{
"invert": false,
"name": "okx_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "EIGEN-USDT"
},
{
"invert": false,
"name": "bybit_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "EIGENUSDT"
},
{
"name": "crypto_dot_com_ws",
"off_chain_ticker": "EIGEN_USD"
},
{
"name": "coinbase_ws",
"off_chain_ticker": "EIGEN-USD"
},
{
"name": "kraken_api",
"off_chain_ticker": "EIGENUSD"
}
],
"ticker": {
"currency_pair": {
"Base": "EIGEN",
"Quote": "USD"
},
"decimals": 9,
"enabled": true,
"metadata_JSON": "{\"reference_price\":3648941500,\"liquidity\":3099304,\"aggregate_ids\":[{\"venue\":\"coinmarketcap\",\"ID\":\"30494\"}]}",
"min_provider_count": 1
}
},
Comment on lines +1826 to +1869
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Review min_provider_count for EIGEN market

Similarly, the EIGEN market is configured with min_provider_count: 1, which could lead to price reliability issues.

Consider increasing the min_provider_count to 3:

   "ticker": {
     "currency_pair": {
       "Base": "EIGEN",
       "Quote": "USD"
     },
     "decimals": 9,
     "enabled": true,
     "metadata_JSON": "{\"reference_price\":3648941500,\"liquidity\":3099304,\"aggregate_ids\":[{\"venue\":\"coinmarketcap\",\"ID\":\"30494\"}]}",
-    "min_provider_count": 1
+    "min_provider_count": 3
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"EIGEN/USD": {
"provider_configs": [
{
"invert": false,
"name": "okx_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "EIGEN-USDT"
},
{
"invert": false,
"name": "bybit_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "EIGENUSDT"
},
{
"name": "crypto_dot_com_ws",
"off_chain_ticker": "EIGEN_USD"
},
{
"name": "coinbase_ws",
"off_chain_ticker": "EIGEN-USD"
},
{
"name": "kraken_api",
"off_chain_ticker": "EIGENUSD"
}
],
"ticker": {
"currency_pair": {
"Base": "EIGEN",
"Quote": "USD"
},
"decimals": 9,
"enabled": true,
"metadata_JSON": "{\"reference_price\":3648941500,\"liquidity\":3099304,\"aggregate_ids\":[{\"venue\":\"coinmarketcap\",\"ID\":\"30494\"}]}",
"min_provider_count": 1
}
},
"EIGEN/USD": {
"provider_configs": [
{
"invert": false,
"name": "okx_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "EIGEN-USDT"
},
{
"invert": false,
"name": "bybit_ws",
"normalize_by_pair": {
"Base": "USDT",
"Quote": "USD"
},
"off_chain_ticker": "EIGENUSDT"
},
{
"name": "crypto_dot_com_ws",
"off_chain_ticker": "EIGEN_USD"
},
{
"name": "coinbase_ws",
"off_chain_ticker": "EIGEN-USD"
},
{
"name": "kraken_api",
"off_chain_ticker": "EIGENUSD"
}
],
"ticker": {
"currency_pair": {
"Base": "EIGEN",
"Quote": "USD"
},
"decimals": 9,
"enabled": true,
"metadata_JSON": "{\"reference_price\":3648941500,\"liquidity\":3099304,\"aggregate_ids\":[{\"venue\":\"coinmarketcap\",\"ID\":\"30494\"}]}",
"min_provider_count": 3
}
},

"ETC/USD": {
"provider_configs": [
{
Expand Down Expand Up @@ -3390,6 +3518,28 @@
"market_type": 1,
"ticker": "XRP-USD"
}
},
{
"params": {
"atomic_resolution": -6,
"default_funding_ppm": 0,
"id": 300,
"liquidity_tier": 4,
"market_id": 300,
"market_type": 2,
"ticker": "EIGEN-USD"
}
},
{
"params": {
"atomic_resolution": -3,
"default_funding_ppm": 0,
"id": 301,
"liquidity_tier": 4,
"market_id": 301,
"market_type": 2,
"ticker": "BOME-USD"
}
Comment on lines +3521 to +3542
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

⚠️ Potential issue

Review atomic resolution and funding rate configurations

Based on the verification results:

  1. The atomic resolution of -3 for BOME-USD is indeed an outlier. Most markets use values between -5 and -9, with -6 being the most common (49 instances), followed by -5 (32 instances).

  2. Regarding default_funding_ppm, while 100 is common (33 instances), having 0 is actually not unusual (104 instances). This suggests that zero funding rate is a valid configuration choice and doesn't require adjustment.

Recommendation:

  • Consider adjusting BOME-USD's atomic_resolution from -3 to a value between -5 and -6 to align with similar markets and ensure appropriate price precision.
🔗 Analysis chain

Review atomic resolution and funding rate configurations

Two potential concerns in the perpetual configurations:

  1. BOME's atomic_resolution (-3) is unusually high compared to other markets (typically -6 to -10)
  2. Both markets have default_funding_ppm set to 0, while other markets use 100

Consider adjusting these parameters:

   "params": {
     "atomic_resolution": -3,
-    "default_funding_ppm": 0,
+    "default_funding_ppm": 100,
     "id": 301,
     "liquidity_tier": 4,
     "market_id": 301,
     "market_type": 2,
     "ticker": "BOME-USD"
   }

Let me verify the default funding rate configurations before making the final response.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the range of atomic_resolution values across all markets
rg -U "atomic_resolution.*-\d+" --json | jq -r '.data.lines.text' | sort | uniq -c

Length of output: 5615


Script:

#!/bin/bash
# Check the range of default_funding_ppm values across all markets
rg -U "default_funding_ppm.*\d+" --json | jq -r '.data.lines.text' | sort | uniq -c

Length of output: 4738

}
]
},
Expand Down Expand Up @@ -3604,6 +3754,20 @@
"id": 1000001,
"min_price_change_ppm": 2500,
"pair": "DYDX-USD"
},
{
"exponent": -9,
"id": 300,
"min_exchanges": 1,
"min_price_change_ppm": 800,
"pair": "EIGEN-USD"
},
{
"exponent": -12,
"id": 301,
"min_exchanges": 1,
"min_price_change_ppm": 800,
"pair": "BOME-USD"
}
],
"market_prices": [
Expand Down Expand Up @@ -3781,6 +3945,16 @@
"exponent": -9,
"id": 1000001,
"price": 2050000000
},
{
"exponent": -9,
"id": 300,
"price": 4973000000
},
{
"exponent": -12,
"id": 301,
"price": 8695478191
}
]
},
Expand Down Expand Up @@ -3916,7 +4090,7 @@
]
}
},
"app_version": "7.0.0-dev0-129-g2b9a6b6dd",
"app_version": "7.0.0-dev0-149-g12cfb908b",
"chain_id": "dydx-sample-1",
"consensus": {
"params": {
Expand Down
100 changes: 99 additions & 1 deletion protocol/testing/genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,26 @@ function edit_genesis() {
dasel put -t int -f "$GENESIS" '.app_state.perpetuals.perpetuals.[32].params.liquidity_tier' -v '1'
dasel put -t int -f "$GENESIS" '.app_state.perpetuals.perpetuals.[32].params.market_type' -v '1'

# Perpetual (Isolated): EIGEN-USD
dasel put -t json -f "$GENESIS" '.app_state.perpetuals.perpetuals.[]' -v "{}"
dasel put -t string -f "$GENESIS" '.app_state.perpetuals.perpetuals.[33].params.ticker' -v 'EIGEN-USD'
dasel put -t int -f "$GENESIS" '.app_state.perpetuals.perpetuals.[33].params.id' -v '300'
dasel put -t int -f "$GENESIS" '.app_state.perpetuals.perpetuals.[33].params.market_id' -v '300'
dasel put -t int -f "$GENESIS" '.app_state.perpetuals.perpetuals.[33].params.atomic_resolution' -v '-6'
dasel put -t int -f "$GENESIS" '.app_state.perpetuals.perpetuals.[33].params.default_funding_ppm' -v '0'
dasel put -t int -f "$GENESIS" '.app_state.perpetuals.perpetuals.[33].params.liquidity_tier' -v '4'
dasel put -t int -f "$GENESIS" '.app_state.perpetuals.perpetuals.[33].params.market_type' -v '2' # Isolated

# Perpetual (Isolated): BOME-USD
dasel put -t json -f "$GENESIS" '.app_state.perpetuals.perpetuals.[]' -v "{}"
dasel put -t string -f "$GENESIS" '.app_state.perpetuals.perpetuals.[34].params.ticker' -v 'BOME-USD'
dasel put -t int -f "$GENESIS" '.app_state.perpetuals.perpetuals.[34].params.id' -v '301'
dasel put -t int -f "$GENESIS" '.app_state.perpetuals.perpetuals.[34].params.market_id' -v '301'
dasel put -t int -f "$GENESIS" '.app_state.perpetuals.perpetuals.[34].params.atomic_resolution' -v '-3'
dasel put -t int -f "$GENESIS" '.app_state.perpetuals.perpetuals.[34].params.default_funding_ppm' -v '0'
dasel put -t int -f "$GENESIS" '.app_state.perpetuals.perpetuals.[34].params.liquidity_tier' -v '4'
dasel put -t int -f "$GENESIS" '.app_state.perpetuals.perpetuals.[34].params.market_type' -v '2' # Isolated

# Update MarketMap module.
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map' -v "{}"
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets' -v "{}"
Expand Down Expand Up @@ -1251,7 +1271,43 @@ function edit_genesis() {
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.USDT/USD.provider_configs.[]' -v '{"name": "kucoin_ws", "off_chain_ticker": "BTC-USDT", "normalize_by_pair": {"Base": "BTC", "Quote": "USD"}, "invert": true}'
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.USDT/USD.provider_configs.[]' -v '{"name": "okx_ws", "off_chain_ticker": "USDC-USDT", "invert": true}'


# Marketmap: EIGEN-USD
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.EIGEN/USD' -v "{}"
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.EIGEN/USD.ticker' -v "{}"

dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.EIGEN/USD.ticker.currency_pair' -v "{}"
dasel put -t string -f "$GENESIS" '.app_state.marketmap.market_map.markets.EIGEN/USD.ticker.currency_pair.Base' -v 'EIGEN'
dasel put -t string -f "$GENESIS" '.app_state.marketmap.market_map.markets.EIGEN/USD.ticker.currency_pair.Quote' -v 'USD'

dasel put -t int -f "$GENESIS" '.app_state.marketmap.market_map.markets.EIGEN/USD.ticker.decimals' -v '9'
dasel put -t int -f "$GENESIS" '.app_state.marketmap.market_map.markets.EIGEN/USD.ticker.min_provider_count' -v '1'
dasel put -t bool -f "$GENESIS" '.app_state.marketmap.market_map.markets.EIGEN/USD.ticker.enabled' -v 'true'
dasel put -t string -f "$GENESIS" '.app_state.marketmap.market_map.markets.EIGEN/USD.ticker.metadata_JSON' -v '{"reference_price":3648941500,"liquidity":3099304,"aggregate_ids":[{"venue":"coinmarketcap","ID":"30494"}]}'

dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.EIGEN/USD.provider_configs.[]' -v '{"name": "okx_ws", "off_chain_ticker": "EIGEN-USDT", "normalize_by_pair": {"Base": "USDT", "Quote": "USD"}, "invert": false}'
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.EIGEN/USD.provider_configs.[]' -v '{"name": "bybit_ws", "off_chain_ticker": "EIGENUSDT", "normalize_by_pair": {"Base": "USDT", "Quote": "USD"}, "invert": false}'
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.EIGEN/USD.provider_configs.[]' -v '{"name": "crypto_dot_com_ws", "off_chain_ticker": "EIGEN_USD"}'
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.EIGEN/USD.provider_configs.[]' -v '{"name": "coinbase_ws", "off_chain_ticker": "EIGEN-USD"}'
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.EIGEN/USD.provider_configs.[]' -v '{"name": "kraken_api", "off_chain_ticker": "EIGENUSD"}'

# Marketmap: BOME-USD
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.BOME/USD' -v "{}"
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.BOME/USD.ticker' -v "{}"

dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.BOME/USD.ticker.currency_pair' -v "{}"
dasel put -t string -f "$GENESIS" '.app_state.marketmap.market_map.markets.BOME/USD.ticker.currency_pair.Base' -v 'BOME'
dasel put -t string -f "$GENESIS" '.app_state.marketmap.market_map.markets.BOME/USD.ticker.currency_pair.Quote' -v 'USD'

dasel put -t int -f "$GENESIS" '.app_state.marketmap.market_map.markets.BOME/USD.ticker.decimals' -v '12'
dasel put -t int -f "$GENESIS" '.app_state.marketmap.market_map.markets.BOME/USD.ticker.min_provider_count' -v '1'
dasel put -t bool -f "$GENESIS" '.app_state.marketmap.market_map.markets.BOME/USD.ticker.enabled' -v 'true'
dasel put -t string -f "$GENESIS" '.app_state.marketmap.market_map.markets.BOME/USD.ticker.metadata_JSON' -v '{"reference_price":6051284618,"liquidity":748591,"aggregate_ids":[{"venue":"coinmarketcap","ID":"29870"}]}'

dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.BOME/USD.provider_configs.[]' -v '{"name":"kucoin_ws","off_chain_ticker":"BOME-USDT","normalize_by_pair":{"Base":"USDT","Quote":"USD"},"invert":false,"metadata_JSON":""}'
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.BOME/USD.provider_configs.[]' -v '{"name":"huobi_ws","off_chain_ticker":"bomeusdt","normalize_by_pair":{"Base":"USDT","Quote":"USD"},"invert":false,"metadata_JSON":""}'
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.BOME/USD.provider_configs.[]' -v '{"name":"bybit_ws","off_chain_ticker":"BOMEUSDT","normalize_by_pair":{"Base":"USDT","Quote":"USD"},"invert":false,"metadata_JSON":""}'
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.BOME/USD.provider_configs.[]' -v '{"name":"raydium_api","off_chain_ticker":"BOME,RAYDIUM,UKHH6C7MMYIWCF1B9PNWE25TSPKDDT3H5PQZGZ74J82/SOL,RAYDIUM,SO11111111111111111111111111111111111111112","normalize_by_pair":{"Base":"SOL","Quote":"USD"},"invert":false,"metadata_JSON":"{\"base_token_vault\":{\"token_vault_address\":\"FBba2XsQVhkoQDMfbNLVmo7dsvssdT39BMzVc2eFfE21\",\"token_decimals\":6},\"quote_token_vault\":{\"token_vault_address\":\"GuXKCb9ibwSeRSdSYqaCL3dcxBZ7jJcj6Y7rDwzmUBu9\",\"token_decimals\":9},\"amm_info_address\":\"DSUvc5qf5LJHHV5e2tD184ixotSnCnwj7i4jJa4Xsrmt\",\"open_orders_address\":\"38p42yoKFWgxw2LCbB96wAKa2LwAxiBArY3fc3eA9yWv\"}"}'
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.BOME/USD.provider_configs.[]' -v '{"name":"okx_ws","off_chain_ticker":"BOME-USDT","normalize_by_pair":{"Base":"USDT","Quote":"USD"},"invert":false,"metadata_JSON":""}'
# Marketmap: DYDX-USD
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.DYDX/USD' -v "{}"
dasel put -t json -f "$GENESIS" '.app_state.marketmap.market_map.markets.DYDX/USD.ticker' -v "{}"
Expand Down Expand Up @@ -1659,6 +1715,30 @@ function edit_genesis() {
dasel put -t int -f "$GENESIS" '.app_state.prices.market_prices.[34].exponent' -v '-9'
dasel put -t int -f "$GENESIS" '.app_state.prices.market_prices.[34].price' -v '2050000000' # $2.05 = 1 DYDX.

# Market: EIGEN-USD
dasel put -t json -f "$GENESIS" '.app_state.prices.market_params.[]' -v "{}"
dasel put -t string -f "$GENESIS" '.app_state.prices.market_params.[35].pair' -v 'EIGEN-USD'
dasel put -t int -f "$GENESIS" '.app_state.prices.market_params.[35].id' -v '300'
dasel put -t int -f "$GENESIS" '.app_state.prices.market_params.[35].exponent' -v '-9'
dasel put -t int -f "$GENESIS" '.app_state.prices.market_params.[35].min_price_change_ppm' -v '800' # 0.080%
dasel put -t int -f "$GENESIS" '.app_state.prices.market_params.[35].min_exchanges' -v '1'
dasel put -t json -f "$GENESIS" '.app_state.prices.market_prices.[]' -v "{}"
dasel put -t int -f "$GENESIS" '.app_state.prices.market_prices.[35].id' -v '300'
dasel put -t int -f "$GENESIS" '.app_state.prices.market_prices.[35].exponent' -v '-9'
dasel put -t int -f "$GENESIS" '.app_state.prices.market_prices.[35].price' -v '4973000000' # $4.973

# Market: BOME-USD
dasel put -t json -f "$GENESIS" '.app_state.prices.market_params.[]' -v "{}"
dasel put -t string -f "$GENESIS" '.app_state.prices.market_params.[36].pair' -v 'BOME-USD'
dasel put -t int -f "$GENESIS" '.app_state.prices.market_params.[36].id' -v '301'
dasel put -t int -f "$GENESIS" '.app_state.prices.market_params.[36].exponent' -v '-12'
dasel put -t int -f "$GENESIS" '.app_state.prices.market_params.[36].min_price_change_ppm' -v '800' # 0.080%
dasel put -t int -f "$GENESIS" '.app_state.prices.market_params.[36].min_exchanges' -v '1'
dasel put -t json -f "$GENESIS" '.app_state.prices.market_prices.[]' -v "{}"
dasel put -t int -f "$GENESIS" '.app_state.prices.market_prices.[36].id' -v '301'
dasel put -t int -f "$GENESIS" '.app_state.prices.market_prices.[36].exponent' -v '-12'
dasel put -t int -f "$GENESIS" '.app_state.prices.market_prices.[36].price' -v '8695478191' # $0.008695

# Initialize bridge module account balance as total native token supply.
bridge_module_account_balance=$TOTAL_NATIVE_TOKEN_SUPPLY
total_accounts_quote_balance=0
Expand Down Expand Up @@ -2025,6 +2105,24 @@ function edit_genesis() {
dasel put -t int -f "$GENESIS" '.app_state.clob.clob_pairs.[32].subticks_per_tick' -v '1000000'
dasel put -t int -f "$GENESIS" '.app_state.clob.clob_pairs.[32].quantum_conversion_exponent' -v '-9'

# Clob: EIGEN-USD
dasel put -t json -f "$GENESIS" '.app_state.clob.clob_pairs.[]' -v "{}"
dasel put -t int -f "$GENESIS" '.app_state.clob.clob_pairs.[33].id' -v '300'
dasel put -t string -f "$GENESIS" '.app_state.clob.clob_pairs.[33].status' -v "$INITIAL_CLOB_PAIR_STATUS"
dasel put -t int -f "$GENESIS" '.app_state.clob.clob_pairs.[33].perpetual_clob_metadata.perpetual_id' -v '300'
dasel put -t int -f "$GENESIS" '.app_state.clob.clob_pairs.[33].step_base_quantums' -v '1000000'
dasel put -t int -f "$GENESIS" '.app_state.clob.clob_pairs.[33].subticks_per_tick' -v '1000000'
dasel put -t int -f "$GENESIS" '.app_state.clob.clob_pairs.[33].quantum_conversion_exponent' -v '-9'

# Clob: BOME-USD
dasel put -t json -f "$GENESIS" '.app_state.clob.clob_pairs.[]' -v "{}"
dasel put -t int -f "$GENESIS" '.app_state.clob.clob_pairs.[34].id' -v '301'
dasel put -t string -f "$GENESIS" '.app_state.clob.clob_pairs.[34].status' -v "$INITIAL_CLOB_PAIR_STATUS"
dasel put -t int -f "$GENESIS" '.app_state.clob.clob_pairs.[34].perpetual_clob_metadata.perpetual_id' -v '301'
dasel put -t int -f "$GENESIS" '.app_state.clob.clob_pairs.[34].step_base_quantums' -v '1000000'
dasel put -t int -f "$GENESIS" '.app_state.clob.clob_pairs.[34].subticks_per_tick' -v '1000000'
dasel put -t int -f "$GENESIS" '.app_state.clob.clob_pairs.[34].quantum_conversion_exponent' -v '-9'

# Liquidations
dasel put -t int -f "$GENESIS" '.app_state.clob.liquidations_config.max_liquidation_fee_ppm' -v '15000' # 1.5%
dasel put -t int -f "$GENESIS" '.app_state.clob.liquidations_config.position_block_limits.min_position_notional_liquidated' -v '1000000000' # 1_000 USDC
Expand Down
6 changes: 0 additions & 6 deletions protocol/x/clob/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,12 @@ func DefaultGenesis() *GenesisState {
func (gs GenesisState) Validate() error {
// Check for duplicated id in clobPair
clobPairIdMap := make(map[uint32]struct{})
expectedId := uint32(0)

for _, clobPair := range gs.ClobPairs {
if _, ok := clobPairIdMap[clobPair.Id]; ok {
return fmt.Errorf("duplicated id for clobPair")
}
clobPairIdMap[clobPair.Id] = struct{}{}

if clobPair.Id != expectedId {
return fmt.Errorf("found gap in clobPair id")
}
expectedId = expectedId + 1
}

if err := gs.BlockRateLimitConfig.Validate(); err != nil {
Expand Down
Loading
Loading