# Dodoex PMM Full Swappable — Next Steps

## 1. Run create-all-dodo-pools (token coverage)

From repo root (`smom-dbis-138`):

```bash
# Required env (see .env.example):
# RPC_URL, PRIVATE_KEY, QUOTE_TOKEN_ADDRESS, DODO_PMM_INTEGRATION_ADDRESS
# Optional: ENHANCED_SWAP_ROUTER_ADDRESS, UNIVERSAL_ASSET_REGISTRY_ADDRESS,
# TOKEN_AGGREGATION_API_URL, CHAIN_ID (default 138)

# Dry run (no on-chain calls)
DRY_RUN=true CHAIN_ID=138 ./scripts/create-all-dodo-pools-from-token-api.sh

# Live run for chain 138
CHAIN_ID=138 ./scripts/create-all-dodo-pools-from-token-api.sh

# Then for chain 651940 (set RPC_URL and token addresses for that chain)
CHAIN_ID=651940 ./scripts/create-all-dodo-pools-from-token-api.sh
```

Ensure Token Aggregation API is running and has tokens indexed for the chain (e.g. `GET /tokens?chainId=138`).

## 2. Deploy SwapBridgeSwapCoordinator

```bash
# Set ENHANCED_SWAP_ROUTER and UNIVERSAL_CCIP_BRIDGE (or BRIDGE_ORCHESTRATOR)
forge script script/bridge/trustless/DeploySwapBridgeSwapCoordinator.s.sol:DeploySwapBridgeSwapCoordinator \
  --rpc-url $RPC_URL --broadcast --legacy
```

Export `SWAP_BRIDGE_SWAP_COORDINATOR` and use it for the swap-then-bridge flow.

## 3. Bridge quote API

Mount the bridge quote routes in your API (e.g. Express):

```ts
import bridgeQuoteRoutes from './orchestration/bridge/bridge-quote-routes';
app.use('/api/bridge', bridgeQuoteRoutes);
```

Set `RPC_URL`, `BRIDGE_REGISTRY_ADDRESS` (and registry ABI); optional: `ENHANCED_SWAP_ROUTER_ADDRESS`, `DESTINATION_RPC_URL`, `DESTINATION_SWAP_ROUTER_ADDRESS`. Then `POST /api/bridge/quote` accepts `token`, `amount`, `destinationChainId`, `destinationAddress` or the swap+bridge+swap shape: `sourceToken`, `destinationToken`, `sourceChainId`, `destinationChainId`, `amount`.

## 4. CCIP and bridge config

- Set CCIP router and chain selectors for 138, 651940, and all target chains (see `docs/deployment/BRIDGE_CONFIGURATION.md`).
- Fund bridge contracts with LINK.
- **SwapBridgeSwapCoordinator**: The bridge accepts any caller; when the coordinator calls `bridge()`, it is `msg.sender` and holds the tokens after the swap, so no extra allowlist is needed. Full details: [CCIP and SwapBridgeSwapCoordinator](trustless/CCIP_AND_SWAP_BRIDGE_COORDINATOR.md).

## 5. Frontend

Set `VITE_BRIDGE_QUOTE_URL` to the base URL of the API that serves `POST /api/bridge/quote`. The Custom Bridge tab documents the request/response; use the "Get full path quote" section to call the API and show `minReceived`, `sourceSwapQuote`, `destinationSwapQuote`.
