Generates a Foundry project from a contract address
sudo git clone https://github.com/erc1337-Coffee/chain2foundry
cd chain2foundry/
sudo apt install python3
sudo python3 -m pip install -r requirements.txt
$ python3 chain2foundry.py
usage: chain2foundry.py [-h] -a ADDRESS [-n NETWORK] [-k API-KEY] [-o OUTPUT_DIR] [-f]
optional arguments:
-h, --help Show this help message and exit
-a ADDRESS, --address ADDRESS Contract address
-n NETWORK, --network NETWORK Network the contract is deployed on (default:mainnet / goerli)
-k API-KEY, --api-key API-KEY Etherscan API key (default: a shared one)
-o OUTPUT_DIR, --output OUTPUT_DIR Output directory
-f, --force Overwrite the output directory if it already exists
$ python3 chain2foundry.py -a 0x8A98E5c8211D20C6c1c82c78c46f5A0528062881 -n goerli -o /tmp/ -f
Fetching the contract source code from Etherscan API...
Creating project ApeCoinStaking at /tmp/ApeCoinStaking
Done ! gl hf fren :)
- Test it to find bugs and edge cases
- Proxies ?
- Support all chains (if there's an API to fetch contract sources aka Polygon, AVAX, Arbitrum, Optimism...)
- Automate tests creation
- Automate constructor arguments parsing
- How cool would it be if the script deployed contracts & populated them on an Anvil node with the same data as currently on-chain ?