Skip to content

Move GMX GM/GLV adapters to the 2.2.1 Reader and GlvReader - #5627

Merged
mohamed-mehany merged 2 commits into
mainfrom
gmx-2-2-1-reader-glvreader
Nov 24, 2026
Merged

mohamed-mehany merged 2 commits into
mainfrom
gmx-2-2-1-reader-glvreader

Conversation

@mohamed-mehany

@mohamed-mehany mohamed-mehany commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Jira: OPDATA-9865

GMX 2.2.1 executes all orders on Arbitrum, Avalanche and MegaETH. The selectors and inputs are unchanged; the only difference in the structs we read is a trailing lentImpactPoolAmount on the MarketPoolValueInfo returned by getMarketTokenPrice, which we do not consume. The reader ABIs in gmx-tokens and gm-token are updated to 2.2.1 so the struct matches, and the defaults move to the 2.2.1 deployments. getGlvTokenPrice and getGlvInfo are unchanged, so the GLV ABIs stay as they are. Botanix is sunset and stays as-is.

Old -> new:

Chain Contract Old New
Arbitrum Reader 0x470fbC46bcC0f16532691Df360A07d8Bf5ee0789 0xAda708aFf0f1D784D28cd8Ff4d6D977fF9599e5D
Arbitrum GlvReader 0x2C670A23f1E798184647288072e84054938B5497 0x51fe0b7919e1208a717E9B16a097C1C3D70eFbf6
Avalanche Reader 0x62Cb8740E6986B29dC671B2EB596676f60590A5B 0x9390285097B4a1997B91F61AF756DCD2509FcD0F
Avalanche GlvReader 0x5C6905A3002f989E1625910ba1793d40a031f947 0x79B6Bf52D49d215724951c5a9A541f8A2Ee165Bc
MegaETH Reader 0x0f038EB4a38B08cd3c937a3256b51aa01904a684 0x12c4E1A499f2fFcB55683F682549049e29d70Cba
MegaETH GlvReader 0x424527a588D56513cB2F5161958D83883EE8aB0f 0xE08885EA7860f19e5fb2AECbA892e8A6BA505C86

Reference: the new values are the SyntheticsReader / GlvReader entries for Arbitrum, Avalanche and MegaETH in GMX's contract config, and the 2.2.1 ABIs are in SyntheticsReaderV2_2_1.ts and GlvReaderV2_2_1.ts.

Changes:

  • gmx-tokens: the six defaults, the getMarketTokenPrice ABI update, the integration-test env defaults and a patch changeset.
  • gm-token / glv-token: the Arbitrum pair so the legacy deployments stay correct until Data Feeds and Data Streams move off them, the gm-token reader ABI update with its fixture, and patch changesets.

How it was tested

Unit and integration: yarn test packages/composites/gm-token packages/composites/glv-token packages/composites/gmx-tokens -> 9 suites, 39 tests pass.

Locally, end to end against live chains: built the data-engine EA and the three composite EAs, ran them together, and replayed every GMX request configured in reference-data-directory.

# data-engine, from packages/sources/data-engine
API_USERNAME=... API_PASSWORD=... EA_PORT=18081 yarn start

# gmx-tokens, from packages/composites/gmx-tokens
DATA_ENGINE_ADAPTER_URL=http://localhost:18081 \
  ARBITRUM_RPC_URL=https://arbitrum.publicnode.com \
  AVALANCHE_RPC_URL=https://api.avax.network/ext/bc/C/rpc \
  MEGAETH_RPC_URL=https://mainnet.megaeth.com/rpc \
  EA_PORT=18082 yarn start

# glv-token, from packages/composites/glv-token
DATA_ENGINE_ADAPTER_URL=http://localhost:18081 \
  ARBITRUM_RPC_URL=https://arbitrum.publicnode.com \
  EA_PORT=18085 yarn start

# gm-token, from packages/composites/gm-token (upstream price EAs stubbed)
ARBITRUM_RPC_URL=https://arbitrum.publicnode.com \
  TIINGO_ADAPTER_URL=http://localhost:18090 \
  NCFX_ADAPTER_URL=http://localhost:18090 \
  EA_PORT=18084 yarn start

