Skip to content

feat: GMX v2 funding rates via DataStore OI imbalance - #2153

Merged
Flotapponnier merged 1 commit into
devfrom
feat/gmx-funding-rates
Aug 27, 2026
Merged

feat: GMX v2 funding rates via DataStore OI imbalance#2153
Flotapponnier merged 1 commit into
devfrom
feat/gmx-funding-rates

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes wrong DataStore address (0xFD70...D8588...0xFD70...D8017...)
  • Adds computeFundingFactorKey and computeOpenInterestKey helpers using keccak256(abi.encode(...)) pattern matching GMX Keys.sol
  • Populates fundingPerSecPerCoin in fetchGmxCarryRates() with: fundingFactor × |longsOI - shortsOI| / totalOI / 1e30
  • OI is summed across both collateral tokens per side (longToken + USDC)
  • Adds GMX_MARKET_LONG_TOKEN mapping for the 7 tracked markets
  • Adds scripts/test-gmx-funding.ts validation script

Validated rates (live from Arbitrum DataStore)

  • BTC: 2.132e-9/sec = 0.000767%/hr
  • ETH: 1.469e-9/sec = 0.000529%/hr
  • SOL: 5.979e-10/sec = 0.000215%/hr
  • ARB: 3.034e-9/sec = 0.001092%/hr
  • DOGE: 4.893e-10/sec = 0.000176%/hr
  • XRP: 2.977e-9/sec = 0.001072%/hr
  • LINK: fundingFactor=0 (GMX disabled funding for this market)

Test plan

  • Run npx ts-node --transpile-only scripts/test-gmx-funding.ts — all markets should print rates in range
  • Call /api/fee-compare?venueA=gmx-v2&venueB=hyperliquid — response should include non-empty fundingPerSecPerCoin for GMX
  • Confirm carry simulation for GMX positions now includes funding component

@Flotapponnier
Flotapponnier merged commit f983458 into dev Aug 27, 2026
1 check failed
Flotapponnier added a commit that referenced this pull request Aug 27, 2026
* fix: restore chainstack findings, new key live on both regions

* fix: us-east only bench, drop us-west dimension and service

* feat: add eu-west + sgp regions, chainstack wins all 3

