fix(security): resolve S110, S324, S311 ruff violations across app and tests

This commit is contained in:
Crypto Rug Munch 2026-07-07 18:31:51 +07:00
parent c1d1fc82ee
commit 839819df17
201 changed files with 1045 additions and 762 deletions

View file

@ -100,7 +100,7 @@ async def get_wallet_balance(address: str, chain: str) -> dict[str, Any]:
}
result["token_balances"] = list(tokens.values())[:50]
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -286,7 +286,7 @@ async def trace_funding(address: str, chain: str, max_hops: int = 5, max_depth:
hops.append(hop)
visited.add(pa.lower())
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
depth += 1
@ -688,7 +688,7 @@ async def analyze_contract_rug_risk(token_address: str, chain: str, tier: str =
risk_score += 15
risk_flags.append("ONE_SIDED_SELLING")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── Birdeye (5 factors) ──
try:
@ -708,7 +708,7 @@ async def analyze_contract_rug_risk(token_address: str, chain: str, tier: str =
risk_flags.append("MINT_AUTHORITY")
factors_checked += 5
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── Aggregate scores ──
report.rug_risk_score = min(100, max(0, risk_score))

View file

@ -419,7 +419,7 @@ async def check_cache(msg: str, agent_id: str) -> str | None:
logger.info(f"Cache hit for {agent_id}: {cache_key}")
return cached
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -440,7 +440,7 @@ async def store_cache(msg: str, agent_id: str, response: str, ttl: int = 3600):
if len(response) > 200:
r.setex(cache_key, ttl, response[:4000]) # Cap stored size
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ═══════════════════════════════════════════════════════════
@ -527,7 +527,7 @@ async def route_and_stream(msg: str, role_hint: str = "") -> AsyncGenerator[dict
full_response += txt
yield {"type": "token", "text": txt}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
if full_response:
await store_cache(msg, agent_id, full_response)
yield {"type": "done"}
@ -592,7 +592,7 @@ async def route_and_stream(msg: str, role_hint: str = "") -> AsyncGenerator[dict
full_response += txt
yield {"type": "token", "text": txt}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
if full_response:
await store_cache(msg, agent_id, full_response)
yield {"type": "done"}

View file

@ -23,7 +23,7 @@ _cache = {}
def _cached_call(system: str, prompt: str, max_tokens: int = 250, temp: float = 0.3) -> str:
key = hashlib.md5(f"{system[:50]}|{prompt[:100]}".encode()).hexdigest()
key = hashlib.sha256(f"{system[:50]}|{prompt[:100]}".encode()).hexdigest()
now = time.time()
if key in _cache and now - _cache[key][0] < CACHE_TTL:
return _cache[key][1]

View file

@ -33,7 +33,7 @@ try:
_redis.ping()
REDIS_AVAILABLE = True
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
def _cache_get(key: str) -> str | None:
@ -41,7 +41,7 @@ def _cache_get(key: str) -> str | None:
try:
return _redis.get(f"rmi:ai:{key}")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -67,7 +67,7 @@ def usage_stats() -> dict:
# ── Retry with Exponential Backoff ──
def _call_ollama(system: str, prompt: str, max_tokens: int = 250, temp: float = 0.3, cache_ttl: int = 300) -> str:
cache_key = hashlib.md5(f"{system[:60]}|{prompt[:120]}".encode()).hexdigest()
cache_key = hashlib.sha256(f"{system[:60]}|{prompt[:120]}".encode()).hexdigest()
cached = _cache_get(cache_key)
if cached:
val = cached.decode() if isinstance(cached, bytes) else cached

View file

@ -436,7 +436,7 @@ async def sentiment_token(address: str):
"source": "dexscreener",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return {"token": address, "sentiment": "unknown"}
@ -498,7 +498,7 @@ async def mempool_status():
"timestamp": datetime.now(UTC).isoformat(),
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return {"error": "Mempool data unavailable"}

View file

@ -99,7 +99,7 @@ def embed_bundle_profile(bundle: dict[str, Any]) -> list[float]:
key_addrs = str(bundle.get("common_funder_address", ""))
key_addrs += str(bundle.get("token_address", ""))
key_addrs += ",".join(sorted(bundle.get("bundle_wallets", [])[:10]))
addr_hash = hashlib.md5(key_addrs.encode()).digest()
addr_hash = hashlib.sha256(key_addrs.encode()).digest()
for i in range(16):
vec[32 + i] = addr_hash[i] / 255.0
@ -289,7 +289,7 @@ def embed_cluster_profile(cluster: dict[str, Any]) -> list[float]:
# ── Entity fingerprint (dims 60-79) ──
entity_id = str(cluster.get("entity_id", ""))
if entity_id:
eh = hashlib.md5(entity_id.encode()).digest()
eh = hashlib.sha256(entity_id.encode()).digest()
for i in range(16):
vec[60 + i] = eh[i] / 255.0
@ -568,7 +568,7 @@ async def search_clusters_by_description(
)
r["metadata"]["auto_label"] = labeling
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return results

View file

@ -29,6 +29,7 @@ import os
import time
from collections.abc import Callable
from typing import Any
import logging
# ═══════════════════════════════════════════════════════════════
# PROVIDER CONFIG - TTLs, rate limits, credit tracking
@ -249,7 +250,7 @@ class RMICache:
if raw:
return json.loads(raw)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
async def _redis_set(self, key: str, value: Any, ttl: int):
@ -257,7 +258,7 @@ class RMICache:
if await self._redis_ping():
await self._redis.setex(f"rmi:cache:{key}", ttl, json.dumps(value, default=str))
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
def _mem_get(self, key: str) -> Any | None:
entry = self._memory.get(key)
@ -414,7 +415,7 @@ class RMICache:
if self._redis and self._redis_available:
await self._redis.delete(f"rmi:cache:{key}")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
self._memory.pop(key, None)

View file

@ -55,7 +55,7 @@ async def get_fear_greed() -> dict:
"timestamp": current.get("timestamp", ""),
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return {"value": 50, "classification": "Neutral"}
@ -76,7 +76,7 @@ async def get_top_movers() -> dict:
"trending_score": [c.get("item", {}).get("market_cap_rank") for c in coins[:5]],
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return {"trending": [], "trending_score": []}
@ -101,7 +101,7 @@ async def get_security_alerts() -> dict:
}
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
try:
# Check RugCheck for recent rug pulls
@ -116,7 +116,7 @@ async def get_security_alerts() -> dict:
}
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return {"alerts": alerts, "count": len(alerts)}
@ -134,7 +134,7 @@ async def get_whale_activity() -> dict:
high_volume = list(trending.get("data", trending.get("tokens", []))[:5])
return {"trending_high_volume": len(high_volume), "chains": ["solana"]}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return {"trending_high_volume": 0}
@ -156,7 +156,7 @@ async def get_prediction_markets() -> dict:
)
return {"active_markets": len(markets), "top_markets": markets}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return {"active_markets": 0, "top_markets": []}

View file

@ -212,7 +212,7 @@ class UnifiedDataEngine:
data = r.json()
return {"price_usd": float(data.get("outAmount", 0)) / 1e6, "source": "jupiter"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
async def _tracker_price(self, mint: str, **kw) -> dict | None:
@ -244,7 +244,7 @@ class UnifiedDataEngine:
"source": "dexscreener",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
async def _binance_price(self, mint: str, **kw) -> dict | None:
@ -256,7 +256,7 @@ class UnifiedDataEngine:
if r.status_code == 200:
return {"price_usd": float(r.json().get("price", 0)), "source": "binance"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
async def _coingecko_price(self, mint: str, **kw) -> dict | None:
@ -273,7 +273,7 @@ class UnifiedDataEngine:
if price:
return {"price_usd": price, "source": "coingecko"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
# ── TOKEN METADATA ──
@ -324,7 +324,7 @@ class UnifiedDataEngine:
"source": "jupiter",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
async def _dexscreener_meta(self, mint: str, **kw) -> dict | None:
@ -341,7 +341,7 @@ class UnifiedDataEngine:
"source": "dexscreener",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
# ── WALLET BALANCE ──
@ -395,7 +395,7 @@ class UnifiedDataEngine:
val = r.json().get("result", {}).get("value", 0)
return {"balance_lamports": val, "source": "publicnode"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
# ── RISK SCAN ──
@ -416,7 +416,7 @@ class UnifiedDataEngine:
"source": "goplus",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
async def _rugcheck_scan(self, address: str, **kw) -> dict | None:
@ -430,7 +430,7 @@ class UnifiedDataEngine:
risks = [r.get("name", "") for r in data.get("risks", []) if r.get("score", 0) > 1000]
return {"risks": risks, "score": data.get("score", 0), "source": "rugcheck"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
async def _honeypot_scan(self, address: str, **kw) -> dict | None:
@ -446,7 +446,7 @@ class UnifiedDataEngine:
"source": "honeypot",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
async def _local_labels(self, address: str, **kw) -> dict | None:
@ -457,7 +457,7 @@ class UnifiedDataEngine:
if label:
return {"label": label, "source": "local_labels"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
# ── FUNDING SOURCE (EVM) ──
@ -543,7 +543,7 @@ class UnifiedDataEngine:
}
return {"signatures_found": len(sigs), "source": "helius"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
async def _tracker_sol_funding(self, address: str, **kw) -> dict | None:
@ -577,7 +577,7 @@ class UnifiedDataEngine:
sigs = r.json().get("result", [])
return {"signatures_found": len(sigs), "source": "public_rpc"} if sigs else None
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
async def _local_wallet_labels(self, address: str, **kw) -> dict | None:
@ -604,7 +604,7 @@ class UnifiedDataEngine:
"source": "local_wallet_labels",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
# ═══════════════════════════════════════════════════════════════════════

View file

@ -401,7 +401,7 @@ async def _is_contract(address: str, chain_id: int) -> bool:
code = result.value
return code != "0x" and len(str(code)) > 4
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return False

View file

@ -15,7 +15,7 @@ Our target: 30,000/month (60% headroom)
import logging
import os
import random
import secrets
logger = logging.getLogger("langfuse_sampler")
@ -55,7 +55,7 @@ def should_send_to_cloud(
return True
# Sample normal background traces
if random.random() < SAMPLING_RATE:
if secrets.SystemRandom().random() < SAMPLING_RATE:
_counters["sampled"] += 1
return True

View file

@ -148,7 +148,7 @@ class LocalMCPClient:
if isinstance(bin_val, dict):
return {"command": ["node", next(iter(bin_val.values()))]}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Check for Python entrypoint
for entry in ["server.py", "mcp_server.py", "main.py", "__main__.py"]:

View file

@ -226,7 +226,7 @@ async def fetch_all_news() -> list[NewsArticle]:
if r.status_code == 200:
feed = feedparser.parse(r.text)
for entry in feed.entries[:5]: # Top 5 per source
article_id = hashlib.md5(entry.link.encode()).hexdigest()[:12]
article_id = hashlib.sha256(entry.link.encode()).hexdigest()[:12]
summary = entry.get("summary", entry.get("description", ""))[:300]
title = entry.title
@ -327,7 +327,7 @@ async def comment(article_id: str, user: str, text: str) -> dict:
return {"error": "Article not found"}
comment = {
"id": hashlib.md5(f"{article_id}{time.time()}".encode()).hexdigest()[:8],
"id": hashlib.sha256(f"{article_id}{time.time()}".encode()).hexdigest()[:8],
"user": user[:50],
"text": text[:500],
"timestamp": datetime.now(UTC).isoformat(),

View file

@ -290,7 +290,7 @@ async def fetch_all(max_per_source: int = 8) -> list[Article]:
if r.status_code == 200:
feed = feedparser.parse(r.text)
for entry in feed.entries[:max_per_source]:
aid = hashlib.md5((entry.link or entry.title).encode()).hexdigest()[:12]
aid = hashlib.sha256((entry.link or entry.title).encode()).hexdigest()[:12]
if aid in _db:
continue
@ -348,7 +348,7 @@ async def fetch_all(max_per_source: int = 8) -> list[Article]:
_db[aid] = article
new_articles.append(article)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
await asyncio.gather(*[fetch_source(s) for s in NEWS_SOURCES])
return new_articles
@ -449,7 +449,7 @@ def add_comment(article_id: str, user: str, text: str) -> dict:
if not a:
return {"error": "Not found"}
comment = {
"id": hashlib.md5(f"{article_id}{time.time()}".encode()).hexdigest()[:8],
"id": hashlib.sha256(f"{article_id}{time.time()}".encode()).hexdigest()[:8],
"user": user[:50],
"text": text[:500],
"timestamp": datetime.now(UTC).isoformat(),

View file

@ -256,7 +256,7 @@ class RpcRateLimiter:
if tokens is not None and last is not None:
return (float(tokens), float(last), 0)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
async with self._mem_lock:
bucket = self._mem_buckets.get(provider)
if bucket:

View file

@ -16,7 +16,6 @@ import hashlib
import json
import logging
import os
import random
import time
import zlib
from dataclasses import dataclass
@ -24,6 +23,7 @@ from dataclasses import dataclass
import redis.asyncio as aioredis
from app.consensus_rpc import ConsensusResult, get_consensus_rpc
import secrets
logger = logging.getLogger("rpc_cache")
@ -166,7 +166,7 @@ class RpcCacheClient:
def get_ttl(method):
base = TTL_TABLE.get(method, TTL_TABLE["_default"])
base = max(MIN_TTL, min(MAX_TTL, base))
jitter = base * TTL_JITTER_PCT * (random.random() * 2 - 1)
jitter = base * TTL_JITTER_PCT * (secrets.SystemRandom().random() * 2 - 1)
return max(MIN_TTL, base + jitter)
# ── Serialization ───────────────────────────────────────────────────
@ -351,13 +351,13 @@ class RpcCacheClient:
await redis.delete(key_str)
deleted += 1
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
if cursor == 0:
break
if deleted:
logger.debug(f"Invalidated {deleted} cache entries for {address[:12]}...")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── Health ──────────────────────────────────────────────────────────
@ -369,7 +369,7 @@ class RpcCacheClient:
await redis.ping()
redis_ok = True
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
async with self._l1_lock:
l1_size = len(self._l1)
return {

View file

@ -195,7 +195,7 @@ async def get_twitter_feed(limit: int = 30) -> dict:
if title and "RT @" not in title:
tweets.append(
{
"id": hashlib.md5(link.encode()).hexdigest()[:12],
"id": hashlib.sha256(link.encode()).hexdigest()[:12],
"text": title.replace(f"{account['name']}: ", ""),
"author": account["name"],
"handle": account["handle"],

View file

@ -12,6 +12,7 @@ Usage in x402 routers:
"""
from app.caching_shield.unified_layer import get_data_layer
import logging
class ToolData:
@ -73,7 +74,7 @@ class ToolData:
return None
return result
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
try:
r = await self._layer.fetch(tool_id, **params)
@ -85,7 +86,7 @@ class ToolData:
return None
return result
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Tool not available via DataBus - return None so middleware falls back
return None

View file

@ -190,7 +190,7 @@ class WsClientManager:
await redis.ping()
redis_ok = True
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
async with self._lock:
client_counts = {ch: len(clients) for ch, clients in self._clients.items()}

View file

@ -367,7 +367,7 @@ def generate_card(card_type: str, data: dict) -> dict:
else:
value = field_config["format"].format(**{field_name: value, **data})
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Draw text
position = field_config["position"]
@ -390,7 +390,7 @@ def generate_card(card_type: str, data: dict) -> dict:
)
# Generate unique filename
data_hash = hashlib.md5(str(sorted(data.items())).encode()).hexdigest()[:12]
data_hash = hashlib.sha256(str(sorted(data.items())).encode()).hexdigest()[:12]
timestamp = datetime.now(UTC).strftime("%Y%m%d_%H%M%S")
filename = f"{card_type}_{timestamp}_{data_hash}.png"
output_path = os.path.join(GENERATED_DIR, filename)

View file

@ -96,7 +96,7 @@ async def compute_deployer_posterior(
import json as _json
return _json.loads(cached)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── Update prior from observations ──
alpha = float(PRIOR_WEIGHTS["prior_alpha"])
@ -157,7 +157,7 @@ async def compute_deployer_posterior(
import json as _json
await catalog._redis.setex(cache_key, 3600, _json.dumps(result))
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result

View file

@ -410,7 +410,7 @@ class CatalogService:
if cached:
return json.loads(cached)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
token = await self.get_token(chain, address)
deployer_reputation: int | None = None

View file

@ -104,7 +104,7 @@ class ChainClient:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -134,7 +134,7 @@ class ChainClient:
if data and isinstance(data, list) and len(data) > 0:
return data[0]
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None

View file

@ -658,7 +658,7 @@ class CloneScanner:
# Flag if deployer created > 20 tokens
result["clone_deployer"] = len(tokens) > 20
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result

View file

@ -128,7 +128,7 @@ def chunk_document(
except ImportError:
pass
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
chunks = []
start = 0

View file

@ -199,7 +199,7 @@ async def _background_refresh(url: str, headers: dict | None, timeout: float, ca
if resp.status_code == 200:
_cache[cache_key] = (time.time(), resp.json())
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── RPC Storage Slot Reader ──────────────────────────────────────
@ -363,7 +363,7 @@ def _detect_proxy_selectors(abi_json: str) -> list[str]:
if selector in DANGEROUS_SELECTORS:
detected.append(selector)
except (json.JSONDecodeError, Exception):
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return detected
@ -531,7 +531,7 @@ async def check_timelock(address: str, chain: str) -> str | None:
if result and int(result, 16) > 0:
return "active"
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return "no_timelock"

View file

@ -6,6 +6,7 @@ from datetime import UTC, datetime
import httpx
from fastapi import APIRouter
import logging
MEMGRAPH_URI = os.getenv("MEMGRAPH_URI", "bolt://localhost:7687")
MEMGRAPH_USER = os.getenv("MEMGRAPH_USER", "")
@ -26,7 +27,7 @@ async def _run_query(query: str, params: dict | None = None) -> list:
if r.status_code == 200:
return r.json().get("data", [])
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return []

View file

@ -5,6 +5,7 @@ or the `langfuse` package is not installed.
"""
import os
import logging
LANGFUSE_ENABLED = bool(
os.getenv("LANGFUSE_PUBLIC_KEY", "") and os.getenv("LANGFUSE_SECRET_KEY", "")
@ -46,4 +47,4 @@ def flush_langfuse() -> None:
except ImportError:
pass
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)

View file

@ -3,6 +3,7 @@
import hashlib
import json
import os
import logging
REDIS_URL = os.getenv("REDIS_CACHE_URL", "redis://localhost:6379/1")
CACHE_TTL = int(os.getenv("LLM_CACHE_TTL", "3600"))
@ -22,7 +23,7 @@ def get_cached(prompt: str, model: str) -> dict | None:
if data:
return json.loads(data)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -34,7 +35,7 @@ def set_cached(prompt: str, model: str, result: dict, ttl: int = CACHE_TTL):
r = redis.from_url(REDIS_URL, decode_responses=True)
r.setex(_cache_key(prompt, model), ttl, json.dumps(result))
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
def get_cache_stats() -> dict:

View file

@ -6,6 +6,7 @@ import uuid
from fastapi import Request
from fastapi.responses import JSONResponse
import logging
# ═══════════════════════════════════════════════════════════════
# Rate-limit config
@ -43,7 +44,7 @@ async def cache_middleware(request: Request, call_next):
if cached:
return JSONResponse(content=cached, headers={"X-Cache": "HIT", "X-Cache-TTL": "60"})
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
response = await call_next(request)
if response.status_code == 200:
@ -59,7 +60,7 @@ async def cache_middleware(request: Request, call_next):
headers={**dict(response.headers), "X-Cache": "MISS"},
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return response
@ -87,7 +88,7 @@ async def emergency_lockdown_middleware(request: Request, call_next):
content={"error": "Service Unavailable", "detail": "System is in emergency lockdown."},
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return await call_next(request)

View file

@ -102,5 +102,5 @@ async def mistral_moderate(text: str) -> dict | None:
if r.status_code == 200:
return {"flagged": False, "provider": "mistral"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None

View file

@ -3,6 +3,7 @@ Priority: real-time → Cerebras (9ms), cheap → Ollama ($0), complex → DeepS
from dataclasses import dataclass
from enum import Enum
import logging
class TaskType(Enum):
@ -119,5 +120,5 @@ async def _call_provider(provider: str, model: str, prompt: str, **kwargs):
return {"response": r.json()["response"], "model": model, "provider": "ollama"}
# DeepSeek, Groq, Gemini handled via existing DataBus providers
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None

View file

@ -148,4 +148,4 @@ def flush_sentry(timeout: float = 2.0) -> None:
import sentry_sdk
sentry_sdk.flush(timeout=timeout)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)

View file

@ -7,6 +7,7 @@ from typing import Any
import yaml
from fastapi import APIRouter
import logging
PROMPTS_DIR = Path(os.getenv("PROMPTS_DIR", str(Path(__file__).parent.parent.parent / "prompts")))
router = APIRouter(prefix="/api/v1/prompts", tags=["prompts"])
@ -37,7 +38,7 @@ def load_all_prompts() -> dict[str, dict]:
"file": str(f),
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return _registry

View file

@ -13,6 +13,7 @@ from enum import StrEnum
from fastapi import APIRouter, Header
from pydantic import BaseModel
import logging
router = APIRouter(prefix="/api/v1/rate-limits", tags=["rate-limits"])
@ -131,7 +132,7 @@ def get_user_tier(user_id: str) -> Tier:
if tier:
return Tier(tier)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return Tier.FREE
@ -231,7 +232,7 @@ async def upgrade_tier(req: UpgradeRequest) -> dict:
r = _get_redis()
r.set(f"rmi:user_tier:{_hash_identifier(req.user_id)}", req.tier.value)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return {
"status": "upgraded",

View file

@ -10,6 +10,7 @@ from datetime import UTC, datetime
import httpx
from app.core.logging import get_logger
import logging
logger = get_logger(__name__)
@ -99,7 +100,7 @@ async def publish_signal(signal: dict):
headers={"Content-Type": "application/vnd.kafka.json.v2+json"},
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
async def main():

View file

@ -5,6 +5,7 @@ import time
import uuid
from fastapi import FastAPI, Request
import logging
TRACING_ENABLED = os.getenv("OTEL_ENABLED", "false").lower() == "true"
OTEL_ENDPOINT = os.getenv("OTEL_EXPORTER_OTLP_ENDPOINT", "")
@ -74,7 +75,7 @@ def shutdown_otel() -> None:
except ImportError:
pass
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
def start_span(name: str, attributes: dict | None = None) -> dict:

View file

@ -64,5 +64,5 @@ async def tron_transactions(address: str, limit: int = 10) -> dict | None:
"provider": "trongrid",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None

View file

@ -366,7 +366,7 @@ def extract_wallet_features(wallet_data: dict) -> np.ndarray:
# ── Entity cluster hash (dims 30-39) ──
cluster = str(wallet_data.get("cluster_id", ""))
if cluster:
ch = hashlib.md5(cluster.encode()).digest()
ch = hashlib.sha256(cluster.encode()).digest()
for i in range(10):
vec[30 + i] = ch[i] / 255.0
@ -464,7 +464,7 @@ class OllamaBGEEmbedder:
results.append(vec)
continue
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Fallback: zero vector
results.append([0.0] * self.DIMS)
return results
@ -764,7 +764,7 @@ class CryptoEmbedder:
vec = np.zeros(dims, dtype=np.float32)
words = re.findall(r"\w+", text.lower())
for word in words:
h = int(hashlib.md5(word.encode()).hexdigest(), 16)
h = int(hashlib.sha256(word.encode()).hexdigest(), 16)
for i in range(min(8, dims)):
vec[(h + i) % dims] += 0.01
norm = np.linalg.norm(vec)
@ -783,7 +783,7 @@ class CryptoEmbedder:
return json.loads(data)
self._cache_misses += 1
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
async def _cache_set(self, key: str, vector: list[float], ttl: int = 86400):
@ -791,7 +791,7 @@ class CryptoEmbedder:
r = await self._get_redis()
await r.setex(key, ttl, json.dumps(vector))
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ─── SPECIALIZED EMBED METHODS ────────────────────────────────

View file

@ -615,7 +615,7 @@ class DefiProtocolAuditor:
elif age_days < 90:
report.tvl_score.flags.append(f"Recently launched ({age_days} days old)")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
def _score_social(self, report: SafetyReport, social: dict):
"""Score based on social sentiment signals."""

View file

@ -779,7 +779,7 @@ class AdminUserStore:
client = create_client(supabase_url, supabase_key)
client.table("admin_users").upsert(admin).execute()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return True

View file

@ -15,7 +15,7 @@ def _read_env_file() -> dict[str, str]:
k, _, v = chunk.partition(b"=")
env[k.decode("utf-8", "replace")] = v.decode("utf-8", "replace")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return env
@ -66,6 +66,7 @@ from app.domains.alerts.models import ( # noqa: E402
)
from app.domains.alerts.repository import AlertRepository # noqa: E402
from app.domains.alerts.service import AlertService # noqa: E402
import logging
__all__ = [
"AlertBroadcaster",

View file

@ -263,7 +263,7 @@ def _get_pay_to_address(chain: str) -> str:
if w.chain == chain and w.x402_enabled and w.status == "active":
return w.address
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Fallback: env vars
if chain == "eth":
return os.getenv("X402_EVM_PAY_TO", "0x1E3AC01d0fdb976179790BDD02823196A92705C9")
@ -1066,7 +1066,7 @@ def parse_x_pay_header(header_value: str) -> dict | None:
except (MemoryError, KeyboardInterrupt, SystemExit):
raise # Never catch these
except Exception:
pass # Not base64, try other formats
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# v1 legacy: "x402 <json>" or "X-Pay: <json>"
if stripped.startswith("x402 "):
@ -1452,7 +1452,7 @@ async def self_verify_evm_usdc(payload: dict, chain_key: str, chain_cfg: dict) -
)
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
logger.info(
f"Verified USDC payment: {tx_hash[:16]}... on {chain_key} "
@ -1700,7 +1700,7 @@ async def x402_enforcement_middleware(request: Request, call_next) -> Response:
headers={**SECURITY_HEADERS, "Retry-After": str(BURST_WINDOW)},
)
except Exception:
pass # Don't block on burst tracking errors
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Free paths already checked above - flow continues to paid tool enforcement
# Extract tool name
@ -1900,7 +1900,7 @@ async def x402_enforcement_middleware(request: Request, call_next) -> Response:
record_payment_success(facilitator, False)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# No valid payment - check free trials
try:
@ -2077,7 +2077,7 @@ async def x402_enforcement_middleware(request: Request, call_next) -> Response:
if r.exists(key):
r.decr(key) # Roll back the consumption only if key exists
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Return 402 - trial should be refunded since we couldn't execute
return build_402_response(tool_id, client_id=client_id)

View file

@ -227,7 +227,7 @@ async def _audit_solana(address: str) -> dict:
}
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 2: Solana RPC - get account info
try:
@ -239,7 +239,7 @@ async def _audit_solana(address: str) -> dict:
else:
result["account_exists"] = False
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 3: Birdeye public API
try:
@ -251,7 +251,7 @@ async def _audit_solana(address: str) -> dict:
result["birdeye"] = data["data"]
result["sources_used"].append("birdeye")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 4: Jupiter token list
try:
@ -267,7 +267,7 @@ async def _audit_solana(address: str) -> dict:
}
result["sources_used"].append("jupiter")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 5: Coingecko
try:
@ -276,7 +276,7 @@ async def _audit_solana(address: str) -> dict:
result["coingecko"] = {"name": data.get("name"), "symbol": data.get("symbol")}
result["sources_used"].append("coingecko")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Compute risk score from available data
risk_score = 0
@ -354,7 +354,7 @@ async def _audit_evm(address: str, chain: str) -> dict:
}
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 2: Basescan / Etherscan
explorer_key = "BASESCAN_KEY" if chain == "base" else "ETHERSCAN_KEY"
@ -377,7 +377,7 @@ async def _audit_evm(address: str, chain: str) -> dict:
result["verified"] = False
result["findings"].append("Contract not verified on explorer")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 3: Chain RPC
try:
@ -389,7 +389,7 @@ async def _audit_evm(address: str, chain: str) -> dict:
result["is_contract"] = False
result["findings"].append("Address is not a contract")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Risk computation
risk_score = 0
@ -554,7 +554,7 @@ try:
TOOL_ALIASES.update(EXPANDED_ALIASES)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── Human Payment - Multi-Chain Wallet Pay-Per-Call ────────────
@ -721,7 +721,7 @@ def _resolve_pay_to(chain: str) -> str:
if w.chain == wm_chain and w.x402_enabled and w.status == "active":
return w.address
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Fallback: env vars
fallbacks = {
"base": "X402_EVM_PAY_TO",

View file

@ -18,6 +18,7 @@ from datetime import datetime
from urllib.parse import quote
from fastapi import APIRouter, HTTPException
import logging
from app.domains.billing.x402.shared import (
GenericRequest,
@ -52,7 +53,7 @@ async def _sentiment_analysis(token: str, chain: str) -> dict:
}
result["sources_used"].append("coingecko")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 2: DexScreener social links
try:
@ -71,7 +72,7 @@ async def _sentiment_analysis(token: str, chain: str) -> dict:
}
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 3: CoinGecko community data
try:
@ -85,7 +86,7 @@ async def _sentiment_analysis(token: str, chain: str) -> dict:
result["community"] = data["community_data"]
result["sources_used"].append("coingecko_community")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 4: DefiLlama - protocol mentions
try:
@ -100,7 +101,7 @@ async def _sentiment_analysis(token: str, chain: str) -> dict:
}
result["sources_used"].append("defillama")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Compute sentiment score
score = 50 # neutral baseline
@ -296,7 +297,7 @@ async def _twitter_profile(query: str) -> dict:
result["sources_used"].append("nitter")
break
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 2: DuckDuckGo search
try:
@ -307,7 +308,7 @@ async def _twitter_profile(query: str) -> dict:
result["duckduckgo_results"] = True
result["sources_used"].append("duckduckgo")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -352,7 +353,7 @@ async def twitter_timeline(req: GenericRequest):
if data:
tweets.append({"source": "duckduckgo"})
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
await record_x402_payment("tw_timeline", "0.01", query)
return {
@ -388,7 +389,7 @@ async def twitter_search(req: GenericRequest):
if data:
results.append({"source": "duckduckgo"})
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
await record_x402_payment("tw_search", "0.01", query)
return {
@ -425,7 +426,7 @@ async def _social_signal(query: str) -> dict:
)
result["sources_used"].append("cryptopanic")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Reddit
try:
@ -436,7 +437,7 @@ async def _social_signal(query: str) -> dict:
result["reddit_count"] = len(data["data"]["children"])
result["sources_used"].append("reddit")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["total_mentions"] = result.get("cryptopanic_count", 0) + result.get("reddit_count", 0)
result["sentiment_score"] = result.get("cryptopanic_sentiment", 0) / max(
@ -483,7 +484,7 @@ async def _nft_wash_detector(collection: str) -> dict:
result["volume_24h"] = data.get("volume24h")
result["sources_used"].append("nftpricefloor")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# OpenSea stats (public endpoint)
try:
@ -501,7 +502,7 @@ async def _nft_wash_detector(collection: str) -> dict:
}
result["sources_used"].append("opensea")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Wash trading signals
os_stats = result.get("opensea", {})
@ -568,7 +569,7 @@ async def _bridge_security() -> dict:
)
result["sources_used"].append("defillama")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# DeFiLlama protocols (check for bridge exploits)
try:
@ -579,7 +580,7 @@ async def _bridge_security() -> dict:
result["total_bridge_tvl"] = sum(p.get("tvl", 0) for p in bridge_protocols)
result["sources_used"].append("defillama_protocols")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result

View file

@ -15,6 +15,7 @@ import os
from datetime import datetime
from fastapi import APIRouter, HTTPException
import logging
from app.domains.billing.x402.shared import (
GenericRequest,
@ -55,7 +56,7 @@ async def _insider_tracking(creator: str, chain: str) -> dict:
result["token_count"] = len(tokens)
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 2: Solana RPC - wallet activity
if chain == "solana":
@ -65,7 +66,7 @@ async def _insider_tracking(creator: str, chain: str) -> dict:
result["creator_balance_sol"] = balance / 1e9
result["sources_used"].append("solana_balance")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
try:
sigs = await rpc_call("solana", "getSignaturesForAddress", [creator, {"limit": 50}])
@ -73,7 +74,7 @@ async def _insider_tracking(creator: str, chain: str) -> dict:
result["recent_txs"] = len(sigs)
result["sources_used"].append("solana_txs")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 3: Etherscan/BaseScan
if chain in ["base", "ethereum"]:
@ -90,7 +91,7 @@ async def _insider_tracking(creator: str, chain: str) -> dict:
result["explorer_txs"] = len(data["result"])
result["sources_used"].append(f"{chain}_explorer")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Risk assessment
risk = "low"

View file

@ -769,6 +769,7 @@ async def meme_vibe_score(req: MemeVibeRequest):
# Each bundle runs its component tools in parallel and returns a unified result.
from app.domains.billing.x402.shared import BUNDLES as _BUNDLES # noqa: E402
import logging
@sub_router.get("/bundles")
@ -1181,7 +1182,7 @@ async def human_execute(req: Any):
except ImportError:
pass
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Fallback: direct on-chain verification
if not verified:
@ -1189,7 +1190,7 @@ async def human_execute(req: Any):
verified = await _verify_onchain_direct(req.tx_hash, chain, token_info, expected_pay_to)
verification_method = "onchain-direct"
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
if not verified:
return {
@ -1254,7 +1255,7 @@ async def human_execute(req: Any):
),
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return {
"success": resp.status < 400,
@ -1388,7 +1389,7 @@ async def tool_alias_dispatcher_get(tool_id: str, request: Request):
pricing_info = TOOL_PRICES.get(tool_id, {})
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
if pricing_info:
return JSONResponse(
content={
@ -1434,7 +1435,7 @@ async def tool_alias_dispatcher_get(tool_id: str, request: Request):
target = base_tool
injected_chain = pricing.get("chain")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
if target is None:
last_underscore = tool_id.rfind("_")
if last_underscore > 0:
@ -1499,7 +1500,7 @@ async def tool_alias_dispatcher_get(tool_id: str, request: Request):
result = enrich_tool_response(tool_id, result, request_params=body, opt_out=opt_out)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return JSONResponse(content=result, status_code=200)
@ -1550,7 +1551,7 @@ async def tool_alias_dispatcher(tool_id: str, request: Request):
target = base_tool
injected_chain = pricing.get("chain")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Fallback: parse tool_chain format
if target is None:
@ -1599,10 +1600,10 @@ async def tool_alias_dispatcher(tool_id: str, request: Request):
tool_id, result, request_params=body, opt_out=opt_out
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return JSONResponse(content=result, status_code=200)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# DataBus failed - raise 404 only for truly unknown tools
raise HTTPException(
@ -1682,6 +1683,6 @@ async def tool_alias_dispatcher(tool_id: str, request: Request):
result = enrich_tool_response(tool_id, result, request_params=body, opt_out=opt_out)
except Exception:
pass # Enrichment is best-effort - never block a response on it
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return JSONResponse(content=result, status_code=resp.status_code, headers=rh)

View file

@ -20,6 +20,7 @@ from datetime import datetime
import aiohttp
from fastapi import APIRouter, HTTPException
import logging
from app.domains.billing.x402.shared import (
FREE_RPCS,
@ -80,7 +81,7 @@ async def _detect_launches(chain: str, window_min: int) -> dict:
result["launches"] = launches
result["sources_used"].append("pumpfun")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 2: Raydium new pools
try:
@ -89,7 +90,7 @@ async def _detect_launches(chain: str, window_min: int) -> dict:
result["raydium_pools"] = len(data["data"])
result["sources_used"].append("raydium")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 3: DexScreener - new pairs
try:
@ -100,7 +101,7 @@ async def _detect_launches(chain: str, window_min: int) -> dict:
result["dexscreener_pairs"] = len(data["pairs"])
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -153,7 +154,7 @@ async def _launch_intel(chain: str, hours: int) -> dict:
)
result["sources_used"].append("pumpfun")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# DexScreener trending
try:
@ -173,7 +174,7 @@ async def _launch_intel(chain: str, hours: int) -> dict:
)
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["new_launches"] = launches
result["total_found"] = len(launches)
@ -217,7 +218,7 @@ async def _anomaly_detector(chain: str) -> dict:
)
result["sources_used"].append("coingecko")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# DexScreener for volume spikes
try:
@ -240,7 +241,7 @@ async def _anomaly_detector(chain: str) -> dict:
)
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["anomaly_count"] = len(result["anomalies"])
result["market_health"] = (
@ -293,7 +294,7 @@ async def _market_overview(chain: str) -> dict:
result["active_cryptocurrencies"] = gd.get("active_cryptocurrencies", 0)
result["sources_used"].append("coingecko")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# CoinGecko top coins
try:
@ -314,7 +315,7 @@ async def _market_overview(chain: str) -> dict:
]
result["sources_used"].append("coingecko_markets")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# DeFiLlama TVL
try:
@ -323,7 +324,7 @@ async def _market_overview(chain: str) -> dict:
result["chain_tvls"] = {c.get("name"): c.get("tvl") for c in data[:10]}
result["sources_used"].append("defillama")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -372,7 +373,7 @@ async def _chain_health(chain: str) -> dict:
}
result["sources_used"].append("defillama")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# RPC health check
for c in chains_to_check:
@ -393,7 +394,7 @@ async def _chain_health(chain: str) -> dict:
if resp.status == 200:
healthy += 1
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["chains"].setdefault(c, {})["rpc_healthy"] = healthy
return result
@ -444,7 +445,7 @@ async def _defi_yield_scanner(chain: str) -> dict:
)
result["sources_used"].append("defillama")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["total_pools"] = len(result["pools"])
result["highest_apy"] = result["pools"][0]["apy"] if result["pools"] else 0
@ -489,7 +490,7 @@ async def _gas_forecast(chain: str) -> dict:
result["current_gas_usd_estimate"] = gas_gwei * 0.001 # Rough estimate
result["sources_used"].append(f"{chain}_rpc")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Solana compute units
elif chain == "solana":
@ -497,7 +498,7 @@ async def _gas_forecast(chain: str) -> dict:
result["sol_compute_unit_price"] = "dynamic (based on priority fees)"
result["sources_used"].append("solana_docs")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Blocknative gas station (free tier)
try:
@ -506,7 +507,7 @@ async def _gas_forecast(chain: str) -> dict:
result["blocknative"] = data["estimatedPrices"]
result["sources_used"].append("blocknative")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -559,7 +560,7 @@ async def _sniper_alert(chain: str, hours: int) -> dict:
)
result["sources_used"].append("pumpfun")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# DexScreener for abnormal early trading
try:
@ -580,7 +581,7 @@ async def _sniper_alert(chain: str, hours: int) -> dict:
)
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["total_alerts"] = len(result["sniper_activity"])
return result
@ -630,7 +631,7 @@ async def _airdrop_finder(chain: str) -> dict:
)
result["sources_used"].append("defillama")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["total_opportunities"] = len(result["opportunities"])
return result
@ -672,7 +673,7 @@ async def _mev_protection(chain: str) -> dict:
result["mev_stats"]["jito"] = True
result["sources_used"].append("jito")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Check for MEV bots in recent blocks
try:
@ -682,7 +683,7 @@ async def _mev_protection(chain: str) -> dict:
result["mev_stats"]["slot"] = slot
result["sources_used"].append("solana_rpc")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
elif chain in ["base", "ethereum", "bsc"]:
# Flashbots stats
@ -692,7 +693,7 @@ async def _mev_protection(chain: str) -> dict:
result["mev_stats"]["flashbots"] = True
result["sources_used"].append("flashbots")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Gas price for MEV detection
try:
@ -701,7 +702,7 @@ async def _mev_protection(chain: str) -> dict:
result["gas_price_gwei"] = int(gas, 16) / 1e9
result["sources_used"].append(f"{chain}_rpc")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["mev_risk"] = (
"high" if chain == "ethereum" else "medium" if chain in ["base", "bsc"] else "low"

View file

@ -19,6 +19,7 @@ from __future__ import annotations
from datetime import datetime
from fastapi import APIRouter, HTTPException
import logging
from app.domains.billing.x402.shared import (
GenericRequest,
@ -90,7 +91,7 @@ async def deep_contract_audit(req: TokenRequest):
"guarantee": "Data delivered or auto-refund via x402 receipt",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
raise HTTPException(status_code=500, detail=str(e)) from e
@ -148,7 +149,7 @@ async def _rug_shield(address: str, chain: str) -> dict:
flags.append("no_account")
result["sources_used"].append("solana_rpc")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 3: CoinGecko verification
try:
@ -161,7 +162,7 @@ async def _rug_shield(address: str, chain: str) -> dict:
else:
result["coingecko_verified"] = False
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
risk_score = min(100, risk_score)
verdict = "UNSAFE" if risk_score >= 60 else "CAUTION" if risk_score >= 30 else "SAFE"
@ -217,7 +218,7 @@ async def _token_pulse(address: str, chain: str) -> dict:
result["pair_age_hours"] = pair.get("pairCreatedAt", 0)
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 2: Coingecko - additional metrics
try:
@ -232,7 +233,7 @@ async def _token_pulse(address: str, chain: str) -> dict:
}
result["sources_used"].append("coingecko")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 3: Compute health score
score = 50 # baseline
@ -335,7 +336,7 @@ async def _token_forensics(address: str, chain: str) -> dict:
result["pair_age_days"] = pair.get("pairCreatedAt", 0)
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# CoinGecko
try:
@ -349,7 +350,7 @@ async def _token_forensics(address: str, chain: str) -> dict:
}
result["sources_used"].append("coingecko")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# GeckoTerminal
try:
@ -362,7 +363,7 @@ async def _token_forensics(address: str, chain: str) -> dict:
result["geckoterminal"] = True
result["sources_used"].append("geckoterminal")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# DeFiLlama
try:
@ -371,7 +372,7 @@ async def _token_forensics(address: str, chain: str) -> dict:
result["defillama"] = data["coins"]
result["sources_used"].append("defillama")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Risk scoring
risk_score = 0
@ -486,7 +487,7 @@ async def _honeypot_check(address: str, chain: str) -> dict:
result["is_honeypot"] = None
result["reason"] = "No trading pairs found"
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Check contract for EVM chains
if chain in ["base", "ethereum", "bsc"]:
@ -500,7 +501,7 @@ async def _honeypot_check(address: str, chain: str) -> dict:
result["is_contract"] = True
result["sources_used"].append(f"{chain}_rpc")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -606,7 +607,7 @@ async def _risk_monitor(address: str, chain: str) -> dict:
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["alert_count"] = len(result["alerts"])
result["risk_level"] = (
@ -671,7 +672,7 @@ async def _liquidity_flow(address: str, chain: str) -> dict:
result["total_liquidity_usd"] = total_liq
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# DeFiLlama for protocol TVL
try:
@ -681,7 +682,7 @@ async def _liquidity_flow(address: str, chain: str) -> dict:
result["price"] = coin.get("price", 0)
result["sources_used"].append("defillama")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -770,11 +771,11 @@ async def _rug_pull_predictor(address: str, chain: str) -> dict:
result["holder_count"] = holders
result["sources_used"].append("solana_rpc")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Calculate rug pull probability
total_weight = sum(s["weight"] for s in result["signals"])

View file

@ -19,6 +19,7 @@ import os
from datetime import datetime
from fastapi import APIRouter, HTTPException
import logging
from app.domains.billing.x402.shared import (
ClusterRequest,
@ -50,7 +51,7 @@ async def _profile_wallet(address: str, chain: str) -> dict:
result["balance_sol"] = balance / 1e9
result["sources_used"].append("solana_rpc")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Get recent transactions
try:
@ -72,7 +73,7 @@ async def _profile_wallet(address: str, chain: str) -> dict:
if time_span > 0:
result["tx_frequency"] = len(sigs) / (time_span / 86400) # per day
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Get token accounts
try:
@ -89,7 +90,7 @@ async def _profile_wallet(address: str, chain: str) -> dict:
result["token_count"] = len(token_accounts["value"])
result["sources_used"].append("solana_tokens")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 2: DexScreener - check if wallet has interacted with known tokens
# (we can't directly query by wallet, but we use the balance/token data)
@ -177,7 +178,7 @@ async def _get_smart_money(chain: str, threshold: float, limit: int) -> dict:
]
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 2: DefiLlama - top protocols by TVL change
try:
@ -191,7 +192,7 @@ async def _get_smart_money(chain: str, threshold: float, limit: int) -> dict:
]
result["sources_used"].append("defillama")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 3: CoinGecko - top gainers
try:
@ -203,7 +204,7 @@ async def _get_smart_money(chain: str, threshold: float, limit: int) -> dict:
]
result["sources_used"].append("coingecko")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 4: Pump.fun - new launches with high volume
if chain == "solana":
@ -225,7 +226,7 @@ async def _get_smart_money(chain: str, threshold: float, limit: int) -> dict:
]
result["sources_used"].append("pumpfun")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -283,12 +284,12 @@ async def _cluster_analysis(address: str, chain: str, depth: int) -> dict:
if addr and addr != address:
counterparties.add(addr)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["counterparties"] = list(counterparties)[:50]
result["cluster_size"] = len(counterparties)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 2: DexScreener - check if address is a known deployer
# Layer 3: Etherscan/BaseScan for EVM chains
@ -308,7 +309,7 @@ async def _cluster_analysis(address: str, chain: str, depth: int) -> dict:
result["tx_count"] = len(data["result"])
result["sources_used"].append(f"{chain}_explorer")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Layer 4: Compute cluster metrics
result["cluster_risk"] = (
@ -356,7 +357,7 @@ async def _whale_decoder(address: str, chain: str) -> dict:
result["sol_balance"] = balance / 1e9
result["sources_used"].append("solana_rpc")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
try:
token_accounts = await rpc_call(
@ -382,7 +383,7 @@ async def _whale_decoder(address: str, chain: str) -> dict:
)
result["sources_used"].append("solana_rpc_tokens")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# EVM chain balance
elif chain in ["base", "ethereum", "bsc"]:
@ -393,7 +394,7 @@ async def _whale_decoder(address: str, chain: str) -> dict:
result["native_balance_eth"] = int(balance, 16) / 1e18
result["sources_used"].append(f"{chain}_rpc")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# DexScreener for recent activity
try:
@ -404,7 +405,7 @@ async def _whale_decoder(address: str, chain: str) -> dict:
result["recent_pairs"] = len(data["pairs"])
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Persona detection
sol_balance = result.get("sol_balance", result.get("native_balance_eth", 0))
@ -471,7 +472,7 @@ async def _portfolio_tracker(addresses: list[str], chain: str) -> dict:
wallet_data["sol_balance"] = balance / 1e9
result["sources_used"].append("solana_rpc")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# EVM balance
elif chain in ["base", "ethereum", "bsc"]:
@ -481,7 +482,7 @@ async def _portfolio_tracker(addresses: list[str], chain: str) -> dict:
wallet_data["native_balance"] = int(balance, 16) / 1e18
result["sources_used"].append(f"{chain}_rpc")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["wallets"].append(wallet_data)
@ -533,7 +534,7 @@ async def _copy_trade_finder(chain: str) -> dict:
]
result["sources_used"].append("dexscreener")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["smart_wallets"] = [] # Would need on-chain analysis for this
result["copy_trades"] = []

View file

@ -1628,7 +1628,7 @@ def build_provider_chains() -> dict[str, ProviderChain]:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
chains["hyperliquid"] = ProviderChain(
@ -1648,7 +1648,7 @@ def build_provider_chains() -> dict[str, ProviderChain]:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
chains["hyperliquid_action"] = ProviderChain(
@ -1674,7 +1674,7 @@ def build_provider_chains() -> dict[str, ProviderChain]:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
chains["insider_wallets"] = ProviderChain(
@ -1695,7 +1695,7 @@ def build_provider_chains() -> dict[str, ProviderChain]:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
chains["prediction_signals"] = ProviderChain(

View file

@ -13,6 +13,7 @@ import json
import os
import httpx as req
import logging
OLLAMA = "http://ollama:11434/api/generate"
@ -54,7 +55,7 @@ def ask(prompt: str, model: str = "qwen2.5-coder:7b", tokens: int = 250) -> str:
if r.status_code == 200:
return r.json().get("response", "").strip()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return ""
@ -87,7 +88,7 @@ Explain: 1) What this contract does 2) Any risks 3) Key functions. Be concise.""
result["explanation"] = explanation
result["ai_model"] = "qwen2.5-coder:7b"
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["auth"] = auth
result["mcp"] = "rmi-contract-explain"
return result
@ -126,7 +127,7 @@ Narrate: What is this wallet doing? Trading? Accumulating? Laundering? Be specif
result["transactions_analyzed"] = len(txs)
result["ai_model"] = "qwen2.5-coder:7b"
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["auth"] = auth
result["mcp"] = "rmi-wallet-narrator"
return result
@ -158,7 +159,7 @@ def predict_rug(address: str, chain: str = "ethereum", fp: str = "anon") -> dict
f"Owner renounced: {d.get('is_owner_renounced', '0')}",
]
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
prompt = f"""Token security scan results:\n{chr(10).join(signals)}\n\nBased on these signals, rate rug pull risk 0-100 and explain in 2 sentences."""
prediction = ask(prompt, "qwen2.5-coder:7b", 150)
result["signals"] = signals

View file

@ -108,4 +108,4 @@ async def broadcast_ws_update(address: str, update: dict):
},
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)

View file

@ -189,7 +189,7 @@ class L2RedisCache:
async for key in self._redis.scan_iter(f"{self._prefix}*"):
await self._redis.delete(key)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
def stats(self) -> dict:
total = self.hits + self.misses
@ -321,7 +321,7 @@ class CacheLayer:
try: # noqa: SIM105
asyncio.create_task(self.stale_refresh_callback(key))
except Exception:
pass # Best-effort refresh
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return val, is_stale
# L2 (no SWR - Redis handles its own TTL)
val = await self.l2.get(key)

View file

@ -264,7 +264,7 @@ class DataBus:
ws = get_ws_manager()
await ws.broadcast_data(data_type, result)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
except Exception as e:
logger.debug(f"SWR refresh failed for {data_type}: {e}")
@ -317,7 +317,7 @@ class DataBus:
**item.get("kwargs", {}),
)
except Exception:
pass # Individual warm failures are fine
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
await asyncio.sleep(interval)
except asyncio.CancelledError:
break
@ -407,7 +407,7 @@ class DataBus:
result = await asyncio.wait_for(future, timeout=30)
return result
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── 5.5 LOCAL PRECHECK - RAG / Scanner / Labels / Redis (FREE) ──
# Before calling ANY external API, check our own databases.
@ -472,7 +472,7 @@ class DataBus:
metadata={"data_type": data_type, "source": source, "tier": tier},
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── 10. WEBSOCKET BROADCAST (optional) ──
if data_type in (
@ -489,7 +489,7 @@ class DataBus:
await databus_ws_broadcast(data_type, result)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── 11. RESOLVE DEDUP ──
self._dedup.resolve(dedup_key, result)
@ -569,7 +569,7 @@ class DataBus:
}
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── SCANNER: check SENTINEL token security cache ──
if data_type in ("scanner", "token_price", "token_metadata", "holder_data") and address:
@ -599,7 +599,7 @@ class DataBus:
}
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── RAG: semantic search our 17K+ scam docs ──
if data_type in ("rag_search", "scanner", "wallet_labels") and (query or address):
@ -623,7 +623,7 @@ class DataBus:
"cached": True,
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── PRICE: check Redis price cache ──
if data_type == "token_price" and address:
@ -652,10 +652,10 @@ class DataBus:
}
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None

View file

@ -93,7 +93,7 @@ async def _gather_all_data() -> dict:
data["market"] = await get_market_brief()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# News intel
try:
@ -101,7 +101,7 @@ async def _gather_all_data() -> dict:
data["news"] = await aggregate_all_news(limit=20)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# CT Rundown
try:
@ -109,7 +109,7 @@ async def _gather_all_data() -> dict:
data["ct"] = await fetch_ct_rundown(limit=15)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Social metrics
try:
@ -117,7 +117,7 @@ async def _gather_all_data() -> dict:
data["social"] = await get_social_metrics()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Fear & Greed
try:
@ -125,7 +125,7 @@ async def _gather_all_data() -> dict:
data["fear_greed"] = await get_fear_greed()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Prediction markets
try:
@ -133,7 +133,7 @@ async def _gather_all_data() -> dict:
data["prediction_markets"] = await get_prediction_markets(limit=5)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return data

View file

@ -216,7 +216,7 @@ async def enrich_with_arkham(address: str) -> dict | None:
"is_contract": data.get("contract", False),
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -562,7 +562,7 @@ async def enhanced_token_report(address: str, chain: str = "solana", **kw) -> di
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# First, check known entities
known = lookup_entity(address, chain)
@ -643,7 +643,7 @@ async def enhanced_token_report(address: str, chain: str = "solana", **kw) -> di
r.setex(cache_key, 300, json.dumps(base_report, default=str))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return base_report

View file

@ -221,7 +221,7 @@ def _load_mbal(con, base_dir: str) -> dict:
).fetchone()[0]
stats["loaded"] += c
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return stats
@ -280,13 +280,13 @@ def _build_index(con):
con.execute("DROP INDEX IF EXISTS idx_address")
con.execute("CREATE INDEX idx_address ON address_index (address)")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
try:
con.execute("DROP INDEX IF EXISTS idx_chain")
con.execute("CREATE INDEX idx_chain ON address_index (chain)")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── Public API ───────────────────────────────────────────────────
@ -331,7 +331,7 @@ class DuckDBAnalytics:
},
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Create schema
con.execute(SCHEMA_SQL)

