# 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.

# 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](./known-issues.md) 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](../updates-support.md) 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](./architecture.md).

The [contracts repo](https://github.com/gmx-io/gmx-synthetics/tree/updates) provides the production-branch source code. The [test](https://github.com/gmx-io/gmx-synthetics/tree/updates/test) folder contains examples for interacting with the contracts.

## Deployments

Key contract addresses for active chains (Arbitrum, Avalanche, MegaETH), legacy Botanix deployments, and testnets are listed on the [Contract addresses](./addresses.md) page.

The full deployment list with all 130+ contracts per chain is in the [gmx-synthetics docs folder](https://github.com/gmx-io/gmx-synthetics/tree/updates/docs). 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](./addresses.md#testnet) for key testnet addresses.

For a frontend that connects to testnet, see the [Testnet frontend](../frontend-integration.md#testnet-frontend) section.

## Reading values

You can read on-chain values using three contracts:

- [Reader](https://github.com/gmx-io/gmx-synthetics/blob/updates/contracts/reader/Reader.sol)
- [GlvReader](https://github.com/gmx-io/gmx-synthetics/blob/updates/contracts/reader/GlvReader.sol)
- [DataStore](https://github.com/gmx-io/gmx-synthetics/blob/updates/contracts/data/DataStore.sol)

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](./architecture.md) for how those pieces fit together.

For delegated trading, gasless relay flows, and GMX Account cross-chain routers, see [Advanced entry points](./advanced-entrypoints.md).

You can also retrieve additional information using the `DataStore` and `Keys` contracts. The [test](https://github.com/gmx-io/gmx-synthetics/tree/updates/test) folder contains `DataStore` usage examples, and the [keys](https://github.com/gmx-io/gmx-synthetics/blob/updates/utils/keys.ts) file shows how to construct keys for `DataStore` reads.

To retrieve multiple values in a single query, use a [Multicall contract](https://github.com/gmx-io/gmx-synthetics/blob/updates/contracts/mock/Multicall3.sol). See [Contract addresses](./addresses.md) for the `Multicall3` address on each chain.

For detailed function references, see the [Reader](./reader.md) and [GLV Reader](./glv-reader.md) pages.

For retrieving prices, see the [Oracle API](../rest-api/oracle-prices.mdx) docs.

For token compatibility, known limitations, and integration considerations, see the [Known issues](./known-issues.md) page.
