Compare commits

...

1 Commits

Author SHA1 Message Date
Devin AI
453f50aa59 docs(chain138): Phase 4b runbook for EnhancedSwapRouterV2 + adapters
Some checks failed
AI Code Review / claude-review (pull_request) Failing after 1m3s
Validate (PR) / run-all-validation (pull_request) Failing after 57s
Add docs/bridge/trustless/PHASE4B_V2_DEPLOY_RUNBOOK.md mirroring the LAN deploy prompt for V2 (parallel infra to V1, doesn't change dApp routing until Phase 4c).

Flag both ADDRESS_MATRIX_AND_STATUS.md \u00a71.6 and PMM_DEX_ROUTING_STATUS.md \u00a72.1 with EnhancedSwapRouterV2 status "Pending Phase 4b" pointing at smom-dbis-138 PR #1 (deploy-script-only).

Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
2026-04-29 14:00:50 +00:00
3 changed files with 122 additions and 0 deletions

View File

@@ -132,6 +132,7 @@
| Pool cEURT/cXAUC (private) | `0x505403093826D494983A93b43Aa0B8601078A44e` | ✅ | Funded live |
| LiquidityPoolETH (trustless) | — | ❌ | Placeholder 0x0 |
| EnhancedSwapRouter | `0xE6Cc7643ae2A4C720A28D8263BC4972905d7DE0f` | ✅ | Deployed 2026-04-22 (Phase 3, EVM Paris). UniV3 + Balancer + DODO Stack-A wired; Curve disabled; 1inch slot inert. 11 DODO pools registered in `dodoPoolAddresses[tokenA][tokenB]` bidirectionally — 8 at deploy, 3 cBTC pools (cBTC/cUSDT, cBTC/cUSDC, cBTC/cXAUC) added Phase 3j (2026-04-22) via `setDodoPoolAddress(...)`. Balancer pool ids still pending per-pair config. |
| EnhancedSwapRouterV2 | _pending_ | ⏳ | Phase 4b — deploy script ready (`smom-dbis-138/script/bridge/trustless/DeployEnhancedSwapRouterV2.s.sol`, PR #1 on `Order-of-Hospitallers/smom-dbis-138`). Awaits LAN broadcast. Will deploy 6 `IRouteExecutorAdapter` contracts (Dodo / DodoV3 / UniswapV3 / Balancer / Curve / OneInch) + V2 router + IntentBridgeCoordinatorV2; wires the same 11 DODO pairs as V1 through Stack-A integration. Parallel infra — does NOT change V1 wiring or dApp routing until Phase 4c. Runbook: `docs/bridge/trustless/PHASE4B_V2_DEPLOY_RUNBOOK.md`. |
### 1.7 TransactionMirror / deployer

View File

@@ -55,6 +55,7 @@
| **PMM pools (Stack A, traded)** | Live | 8 pools registered + traded. See [ADDRESS_MATRIX_AND_STATUS](ADDRESS_MATRIX_AND_STATUS.md) §1.6. |
| **PMM pools (Stack B, seeded)** | Live but un-traded | 3 pools at flat 10M/10M (or 0/0). Superseded by Stack A. |
| **EnhancedSwapRouter** | Deployed | `0xE6Cc7643ae2A4C720A28D8263BC4972905d7DE0f` on Chain 138 (Phase 3, 2026-04-22, EVM Paris). UniV3 + Balancer + DODO Stack A wired; Curve/1inch slots inert; 11 DODO pools registered (8 at deploy + 3 cBTC pools Phase 3j). Balancer pool ids still pending per-pair `setBalancerPoolId(...)`. |
| **EnhancedSwapRouterV2** | Pending — Phase 4b | Deploy script ready (`smom-dbis-138/script/bridge/trustless/DeployEnhancedSwapRouterV2.s.sol`, PR #1 on `Order-of-Hospitallers/smom-dbis-138`). Replaces V1's hardcoded provider enum with post-deploy `setProviderAdapter(...)` so adding a new DEX no longer requires a router redeploy. Pre-wires the same 11 DODO pairs as V1 + 6 `IRouteExecutorAdapter` contracts (Dodo / DodoV3 / UniswapV3 / Balancer / Curve / OneInch). Parallel infra — does NOT change V1 wiring or dApp routing until Phase 4c. Runbook: [docs/bridge/trustless/PHASE4B_V2_DEPLOY_RUNBOOK.md](../bridge/trustless/PHASE4B_V2_DEPLOY_RUNBOOK.md). |
| **LiquidityPoolETH** (trustless bridge) | Placeholder | Not deployed; config uses `0x0`. |
**Doc note:** [LIQUIDITY_POOLS_MASTER_MAP.md](LIQUIDITY_POOLS_MASTER_MAP.md) and [ADDRESS_MATRIX_AND_STATUS.md](ADDRESS_MATRIX_AND_STATUS.md) list pool and DODOPMMProvider addresses. DEX_AND_CROSS_CHAIN_CONTRACTS_NEEDED reflects DODOPMMIntegration deployed and pools created.

View File

@@ -0,0 +1,120 @@
# Phase 4b — `EnhancedSwapRouterV2` + 6 adapters deploy runbook
Companion to PR #1 on `Order-of-Hospitallers/smom-dbis-138` (`deploy(EnhancedSwapRouterV2): register 3 cBTC DODO pools (Phase 3j parity)`).
**Status:** **Pending broadcast.** Deploy script ready; awaits LAN execution.
## What V2 changes vs V1
| | V1 (`0xE6Cc7643…`) | V2 (Phase 4b) |
|---|---|---|
| Provider dispatch | Hardcoded enum (UniV3 / Curve / Dodoex / Balancer / OneInch) | Post-deploy `setProviderAdapter(provider, adapter)` |
| Per-provider executor | Inline in router; Curve + 1inch slots inert by design | Each provider has its own `IRouteExecutorAdapter` contract |
| Adding a new DEX | Requires V1 redeploy | Deploy a new adapter, call `setProviderAdapter(...)` — no router redeploy |
| DODO pools (Stack A) | 11 pools registered (8 at deploy + 3 cBTC Phase 3j) | 11 pairs wired in the V2 deploy script via `setProviderRoute` (matches V1 state) |
| Affects existing dApp wiring | n/a | **No.** V2 is parallel infra. dApp keeps using V1 until a separate Phase 4c PR opts traffic into V2 behind a feature flag. |
## What the deploy script does (`script/bridge/trustless/DeployEnhancedSwapRouterV2.s.sol`)
1. Deploys 6 `IRouteExecutorAdapter` contracts: `Dodo`, `DodoV3`, `UniswapV3`, `Balancer`, `Curve`, `OneInch`.
2. Deploys `EnhancedSwapRouterV2` (constructor takes WETH/USDT/USDC/DAI placeholders).
3. Deploys `IntentBridgeCoordinatorV2` pointing at the V2 router.
4. Wires adapters: 6 × `setProviderAdapter`.
5. Wires 11 DODO pairs (both directions = 22 writes) through Stack-A integration:
- `cUSDT/cUSDC` → pool `0x9e89bAe0…`
- `cUSDT/USDT` → pool `0x866Cb44b…`
- `cUSDC/USDC` → pool `0xc39B7D0F…`
- `cUSDT/cXAUC` → pool `0x1AA55E20…`
- `cUSDC/cXAUC` → pool `0xEa9AC635…`
- `cEURT/cXAUC` → pool `0xba99bc1e…`
- `cBTC/cUSDT` → pool `0x67049E73…` (Phase 3j; added in PR #1)
- `cBTC/cUSDC` → pool `0x72F1A079…` (Phase 3j; added in PR #1)
- `cBTC/cXAUC` → pool `0xF3e8A07D…` (Phase 3j; added in PR #1)
- `WETH/USDT` → pool `0xe227F6C0…` (env-conditional)
- `WETH/USDC` → pool `0xb53A0508…` (env-conditional)
6. Optional: UniV3 / Balancer / DodoV3 routes if the corresponding env vars are set; otherwise the script disables the provider with `setProviderEnabled(provider, false)`.
7. Emits 8 `console.log` lines with the deployed addresses.
## Permanent rules being honored
- `[profile.chain138_legacy]` (or per-deploy `--evm-version paris`) — Chain 138 / Besu v25.12 is on Paris hard fork; default Cancun produces `PUSH0` opcodes that are `INVALID` on this chain (root cause of the 2026-04 V1 broadcast OOG).
- Stack-A integration `0x86ADA6Ef91A3B450F89f2b751e93B1b7A3218895` and provider `0x3f729632E9553EBacCdE2e9b4c8F2B285b014F2e` are the canonical DODO PMM stack for Chain 138 (Stack B at `0x5BDc62f1…` is unfunded — see `chain138-tokens-and-pmm.mdc`).
## Pre-flight + step-by-step LAN commands
The pasteable Cursor/Operator prompt is at `~/test-plans/phase4b-cursor-lan-prompt.md` on the Devin VM. Re-state for archival:
### Pre-flight
```bash
cd ~/projects/proxmox/smom-dbis-138
git checkout main && git pull --ff-only origin main
git log -1 --pretty='%h %s' -- script/bridge/trustless/DeployEnhancedSwapRouterV2.s.sol
# expected: a commit titled "deploy(EnhancedSwapRouterV2): register 3 cBTC DODO pools (Phase 3j parity)"
source scripts/lib/deployment/dotenv.sh
load_deployment_env --repo-root "$PWD/.."
DEPLOYER=0x4A666F96fC8764181194447A7dFdb7d471b301C8
cast balance "$DEPLOYER" --rpc-url "$RPC_URL_138"
# expected: > ~0.1 ETH
FOUNDRY_PROFILE=chain138_legacy forge config --json | python3 -c \
"import json,sys; print('evm_version:', json.load(sys.stdin)['evm_version'])"
# expected: paris
```
### Env vars
```bash
export UNISWAP_V3_ROUTER=0xde9cd8ee2811e6e64a41d5f68be315d33995975e
export UNISWAP_QUOTER_ADDRESS= # leave empty unless quoter is verified on Chain 138
export BALANCER_VAULT=0x96423d7c1727698d8a25ebfb88131e9422d1a3c3
export ONEINCH_ROUTER=0x500b84b1bc6f59c1898a5fe538ea20a758757a4f
export CURVE_3POOL=0x000000000000000000000000000000000000dEaD
export DODO_PMM_PROVIDER_ADDRESS=0x3f729632E9553EBacCdE2e9b4c8F2B285b014F2e
export CHAIN138_POOL_WETH_USDT=0xe227f6c0520c0c6e8786fe56fa76c4914f861533
export CHAIN138_POOL_WETH_USDC=0xb53a0508940b1ff90f1aad4f6cb50a7012fe5593
```
### Dry run
```bash
FOUNDRY_PROFILE=chain138_legacy forge script \
script/bridge/trustless/DeployEnhancedSwapRouterV2.s.sol:DeployEnhancedSwapRouterV2 \
--rpc-url "$RPC_URL_138" --private-key "$PRIVATE_KEY" \
--evm-version paris -vvv \
| tee /tmp/v2-dryrun.log
```
### Broadcast
```bash
FOUNDRY_PROFILE=chain138_legacy forge script \
script/bridge/trustless/DeployEnhancedSwapRouterV2.s.sol:DeployEnhancedSwapRouterV2 \
--rpc-url "$RPC_URL_138" --private-key "$PRIVATE_KEY" \
--evm-version paris --broadcast --slow -vvv \
| tee /tmp/v2-broadcast.log
```
### Post-deploy verification
See full readout commands in `~/test-plans/phase4b-cursor-lan-prompt.md` Step 4 (provider enable bits, adapter mapping, `getProviderRoute` for 5 sample DODO pairs).
## What to hand back
1. The 8 deployed addresses (router, coordinator, 6 adapters).
2. `providerEnabled(0..6)` reads.
3. `providerAdapters(0..6)` reads (skip 5 = Partner).
4. `getProviderRoute(...)` for cBTC/cUSDT, cUSDT/cBTC, cBTC/cUSDC, cBTC/cXAUC, cUSDT/cUSDC.
5. Filtered grep of `/tmp/v2-broadcast.log` (deploy + setProviderRoute + setProviderAdapter + setProviderEnabled events).
If anything reverts, paste the failing tx receipt + the relevant log section. Do not retry-loop.
## What this does NOT do
- Does not change the dApp's route registry. V2 has no client traffic; that's Phase 4c.
- Does not affect V1. V1 keeps its 11 DODO pools + the existing `?useEnhancedRouter=1` dispatch path stays on V1 until Phase 4c.
- Does not wire Balancer pool ids on V2 — they need to be discovered (`BALANCER_WETH_USDT_POOL_ID`, `BALANCER_WETH_USDC_POOL_ID`) and either set on the env before the broadcast or via a follow-up `setProviderRoute(Provider.Balancer, …)` cast.
- Does not activate Curve or OneInch — both intentionally disabled.
## Follow-ups after broadcast
1. Update `docs/11-references/ADDRESS_MATRIX_AND_STATUS.md` and `PMM_DEX_ROUTING_STATUS.md` rows for `EnhancedSwapRouterV2` from "Pending — Phase 4b" to "Deployed at 0x… (11 pools wired)".
2. Phase 4c — small dApp PR: surface V2 in `live-route-registry.json` (disclosure-only, behind a flag); add a route-honesty chip if API selects a provider that V2 has wired but V1 doesn't.
3. (Stretch) discover Balancer pool ids on Chain 138 + wire `setProviderRoute(Provider.Balancer, …)` per pair.