Skip to main content

Overview

Docs for the GMX contracts. This section focuses on the contracts most integrations interact with directly, not an exhaustive page for every deployed contract.

Important notes

Review these points before integrating with the contracts.

warning

See the Known issues page for the full list of known issues and integration considerations.

These docs provide an overview. Check the actual contract code for the exact implementation and for any edge cases when building an application or integration.

Contracts such as readers and events may not be audited. Check the scopes of the audits for more information, and take extra caution when using or depending on these contracts.

Subscribe to the channels on the Updates and Support page for important contract update notifications.

How it works

The protocol separates concerns across four contract categories (bank, data storage, logic, and event contracts) to enable upgrades without fund migration. Most user actions follow a two-phase execution model where the user submits a request and a keeper executes it with oracle prices. For a detailed explanation of the architecture and keeper network, see Architecture.

The contracts repo provides the production-branch source code. The test folder contains examples for interacting with the contracts.

Deployments

Key contract addresses for all supported chains (Arbitrum, Avalanche, Botanix, MegaETH) and testnets are listed on the Contract addresses page.

The full deployment list with all 130+ contracts per chain is in the gmx-synthetics docs folder. The machine-readable contracts.json currently covers mainnet deployments, while testnet deployments are published in the per-network markdown files in that folder.

Testnet

The Arbitrum Sepolia deployment is typically the most current testnet. See Contract addresses — Testnet for key testnet addresses.

For a frontend that connects to testnet, see the Testnet frontend section.

Reading values

You can read on-chain values using three contracts:

The Reader contract provides convenience functions for retrieving information such as markets and positions lists.

Most integrations only need a small set of entry points:

  • ExchangeRouter for creating orders, deposits, withdrawals, and shifts
  • GlvRouter for GLV-specific deposits and withdrawals
  • Reader for GM markets, positions, and pricing data
  • GlvReader for GLV-specific reads

The wider protocol architecture includes many additional handlers, vaults, storage contracts, and utility contracts. See Architecture for how those pieces fit together.

For delegated trading, gasless relay flows, and GMX Account cross-chain routers, see Advanced entry points.

You can also retrieve additional information using the DataStore and Keys contracts. The test folder contains DataStore usage examples, and the keys file shows how to construct keys for DataStore reads.

To retrieve multiple values in a single query, use a Multicall contract. See Contract addresses for the Multicall3 address on each chain.

For detailed function references, see the Reader and GLV Reader pages.

For retrieving prices, see the REST API docs.

For token compatibility, known limitations, and integration considerations, see the Known issues page.