Files
proxmox/docs/00-meta/TASKS_ROUTING_SWAP_CROSSCHAIN.md
defiQUG 3f76bc9507
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: update master documentation and push to Gitea (2026-03-06)
- MASTER_INDEX: Last Updated 2026-03-06; status 59/59 contracts; add NEXT_STEPS_LIST, CONTRACT_NEXT_STEPS_LIST
- docs/README, NEXT_STEPS_INDEX, 06-besu/MASTER_INDEX: Last Updated 2026-03-06
- Contract check script: 59 addresses (PMM, vault/reserve, CompliantFiatTokens); canonical CCIP/router
- New docs: EXECUTION_CHECKLIST, NEXT_STEPS_LIST, DOTENV_AUDIT, ADDITIONAL_PATHS, deployer gas runbook, WEMIX_ACQUISITION_TABLED, etc.
- Config: deployer-gas-routes, cro-wemix-swap-routes, routing-registry, token-mapping
- Scripts: check-contracts-on-chain-138, check-pmm-pool-balances-chain138, deployer-gas-auto-route, acquire-cro-and-wemix-gas
- Operator rule: operator-lan-access-check.mdc

Made-with: Cursor
2026-03-06 19:11:25 -08:00

10 KiB
Raw Permalink Blame History

Tasks: Routing, Swapping, and Cross-Chain Ops

Last Updated: 2026-03-06
Purpose: Single list of tasks that affect routing, swapping, and cross-chain operations only. For the full task list see ALL_TASKS_INCLUDING_OPTIONAL.md.

Key docs: DEX_AND_AGGREGATORS_CHAIN138_EXPLAINER, PMM_DEX_ROUTING_STATUS, DEPLOYED_TOKENS_BRIDGES_LPS_AND_ROUTING_STATUS, CONFIG_READY_CHAINS_COMPLETION_RUNBOOK.


1. Current state (whats live)

Area Status Notes
Same-chain swap (138) Pools + API DODO PMM: cUSDT↔cUSDC pool live; DODOPMMProvider deployed. Add liquidity blocked (deployer 0 c*/WETH). GET /api/v1/quote single-hop.
Bridge 138 → dest CCIP + Alltra WETH9/WETH10 to 1, 56, 137, 10, 42161, 43114, 8453, 100, 25, 42220 (Celo ); Wemix (need 0.4 WEMIX). Alltra 138↔651940.
Routing registry config/routing-registry.json — WETH routes 138↔dest; ALT for 138↔651940.
Token mapping API GET /api/v1/token-mapping, /resolve; source: config/token-mapping-multichain.json.
Bridge quote API Partial POST /api/bridge/quote — sourceSwapQuote / destinationSwapQuote when configured.
Swapbridgeswap Partial QuoteService exists; SwapBridgeSwapCoordinator deployable; destination DEX/aggregator not wired per chain.
cW edge pools* pool-matrix design only; deployment-status.json empty; no cW* pools on public chains.
N-hop / multi-provider Single-hop only; EnhancedSwapRouter not deployed.

2. Same-chain routing & swap (Chain 138)

2.1 Prerequisites for swap execution