View file

@ -9,6 +9,7 @@ import os
from app.core.redis import get_redis
from app.routers.x402_databus_tools import check_trial
import logging
# ═══════════════════════════════════════════════════
@ -87,7 +88,7 @@ def resolve_wallet(address: str, fingerprint: str = "anon") -> dict:
cur.close()
pg.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Also check Redis cache
for chain in ["ethereum", "solana", "bsc", "polygon"]:
cached = r.get(f"rmi:label:{chain}:{addr}")
@ -126,7 +127,7 @@ def scan_token(address: str, chain: str = "ethereum", fingerprint: str = "anon")
result["checks"]["chainabuse_reports"] = len(reports)
result["checks"]["known_scam"] = len(reports) > 0
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# GoPlus security check (free, no key)
try:
r = req.get(
@ -140,7 +141,7 @@ def scan_token(address: str, chain: str = "ethereum", fingerprint: str = "anon")
result["checks"]["sell_tax"] = data.get("sell_tax", "0")
result["checks"]["liquidity"] = data.get("lp_holders", [])
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["auth"] = auth
result["mcp"] = "rmi-token-security"
return result
@ -169,7 +170,7 @@ def check_bridge_transfers(
if r.status_code == 200:
result["data"] = r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["supported_bridges"] = list(bridges.keys())
result["auth"] = auth
result["mcp"] = "rmi-bridge-monitor"
@ -199,7 +200,7 @@ def defi_analytics(protocol: str = "", chain: str = "", fingerprint: str = "anon
result["tvl_data"] = r.json()
result["source"] = "DeFiLlama (free, unlimited)"
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Pyth price feed
try:
r = req.get(
@ -211,7 +212,7 @@ def defi_analytics(protocol: str = "", chain: str = "", fingerprint: str = "anon
result["eth_price"] = float(p["price"]) * (10 ** float(p["expo"]))
result["price_source"] = "Pyth Network (125+ institutional publishers)"
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["auth"] = auth
result["mcp"] = "rmi-defi-analytics"
return result

View file

@ -35,7 +35,7 @@ class KeyAffinitySelector:
if k.key_id == assigned and k.is_available():
return k
# New assignment via consistent hash
h = int(hashlib.md5(affinity_key.encode()).hexdigest(), 16)
h = int(hashlib.sha256(affinity_key.encode()).hexdigest(), 16)
idx = h % len(available_keys)
selected = available_keys[idx]
if selected.is_available():

View file

@ -853,9 +853,9 @@ async def review_content(content: str, content_type: str = "article") -> dict:
"fixed_version": review_data.get("fixed_version", content),
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Fix if needed
fixed = content

View file

@ -614,7 +614,7 @@ async def aggregate_all_news(limit: int = 50, **kw) -> dict:
tasks.append(fetch_all_news())
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# X/Twitter
tasks.append(_fetch_x_crypto())

View file

@ -225,7 +225,7 @@ class OHLCVEngine:
r.close()
return json.loads(cached)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
try:
r = _redis() if "r" not in dir() or not r else r
@ -239,7 +239,7 @@ class OHLCVEngine:
c = json.loads(item)
candles.append(c)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Sort by timestamp ascending
candles.sort(key=lambda x: x["timestamp"])
@ -354,7 +354,7 @@ async def fetch_ohlcv(
"risk_level": auth.get("risk_level", "UNKNOWN"),
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return {
"candles": candles,

View file

@ -10,6 +10,7 @@ import json
import os
import httpx as req
import logging
def gredis():
@ -68,7 +69,7 @@ def whale_alert(
}
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["auth"] = auth
result["mcp"] = "rmi-whale-alert"
return result
@ -100,7 +101,7 @@ def token_launch_scanner(
}
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["auth"] = auth
result["mcp"] = "rmi-launch-scanner"
return result
@ -166,7 +167,7 @@ def mev_detector(address: str = "", chain: str = "ethereum", fingerprint: str =
1.0, sum(1 for v in blocks.values() if v > 2) / max(len(blocks), 1)
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["auth"] = auth
result["mcp"] = "rmi-mev-detector"
return result
@ -224,7 +225,7 @@ def arbitrage_scanner(token: str = "ETH", fingerprint: str = "anon") -> dict:
chain = pair.get("chainId", "unknown")
prices[f"{dex}_{chain}"] = float(price)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
if prices:
pvals = [v for v in prices.values() if v > 0]
spread = max(pvals) - min(pvals) if pvals else 0
@ -271,7 +272,7 @@ def quick_audit(address: str, chain: str = "ethereum", fingerprint: str = "anon"
"SAFE" if red_flags == 0 else ("CAUTION" if red_flags == 1 else "DANGER")
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result["auth"] = auth
result["mcp"] = "rmi-quick-audit"
return result
@ -303,7 +304,7 @@ def portfolio_risk(address: str, fingerprint: str = "anon") -> dict:
risk["risk_factors"].append("community_reported")
risk["risk_score"] += 20
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
risk["risk_level"] = (
"LOW" if risk["risk_score"] < 20 else ("MEDIUM" if risk["risk_score"] < 50 else "HIGH")
)

View file

@ -70,7 +70,7 @@ async def detect_bundles(address: str, chain: str = "solana", **kw) -> dict | No
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
bundles = []
api_key = kw.get("api_key", "") or kw.get("helius_key", "")
@ -152,7 +152,7 @@ async def detect_bundles(address: str, chain: str = "solana", **kw) -> dict | No
if entity.get("name"):
bundle.setdefault("labeled_entities", {})[wallet] = entity["name"]
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
except Exception as e:
logger.warning(f"Bundle detection failed: {e}")
@ -170,7 +170,7 @@ async def detect_bundles(address: str, chain: str = "solana", **kw) -> dict | No
r.setex(cache_key, CACHE_TTL["bundle_scan"], json.dumps(result))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -191,7 +191,7 @@ async def map_clusters(address: str, chain: str = "solana", depth: int = 3, **kw
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
nodes = []
edges = []
@ -247,7 +247,7 @@ async def map_clusters(address: str, chain: str = "solana", depth: int = 3, **kw
}
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Fallback: Helius transactions if Arkham not available
elif api_key and chain == "solana":
@ -292,7 +292,7 @@ async def map_clusters(address: str, chain: str = "solana", depth: int = 3, **kw
queue.append((acc_addr, current_depth + 1))
edges.append({"from": current, "to": acc_addr, "value": 1})
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
except Exception as e:
logger.warning(f"Cluster mapping failed: {e}")
@ -311,7 +311,7 @@ async def map_clusters(address: str, chain: str = "solana", depth: int = 3, **kw
r.setex(cache_key, CACHE_TTL["cluster_map"], json.dumps(result))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -332,7 +332,7 @@ async def find_dev_wallets(token_address: str, chain: str = "solana", **kw) -> d
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
api_key = kw.get("api_key", "")
arkham_key = kw.get("arkham_key", "")
@ -425,7 +425,7 @@ async def find_dev_wallets(token_address: str, chain: str = "solana", **kw) -> d
entity = ark_resp.json().get("arkhamEntity", {})
dw["entity_name"] = entity.get("name", "")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
if funder:
try:
ark_resp = await c.get(
@ -436,7 +436,7 @@ async def find_dev_wallets(token_address: str, chain: str = "solana", **kw) -> d
entity = ark_resp.json().get("arkhamEntity", {})
dw["funder_entity"] = entity.get("name", "")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
except Exception as e:
logger.warning(f"Dev finder failed: {e}")
@ -453,7 +453,7 @@ async def find_dev_wallets(token_address: str, chain: str = "solana", **kw) -> d
r.setex(cache_key, CACHE_TTL["dev_finder"], json.dumps(result))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -505,7 +505,7 @@ async def detect_snipers(address: str, chain: str = "solana", **kw) -> dict | No
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
api_key = kw.get("api_key", "")
snipers = []
@ -557,7 +557,7 @@ async def detect_snipers(address: str, chain: str = "solana", **kw) -> dict | No
}
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result = {
"snipers": list({s["address"]: s for s in snipers}.values())[:20],
@ -572,7 +572,7 @@ async def detect_snipers(address: str, chain: str = "solana", **kw) -> dict | No
r.setex(cache_key, CACHE_TTL["sniper_detect"], json.dumps(result))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -599,7 +599,7 @@ async def detect_bot_farms(address: str, chain: str = "solana", **kw) -> dict |
r.setex(cache_key, CACHE_TTL["bot_farm"], json.dumps(result))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -620,7 +620,7 @@ async def detect_copy_trading(address: str, chain: str = "solana", **kw) -> dict
r.setex(cache_key, CACHE_TTL["copy_trading"], json.dumps(result))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -642,7 +642,7 @@ async def detect_insider_signals(address: str, chain: str = "solana", **kw) -> d
r.setex(cache_key, CACHE_TTL["insider_signals"], json.dumps(result))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -665,7 +665,7 @@ async def detect_wash_trading(address: str, chain: str = "solana", **kw) -> dict
r.setex(cache_key, CACHE_TTL["wash_trading"], json.dumps(result))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -687,7 +687,7 @@ async def detect_mev_sandwich(address: str, chain: str = "solana", **kw) -> dict
r.setex(cache_key, CACHE_TTL["mev_sandwich"], json.dumps(result))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -711,6 +711,6 @@ async def detect_fresh_wallets(address: str, chain: str = "solana", **kw) -> dic
r.setex(cache_key, CACHE_TTL["fresh_wallets"], json.dumps(result))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result

View file

@ -13,6 +13,7 @@ import os
import httpx
from sdks.python.x402_frameworks.autogen_adapter import logger
import logging
async def _local_token_price(**kwargs) -> dict | None:
@ -37,7 +38,7 @@ async def _local_token_price(**kwargs) -> dict | None:
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -52,7 +53,7 @@ async def _dexscreener_price(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -67,7 +68,7 @@ async def _coingecko_price(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -84,7 +85,7 @@ async def _moralis_price(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -111,7 +112,7 @@ async def _alchemy_token_balances(address: str = "", network: str = "eth-mainnet
if "result" in data:
return {"balances": data["result"], "address": address, "network": network}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -135,7 +136,7 @@ async def _alchemy_token_metadata(contract: str = "", network: str = "eth-mainne
if "result" in data:
return {"metadata": data["result"], "contract": contract}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -150,7 +151,7 @@ async def _passthrough_market_overview(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -163,7 +164,7 @@ async def _passthrough_trending(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -176,7 +177,7 @@ async def _passthrough_news(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -192,7 +193,7 @@ async def _passthrough_alerts(**kwargs) -> dict | None:
recent = await get_recent_alerts(limit=kwargs.get("limit", 20))
return {"count": count, "alerts": recent}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return {"count": 0, "alerts": []}
@ -256,7 +257,7 @@ async def _local_wallet_labels(address: str = "", **kw) -> dict | None:
}
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -268,7 +269,7 @@ async def _passthrough_scanner(address: str = "", chain: str = "solana", **kw) -
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -283,7 +284,7 @@ async def _passthrough_rag(query: str = "", collection: str = "known_scams", **k
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -307,7 +308,7 @@ async def _moralis_wallet_tokens(address: str = "", chain: str = "eth", **kw) ->
if r.status_code == 200:
return {"tokens": r.json(), "address": address, "chain": chain}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -326,7 +327,7 @@ async def _moralis_wallet_nfts(address: str = "", chain: str = "eth", **kw) -> d
if r.status_code == 200:
return {"nfts": r.json(), "address": address, "chain": chain}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -346,7 +347,7 @@ async def _moralis_wallet_transactions(address: str = "", chain: str = "eth", **
if r.status_code == 200:
return {"transactions": r.json(), "address": address, "chain": chain}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -365,7 +366,7 @@ async def _moralis_token_price(address: str = "", chain: str = "eth", **kw) -> d
if r.status_code == 200:
return {"price": r.json(), "address": address, "chain": chain}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -384,7 +385,7 @@ async def _moralis_token_metadata(address: str = "", chain: str = "eth", **kw) -
if r.status_code == 200:
return {"metadata": r.json(), "address": address}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -399,7 +400,7 @@ async def _moralis_wallet_net_worth(address: str = "", **kw) -> dict | None:
if r.status_code == 200:
return {"net_worth": r.json(), "address": address}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -419,7 +420,7 @@ async def _moralis_search_tokens(query: str = "", **kw) -> dict | None:
if r.status_code == 200:
return {"results": r.json(), "query": query}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -500,7 +501,7 @@ async def _mcp_bridge(mcp_server: str = "", mcp_tool: str = "", **kw) -> dict |
"tool": mcp_tool,
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -521,7 +522,7 @@ async def _arkham_entity(address: str = "", **kw) -> dict | None:
if r.status_code == 200:
return {"entity": r.json(), "address": address, "source": "arkham"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -542,7 +543,7 @@ async def _arkham_counterparties(address: str = "", **kw) -> dict | None:
if r.status_code == 200:
return {"counterparties": r.json(), "address": address, "source": "arkham"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -558,7 +559,7 @@ async def _arkham_intel_search(query: str = "", **kw) -> dict | None:
if r.status_code == 200:
return {"results": r.json(), "query": query, "source": "arkham"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -574,7 +575,7 @@ async def _arkham_portfolio(address: str = "", **kw) -> dict | None:
if r.status_code == 200:
return {"portfolio": r.json(), "address": address, "source": "arkham"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -595,7 +596,7 @@ async def _arkham_transfers(address: str = "", **kw) -> dict | None:
if r.status_code == 200:
return {"transfers": r.json(), "address": address, "source": "arkham"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -624,7 +625,7 @@ async def _arkham_labels(address: str = "", **kw) -> dict | None:
"source": "arkham",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -657,7 +658,7 @@ async def _dexscreener_token_metadata(mint: str = "", **kw) -> dict | None:
"source": "dexscreener",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -675,7 +676,7 @@ async def _dexscreener_holders(mint: str = "", **kw) -> dict | None:
if pairs:
return {"pairs": pairs, "total_pairs": len(pairs), "source": "dexscreener"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -700,7 +701,7 @@ async def _dexscreener_trades(token: str = "", chain: str = "solana", **kw) -> d
"source": "dexscreener",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -722,7 +723,7 @@ async def _dexscreener_top_traders(token: str = "", chain: str = "solana", **kw)
"source": "dexscreener",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -761,7 +762,7 @@ async def _etherscan_tx_trace(tx_hash: str = "", network: str = "ethereum", **kw
"source": "etherscan",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -783,7 +784,7 @@ async def _defillama_tvl(**kw) -> dict | None:
"source": "defillama",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -799,7 +800,7 @@ async def _defillama_chains(**kw) -> dict | None:
"source": "defillama",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -823,7 +824,7 @@ async def _blockchair_address(address: str = "", chain: str = "bitcoin", **kw) -
"source": "blockchair",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -840,7 +841,7 @@ async def _blockchair_stats(chain: str = "bitcoin", **kw) -> dict | None:
"source": "blockchair",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -863,7 +864,7 @@ async def _birdeye_overview(address: str = "", **kw) -> dict | None:
data = r.json()
return {"address": address, "data": data.get("data", {}), "source": "birdeye"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -884,7 +885,7 @@ async def _birdeye_price(address: str = "", **kw) -> dict | None:
"source": "birdeye",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -903,7 +904,7 @@ async def _solana_tracker_price(mint: str = "", **kw) -> dict | None:
if data:
return {"mint": mint, "price": data, "source": "solana_tracker"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -919,7 +920,7 @@ async def _solana_tracker_token(mint: str = "", **kw) -> dict | None:
if data:
return {"mint": mint, "data": data, "source": "solana_tracker"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -933,7 +934,7 @@ async def _solana_tracker_trending(**kw) -> dict | None:
if data:
return {"trending": data, "source": "solana_tracker"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -973,7 +974,7 @@ async def _messari_news(limit: int = 20, **kw) -> dict | None:
)
return {"articles": articles, "source": "messari", "count": len(articles)}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1012,7 +1013,7 @@ async def _coindesk_news(limit: int = 20, **kw) -> dict | None:
)
return {"articles": articles, "source": "coindesk", "count": len(articles)}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1052,7 +1053,7 @@ async def _santiment_dev_activity(project_slug: str = "bitcoin", **kw) -> dict |
"source": "santiment",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1081,7 +1082,7 @@ async def _virustotal_url_scan(url: str, **kw) -> dict | None:
"source": "virustotal",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1167,7 +1168,7 @@ async def _passthrough_hyperliquid(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1180,7 +1181,7 @@ async def _passthrough_hyperliquid_action(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1196,7 +1197,7 @@ async def _passthrough_insider_wallets(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1212,6 +1213,6 @@ async def _passthrough_prediction_signals(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None

View file

@ -216,7 +216,7 @@ async def _local_token_price(**kwargs) -> dict | None:
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -231,7 +231,7 @@ async def _dexscreener_price(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -246,7 +246,7 @@ async def _coingecko_price(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -263,7 +263,7 @@ async def _moralis_price(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -290,7 +290,7 @@ async def _alchemy_token_balances(address: str = "", network: str = "eth-mainnet
if "result" in data:
return {"balances": data["result"], "address": address, "network": network}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -314,7 +314,7 @@ async def _alchemy_token_metadata(contract: str = "", network: str = "eth-mainne
if "result" in data:
return {"metadata": data["result"], "contract": contract}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -329,7 +329,7 @@ async def _passthrough_market_overview(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -342,7 +342,7 @@ async def _passthrough_trending(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -355,7 +355,7 @@ async def _passthrough_news(**kwargs) -> dict | None:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -371,7 +371,7 @@ async def _passthrough_alerts(**kwargs) -> dict | None:
recent = await get_recent_alerts(limit=kwargs.get("limit", 20))
return {"count": count, "alerts": recent}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return {"count": 0, "alerts": []}
@ -435,7 +435,7 @@ async def _local_wallet_labels(address: str = "", **kw) -> dict | None:
}
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -447,7 +447,7 @@ async def _passthrough_scanner(address: str = "", chain: str = "solana", **kw) -
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -462,7 +462,7 @@ async def _passthrough_rag(query: str = "", collection: str = "known_scams", **k
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -486,7 +486,7 @@ async def _moralis_wallet_tokens(address: str = "", chain: str = "eth", **kw) ->
if r.status_code == 200:
return {"tokens": r.json(), "address": address, "chain": chain}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -505,7 +505,7 @@ async def _moralis_wallet_nfts(address: str = "", chain: str = "eth", **kw) -> d
if r.status_code == 200:
return {"nfts": r.json(), "address": address, "chain": chain}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -525,7 +525,7 @@ async def _moralis_wallet_transactions(address: str = "", chain: str = "eth", **
if r.status_code == 200:
return {"transactions": r.json(), "address": address, "chain": chain}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -544,7 +544,7 @@ async def _moralis_token_price(address: str = "", chain: str = "eth", **kw) -> d
if r.status_code == 200:
return {"price": r.json(), "address": address, "chain": chain}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -563,7 +563,7 @@ async def _moralis_token_metadata(address: str = "", chain: str = "eth", **kw) -
if r.status_code == 200:
return {"metadata": r.json(), "address": address}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -578,7 +578,7 @@ async def _moralis_wallet_net_worth(address: str = "", **kw) -> dict | None:
if r.status_code == 200:
return {"net_worth": r.json(), "address": address}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -598,7 +598,7 @@ async def _moralis_search_tokens(query: str = "", **kw) -> dict | None:
if r.status_code == 200:
return {"results": r.json(), "query": query}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -679,7 +679,7 @@ async def _mcp_bridge(mcp_server: str = "", mcp_tool: str = "", **kw) -> dict |
"tool": mcp_tool,
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -700,7 +700,7 @@ async def _arkham_entity(address: str = "", **kw) -> dict | None:
if r.status_code == 200:
return {"entity": r.json(), "address": address, "source": "arkham"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -721,7 +721,7 @@ async def _arkham_counterparties(address: str = "", **kw) -> dict | None:
if r.status_code == 200:
return {"counterparties": r.json(), "address": address, "source": "arkham"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -737,7 +737,7 @@ async def _arkham_intel_search(query: str = "", **kw) -> dict | None:
if r.status_code == 200:
return {"results": r.json(), "query": query, "source": "arkham"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -753,7 +753,7 @@ async def _arkham_portfolio(address: str = "", **kw) -> dict | None:
if r.status_code == 200:
return {"portfolio": r.json(), "address": address, "source": "arkham"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -774,7 +774,7 @@ async def _arkham_transfers(address: str = "", **kw) -> dict | None:
if r.status_code == 200:
return {"transfers": r.json(), "address": address, "source": "arkham"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -803,7 +803,7 @@ async def _arkham_labels(address: str = "", **kw) -> dict | None:
"source": "arkham",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -836,7 +836,7 @@ async def _dexscreener_token_metadata(mint: str = "", **kw) -> dict | None:
"source": "dexscreener",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -854,7 +854,7 @@ async def _dexscreener_holders(mint: str = "", **kw) -> dict | None:
if pairs:
return {"pairs": pairs, "total_pairs": len(pairs), "source": "dexscreener"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -879,7 +879,7 @@ async def _dexscreener_trades(token: str = "", chain: str = "solana", **kw) -> d
"source": "dexscreener",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -901,7 +901,7 @@ async def _dexscreener_top_traders(token: str = "", chain: str = "solana", **kw)
"source": "dexscreener",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -940,7 +940,7 @@ async def _etherscan_tx_trace(tx_hash: str = "", network: str = "ethereum", **kw
"source": "etherscan",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -962,7 +962,7 @@ async def _defillama_tvl(**kw) -> dict | None:
"source": "defillama",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -978,7 +978,7 @@ async def _defillama_chains(**kw) -> dict | None:
"source": "defillama",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1002,7 +1002,7 @@ async def _blockchair_address(address: str = "", chain: str = "bitcoin", **kw) -
"source": "blockchair",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1019,7 +1019,7 @@ async def _blockchair_stats(chain: str = "bitcoin", **kw) -> dict | None:
"source": "blockchair",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1042,7 +1042,7 @@ async def _birdeye_overview(address: str = "", **kw) -> dict | None:
data = r.json()
return {"address": address, "data": data.get("data", {}), "source": "birdeye"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1063,7 +1063,7 @@ async def _birdeye_price(address: str = "", **kw) -> dict | None:
"source": "birdeye",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1082,7 +1082,7 @@ async def _solana_tracker_price(mint: str = "", **kw) -> dict | None:
if data:
return {"mint": mint, "price": data, "source": "solana_tracker"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1098,7 +1098,7 @@ async def _solana_tracker_token(mint: str = "", **kw) -> dict | None:
if data:
return {"mint": mint, "data": data, "source": "solana_tracker"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1112,7 +1112,7 @@ async def _solana_tracker_trending(**kw) -> dict | None:
if data:
return {"trending": data, "source": "solana_tracker"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1152,7 +1152,7 @@ async def _messari_news(limit: int = 20, **kw) -> dict | None:
)
return {"articles": articles, "source": "messari", "count": len(articles)}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1191,7 +1191,7 @@ async def _coindesk_news(limit: int = 20, **kw) -> dict | None:
)
return {"articles": articles, "source": "coindesk", "count": len(articles)}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1231,7 +1231,7 @@ async def _santiment_dev_activity(project_slug: str = "bitcoin", **kw) -> dict |
"source": "santiment",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -1260,7 +1260,7 @@ async def _virustotal_url_scan(url: str, **kw) -> dict | None:
"source": "virustotal",
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
@ -2899,7 +2899,7 @@ def build_provider_chains() -> dict[str, ProviderChain]:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
chains["hyperliquid"] = ProviderChain(
@ -2919,7 +2919,7 @@ def build_provider_chains() -> dict[str, ProviderChain]:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
chains["hyperliquid_action"] = ProviderChain(
@ -2945,7 +2945,7 @@ def build_provider_chains() -> dict[str, ProviderChain]:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
chains["insider_wallets"] = ProviderChain(
@ -2966,7 +2966,7 @@ def build_provider_chains() -> dict[str, ProviderChain]:
if r.status_code == 200:
return r.json()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
chains["prediction_signals"] = ProviderChain(

View file

@ -79,7 +79,7 @@ async def smart_money_feed(chain: str = "solana", limit: int = 20, **kw) -> dict
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
smart_wallets = []
api_key = kw.get("api_key", "") or HELIUS_KEY
@ -142,7 +142,7 @@ async def smart_money_feed(chain: str = "solana", limit: int = 20, **kw) -> dict
w["entity"] = entity.get("name", "")
w["entity_type"] = entity.get("type", "")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
result = {
"smart_money_wallets": smart_wallets[:limit],
@ -157,7 +157,7 @@ async def smart_money_feed(chain: str = "solana", limit: int = 20, **kw) -> dict
r.setex(cache_key, CACHE_TTL["smart_money"], json.dumps(result, default=str))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -183,7 +183,7 @@ async def whale_alert_stream(
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
whales = []
api_key = kw.get("api_key", "") or HELIUS_KEY
@ -251,7 +251,7 @@ async def whale_alert_stream(
r.setex(cache_key, CACHE_TTL["whale_alert"], json.dumps(result, default=str))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -275,7 +275,7 @@ async def token_launch_scanner(chain: str = "solana", limit: int = 50, **kw) ->
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
new_tokens = []
api_key = kw.get("api_key", "") or HELIUS_KEY
@ -366,7 +366,7 @@ async def token_launch_scanner(chain: str = "solana", limit: int = 50, **kw) ->
r.setex(cache_key, CACHE_TTL["token_launch"], json.dumps(result, default=str))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -393,7 +393,7 @@ async def insider_pattern_detector(address: str = "", chain: str = "solana", **k
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
api_key = kw.get("api_key", "") or HELIUS_KEY
insider_signals = []
@ -464,7 +464,7 @@ async def insider_pattern_detector(address: str = "", chain: str = "solana", **k
r.setex(cache_key, CACHE_TTL["insider"], json.dumps(result, default=str))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -491,7 +491,7 @@ async def liquidity_risk_monitor(address: str = "", chain: str = "solana", **kw)
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
api_key = kw.get("api_key", "") or HELIUS_KEY
liquidity_data = {
@ -574,7 +574,7 @@ async def liquidity_risk_monitor(address: str = "", chain: str = "solana", **kw)
h["entity"] = entity["name"]
h["entity_type"] = entity.get("type", "")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
liquidity_data["token"] = address
liquidity_data["chain"] = chain
@ -586,7 +586,7 @@ async def liquidity_risk_monitor(address: str = "", chain: str = "solana", **kw)
r.setex(cache_key, CACHE_TTL["liquidity"], json.dumps(liquidity_data, default=str))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return liquidity_data
@ -613,7 +613,7 @@ async def holder_health_score(address: str = "", chain: str = "solana", **kw) ->
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
api_key = kw.get("api_key", "") or HELIUS_KEY
health = {
@ -711,7 +711,7 @@ async def holder_health_score(address: str = "", chain: str = "solana", **kw) ->
r.setex(cache_key, CACHE_TTL["holder_health"], json.dumps(health, default=str))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return health
@ -738,7 +738,7 @@ async def cross_chain_entity(address: str = "", **kw) -> dict | None:
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
if not ARKHAM_KEY:
return {"error": "ARKHAM_API_KEY required", "address": address}
@ -802,7 +802,7 @@ async def cross_chain_entity(address: str = "", **kw) -> dict | None:
r.setex(cache_key, CACHE_TTL["cross_chain"], json.dumps(result, default=str))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -892,7 +892,7 @@ async def rug_pattern_matcher(address: str = "", chain: str = "solana", **kw) ->
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
matches = []
api_key = kw.get("api_key", "") or HELIUS_KEY
@ -1043,7 +1043,7 @@ async def rug_pattern_matcher(address: str = "", chain: str = "solana", **kw) ->
r.setex(cache_key, CACHE_TTL["rug_pattern"], json.dumps(result, default=str))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
@ -1070,7 +1070,7 @@ async def developer_reputation(address: str = "", chain: str = "solana", **kw) -
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
api_key = kw.get("api_key", "") or HELIUS_KEY
reputation = {
@ -1151,7 +1151,7 @@ async def developer_reputation(address: str = "", chain: str = "solana", **kw) -
r.setex(cache_key, CACHE_TTL["dev_reputation"], json.dumps(reputation, default=str))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return reputation
@ -1181,7 +1181,7 @@ async def instant_token_report(address: str = "", chain: str = "solana", **kw) -
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
report = {
"token": address,
@ -1314,7 +1314,7 @@ async def instant_token_report(address: str = "", chain: str = "solana", **kw) -
if entity["entity"].get("entity_name"):
risk_scores.append(5) # Known entity = low risk
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── Compute Overall Risk ──
if risk_scores:
@ -1364,7 +1364,7 @@ async def instant_token_report(address: str = "", chain: str = "solana", **kw) -
r.setex(cache_key, CACHE_TTL["token_report"], json.dumps(report, default=str))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return report

View file

@ -354,7 +354,7 @@ class SocialDataAggregator:
Search for brand mentions - VERY expensive on free tier.
Heavily cached (24h). Only use for critical queries.
"""
cache_key = f"social:x:search:{hashlib.md5(query.encode()).hexdigest()}"
cache_key = f"social:x:search:{hashlib.sha256(query.encode()).hexdigest()}"
cached = await self.cache.get(cache_key)
if cached:
return cached

View file

@ -133,7 +133,7 @@ def fetch_nitter(db_r=None):
f" @{username}: {len([r for r in results if r['source'] == username])} tweets"
)
except Exception:
pass # Try next instance
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return results

View file

@ -212,7 +212,7 @@ async def detect_shill_campaigns(posts: list[dict] | None = None, **kw) -> dict:
}
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Store detected campaigns
DETECTED_CAMPAIGNS.extend(campaigns)

View file

@ -406,7 +406,7 @@ async def decode_spl_token_metadata(mint: str, rpc_urls: list[str] | None = None
if meta:
result["metadata"] = meta
except Exception:
pass # Metadata is optional
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result

View file

@ -603,7 +603,7 @@ async def run_quick_scan(address: str, chain: str = "ethereum", **kw) -> dict[st
else:
results["RP05"] = {"status": "pass", "details": f"Age={age_hours:.0f}h"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Volume authenticity
try:
@ -628,7 +628,7 @@ async def run_quick_scan(address: str, chain: str = "ethereum", **kw) -> dict[st
if vl_ratio > 5:
results["TA02"] = {"status": "warning", "details": f"V/L={vl_ratio:.1f}x"}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Compute final score
score, band, color = TokenSecurityScorer.compute_score(results)
@ -671,7 +671,7 @@ async def run_full_scan(address: str = "", chain: str = "ethereum", **kw) -> dic
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Run quick scan
result = await run_quick_scan(address, chain, **kw)
@ -703,7 +703,7 @@ async def run_full_scan(address: str = "", chain: str = "ethereum", **kw) -> dic
r.setex(cache_key, CACHE_TTL, json.dumps(result, default=str))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result

View file

@ -406,7 +406,7 @@ class DataBusVault:
if val and val not in ("", "None", "***"):
return val
except Exception:
pass # Vault unavailable, fall back to env
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Fallback to env var
val = os.getenv(env_name, "").strip()

View file

@ -460,7 +460,7 @@ async def analyze_volume_authenticity(address: str = "", chain: str = "ethereum"
return json.loads(cached)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
signals = []
tx_count = 0
@ -557,7 +557,7 @@ async def analyze_volume_authenticity(address: str = "", chain: str = "ethereum"
r.setex(cache_key, CACHE_TTL, json.dumps(output, default=str))
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return output

View file

@ -98,7 +98,7 @@ async def handle_webhook(service: str, payload: dict, headers: dict, raw_body: b
r.setex(f"webhook:dedup:{service}:{event_id}", 3600, "1")
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── 3. Store in DataBus cache ──
event_type = payload.get("type") or payload.get("event") or "unknown"
@ -120,7 +120,7 @@ async def handle_webhook(service: str, payload: dict, headers: dict, raw_body: b
)
r.close()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── 4. Index in RAG for intelligence ──
try:
@ -143,7 +143,7 @@ async def handle_webhook(service: str, payload: dict, headers: dict, raw_body: b
},
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── 5. Trigger premium scanner based on event type ──
scan_triggers = _get_scan_triggers(service, event_type, payload)
@ -162,7 +162,7 @@ async def handle_webhook(service: str, payload: dict, headers: dict, raw_body: b
metadata={"webhook_service": service, "event_id": event_id},
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return {
"status": "processed",

View file

@ -22,6 +22,7 @@ import json
from fastmcp import FastMCP
from app.core.redis import get_redis
import logging
# ── Server Setup ──
mcp = FastMCP("rmi-intelligence")
@ -164,7 +165,7 @@ def get_token_price(mint: str = "So11111111111111111111111111111111111111112") -
"free": True,
}
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return {
"mint": mint,
"price_usd": 68.27,

View file

@ -412,7 +412,7 @@ async def _cookie_scrape_x(handles: list[str]) -> list[dict]:
}
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return posts
except Exception as e:
logger.debug(f"Cookie scrape failed: {e}")
@ -556,7 +556,7 @@ def score_ct_post(post: dict, account: dict) -> float:
).total_seconds() / 3600
score += max(0, 5 - age_hours * 0.5) # 5 points now, 0 after 10 hours
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Content signals
text = post.get("text", "")

View file

@ -248,7 +248,7 @@ async def scan_known_scams(limit: int = 3) -> int:
if age_h < 24:
recent_count += 1
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
await r.close()

View file

@ -96,7 +96,7 @@ async def classify_scam_risk(text: str) -> dict:
if any(kw in content for kw in keywords):
scores[label] = scores.get(label, 0) + 0.1
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
if not scores:
return {
@ -236,7 +236,7 @@ async def label_wallet(wallet_data: dict) -> dict:
confidence_scores[label] = 0
confidence_scores[label] = min(confidence_scores[label] + 0.15, 1.0)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
labels = [
{"label": k, "confidence": v}

View file

@ -64,7 +64,7 @@ async def query_metasleuth(address: str, chain: str = "ethereum") -> list[Label]
if result.returncode == 0 and result.stdout.strip():
api_key = result.stdout.strip()
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
if not api_key:
log.debug("metasleuth_no_api_key configured, skipping")

View file

@ -238,7 +238,7 @@ class PredictionMarketService:
markets_data = json.loads(cached)
return [_dict_to_market(d) for d in markets_data]
except Exception:
pass # Cache miss or Redis error - fall through to live query
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Fire all 4 sources in parallel
results: list[list[PredictionMarket]] = await asyncio.gather(
@ -302,7 +302,7 @@ class PredictionMarketService:
data = json.loads(cached)
return _dict_to_digest(data)
except Exception:
pass # Cache miss or Redis error - fall through to live query
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Search for security-relevant crypto markets
security_queries = [
@ -554,7 +554,7 @@ class PredictionMarketService:
pm.probability_yes = live_price
pm.probability_no = 1.0 - live_price
except Exception:
pass # CLOB price is a bonus, Gamma price is fine
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return pm
except Exception as e:
@ -1047,7 +1047,7 @@ def _extract_token_symbols(text: str) -> list[str]:
def _cache_hash(*args) -> str:
"""Create a short hash for cache keys."""
raw = "|".join(str(a) for a in args)
return hashlib.md5(raw.encode()).hexdigest()[:12]
return hashlib.sha256(raw.encode()).hexdigest()[:12]
def _market_to_dict(m: PredictionMarket) -> dict:

View file

@ -66,6 +66,6 @@ class AIGuardWrapper:
if pattern in body_str:
return False, f"Malicious pattern detected: {pattern}"
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return True, None

View file

@ -224,7 +224,7 @@ def cluster_items(
it = group[0]
stories.append(
StoryCluster(
cluster_id=hashlib.sha1(
cluster_id=hashlib.sha256(
f"single:{it.id}:{it.published_at.isoformat()}".encode()
).hexdigest()[:16],
representative_title=it.title,
@ -251,7 +251,7 @@ def cluster_items(
rep = max(members, key=lambda x: len(x.title))
sentiments = [m.sentiment for m in members if m.sentiment is not None]
avg_sent = sum(sentiments) / len(sentiments) if sentiments else 0.0
cluster_id = hashlib.sha1(
cluster_id = hashlib.sha256(
":".join(sorted(m.id for m in members)).encode()
).hexdigest()[:16]
stories.append(

View file

@ -44,7 +44,7 @@ DEFAULT_FEEDS: list[dict[str, str]] = [
def _stable_id(source: str, url: str) -> str:
"""Stable news_id from source + URL."""
h = hashlib.md5(f"{source}:{url}".encode()).hexdigest()[:24]
h = hashlib.sha256(f"{source}:{url}".encode()).hexdigest()[:24]
return f"{source}:{h}"
@ -203,7 +203,7 @@ async def ingest_all(
r["qdrant_point_id"], ni.news_id,
)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
except Exception as e:
log.warning("ingest_rag_fail: %s", e)

View file

@ -30,6 +30,7 @@ from pydantic import BaseModel, ConfigDict, Field
from app.catalog.llm_router import LLMRouter
from app.catalog.models import utcnow
from app.catalog.service import get_catalog
import logging
# Prefix is /api/v1 (not /api/v1/news) per Phase 2 Wave 2 (AUDIT-2026-Q3.md):
# the catch-all endpoints moved to /api/v1/articles/{news_id} so that
@ -135,7 +136,7 @@ def _adapt_legacy_row(row: dict) -> NewsItemOut:
except ValueError:
continue
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return NewsItemOut(
news_id=row.get("id", ""),
url=row.get("url", ""),
@ -249,7 +250,7 @@ async def list_news(
asyncio.create_task(persist_clusters(stories))
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Return clusters as synthetic items (representative title, first source)
clustered_items = []
for s in stories:
@ -338,7 +339,7 @@ async def trending_news(
if d.get("ingested_at"):
hours_old = max(0, (now.timestamp() - float(d["ingested_at"])) / 3600)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
item = _adapt_legacy_row(d)
item.score = round(trend_score(hours_old, item.source, item.sentiment_score), 4)
items.append(item)

View file

@ -621,7 +621,7 @@ class AddressLabeler:
if rag_cits:
report.warnings[i] = build_citation_string(rag_cits, w)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return report

View file

@ -216,7 +216,7 @@ class ContractAuthorityScanner:
raw = base64.b64decode(data[0])
parsed_data = self._parse_spl_mint_raw(raw, token_address)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
elif isinstance(data, dict):
parsed_data = data

View file

@ -203,7 +203,7 @@ class ContractDiffAnalyzer:
if pattern.lower() in raw:
found.append(pattern.decode(errors="replace"))
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return found
def _compute_similarity(self, selectors_a: list[str], selectors_b: list[str]) -> float:
@ -364,7 +364,7 @@ class ContractDiffAnalyzer:
cit_str = build_citation_string(report.citations)
report.warnings[-1] += f" {cit_str}"
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
except Exception as e:
logger.error(f"Contract diff analysis failed: {e}")

View file

@ -609,6 +609,6 @@ class DecompilerAnalyzer:
if rag_cits:
report.warnings[i] = build_citation_string(rag_cits, w)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return report

View file

@ -367,6 +367,6 @@ class FlashLoanDetector:
if rag_cits:
report.warnings[i] = build_citation_string(rag_cits, w)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return report

View file

@ -557,7 +557,7 @@ class GasTraceAnalyzer:
)
result["first_seen"] = dt.strftime("%Y-%m-%dT%H:%M:%SZ")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Get transaction count (first page gives us an idea)
txs = FreeSolscanClient.account_transactions(address, page=1, page_size=20)
@ -575,7 +575,7 @@ class GasTraceAnalyzer:
dt = datetime.fromtimestamp(int(bt), tz=UTC)
result["first_seen"] = dt.strftime("%Y-%m-%dT%H:%M:%SZ")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Also check transfers to get a more complete picture
transfers = FreeSolscanClient.account_transfers(address, page=1, page_size=20)
@ -632,7 +632,7 @@ class GasTraceAnalyzer:
dt = datetime.fromtimestamp(ts, tz=UTC)
result["first_seen"] = dt.strftime("%Y-%m-%dT%H:%M:%SZ")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
except Exception as e:
logger.warning(f"EVM wallet info error for {address}: {e}")

View file

@ -469,6 +469,6 @@ class GovernanceAttackDetector:
if rag_cits:
report.warnings[i] = build_citation_string(rag_cits, w)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return report

View file

@ -498,7 +498,7 @@ class LiquidityVerifier:
# Weak signal - corroborate with burn-address check
pass
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return False

View file

@ -206,7 +206,7 @@ class OracleManipulationDetector:
if result and result != "0x" and result != "0x0":
return True, registry_addr
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Check contract source for Chainlink imports
source = await self._fetch_contract_source(token_address, chain)
@ -416,6 +416,6 @@ class OracleManipulationDetector:
if rag_cits:
report.warnings[i] = build_citation_string(rag_cits, w)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return report

View file

@ -489,6 +489,6 @@ class ProxyDetector:
if rag_cits:
report.warnings[i] = build_citation_string(rag_cits, w)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return report

View file

@ -431,6 +431,6 @@ class PumpDumpDetector:
if rag_cits:
report.warnings[i] = build_citation_string(rag_cits, w)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return report

View file

@ -352,7 +352,7 @@ class PumpFunAnalyzer:
if resp.status_code == 200:
return resp.json().get("result")
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return None
def _extract_buyer_from_tx(self, tx: dict, buyer_map: dict[str, BuyerProfile]) -> None:

View file

@ -512,7 +512,7 @@ class StaticAnalyzer:
if tmp_parent.startswith("/tmp/"):
shutil.rmtree(tmp_parent, ignore_errors=True)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
elif not report.used_heimdall_fallback:
warnings_msg = "Contract source not available and Heimdall not installed"
@ -549,6 +549,6 @@ class StaticAnalyzer:
if rag_cits:
report.warnings[i] = build_citation_string(rag_cits, w)
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return report

View file

@ -13,7 +13,6 @@ Run: cd /root/backend/app/domains/telegram/rugmunchbot && python3 bot.py
import asyncio
import contextlib
import logging
import random
import re
import sys
import time
@ -49,6 +48,7 @@ from app.domains.referral import (
get_referral_stats,
)
from app.domains.telegram.rugmunchbot import db
import secrets
from app.domains.telegram.rugmunchbot.config import (
BACKEND_URL,
BOT_DESCRIPTION,
@ -381,7 +381,7 @@ async def scan_token(address: str, chain: str | None = None) -> dict:
if rmi.get("dev_wallet"):
result["dev_wallet"] = rmi["dev_wallet"]
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# ── Volume authenticity ──
if result["volume_24h"] > 0 and result["mcap"] > 0:
@ -421,7 +421,7 @@ def format_scan_report(r: dict) -> str:
else:
age_str = f" | Age: {age.seconds // 3600}h"
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
lines = [
"🛡️ <b>RMI Token Scan</b>",
@ -564,10 +564,10 @@ async def analyze_wallet(address: str, chain: str | None = None) -> dict:
result["wallet_age_days"] = (datetime.now(UTC) - first).days
result["is_fresh"] = result["wallet_age_days"] < 7
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
return result
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
if is_sol(address):
try:
r = await client.get(f"https://api.solana.fm/v0/accounts/{address}")
@ -1115,7 +1115,7 @@ async def cmd_quick(update: Update, ctx: ContextTypes.DEFAULT_TYPE):
)
return
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
await update.message.reply_text(f"❌ Could not find token: <b>{symbol}</b>", parse_mode=ParseMode.HTML)
@ -1211,7 +1211,7 @@ async def cmd_news(update: Update, ctx: ContextTypes.DEFAULT_TYPE):
)
return
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
await update.message.reply_text(
f"📰 <b>Crypto News</b>\n\n"
f"News feed loading...\n\n"
@ -1613,7 +1613,7 @@ async def handle_message(update: Update, ctx: ContextTypes.DEFAULT_TYPE):
)
return
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Natural language address extraction
evm_match = EVM_RE.search(text)
@ -1674,7 +1674,7 @@ async def handle_message(update: Update, ctx: ContextTypes.DEFAULT_TYPE):
await update.message.reply_text(answer, parse_mode=ParseMode.HTML, reply_markup=back_kb())
return
except Exception:
pass
logging.getLogger(__name__).warning("swallowed exception", exc_info=True)
# Smart fallback responses
text_lower = text.lower()
@ -2016,7 +2016,7 @@ async def setup_bot_profile(app: Application):
async def daily_scam_tip(ctx: ContextTypes.DEFAULT_TYPE):
if not CHANNELS.get("main"):
return
topic_key = random.choice(list(SCAM_SCHOOL_TOPICS.keys()))
topic_key = secrets.choice(list(SCAM_SCHOOL_TOPICS.keys()))
topic = SCAM_SCHOOL_TOPICS[topic_key]
text = (
f"🛡️ <b>Daily Scam Tip</b>\n{sep()}\n\n"

Some files were not shown because too many files have changed in this diff Show more