Skip to content
Open
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
211 changes: 211 additions & 0 deletions protocol/marketmap_updates/step1_msg_upsert_markets_core.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
{
"@type": "/cosmos.gov.v1.MsgSubmitProposal",
"messages": [
{
"@type": "/slinky.marketmap.v1.MsgUpsertMarkets",
"authority": "dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky",
"markets": [
{
"ticker": {
"currency_pair": {
"Base": "BTC",
"Quote": "USDC"
},
"decimals": "5",
"min_provider_count": "3",
"enabled": false,
"metadata_JSON": ""
},
"provider_configs": [
{
"name": "binance_ws",
"off_chain_ticker": "BTCUSDC",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
},
{
"name": "bybit_ws",
"off_chain_ticker": "BTCUSDC",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
},
{
"name": "kucoin_ws",
"off_chain_ticker": "BTC-USDC",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
},
{
"name": "gate_ws",
"off_chain_ticker": "BTC_USDC",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
}
]
},
{
"ticker": {
"currency_pair": {
"Base": "ETH",
"Quote": "USDC"
},
"decimals": "6",
"min_provider_count": "3",
"enabled": false,
"metadata_JSON": ""
},
"provider_configs": [
{
"name": "binance_ws",
"off_chain_ticker": "ETHUSDC",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
},
{
"name": "bybit_ws",
"off_chain_ticker": "ETHUSDC",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
},
{
"name": "kucoin_ws",
"off_chain_ticker": "ETH-USDC",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
},
{
"name": "gate_ws",
"off_chain_ticker": "ETH_USDC",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
}
]
},
{
"ticker": {
"currency_pair": {
"Base": "SOL",
"Quote": "USDC"
},
"decimals": "8",
"min_provider_count": "3",
"enabled": false,
"metadata_JSON": ""
},
"provider_configs": [
{
"name": "binance_ws",
"off_chain_ticker": "SOLUSDC",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
},
{
"name": "bybit_ws",
"off_chain_ticker": "SOLUSDC",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
},
{
"name": "kucoin_ws",
"off_chain_ticker": "SOL-USDC",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
},
{
"name": "gate_ws",
"off_chain_ticker": "SOL_USDC",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
},
{
"name": "kraken_api",
"off_chain_ticker": "SOLUSDC",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
}
]
},
{
"ticker": {
"currency_pair": {
"Base": "USDT",
"Quote": "USDC"
},
"decimals": "6",
"min_provider_count": "3",
"enabled": false,
"metadata_JSON": ""
},
Comment on lines +141 to +151

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

Verify USDT/USDC decimals: 9 seems unexpectedly high for a stablecoin pair.

The USDT/USDC market is configured with decimals: "9", which is unusual. Stablecoin pairs (1:1 or near-parity) typically require only 6–8 decimals of precision. A 9-decimal specification may indicate misalignment with actual exchange pair precision, potentially causing rounding errors or data interpretation issues downstream. This may be a copy-paste error or misconfiguration.

Verify that 9 decimals is intentional and aligns with how exchanges (binance, bybit, coinbase, etc.) actually quote this pair. Consider cross-referencing against step 2 and step 3 of the migration to ensure consistency.


I'll verify the concerns raised in the review comment. Let me examine the JSON file and search for external context.








🏁 Script executed:

#!/bin/bash
# Read the JSON file and extract decimal values for all markets and verify authority/deposit
cat protocol/marketmap_updates/step1_msg_upsert_markets_core.json | jq '.tx.body.messages[0].msg_execute_contract.msg | {
  authority: .authority,
  markets_decimals: [.markets[] | {
    ticker: (.ticker.currency_pair.Base + "/" + .ticker.currency_pair.Quote),
    decimals: .ticker.decimals,
    enabled: .ticker.enabled,
    provider_count: (.providers | length)
  }],
  deposit: .deposit
}'

Length of output: 59


🏁 Script executed:

#!/bin/bash
# Extract provider details for USDT/USDC specifically to verify inversion consistency
cat protocol/marketmap_updates/step1_msg_upsert_markets_core.json | jq '.tx.body.messages[0].msg_execute_contract.msg.markets[] | select(.ticker.currency_pair.Base == "USDT" and .ticker.currency_pair.Quote == "USDC") | {
  decimals: .ticker.decimals,
  providers: [.providers[] | {
    name: .name,
    invert: .invert
  }]
}'

Length of output: 59


🏁 Script executed:

#!/bin/bash
# Compare decimals across all markets
cat protocol/marketmap_updates/step1_msg_upsert_markets_core.json | jq '.tx.body.messages[0].msg_execute_contract.msg.markets | map({pair: (.ticker.currency_pair.Base + "/" + .ticker.currency_pair.Quote), decimals: .ticker.decimals})'

Length of output: 59


🌐 Web query:

USDT/USDC decimal precision Binance Bybit Coinbase API 2025

💡 Result:

Short answer — use each exchange's "exchange/symbol info" endpoint and read the price/tick/quote precision fields:

  • Binance (Spot / Futures): GET /api/v3/exchangeInfo (spot) or the futures Exchange Information endpoints. The JSON for each symbol contains pricePrecision and filters[].PRICE_FILTER.tickSize (and quotePrecision). Use those to determine allowed decimal places for price (and LOT_SIZE.stepSize for quantity). [1]

  • Bybit: call the public symbols endpoint (e.g. v2: GET https://api.bybit.com/v2/public/symbols or v5 market-symbols endpoints). Each symbol includes a price_filter / tick_size or price_scale field you must use to compute allowed price decimals. [2]

  • Coinbase (Advanced Trade / Exchange API): GET the product/instrument (products or instruments endpoints). The product object includes base_increment and quote_increment (or base_increment/quote_increment or base_increment/quote_increment-like fields) which give the minimum increments for quantity and price. Use those to derive decimal precision. [3]

If you want, I can fetch the current tickSize / quote_increment values for specific pairs (e.g. USDT‑USD, USDC‑USD, USDT/USDC) right now.

Sources: [Binance exchangeInfo API docs][1], [Bybit public symbols / API docs][2], [Coinbase product/instruments API docs][3].


🌐 Web query:

adv4tnt token dydx denomination

💡 Result:

"adv4tnt" is the dYdX testnet native token denomination (the mainnet native denom is "adydx"). [1][2]

Sources:
[1] dYdX Network Constants (Native Token Denom: testnet = adv4tnt, mainnet = adydx).
[2] dYdX Docs — Accounts (example showing adv4tnt used as the testnet denom).


🌐 Web query:

dydx protocol governance authority deposit requirements

💡 Result:

Short answer

  • Minimum on-chain proposal deposit: 2,000 DYDX (expressed as 2000000000000000000000adydx). [1][2]

Details

  • The proposal JSON must include a "deposit" field (units: aDYDX). If the min_deposit (2,000 DYDX) isn't reached within the max_deposit_period the proposal won't enter voting; deposits are refunded or burned depending on the chain parameter (burn_proposal_deposit_prevote). [1]
  • Some proposal examples (e.g., order-router rev-share) show the deposit set to that 2,000 DYDX minimum; proposers can submit larger deposits. [3]

References

  • dYdX Proposal lifecycle / deposit rules. [1]
  • dYdX CLI — submit a governance proposal (minimum deposit = 2,000 DYDX). [2]
  • Example order-router rev-share proposal JSON (deposit field). [3]

Let me correct my approach and read the JSON structure directly:





🏁 Script executed:

#!/bin/bash
# First, understand the actual JSON structure of the file
head -50 protocol/marketmap_updates/step1_msg_upsert_markets_core.json

Length of output: 1415


🏁 Script executed:

#!/bin/bash
# Extract all market pairs and their decimals using simpler grep/awk since jq path failed
grep -A 5 '"Base"' protocol/marketmap_updates/step1_msg_upsert_markets_core.json | grep -E '(Base|Quote|decimals)' | head -40

Length of output: 352


🏁 Script executed:

#!/bin/bash
# Count how many markets and extract authority/deposit directly
grep -E '(authority|deposit|"decimals")' protocol/marketmap_updates/step1_msg_upsert_markets_core.json

Length of output: 213


🌐 Web query:

USDT USDC stablecoin pair decimal places precision standard

💡 Result:

Short answer: both USDC and USDT are commonly implemented with 6 decimals (i.e., smallest unit = 10^-6). Use the token contract's decimals() call (or a reliable issuer doc) to confirm for the specific chain/deployment before integrating. [1][2]

Sources:

  • Circle / USDC docs (lists USDC decimals = 6). [1]
  • Token-decimals / dev docs (example and guidance showing USDT/USDC use 6; always query decimals() on-chain). [2]

USDT/USDC decimals configuration: 9 is anomalous and should be 6.

USDT and USDC are standard 6-decimal tokens. The USDT/USDC market is configured with decimals: "9" (line 141), which deviates from both token standards and the typical precision needed for stablecoin pairs. This differs from the pattern in the same proposal: BTC/USDC (5), ETH/USDC (6), SOL/USDC (8). The 9-decimal specification is likely a data entry error or misalignment with actual exchange pair precision, and may cause rounding or interpretation issues downstream.

Correct the USDT/USDC decimals to "6" unless there is explicit documentation justifying the 9-decimal choice (e.g., matching a specific exchange API).

🤖 Prompt for AI Agents
In protocol/marketmap_updates/step1_msg_upsert_markets_core.json around lines
141 to 151, the USDT/USDC market entry incorrectly sets "decimals": "9"; change
this to "6" to match standard USDT/USDC 6-decimal precision and align with other
stablecoin pairs, ensuring no other fields are altered and validate the JSON
after editing.

"provider_configs": [
{
"name": "binance_ws",
"off_chain_ticker": "USDCUSDT",
"normalize_by_pair": null,
"invert": true,
"metadata_JSON": ""
},
{
"name": "bybit_ws",
"off_chain_ticker": "USDCUSDT",
"normalize_by_pair": null,
"invert": true,
"metadata_JSON": ""
},
{
"name": "coinbase_ws",
"off_chain_ticker": "USDT-USDC",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
},
{
"name": "huobi_ws",
"off_chain_ticker": "usdcusdt",
"normalize_by_pair": null,
"invert": true,
"metadata_JSON": ""
},
{
"name": "kraken_api",
"off_chain_ticker": "USDCUSDT",
"normalize_by_pair": null,
"invert": true,
"metadata_JSON": ""
},
{
"name": "kucoin_ws",
"off_chain_ticker": "USDC-USDT",
"normalize_by_pair": null,
"invert": true,
"metadata_JSON": ""
},
{
"name": "okx_ws",
"off_chain_ticker": "USDC-USDT",
"normalize_by_pair": null,
"invert": true,
"metadata_JSON": ""
}
]
}
]
}
],
"metadata": "Create helper markets for USDC-based normalization",
"deposit": "10000000adv4tnt",
"title": "Create USDC Helper Markets",
"summary": "Create BTC/USDC, ETH/USDC, SOL/USDC, and USDT/USDC markets (enabled: false) for use as normalization sources"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"@type": "/cosmos.gov.v1.MsgSubmitProposal",
"messages": [
{
"@type": "/dydxprotocol.prices.MsgCreateOracleMarket",
"authority": "dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky",
"params": {
"id": 9000,
"pair": "BTC-USDC",
"exponent": -5,
"min_exchanges": 3,
"min_price_change_ppm": 500,
"exchange_config_json": "{\"exchanges\":[]}"
}
},
{
"@type": "/dydxprotocol.prices.MsgCreateOracleMarket",
"authority": "dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky",
"params": {
"id": 9001,
"pair": "ETH-USDC",
"exponent": -6,
"min_exchanges": 3,
"min_price_change_ppm": 500,
"exchange_config_json": "{\"exchanges\":[]}"
}
},
{
"@type": "/dydxprotocol.prices.MsgCreateOracleMarket",
"authority": "dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky",
"params": {
"id": 9002,
"pair": "SOL-USDC",
"exponent": -8,
"min_exchanges": 3,
"min_price_change_ppm": 500,
"exchange_config_json": "{\"exchanges\":[]}"
}
},
{
"@type": "/dydxprotocol.prices.MsgCreateOracleMarket",
"authority": "dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky",
"params": {
"id": 9003,
"pair": "USDT-USDC",
"exponent": -6,
"min_exchanges": 3,
"min_price_change_ppm": 10,
"exchange_config_json": "{\"exchanges\":[]}"
}
}
],
"metadata": "Enable BTC/USDC, ETH/USDC, SOL/USDC, USDT/USDC markets for price normalization",
"title": "Enable USDC Helper Markets",
"summary": "Create and enable BTC/USDC, ETH/USDC, SOL/USDC, and USDT/USDC markets in x/prices to enable USDC-based price normalization across all markets",
"deposit": "10000000adv4tnt"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"@type": "/cosmos.gov.v1.MsgSubmitProposal",
"messages": [
{
"@type": "/slinky.marketmap.v1.MsgUpsertMarkets",
"authority": "dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky",
"markets": [
{
"ticker": {
"currency_pair": {
"Base": "USDC",
"Quote": "USD"
},
"decimals": "10",
"min_provider_count": "1",
"enabled": true,
"metadata_JSON": "{\"reference_price\":9987985104,\"liquidity\":452991176,\"aggregate_ids\":[{\"venue\":\"coinmarketcap\",\"ID\":\"3408\"}]}"
},
"provider_configs": [
{
"name": "bitstamp_api",
"off_chain_ticker": "USDC/USD",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
},
{
"name": "kraken_api",
"off_chain_ticker": "USDCUSD",
"normalize_by_pair": null,
"invert": false,
"metadata_JSON": ""
},
{
"name": "kraken_btc_usd",
"off_chain_ticker": "XXBTZUSD",
"normalize_by_pair": {
"Base": "BTC",
"Quote": "USDC"
},
"invert": false,
"metadata_JSON": ""
},
{
"name": "raydium_api",
"off_chain_ticker": "SOL,RAYDIUM,SO11111111111111111111111111111111111111112/USDC,RAYDIUM,EPJFWDD5AUFQSSQEM2QN1XZYBAPC8G4WEGGKZWYTDT1V",
"normalize_by_pair": {
"Base": "SOL",
"Quote": "USDC"
},
"invert": true,
"metadata_JSON": "{\"base_token_vault\":{\"token_vault_address\":\"DQyrAcCrDXQ7NeoqGgDCZwBvWDcYmFCjSb9JtteuvPpz\",\"token_decimals\":9},\"quote_token_vault\":{\"token_vault_address\":\"HLmqeL62xR1QoZ1HKKbXRrdN1p3phKpxRMb2VVopvBBz\",\"token_decimals\":6},\"amm_info_address\":\"58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2\",\"open_orders_address\":\"HmiHHzq4Fym9e1D4qzLS6LDDM3tNsCTBPDWHTLZ763jY\"}"
},
{
"name": "uniswapv3_api-base",
"off_chain_ticker": "USDC,UNISWAP_V3_BASE,0X833589FCD6EDB6E08F4C7C32D4F71B54BDA02913/WETH,UNISWAP_V3_BASE,0X4200000000000000000000000000000000000006",
"normalize_by_pair": {
"Base": "ETH",
"Quote": "USDC"
},
"invert": false,
"metadata_JSON": "{\"address\":\"0xd0b53d9277642d899df5c87a3966a349a798f224\",\"base_decimals\":6,\"quote_decimals\":18,\"invert\":true}"
},
{
"name": "uniswapv3_api-ethereum",
"off_chain_ticker": "WETH,UNISWAP_V3,0XC02AAA39B223FE8D0A0E5C4F27EAD9083C756CC2/USDC,UNISWAP_V3,0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48",
"normalize_by_pair": {
"Base": "ETH",
"Quote": "USDC"
},
"invert": true,
"metadata_JSON": "{\"address\":\"0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640\",\"base_decimals\":18,\"quote_decimals\":6,\"invert\":true}"
}
]
}
]
}
],
"metadata": "Update USDC/USD market to use BTC/USDC, ETH/USDC, SOL/USDC normalizations",
"deposit": "10000000adv4tnt",
"title": "Update USDC/USD Market Normalizations",
"summary": "Add Kraken BTC/USD (normalized by BTC/USDC), Raydium SOL, and Uniswap ETH providers to USDC/USD market"
}
Loading
Loading