fetch-source
Installation
SKILL.md
Fetch Source
Fetches verified smart contract source code from Sourcify and Etherscan for any EVM-compatible chain.
Usage
./scripts/fetch_sources.sh -c <chain_id> [-o <output_dir>] <address>
Optional environment variable: ETHERSCAN_API_KEY (enables Etherscan fallback if not found on Sourcify)
What it does
- Tries Sourcify first (no API key needed)
- Falls back to Etherscan v2 API if not found on Sourcify
- Saves all source files under
sources_<address>/(or custom-odir)
Handles all Etherscan source formats: standard JSON input (with or without extra braces), and single flat files. Detects Vyper vs Solidity by compiler version.