DOCUMENTATION

import EtherscanOptions from "../../reference/common/etherscan-optionsx"; import CommonOptions from "./common-optionsx";

cast etherscan-source


NAME

cast-etherscan-source - Get the source code of a contract from Etherscan.

SYNOPSIS

cast 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.

<EtherscanOptions /> <CommonOptions />

EXAMPLES

  1. Get the source code of the WETH contract:

    cast source 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
    
  2. Expand the source code of the WETH contract into a directory named weth

    cast source -d weth 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
    

SEE ALSO

cast