- Move app/domains/tokens/deployer.py -> app/domains/token/deployer.py. Delete app/domains/tokens/ (was a single-file shadow of the token domain). - Move app/domains/scanner/* into app/domains/scanners/core/. The 31 detector modules in app/domains/scanners/ + the core service are now a single coherent domain. - Update import paths in app/token_scanner.py and app/token_deployer.py. - Delete empty app/domain/ (singular, was a leftover scaffold). - Factory still loads 466 routes, mypy-gate clean.
270 lines
11 KiB
Python
270 lines
11 KiB
Python
"""Scanner modules - all scanner functions."""
|
|
|
|
from typing import Any
|
|
|
|
from app.core.logging import get_logger
|
|
|
|
logger = get_logger(__name__)
|
|
|
|
|
|
async def _check_blockscout(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check token on Blockscout."""
|
|
logger.info("check_blockscout", token=token_address, chain=chain)
|
|
return {"check": "blockscout", "result": "pending"}
|
|
|
|
|
|
async def _check_token_sniffer(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check token on TokenSniffer."""
|
|
logger.info("check_token_sniffer", token=token_address, chain=chain)
|
|
return {"check": "tokensniffer", "result": "pending"}
|
|
|
|
|
|
async def _check_trm_sanctions(address: str) -> dict[str, Any] | None:
|
|
"""Check address on TRM sanctions list."""
|
|
logger.info("check_trm_sanctions", address=address[:10])
|
|
return {"check": "trm", "result": "pending"}
|
|
|
|
|
|
async def _check_scorechain_sanctions(address: str, chain: str = "ethereum") -> dict[str, Any] | None:
|
|
"""Check address on Scorechain sanctions list."""
|
|
logger.info("check_scorechain", address=address[:10], chain=chain)
|
|
return {"check": "scorechain", "result": "pending"}
|
|
|
|
|
|
async def _check_chainabuse(address: str) -> dict[str, Any] | None:
|
|
"""Check address on Chainabuse."""
|
|
logger.info("check_chainabuse", address=address[:10])
|
|
return {"check": "chainabuse", "result": "pending"}
|
|
|
|
|
|
async def _check_forta_alerts(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check Forta alerts for token."""
|
|
logger.info("check_forta", token=token_address, chain=chain)
|
|
return {"check": "forta", "result": "pending"}
|
|
|
|
|
|
async def _check_defillama_context(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check DeFiLlama context for token."""
|
|
logger.info("check_defillama", token=token_address, chain=chain)
|
|
return {"check": "defillama", "result": "pending"}
|
|
|
|
|
|
async def _check_coingecko_price(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check CoinGecko price for token."""
|
|
logger.info("check_coingecko", token=token_address, chain=chain)
|
|
return {"check": "coingecko", "result": "pending"}
|
|
|
|
|
|
async def _check_1inch_swap(token_address: str, chain: str, amount_usd: float = 100.0) -> dict[str, Any] | None:
|
|
"""Check 1inch swap for token."""
|
|
logger.info("check_1inch", token=token_address, chain=chain, amount_usd=amount_usd)
|
|
return {"check": "1inch", "result": "pending"}
|
|
|
|
|
|
async def _get_holder_data(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Get holder data for token."""
|
|
logger.info("get_holder_data", token=token_address, chain=chain)
|
|
return {"check": "holders", "result": "pending"}
|
|
|
|
|
|
async def _get_deployer_info(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Get deployer info for token."""
|
|
logger.info("get_deployer_info", token=token_address, chain=chain)
|
|
return {"check": "deployer", "result": "pending"}
|
|
|
|
|
|
async def _rag_scam_check(token_address: str, chain: str, deployer: str | None = None) -> dict[str, Any] | None:
|
|
"""Check RAG for scam indicators."""
|
|
logger.info("rag_scam_check", token=token_address, chain=chain, deployer=deployer)
|
|
return {"check": "rag", "result": "pending"}
|
|
|
|
|
|
async def _deep_deployer_check(deployer_addr: str, chain: str) -> dict[str, Any] | None:
|
|
"""Deep check of deployer address."""
|
|
logger.info("deep_deployer_check", deployer=deployer_addr, chain=chain)
|
|
return {"check": "deployer_deep", "result": "pending"}
|
|
|
|
|
|
async def _check_cross_chain_deployer(deployer_addr: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check if deployer has cross-chain activity."""
|
|
logger.info("cross_chain_deployer", deployer=deployer_addr, chain=chain)
|
|
return {"check": "cross_chain", "result": "pending"}
|
|
|
|
|
|
async def _check_contract_verification(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check if contract is verified."""
|
|
logger.info("check_verification", token=token_address, chain=chain)
|
|
return {"check": "verified", "result": "pending"}
|
|
|
|
|
|
async def _check_liquidity_lock_multi(token_address: str, chain: str, pair_address: str = "") -> dict[str, Any] | None:
|
|
"""Check liquidity lock status."""
|
|
logger.info("check_liquidity", token=token_address, chain=chain)
|
|
return {"check": "liquidity", "result": "pending"}
|
|
|
|
|
|
async def _check_copycat(symbol: str, name: str) -> dict[str, Any] | None:
|
|
"""Check if token is a copycat of a top symbol."""
|
|
logger.info("check_copycat", symbol=symbol, name=name)
|
|
return {"check": "copycat", "result": "pending"}
|
|
|
|
|
|
async def _check_volume_anomaly(
|
|
token_address: str,
|
|
chain: str,
|
|
market_price: float = 0,
|
|
volume_24h: float = 0,
|
|
circulating_supply: float = 0,
|
|
) -> dict[str, Any] | None:
|
|
"""Check for volume anomalies."""
|
|
logger.info("check_volume", token=token_address, chain=chain)
|
|
return {"check": "volume", "result": "pending"}
|
|
|
|
|
|
async def _get_price_consensus(token_address: str, chain: str, market_price: float = 0) -> dict[str, Any] | None:
|
|
"""Get price consensus across multiple sources."""
|
|
logger.info("price_consensus", token=token_address, chain=chain)
|
|
return {"check": "price", "result": "pending"}
|
|
|
|
|
|
async def _get_birdeye_data(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Get Birdeye data for token."""
|
|
logger.info("birdeye_data", token=token_address, chain=chain)
|
|
return {"check": "birdeye", "result": "pending"}
|
|
|
|
|
|
async def _verify_mint_consensus(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Verify mint authority consensus."""
|
|
logger.info("verify_mint", token=token_address, chain=chain)
|
|
return {"check": "mint", "result": "pending"}
|
|
|
|
|
|
async def _ingest_scan_to_rag(scan_result) -> None:
|
|
"""Ingest scan result to RAG for future searches."""
|
|
logger.info("ingest_to_rag", token=scan_result.token_address)
|
|
|
|
|
|
async def _get_solscan_data(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Get Solscan data for token."""
|
|
logger.info("solscan_data", token=token_address, chain=chain)
|
|
return {"check": "solscan", "result": "pending"}
|
|
|
|
|
|
async def _get_moralis_data(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Get Moralis data for token."""
|
|
logger.info("moralis_data", token=token_address, chain=chain)
|
|
return {"check": "moralis", "result": "pending"}
|
|
|
|
|
|
async def _get_etherscan_enhanced(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Get enhanced Etherscan data for token."""
|
|
logger.info("etherscan_enhanced", token=token_address, chain=chain)
|
|
return {"check": "etherscan", "result": "pending"}
|
|
|
|
|
|
async def _get_quicknode_pumpfun(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Get Quicknode Pump.fun data for token."""
|
|
logger.info("quicknode_pumpfun", token=token_address, chain=chain)
|
|
return {"check": "quicknode", "result": "pending"}
|
|
|
|
|
|
async def _check_nansen(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check Nansen data for token."""
|
|
logger.info("nansen_check", token=token_address, chain=chain)
|
|
return {"check": "nansen", "result": "pending"}
|
|
|
|
|
|
async def _check_chainaware(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check ChainAware data for token."""
|
|
logger.info("chainaware_check", token=token_address, chain=chain)
|
|
return {"check": "chainaware", "result": "pending"}
|
|
|
|
|
|
async def _check_blowfish(token_address: str, chain: str, user_address: str = "") -> dict[str, Any] | None:
|
|
"""Check Blowfish AI for token."""
|
|
logger.info("blowfish_check", token=token_address, chain=chain, user=user_address)
|
|
return {"check": "blowfish", "result": "pending"}
|
|
|
|
|
|
async def _check_santiment(symbol: str) -> dict[str, Any] | None:
|
|
"""Check Santiment for token."""
|
|
logger.info("santiment_check", symbol=symbol)
|
|
return {"check": "santiment", "result": "pending"}
|
|
|
|
|
|
async def _check_fear_greed() -> dict[str, Any] | None:
|
|
"""Check Crypto Fear & Greed index."""
|
|
logger.info("fear_greed_check")
|
|
return {"check": "fear_greed", "result": "pending"}
|
|
|
|
|
|
async def _check_news_sentiment(symbol: str) -> dict[str, Any] | None:
|
|
"""Check news sentiment for token."""
|
|
logger.info("news_sentiment_check", symbol=symbol)
|
|
return {"check": "news", "result": "pending"}
|
|
|
|
|
|
async def _check_augmento(symbol: str) -> dict[str, Any] | None:
|
|
"""Check Augmento for token."""
|
|
logger.info("augmento_check", symbol=symbol)
|
|
return {"check": "augmento", "result": "pending"}
|
|
|
|
|
|
async def _check_coingecko_trending() -> dict[str, Any] | None:
|
|
"""Check CoinGecko trending tokens."""
|
|
logger.info("coingecko_trending")
|
|
return {"check": "trending", "result": "pending"}
|
|
|
|
|
|
async def _check_webacy(address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check Webacy for address."""
|
|
logger.info("webacy_check", address=address, chain=chain)
|
|
return {"check": "webacy", "result": "pending"}
|
|
|
|
|
|
async def _check_sourcify(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check Sourcify for token."""
|
|
logger.info("sourcify_check", token=token_address, chain=chain)
|
|
return {"check": "sourcify", "result": "pending"}
|
|
|
|
|
|
async def _check_scamsniffer_live(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check ScamSniffer Live for token."""
|
|
logger.info("scamsniffer_live", token=token_address, chain=chain)
|
|
return {"check": "scamsniffer", "result": "pending"}
|
|
|
|
|
|
async def _check_dune(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check Dune analytics for token."""
|
|
logger.info("dune_check", token=token_address, chain=chain)
|
|
return {"check": "dune", "result": "pending"}
|
|
|
|
|
|
async def _check_arkham(address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check Arkham for address."""
|
|
logger.info("arkham_check", address=address, chain=chain)
|
|
return {"check": "arkham", "result": "pending"}
|
|
|
|
|
|
async def _check_thegraph(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check The Graph for token."""
|
|
logger.info("thegraph_check", token=token_address, chain=chain)
|
|
return {"check": "thegraph", "result": "pending"}
|
|
|
|
|
|
async def _check_honeypot_is(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check if token is a honeypot using IS platform."""
|
|
logger.info("check_honeypot_is", token=token_address, chain=chain)
|
|
return {"check": "honeypot", "result": "pending"}
|
|
|
|
|
|
async def _check_chainpatrol_asset(asset_type: str, asset_id: str) -> dict[str, Any] | None:
|
|
"""Check asset on ChainPatrol."""
|
|
logger.info("check_chainpatrol", type=asset_type, id=asset_id)
|
|
return {"check": "chainpatrol", "result": "pending"}
|
|
|
|
|
|
async def _check_defi_scanner(token_address: str, chain: str) -> dict[str, Any] | None:
|
|
"""Check token on DeFi Scanner."""
|
|
logger.info("check_defi_scanner", token=token_address, chain=chain)
|
|
return {"check": "defi_scanner", "result": "pending"}
|