# Task Command / doc
A1 Add liquidity to PMM pools (cUSDT/cUSDC first) Fund deployer with cUSDT/cUSDC/WETH (or mint); ADD_LIQUIDITY_PMM_CHAIN138_RUNBOOK; mint-for-liquidity.sh --add-liquidity
A2 Ensure token-aggregation indexes DODO on 138 Set CHAIN_138_DODO_PMM_INTEGRATION in env; indexer running so GET /api/v1/quote returns DODO quotes.
A3 Expose token-aggregation API for dApps/Snap Proxy /api/v1/* (e.g. explorer.d-bis.org) to token-aggregation; or GATSBY_SNAP_API_BASE_URL.

2.2 Optional (same-chain)

# Task Notes
A4 Deploy EnhancedSwapRouter on 138 Only after Uniswap/Balancer pools exist on 138; configure quoter/poolId.
A5 N-hop quote/pathfinding in token-aggregation Today single-hop only; add graph A→B→C if needed.

3. Cross-chain: bridges & routing

3.1 Bridge coverage (138 ↔ all 13 chains)

# Task Command / doc
B1 Cronos (25): deploy CCIP bridges + complete-config Fund deployer ~15 CRO (acquire-cro-and-wemix-gas.sh); set CRONOS_RPC, CCIP_ROUTER_CRONOS; deploy-bridges-config-ready-chains.sh cronos; complete-config-ready-chains.sh.
B2 Wemix (1111): deploy CCIP bridges + complete-config Fund deployer ~0.4 WEMIX (manual/aggregator); WEMIX_ACQUISITION_TABLED; deploy-bridges-config-ready-chains.sh wemix; complete-config.
B3 Fund all CCIP bridges with LINK ./scripts/deployment/fund-ccip-bridges-with-link.sh (dry-run first).
B4 Ensure routing registry and token-mapping include new chains Update config/routing-registry.json and config/token-mapping-multichain.json when adding Cronos/Wemix; run validate-config-files.sh.

3.2 Token mapping & route config

# Task Notes
B5 Wemix (1111) token addresses Confirm WETH, USDT, USDC on scan.wemix.com; update token-mapping and WEMIX_TOKEN_VERIFICATION.md; validate-config-files.sh.
B6 Token-aggregation: GET /api/v1/bridge/routes returns Chain 138 bridges Set BRIDGE_LIST_JSON_URL or built-in routes; verify response has chain138Bridges.
B7 Token mapping API for 138↔destination Ensure token-mapping-multichain.json (or loader) includes 138 and all target chains for bridge UIs.

3.3 Alltra (138 ↔ 651940)

# Task Notes
B8 AlltraAdapter setBridgeFee Call setBridgeFee(uint256) after deploy; set ALLTRA_BRIDGE_FEE, ALLTRA_ADAPTER_CHAIN138 in .env.

4. Swapbridgeswap (full path)

4.1 Orchestration & quote

# Task Command / doc
C1 Complete Flow A (liquidity + quote on 138) Prerequisite: §2.1.
C2 Complete Flow B (bridge configured + LINK funded) Prerequisite: §3.13.2.
C3 POST /api/bridge/quote returns sourceSwapQuote and destinationSwapQuote Set BRIDGE_REGISTRY_ADDRESS; optional ENHANCED_SWAP_ROUTER_ADDRESS (source), DESTINATION_RPC_URL, DESTINATION_SWAP_ROUTER_ADDRESS. [QuoteService already supports optional swap quotes.]
C4 Destination-chain DEX/aggregator for destinationSwapQuote Wire QuoteService to destination DEX or aggregator API per chain for destinationSwapQuote.
C5 (Optional) Deploy SwapBridgeSwapCoordinator on-chain One tx: swap (source) → bridge → swap (destination). DODO_PMM_NEXT_STEPS.

4.2 Frontend & E2E

# Task Notes
C6 Frontend: wire Bridge UI to routes + token mapping Use GET /api/v1/bridge/routes and /api/v1/token-mapping/resolve.
C7 Frontend: “Get full path quote” and execute Call POST /api/bridge/quote; show sourceSwapQuote, destinationSwapQuote; execute steps or coordinator.
C8 E2E test: swap 138 → bridge → swap destination Automated or manual; document tx hashes.

5. Public-chain cW* and edge pools (Phase C)

Enables swapbridgeswap and arbitrage on destination chains via cW* tokens and PMM edge pools.

# Task Command / doc
D1 Deploy or bridge cW* tokens per chain (1, 56, 137, 10, 42161, 8453, 43114, 100, 25, 42220, 1111) PHASE_C_CW_AND_EDGE_POOLS_RUNBOOK; cross-chain-pmm-lps token-map and deployment recipe; record in deployment-status.json and .env.
D2 Create and fund PMM edge pools (cW*/USDC, cW*/USDT) per pool-matrix Same runbook; pool-matrix.json; populate deployment-status.json with pool addresses.
D3 (Optional) Stabilization bot / peg bands for cW* cross-chain-pmm-lps.

6. Deployer gas routing (ops)

Relevant only for funding deployer with native gas on each chain so bridge/deploy ops can run.

# Task Command / doc
E1 Deployer gas auto-route (Protocolink + 138 + manual) ./scripts/deployment/deployer-gas-auto-route.sh (optional --dry-run). DEPLOYER_GAS_AUTO_ROUTE_RUNBOOK.
E2 Acquire CRO and WEMIX (manual routes) ./scripts/deployment/acquire-cro-and-wemix-gas.sh (lists aggregator links); config: config/cro-wemix-swap-routes.json.

7. Config and code references

Config / code Purpose
config/routing-registry.json (fromChain, toChain, asset) → pathType, bridgeAddress; used by UI/indexer.
config/token-mapping-multichain.json Token pairs 138↔651940 (and other chains); addressFrom, addressTo for bridge UIs.
config/deployer-gas-routes.json Deployer gas strategy per chain (protocolink, chain138, manual).
config/cro-wemix-swap-routes.json Manual swap routes for CRO/WEMIX (aggregator links).
smom-dbis-138/services/token-aggregation/src/config/cross-chain-bridges.ts CHAIN_138_BRIDGES, getRouteFromRegistry().
smom-dbis-138/real-robinhood/data/routing-matrix-13x13.json 13×13 chain matrix (B/SBS, ALT, via 138).

8. Quick command reference (routing / swap / cross-chain)

Task Command
Validate config (routing, token-mapping) ./scripts/validation/validate-config-files.sh
Preflight config-ready chains cd smom-dbis-138 && ./scripts/deployment/preflight-config-ready-chains.sh [celo|wemix|cronos|all]
Deploy bridges (Cronos/Wemix) ./scripts/deployment/deploy-bridges-config-ready-chains.sh [cronos|wemix]
Complete CCIP destinations (138↔chain) ./scripts/deployment/complete-config-ready-chains.sh
Fund CCIP with LINK ./scripts/deployment/fund-ccip-bridges-with-link.sh
Deployer gas report (dry-run) ./scripts/deployment/deployer-gas-auto-route.sh --dry-run
List CRO/WEMIX swap routes ./scripts/deployment/acquire-cro-and-wemix-gas.sh or --list / --json

9. Summary: routing/swap/cross-chain task order

  1. Same-chain swap: Add liquidity (A1) → token-aggregation DODO index (A2) → expose API (A3). Optional: EnhancedSwapRouter (A4), N-hop (A5).
  2. Cross-chain: Cronos/Wemix bridges (B1B2) → fund LINK (B3) → registry/token-mapping (B4B7) → Alltra setBridgeFee (B8).
  3. Swapbridgeswap: Complete A + B → quote API (C3) → destination DEX wiring (C4) → optional coordinator (C5) → frontend (C6C7) → E2E test (C8).
  4. cW mesh (Phase C):* Deploy cW* (D1) → edge pools (D2) → optional bot (D3).
  5. Ops: Deployer gas auto-route (E1); CRO/WEMIX via acquire script (E2) when needed.

References