Skip to content

Update to v2.2c contracts#2310

Open
qwinndev wants to merge 25 commits into
releasefrom
qwinndev/update-v22c-contracts
Open

Update to v2.2c contracts#2310
qwinndev wants to merge 25 commits into
releasefrom
qwinndev/update-v22c-contracts

Conversation

@qwinndev

@qwinndev qwinndev commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

qwinndev added 12 commits March 6, 2026 12:03
- Add SimulationRouter ABI and contract address for Arbitrum Sepolia
- Remove simulation methods from ExchangeRouter ABI (cleanup)
- Update simulateExecuteOrder.ts (SDK) with two-step simulation:
  create on ExchangeRouter, execute on SimulationRouter
- Update simulateExecuteTxn.tsx (frontend) with three-path routing:
  GLV -> GlvRouter, v2.2c -> SimulationRouter, legacy -> ExchangeRouter
- Add tryGetContract helper to SDK contracts config
…ion)

- Add minCollateralFactorForLiquidation to subsquid codegen types
- Update useFastMarketsInfoRequest GraphQL query to fetch dedicated field
  instead of duplicating minCollateralFactor
- Fix getEstimatedLiquidationTimeInHours to use minCollateralFactorForLiquidation
  for accurate liquidation time estimation
- Update dataStore key functions to encode isLong boolean parameter
- Rename MarketInfo type fields: minFundingFactorPerSecond ->
  minFundingFactorPerSecondLong/Short, maxFundingFactorPerSecond ->
  maxFundingFactorPerSecondLong/Short
- Update hashKeys.ts with per-side key encoding and regenerate
  prebuilt hashedMarketConfigKeys.json
- Update multicall.ts to fetch 4 per-side funding values from DataStore
- Update useFastMarketsInfoRequest GraphQL query for per-side fields
- Update SyntheticsStats tooltip to display per-side funding factors
- Update test mocks, specs, and data fixtures for new field names
- Add per-side funding fields to subsquid codegen types
…g floor logic

Adds the MIN_FUNDING_INCREASE_RATE_PER_SECOND config key across the SDK pipeline:
dataStore, hashKeys, multicall, types, subsquid codegen, prebuilt hashed keys,
GraphQL fast path, and all test/mock data files.
…ens balance)

- Update SyntheticsReader ABI to include positionValueInUsd field
- Implement useOpenInterestInTokensForBalance logic in getPriceImpactForPosition
  using tokenDelta * midPrice as effectiveUsdDelta
- Thread sizeDeltaInTokens through getAcceptablePriceInfo, getCappedPositionImpactUsd,
  and all decrease/increase trade paths
- Pass sizeDeltaInTokens in liquidation price and position info calculations
Sync CustomErrors.ts ABI with the latest v2.2c contract error definitions.
- Add cancelledByKeeper flag to PositionOrderAction and SwapOrderAction types
- Update trade history keys to include cancelledByKeeper for proper re-rendering
- Update position and swap trade history row utils to show keeper-cancel messaging
- Update ExchangeRouter ABI with createTwapOrder method signature
- Add nativeTwapParams to BatchOrderTxnParams and wire through order callbacks
- Build native TWAP multicall encoding in orderTransactions utils
- Add selectTradeBoxNativeTwapParams selector for TWAP order parameters
- Update PositionSeller and TradeBox to handle native TWAP flow
- Exclude native TWAP from express/relayer path with explicit guard
SimulationRouter uses NonceUtils.getCurrentKey which requires the order
to exist on-chain. Since PayableMulticall uses delegatecall (can only
call methods on its own contract), createOrder (ExchangeRouter) and
simulateExecuteLatestOrder (SimulationRouter) cannot run atomically
in one eth_call. The two-step approach caused OrderNotFound errors.

Now v2.2c chains only validate the create payload on ExchangeRouter.
Execution validation relies on Reader/SDK local calculations.
Also adds debug logs ([v2.2c ...] prefix) for manual testing.
- Add MAX_COLLATERAL_SUM DataStore key, hash keys (4 per market),
  types, and multicall fetch paths (FEDEV-3590)
- Update Arbitrum Sepolia contract addresses to latest v2.2c deployment
  (ExchangeRouter, Reader, GlvReader/Router, relay routers, multichain routers)