* feat: GMX v2 funding rates via DataStore OI imbalance (#2153)

* feat: bench #243 keyed-rpc-robinhood — 3-region live data (#2154)

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin robinhood bench queries to region=us-east

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin queries to region=us-east to ignore stale eu/sgp prom data

* fix: augment HL position reconstruction with clearinghouseState to bypass 2000-fill cap (#2159)

* feat(rpc): add Litecoin, Babylon, Acala, Interlay benches (#246-249) (#2166)
Flotapponnier added a commit that referenced this pull request Aug 28, 2026
* fix(ci): smoke against deploy URL, not CDN-cached openchainbench.com

* fix: augment HL position reconstruction with clearinghouseState to bypass 2000-fill cap

* fix: restore chainstack findings, new key live on both regions

* fix: us-east only bench, drop us-west dimension and service

* feat: add eu-west + sgp regions, chainstack wins all 3

* feat: GMX v2 funding rates via DataStore OI imbalance (#2153)

* feat: bench #243 keyed-rpc-robinhood — 3-region live data (#2154)

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin robinhood bench queries to region=us-east

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin queries to region=us-east to ignore stale eu/sgp prom data

* fix(ci): add checkHost arg to smoke — sitemap from deploy URL, pages on prod

* fix(sitemap): filter removed benches, HL spec slugs, add zerion/routescan to removed products

* fix(sitemap): isHlBuilderSlug filter + exclude REMOVED_BENCH_SLUGS from categories

* sync: merge dev into main (benches 246-249 + recent fixes) (#2167)

* fix: restore chainstack findings, new key live on both regions

* fix: us-east only bench, drop us-west dimension and service

* feat: add eu-west + sgp regions, chainstack wins all 3

* feat: GMX v2 funding rates via DataStore OI imbalance (#2153)

* feat: bench #243 keyed-rpc-robinhood — 3-region live data (#2154)

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin robinhood bench queries to region=us-east

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin queries to region=us-east to ignore stale eu/sgp prom data

* fix: augment HL position reconstruction with clearinghouseState to bypass 2000-fill cap (#2159)

* feat(rpc): add Litecoin, Babylon, Acala, Interlay benches (#246-249) (#2166)

* fix(rpc): remove em dashes from acala/babylon/interlay seo_intro (#2170)

* fix(rpc): replace dead Acala/Interlay providers with live endpoints

* fix(rpc): remove em dashes from acala/babylon/interlay seo_intro

* fix(rpc): replace dead Acala/Interlay providers with live endpoints

* fix: use query params for shareable URL instead of broken path format
Flotapponnier added a commit that referenced this pull request Aug 28, 2026
* fix: restore chainstack findings, new key live on both regions

* fix: us-east only bench, drop us-west dimension and service

* feat: add eu-west + sgp regions, chainstack wins all 3

* feat: GMX v2 funding rates via DataStore OI imbalance (#2153)

* feat: bench #243 keyed-rpc-robinhood — 3-region live data (#2154)

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin robinhood bench queries to region=us-east

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin queries to region=us-east to ignore stale eu/sgp prom data

* fix: augment HL position reconstruction with clearinghouseState to bypass 2000-fill cap (#2159)

* feat(rpc): add Litecoin, Babylon, Acala, Interlay benches (#246-249) (#2166)

* fix(rpc): remove em dashes from acala/babylon/interlay bench YAMLs (#2168)

* feat(rpc): add Litecoin, Babylon, Acala, Interlay benches (#246-249)

* fix(rpc): remove em dashes from seo_intro in acala/babylon/interlay YAMLs

* fix: direction-aware funding projection for all venues (#2163)

* fix(ci): smoke against deploy URL, not CDN-cached openchainbench.com

* fix: augment HL position reconstruction with clearinghouseState to bypass 2000-fill cap

* fix(ci): add checkHost arg to smoke — sitemap from deploy URL, pages on prod

* fix: direction-aware funding projection for all venues

* fix(rpc): replace dead Acala/Interlay providers with live endpoints

* fix: correct Robinhood Chain launch date and remove unverified provider claim (#2174)

* feat: pre-fill wallet from URL params on fee-compare (#2176)

* fix(rpc): replace dead Acala/Interlay providers with live endpoints

* feat: pre-fill wallet/venues from URL search params on fee-compare page

* fix: shareable URL uses query params not broken path format (#2177)

* fix(ci): smoke against deploy URL, not CDN-cached openchainbench.com

* fix: augment HL position reconstruction with clearinghouseState to bypass 2000-fill cap

* fix: restore chainstack findings, new key live on both regions

* fix: us-east only bench, drop us-west dimension and service

* feat: add eu-west + sgp regions, chainstack wins all 3

* feat: GMX v2 funding rates via DataStore OI imbalance (#2153)

* feat: bench #243 keyed-rpc-robinhood — 3-region live data (#2154)

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin robinhood bench queries to region=us-east

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin queries to region=us-east to ignore stale eu/sgp prom data

* fix(ci): add checkHost arg to smoke — sitemap from deploy URL, pages on prod

* fix(sitemap): filter removed benches, HL spec slugs, add zerion/routescan to removed products

* fix(sitemap): isHlBuilderSlug filter + exclude REMOVED_BENCH_SLUGS from categories

* sync: merge dev into main (benches 246-249 + recent fixes) (#2167)

* fix: restore chainstack findings, new key live on both regions

* fix: us-east only bench, drop us-west dimension and service

* feat: add eu-west + sgp regions, chainstack wins all 3

* feat: GMX v2 funding rates via DataStore OI imbalance (#2153)

* feat: bench #243 keyed-rpc-robinhood — 3-region live data (#2154)

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin robinhood bench queries to region=us-east

* remove non-functional eu/sgp Railway scrape targets from Railway Prom (VPS harnesses take over)

* bump cache keys v62/v29 for eu-west+sgp VPS harness data

* fix(keyed-rpc-robinhood): Alchemy leads global avg + eu-west/sgp, Chainstack wins us-east

* revert: us-east only, no dimensions, Chainstack leads

* fix: pin queries to region=us-east to ignore stale eu/sgp prom data

* fix: augment HL position reconstruction with clearinghouseState to bypass 2000-fill cap (#2159)

* feat(rpc): add Litecoin, Babylon, Acala, Interlay benches (#246-249) (#2166)

* fix(rpc): remove em dashes from acala/babylon/interlay seo_intro (#2170)

* fix(rpc): replace dead Acala/Interlay providers with live endpoints

* fix(rpc): remove em dashes from acala/babylon/interlay seo_intro

* fix(rpc): replace dead Acala/Interlay providers with live endpoints

* fix: use query params for shareable URL instead of broken path format

* fix: split Gains taker vs vault fee, add per-trade equiv fee column (#2178)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant