fetch-source
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.
Examples
# Fetch Uniswap V3 Factory on Ethereum (chain 1)
./scripts/fetch_sources.sh -c 1 0x1F98431c8aD98523631AE4a59f267346ea31F984
# Custom output directory
./scripts/fetch_sources.sh -c 137 -o ./uniswap_polygon 0x1F98431c8aD98523631AE4a59f267346ea31F984
Chain IDs
Common chain IDs: 1 (Ethereum), 10 (Optimism), 56 (BSC), 137 (Polygon), 8453 (Base), 42161 (Arbitrum)
Output
sources_<address>/sourcify.jsonoretherscan.json— raw API responsesources_<address>/<filepath>.sol— individual source files as returned by the verifier
Weekly Installs
1
Repository
syjcnss/web3_skillsFirst Seen
7 days ago
Security Audits
Installed on
amp1
cline1
opencode1
cursor1
kimi-cli1
codex1