Requests, one per adapter family:

# gmx-tokens: GM LINK/USD and GLV [USDG-USDG] on Arbitrum
curl -s -X POST http://localhost:18082/ -H 'Content-Type: application/json' \
  -d '{"data":{"endpoint":"gm-price","chain":"arbitrum","index":"LINK","long":"LINK","short":"USDC","market":"0x7f1fa204bb700853D36994DA19F830b6Ad18455C"}}'
curl -s -X POST http://localhost:18082/ -H 'Content-Type: application/json' \
  -d '{"data":{"endpoint":"glv-price","chain":"arbitrum","glv":"0x4Cd5A94a30876320ac65F2e192493EE476f13866"}}'

# glv-token: price and LWBA for GLV [BTC-USDC]
curl -s -X POST http://localhost:18085/ -H 'Content-Type: application/json' \
  -d '{"data":{"endpoint":"price","glv":"0xdF03EEd325b82bC1d4Db8b49c30ecc9E05104b96"}}'
curl -s -X POST http://localhost:18085/ -H 'Content-Type: application/json' \
  -d '{"data":{"endpoint":"crypto-lwba","glv":"0x528A5bac7E746C9A509A1f4F6dF58A03d44279F9"}}'

# gm-token: gmETH / USD
curl -s -X POST http://localhost:18084/ -H 'Content-Type: application/json' \
  -d '{"data":{"endpoint":"price","index":"ETH","long":"ETH","short":"USDC","market":"0x70d95587d40A2caf56bd97485aB3Eec10Bee6336"}}'

Every one of the 14 production GMX requests has returned 200 with this code, including a gmx-tokens GM request and all seven gm-token Arbitrum markets after the ABI update, which confirms the 12-field 2.2.1 struct decodes against the live contracts. The final replay hit public RPC rate limits on two glv-token price calls that had returned 200 in earlier runs; that ABI did not change. A logging JSON-RPC proxy confirmed the new addresses are what the adapters call: getMarketTokenPrice to 0xada708..., 0x939028..., 0x12c4e1... and getGlvInfo / getGlvTokenPrice to 0x51fe..., 0x79b6..., 0xe088.... The two Botanix gm-token feeds were skipped (GMX sunset).

Cutover dependencies outside this repo

  • data-feeds/gmx-tokens, data-feeds/glv-token and data-streams/gmx-tokens-data-streams set no reader env vars, so an image roll is enough for them.

GMX's 2.2.1 release executes all orders on Arbitrum, Avalanche and
MegaETH. The selectors and inputs are unchanged; the only difference in
the structs we read is a trailing lentImpactPoolAmount on the poolValue
info returned by getMarketTokenPrice, which we do not consume. The
reader ABI moves to 2.2.1 so the extra field is accounted for.

Botanix entries stay as they are: GMX has sunset it.
Data Feeds and Data Streams still run these two adapters while their
workloads move to gmx-tokens, so they need the new Arbitrum Reader and
GlvReader until that is finished.

The gm-token reader ABI gains the trailing lentImpactPoolAmount field
and its RPC fixture the extra word. The GlvReader entries we call are
unchanged, so that ABI stays as it is.
@changeset-bot

changeset-bot Bot commented Nov 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b36435a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@chainlink/glv-token-adapter Patch
@chainlink/gm-token-adapter Patch
@chainlink/gmx-tokens-adapter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mohamed-mehany
mohamed-mehany marked this pull request as ready for review November 24, 2026 13:27
@mohamed-mehany
mohamed-mehany requested review from a team as code owners November 24, 2026 13:27
@mohamed-mehany
mohamed-mehany merged commit 95baf6b into main Nov 24, 2026
22 of 23 checks passed
@mohamed-mehany
mohamed-mehany deleted the gmx-2-2-1-reader-glvreader branch November 24, 2026 13:27
@gati-app gati-app Bot mentioned this pull request Nov 24, 2026
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.

2 participants