Add MEV Chain138 live smoke pack

This commit is contained in:
defiQUG
2026-04-14 07:32:01 -07:00
parent cabb6b6baa
commit 579a3bbe3a
4 changed files with 190 additions and 1 deletions

Submodule MEV_Bot updated: f7961d2abe...5dc6ba5bad

View File

@@ -0,0 +1,28 @@
# MEV Chain 138 Live Smoke Pack
Use this after a MEV rollout when you want one command to verify the public Chain 138 path end to end.
It checks:
- public `mev.defi-oracle.io` health
- freshness summary includes live Chain `138` state
- venue coverage includes active Chain `138` venues
- `/api/pools` exposes the canonical DODO metadata, including `cUSDC/USDC`
- `/api/reserve_state` includes nonzero Chain `138` reserve rows
- native DODO PMM and D3 read surfaces via on-chain calls
Command:
```bash
API_KEY='your-mev-api-key' \
bash scripts/verify/check-mev-chain138-live-smoke-pack.sh
```
Optional environment overrides:
- `MEV_BASE_URL`
- `MEV_CHAIN_ID`
- `MEV_API_KEY`
- `MEV_LIVE_SMOKE_RUN_NATIVE_DODO=0` to skip the native on-chain DODO verifier
The script exits nonzero on any failed check.

View File

@@ -67,6 +67,8 @@ This directory contains setup and configuration guides.
**Price feed (MetaMask and all wallets):**
- **[PRICE_FEED_CHAIN138_METAMASK_AND_WALLETS.md](PRICE_FEED_CHAIN138_METAMASK_AND_WALLETS.md)** ⭐⭐⭐ - **Single reference** for adding Chain 138 USD prices to MetaMask and wallets: CoinGecko, CMC, Consensys outreach, on-chain oracle, Snap workaround.
- **[CHAIN138_PRICING_FEEDS_LIVE.md](CHAIN138_PRICING_FEEDS_LIVE.md)** — On-chain feed matrix (WETH mock, D3Oracle, ReserveSystem) and `fix-chain138-pricing-feeds.sh` operator repair.
- **[CHAIN138_EXTERNAL_LISTINGS_AND_REMAINING_FIXES.md](CHAIN138_EXTERNAL_LISTINGS_AND_REMAINING_FIXES.md)** — Operator fixes vs **CoinGecko / CMC / MetaMask** listing prerequisites and post-listing doc updates.
**Explorer tokens and GRU:**
- **[naming-conventions/README.md](naming-conventions/README.md)** — UTRNF token-role grammar, DBIS `c*` / `cW*` vs UTRNF collision matrix, bridge naming, registry JSON fields (Chain 138 + cross-chain); optional schema + examples validated by `scripts/validation/validate-naming-convention-registry-examples.sh` when `check-jsonschema` is installed.
@@ -77,6 +79,7 @@ This directory contains setup and configuration guides.
**DEX and aggregators (Chain 138 tokens and routing):**
- **[DEX_AND_AGGREGATORS_CHAIN138_EXPLAINER.md](DEX_AND_AGGREGATORS_CHAIN138_EXPLAINER.md)** ⭐⭐⭐ - Using DEX and aggregators with Chain 138 coins/tokens; routing for DEXs; token-aggregation API, DODO PMM, swapbridgeswap flows.
- **[CHAIN138_NATIVE_DODO_READ_SURFACE_VERIFIER.md](CHAIN138_NATIVE_DODO_READ_SURFACE_VERIFIER.md)** — Native DODO PMM / D3MM read-surface verifier for Chain 138 (`getVaultReserve`, `getPMMStateForCall`, `getTokenReserve`, `querySellTokens`)
- **[MEV_CHAIN138_LIVE_SMOKE_PACK.md](MEV_CHAIN138_LIVE_SMOKE_PACK.md)** — One-command public + native smoke pack for Chain 138 MEV health, freshness, venue coverage, pools, reserve state, and native DODO reads
**Chain 138 / Wallets (overview first; all repos in ~/projects/):**
- **[CHAIN138_WALLET_REPOSITORIES.md](CHAIN138_WALLET_REPOSITORIES.md)** ⭐⭐⭐ - **Canonical layout:** metamask-integration, LedgerLive, app-ethereum, TrustWallet-Integration each in `~/projects/`. All items **Yes / Completed.**

View File

@@ -0,0 +1,158 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
if [[ -f "${PROJECT_ROOT}/scripts/lib/load-project-env.sh" ]]; then
# shellcheck source=/dev/null
source "${PROJECT_ROOT}/scripts/lib/load-project-env.sh"
fi
require_command() {
command -v "$1" >/dev/null 2>&1 || {
printf '[fail] missing required command: %s\n' "$1" >&2
exit 1
}
}
require_command curl
require_command jq
require_command python3
BASE_URL="${MEV_BASE_URL:-https://mev.defi-oracle.io}"
CHAIN_ID="${MEV_CHAIN_ID:-138}"
API_KEY="${MEV_API_KEY:-${API_KEY:-}}"
RUN_NATIVE_DODO="${MEV_LIVE_SMOKE_RUN_NATIVE_DODO:-1}"
auth_args=()
if [[ -n "${API_KEY}" ]]; then
auth_args=(-H "X-API-Key: ${API_KEY}")
fi
pass_count=0
fail_count=0
pass() {
printf '[PASS] %s\n' "$*"
pass_count=$((pass_count + 1))
}
fail() {
printf '[FAIL] %s\n' "$*" >&2
fail_count=$((fail_count + 1))
}
check_url_ok() {
local label="$1"
local url="$2"
if curl -fsS "${auth_args[@]}" "$url" >/dev/null; then
pass "${label}"
else
fail "${label}"
fi
}
printf 'MEV Chain %s live smoke pack\n' "${CHAIN_ID}"
printf 'base=%s\n' "${BASE_URL}"
check_url_ok "public /api/health" "${BASE_URL}/api/health"
check_url_ok "public /api/stats/freshness" "${BASE_URL}/api/stats/freshness"
check_url_ok "public /api/stats/venue-coverage" "${BASE_URL}/api/stats/venue-coverage"
check_url_ok "public /api/tokens" "${BASE_URL}/api/tokens?chain_id=${CHAIN_ID}&limit=20"
freshness_json="$(curl -fsS "${auth_args[@]}" "${BASE_URL}/api/stats/freshness")"
if JSON_INPUT="${freshness_json}" python3 - "${CHAIN_ID}" <<'PY'
import json, os, sys
rows = json.loads(os.environ["JSON_INPUT"])
cid = int(sys.argv[1])
row = next((r for r in rows if int(r["chain_id"]) == cid), None)
assert row is not None
assert int(row["pools_with_recent_state"]) > 0
assert int(row["reserve_rows"]) > 0
assert int(row["latest_observed_block"]) > 0
PY
then
pass "freshness summary contains live Chain ${CHAIN_ID} state"
else
fail "freshness summary contains live Chain ${CHAIN_ID} state"
fi
coverage_json="$(curl -fsS "${auth_args[@]}" "${BASE_URL}/api/stats/venue-coverage")"
if JSON_INPUT="${coverage_json}" python3 - "${CHAIN_ID}" <<'PY'
import json, os, sys
rows = json.loads(os.environ["JSON_INPUT"])
cid = int(sys.argv[1])
chain_rows = [r for r in rows if int(r["chain_id"]) == cid]
assert chain_rows
assert any(int(r["pools_with_state"]) > 0 for r in chain_rows)
PY
then
pass "venue coverage contains active Chain ${CHAIN_ID} venues"
else
fail "venue coverage contains active Chain ${CHAIN_ID} venues"
fi
pools_json="$(curl -fsS "${auth_args[@]}" "${BASE_URL}/api/pools?chain_id=${CHAIN_ID}&limit=20")"
if JSON_INPUT="${pools_json}" python3 - "${CHAIN_ID}" <<'PY'
import json, os, sys
rows = json.loads(os.environ["JSON_INPUT"])
cid = int(sys.argv[1])
assert rows
assert any(int(r["chain_id"]) == cid for r in rows)
assert any(r.get("dex") == "dodo_pmm" for r in rows)
assert any(r.get("dex") == "dodo_d3mm" for r in rows)
assert any(
str(r.get("pool_id", "")).lower() == "0xc39b7d0f40838cbfb54649d327f49a6dac964062"
and str(r.get("token_a", "")).lower() == "0xf22258f57794cc8e06237084b353ab30fffa640b"
and str(r.get("token_b", "")).lower() == "0x71d6687f38b93ccad569fa6352c876eea967201b"
for r in rows
)
PY
then
pass "pools endpoint exposes canonical Chain ${CHAIN_ID} DODO metadata"
else
fail "pools endpoint exposes canonical Chain ${CHAIN_ID} DODO metadata"
fi
tokens_json="$(curl -fsS "${auth_args[@]}" "${BASE_URL}/api/tokens?chain_id=${CHAIN_ID}&limit=20")"
if JSON_INPUT="${tokens_json}" python3 - "${CHAIN_ID}" <<'PY'
import json, os, sys
rows = json.loads(os.environ["JSON_INPUT"])
cid = int(sys.argv[1])
symbols = {r.get("symbol") for r in rows if int(r.get("chain_id", 0)) == cid}
assert {"cUSDT", "cUSDC", "USDT", "USDC", "WETH10"}.issubset(symbols)
PY
then
pass "tokens endpoint exposes canonical Chain ${CHAIN_ID} symbols"
else
fail "tokens endpoint exposes canonical Chain ${CHAIN_ID} symbols"
fi
reserve_json="$(curl -fsS "${auth_args[@]}" "${BASE_URL}/api/reserve_state?chain_id=${CHAIN_ID}&limit=20")"
if JSON_INPUT="${reserve_json}" python3 - "${CHAIN_ID}" <<'PY'
import json, os, sys
rows = json.loads(os.environ["JSON_INPUT"])
cid = int(sys.argv[1])
assert rows
assert any(int(r["chain_id"]) == cid for r in rows)
assert any(str(r["reserve_a"]) not in ("0", "0x0") and str(r["reserve_b"]) not in ("0", "0x0") for r in rows)
PY
then
pass "reserve_state exposes nonzero Chain ${CHAIN_ID} liquidity rows"
else
fail "reserve_state exposes nonzero Chain ${CHAIN_ID} liquidity rows"
fi
if [[ "${RUN_NATIVE_DODO}" == "1" ]]; then
if bash "${PROJECT_ROOT}/scripts/verify/check-chain138-native-dodo-read-surfaces.sh"; then
pass "native Chain 138 DODO read surfaces"
else
fail "native Chain 138 DODO read surfaces"
fi
fi
printf '\nSummary: %s passed, %s failed\n' "${pass_count}" "${fail_count}"
if (( fail_count > 0 )); then
exit 1
fi