Files
proxmox/scripts/verify/check-cwusdc-etherscan-prereq-urls.sh
defiQUG 4ebf2d7902
Some checks failed
Deploy to Phoenix / validate (push) Failing after 1s
Deploy to Phoenix / deploy (push) Has been skipped
Deploy to Phoenix / deploy-atomic-swap-dapp (push) Has been skipped
Deploy to Phoenix / cloudflare (push) Has been skipped
chore(repo): sync operator workspace (config, scripts, docs, multi-chain)
Add optional Cosmos/Engine-X/act-runner templates, CWUSDC/EI-matrix tooling,
non-EVM route planner in multi-chain-execution (tests passing), token list and
extraction updates, and documentation (MetaMask matrix, GRU/CWUSDC packets).

Ignore institutional evidence tarballs/sha256 under reports/status.

Validated with: bash scripts/verify/run-all-validation.sh --skip-genesis

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 16:25:08 -07:00

146 lines
4.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Public URL prereq checks for cWUSDC Etherscan token profile (d-bis.org surfaces).
# See: docs/04-configuration/etherscan/CWUSDC_ETHERSCAN_E2E_RECOMMENDATIONS.md
# Usage: bash scripts/verify/check-cwusdc-etherscan-prereq-urls.sh [--json-out PATH] [--md-out PATH] [--timeout SEC] [--retries N]
# Exit: 0 if every URL returns HTTP 200; 1 otherwise.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
cd "$PROJECT_ROOT"
JSON_OUT=""
MD_OUT=""
TIMEOUT="${CWUSDC_PROVIDER_URL_TIMEOUT:-15}"
RETRIES="${CWUSDC_PROVIDER_URL_RETRIES:-1}"
while [[ $# -gt 0 ]]; do
case "$1" in
--json-out)
[[ $# -ge 2 ]] || { echo "Missing value for --json-out" >&2; exit 1; }
JSON_OUT="$2"
shift 2
;;
--md-out)
[[ $# -ge 2 ]] || { echo "Missing value for --md-out" >&2; exit 1; }
MD_OUT="$2"
shift 2
;;
--timeout)
[[ $# -ge 2 ]] || { echo "Missing value for --timeout" >&2; exit 1; }
TIMEOUT="$2"
shift 2
;;
--retries)
[[ $# -ge 2 ]] || { echo "Missing value for --retries" >&2; exit 1; }
RETRIES="$2"
shift 2
;;
-h|--help)
sed -n '1,5p' "$0"
exit 0
;;
*)
echo "Unknown argument: $1" >&2
exit 1
;;
esac
done
TMP_TSV="$(mktemp)"
trap 'rm -f "$TMP_TSV"' EXIT
FAIL=0
while IFS= read -r url; do
[[ -z "$url" || "$url" =~ ^# ]] && continue
code="000"
curl_status=0
attempts=0
max_attempts=$((RETRIES + 1))
while [[ "$attempts" -lt "$max_attempts" ]]; do
attempts=$((attempts + 1))
curl_status=0
code=$(curl -L --max-time "$TIMEOUT" -o /dev/null -s -w "%{http_code}" "$url") || curl_status=$?
[[ -n "$code" ]] || code="000"
[[ "$code" == "200" ]] && break
[[ "$attempts" -lt "$max_attempts" ]] && sleep 1
done
if [[ "$code" != "200" ]]; then
echo "FAIL $code $url (attempts=$attempts curl_status=$curl_status)" >&2
FAIL=1
printf '%s\t%s\t%s\t%s\t%s\n' "$url" "$code" "false" "$attempts" "$curl_status" >> "$TMP_TSV"
else
echo "OK 200 $url (attempts=$attempts)"
printf '%s\t%s\t%s\t%s\t%s\n' "$url" "$code" "true" "$attempts" "$curl_status" >> "$TMP_TSV"
fi
done <<'URLS'
https://d-bis.org/
https://d-bis.org/contact
https://d-bis.org/leadership
https://d-bis.org/gru/tokens
https://d-bis.org/security
https://d-bis.org/.well-known/trust.json
https://d-bis.org/brand-assets
https://d-bis.org/tokens/cwusdc.svg
URLS
if [[ -n "$JSON_OUT" || -n "$MD_OUT" ]]; then
python3 - "$TMP_TSV" "$JSON_OUT" "$MD_OUT" <<'PY'
import json
import sys
from datetime import datetime, timezone
from pathlib import Path
tsv = Path(sys.argv[1])
json_out = Path(sys.argv[2]) if sys.argv[2] else None
md_out = Path(sys.argv[3]) if sys.argv[3] else None
checks = []
for line in tsv.read_text().splitlines():
url, status, passed, attempts, curl_status = line.split("\t")
checks.append({
"url": url,
"status": int(status) if status.isdigit() else status,
"passed": passed == "true",
"attempts": int(attempts),
"curlStatus": int(curl_status),
})
payload = {
"schema": "cwusdc-etherscan-prereq-urls/v1",
"generatedAt": datetime.now(timezone.utc).isoformat(),
"summary": {
"allPassed": all(check["passed"] for check in checks),
"requiredCount": len(checks),
"passedCount": sum(1 for check in checks if check["passed"]),
"failedUrls": [check["url"] for check in checks if not check["passed"]],
},
"checks": checks,
}
if json_out:
json_out.parent.mkdir(parents=True, exist_ok=True)
json_out.write_text(json.dumps(payload, indent=2) + "\n")
print(f"Wrote {json_out}")
if md_out:
md_out.parent.mkdir(parents=True, exist_ok=True)
lines = [
"# cWUSDC Etherscan Prerequisite URL Evidence",
"",
f"- Generated: `{payload['generatedAt']}`",
f"- All passed: `{payload['summary']['allPassed']}`",
f"- Passed: `{payload['summary']['passedCount']} / {payload['summary']['requiredCount']}`",
"",
"| URL | Passed | HTTP | Attempts | curl status |",
"|---|---:|---:|---:|---:|",
]
for check in checks:
lines.append(f"| {check['url']} | `{check['passed']}` | `{check['status']}` | `{check['attempts']}` | `{check['curlStatus']}` |")
md_out.write_text("\n".join(lines) + "\n")
print(f"Wrote {md_out}")
PY
fi
exit "$FAIL"