Create order
TLM submits a UserOp. For automated paths it targets SpellsGmxWrapper instead of raw multicall.
Spells v2 Walkthrough
Durable execution, GMX async orders, and fee logic.
On This Page
Spells splits execution into two layers because business intent and blockchain ambiguity are different problems. Workflows own durable sequencing for casts, monitoring, and triggers. The TLM owns nonce serialization, submission, receipt verification, and bounded recovery per Metavault.
60s
Position monitor and trigger evaluator both target one-minute loops.
2 min
After that, TLM moves from optimistic polling into explicit verification.
15 min
Gas bumps and nonce recovery remain bounded rather than indefinite.
Separate
User-paid degraded close stays available even if sponsorship or Vercel fail.
Worker validates and hands off. Workflow owns business sequencing. TLM owns transaction truth until the resulting state is confirmed and recorded.
Triggers do not bypass the execution backbone. They enter it through the same durable path, which matters especially for GMX’s async order model.
When higher-level dependencies fail, the system can drop to a Worker-owned emergency surface and eventually to raw user-signed transactions.
The TLM is a Durable Object per Metavault. It acquires nonce context, builds calldata or wrapper calls, estimates gas, signs, submits, polls, verifies post-conditions, and recovers from stuck states without entering blind retry loops.
A GMX receipt confirms order creation, not completed exposure. That means the system must track by order, persist `gmx_order_key`, detect frozen or cancelled orders, and treat keeper execution as a second phase.
TLM submits a UserOp. For automated paths it targets SpellsGmxWrapper instead of raw multicall.
The order is on-chain, but the position is not yet active. Typical keeper latency is 30–120 seconds.
The monitor checks `getAccountOrders` and position deltas. Disappearing order key plus expected state change means success. Frozen or timed-out orders raise attention.
The PRD exposes active, closed, and liquidated. The runtime model adds opening, arming, adjusting, closing, and GMX-specific pending states, but unresolved execution problems are still shown as attention on the position rather than as a confusing new lifecycle state.
Spells charges a gas-cost recovery component plus a platform execution fee on open and close operations. Fee transfer happens atomically inside the same UserOp as the operation, so if the fee cannot be collected, the action does not proceed.
10 bps on position open, waived below $100 notional.
5 bps on close, with management actions otherwise charging gas recovery only.
20% configurable markup on estimated gas cost, plus GMX keeper fee recovery where relevant.