- Update Sepolia squid URL to new deployment
- Fix market config debug log to skip stale markets (maxLongPoolAmount > 0)
- Regenerate prebuilt hashedMarketConfigKeys.json with new keys
@qwinndev qwinndev force-pushed the qwinndev/update-v22c-contracts branch from e0763ff to 0d827ad Compare March 12, 2026 10:01
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Mar 12, 2026

Copy link
Copy Markdown

Deploying gmx-interface-home with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8fc485d
Status: ✅  Deploy successful!
Preview URL: https://e2117726.gmx-interface-home.pages.dev
Branch Preview URL: https://qwinndev-update-v22c-contrac.gmx-interface-home.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Mar 12, 2026

Copy link
Copy Markdown

Deploying gmx-interface with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8fc485d
Status: ✅  Deploy successful!
Preview URL: https://f5c63b96.gmx-interface.pages.dev
Branch Preview URL: https://qwinndev-update-v22c-contrac.gmx-interface.pages.dev

View logs

@qwinndev qwinndev changed the title Qwinndev/update v22c contracts Update to v2.2c contracts Mar 12, 2026
qwinndev and others added 12 commits March 12, 2026 15:05
…o Position type

- Add MaxRelayFeeSwapExceeded, InvalidEdgeDataStreamDecimals,
  InsufficientBridgeOutputAmount to CustomErrors ABI so reverts decode
- Add positionValueInUsd to Position type and populate it from the
  v2.2c Reader positionInfo tuple in usePositions and SDK positions module
…2c-contracts

# Conflicts:
#	sdk/src/configs/api.ts
#	src/components/TradeBox/hooks/useTradeboxTransactions.tsx
#	src/components/TradeHistory/keys.ts
#	src/config/indexers.ts
#	src/domain/synthetics/orders/simulation.ts
#	src/domain/synthetics/positions/usePositions.ts
#	src/locales/de/messages.po
#	src/locales/en/messages.po
#	src/locales/es/messages.po
#	src/locales/fr/messages.po
#	src/locales/ja/messages.po
#	src/locales/ko/messages.po
#	src/locales/pseudo/messages.po
#	src/locales/ru/messages.po
#	src/locales/zh-tw/messages.po
#	src/locales/zh/messages.po
#	vite.config.ts
…ugh SimulationRouter

- Update 6 MegaEth addresses redeployed in 2.2c phase 1+2:
  MultichainOrderRouter, MultichainGlvRouter, MultichainGmRouter,
  MultichainTransferRouter, LayerZeroProvider, ClaimHandler
- Route simulateExecuteLatestJitOrder through SimulationRouter (v2.2c
  moves the method off ExchangeRouter)
…2c-contracts

# Conflicts:
#	src/config/indexers.ts
# Conflicts:
#	sdk/src/utils/balances/api.ts
#	src/components/TradeHistory/TradeHistoryRow/utils/position.ts
#	src/components/TradeHistory/TradeHistoryRow/utils/swap.ts
#	src/config/indexers.ts
#	src/domain/synthetics/subaccount/utils.ts
#	src/domain/utm/index.ts
#	src/locales/de/messages.po
#	src/locales/en/messages.po
#	src/locales/es/messages.po
#	src/locales/fr/messages.po
#	src/locales/ja/messages.po
#	src/locales/ko/messages.po
#	src/locales/pseudo/messages.po
#	src/locales/ru/messages.po
#	src/locales/zh-tw/messages.po
#	src/locales/zh/messages.po
…ed error structure; updated parseGetOrdersResponse to include uiFeeFactor in the response type.
Refactor CustomErrors: removed unused error definitions and streamlin…
createTwapOrder is only available on ExchangeRouter and the Gelato/Subaccount relay routers, not the multichain routers, so TWAP can't go through Express/1CT/multichain uniformly. Restore the previous buildTwapOrdersPayloads mechanism (TWAP as N batched limit orders) which works through batch on all routers, and drop the createTwapOrder usages (native order building, the twapParams batch field, and the express guard that excluded TWAP).

Reverts FEDEV-3479.
@github-actions

Copy link
Copy Markdown

Playwright Component Test Report

All tests passed.

View Report

Commit 8fc485d

@qwinndev qwinndev marked this pull request as ready for review June 29, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants