@continuumdao/ctm-mpc-defi 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,45 @@
1
+ # GMX V2 (classic mode)
2
+
3
+ Perpetuals on Arbitrum (42161) and Avalanche (43114) via `@gmx-io/sdk` v2 **classic** orders only.
4
+
5
+ ## Constraints
6
+
7
+ - **No express mode** — MPC multi-sign requires on-chain calldata (`prepareOrder({ mode: "classic" })`).
8
+ - **No subaccounts (1CT)** — incompatible with threshold MPC; executor is always `keyGen.ethereumaddress`.
9
+ - **No spot swaps** in v1 — perps only (increase, decrease, limit, cancel).
10
+ - Orders are **keeper-executed asynchronously** after broadcast; poll `fetchOrders` for status.
11
+
12
+ ## Typical agent flow
13
+
14
+ 1. `load_defi_protocol({ protocolId: "gmx" })`
15
+ 2. `ctm_gmx_fetch_markets({ chainId })` — pick `symbol` e.g. `ETH/USD [WETH-USDC]`; each row includes `maxLeverageLabel`
16
+ 3. `ctm_gmx_fetch_market_prices({ chainId, symbol, collateralSymbol })` — index/collateral USD mark
17
+ 4. `ctm_gmx_fetch_ohlcv({ chainId, symbol, timeframe: "15m" })` — tabular OHLCV candles (USD index)
18
+ 5. `ctm_gmx_fetch_positions({ chainId, executorAddress })` — for close flows
19
+ 6. `ctm_gmx_build_increase_multisign` or `ctm_gmx_build_decrease_multisign` with `keyGenId`, `chainId`, `purposeText`
20
+ 7. Base MPC: agree → trigger sign → broadcast
21
+
22
+ ## Limit orders
23
+
24
+ Set `orderType: "limit"` and `triggerPriceUsdHuman` on increase/decrease builders.
25
+
26
+ ## Cancel
27
+
28
+ Use `orderId` from `fetchOrders` with `ctm_gmx_build_cancel_multisign`.
29
+
30
+ ## GM liquidity (phase 2)
31
+
32
+ GM pool deposit/withdraw uses **ExchangeRouter multicall** (not `prepareOrder`):
33
+
34
+ 1. `ctm_gmx_fetch_gm_markets({ chainId })` — GM markets + long/short collateral symbols + estimated APY
35
+ 2. `ctm_gmx_fetch_gm_apy({ chainId })` — same APY data sorted by yield (highest first)
36
+ 3. `ctm_gmx_build_gm_deposit_multisign` — approve + `multicall(sendWnt + sendTokens + createDeposit)`
37
+ 4. `ctm_gmx_build_gm_withdraw_multisign` — approve GM token + `multicall(sendWnt + sendTokens + createWithdrawal)`
38
+
39
+ Keeper execution is asynchronous (same as perp orders). Execution fee is paid in native gas token via `sendWnt`.
40
+
41
+ ## GMX token staking (phase 2)
42
+
43
+ 1. `ctm_gmx_fetch_staking_power({ chainId, executorAddress })`
44
+ 2. `ctm_gmx_build_stake_gmx_multisign` — approve GMX + `RewardRouter.stakeGmx`
45
+ 3. `ctm_gmx_build_unstake_gmx_multisign` — `RewardRouter.unstakeGmx`