cast etherscan-source
NAME
cast-etherscan-source - Get the source code of a contract from Etherscan.
SYNOPSIS
cast etherscan-source
[options] address
DESCRIPTION
Get the source code of a contract from Etherscan.
The destination (to) can be an ENS name or an address.
OPTIONS
Output Options
-d
directory
The output directory to expand the source tree into.
If not provided, the source will be outputted to stdout.
-f
--flatten
Whether to flatten the source code.
Etherscan Options
--chain
chain_name
The Etherscan chain.
--etherscan-api-key
key
Etherscan API key, or the key of an Etherscan configuration table.
Environment: ETHERSCAN_API_KEY
Common Options
-h
--help
Prints help information.
EXAMPLES
-
Get the source code of the WETH contract:
cast etherscan-source 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
-
Expand the source code of the WETH contract into a directory named
weth
cast etherscan-source -d weth 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2