gmx

Executes GMX V2 spot swaps, perpetual orders, and GM liquidity operations on Arbitrum and Avalanche.

1|1|Updated May 21, 2026
One-click install
npx skills add https://github.com/naruto11eth/cryptoskills --skill gmx-naruto11eth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gmx
Source: https://github.com/naruto11eth/cryptoskills/tree/main/skills/gmx
Command: npx skills add https://github.com/naruto11eth/cryptoskills --skill gmx-naruto11eth

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires viem, @gmx-io/sdk, and includes references (resource) components.

What problem does it solve? AI agents frequently produce incorrect GMX integrations: confusing V1 GLP with V2 isolated GM pools, using 18 instead of 30 decimals for USD values, calling createOrder without the mandatory multicall pattern, or approving tokens to the wrong contract. This Skill provides verified contract addresses, correct order construction patterns, and troubleshooting guidance for GMX V2 on Arbitrum and Avalanche. ## Core Features & Use Cases - Order Construction: Build spot swaps, market increase/decrease orders, take-profit, and stop-loss orders using the ExchangeRouter multicall pattern with sendWnt, sendTokens, and createOrder. - GM Liquidity Operations: Deposit and withdraw GM tokens via createDeposit and createWithdrawal with correct vault routing (OrderVault, DepositVault, WithdrawalVault). - Market Data Reading: Query markets, positions, and orders through the Reader contract with batched multicall reads, plus @gmx-io/sdk integration. - Use Case: Open a 10x leveraged long ETH position with 0.5 ETH collateral by batching sendWnt and createOrder into a single multicall transaction with correct 30-decimal USD sizing. ## Quick Start Use the gmx skill to open a leveraged long ETH position on Arbitrum with 0.5 ETH collateral and $5000 position size.

Frequently Asked Questions about gmx

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I open a leveraged position on GMX V2?

Create a MarketIncrease order by batching sendWnt (collateral plus execution fee) and createOrder into a single multicall on the ExchangeRouter. Leverage is implicit: it equals sizeDeltaUsd divided by collateral value, with no separate leverage parameter.

How to swap tokens using GMX V2 contracts?

Use OrderType.MarketSwap (enum value 0) with sizeDeltaUsd set to zero and a swapPath containing the market token. Batch sendWnt for the execution fee, sendTokens for the input token, and createOrder into one multicall transaction.

Why does my GMX order get created but never executed?

GMX orders are asynchronous: keepers execute them in a separate transaction using Chainlink Data Streams prices. Common causes are insufficient execution fee, keeper backlog during volatility, or the price moving past your acceptablePrice causing auto-cancellation.

What decimal precision does GMX use for USD values?

GMX uses 30-decimal precision for all USD values like sizeDeltaUsd and triggerPrice. A $5000 position is 5000 * 10^30, not 10^18. Using 18 decimals creates positions orders of magnitude off and triggers leverage errors.

Which contract should I approve tokens to on GMX?

Approve ERC-20 tokens to the Router contract (0x7452c558d45f8afC8c83dAe62C3f8A5BE19c71f6 on Arbitrum), not the ExchangeRouter. The ExchangeRouter calls the Router internally to transfer tokens, so approving the ExchangeRouter directly does nothing.

Does GMX V2 work on chains other than Arbitrum?

GMX V2 is deployed on Arbitrum (chain ID 42161) and Avalanche (chain ID 43114). Avalanche has fewer markets and different contract addresses, so always verify addresses against the official docs before integrating.