forked! easy POC template generation from the command line
- add .env (just because)
- fix messy directories by just flattening everything into /src
- fix import paths to be always relative (compiler doesn't mind)
- adjust pragma solidity in POC.t.sol (90% of cases require it)
- remappings only for /lib (some edge cases are nasty)
- comments!
catching edge cases in bash is hard. some of edge cases user needs to for now resolve manually:
- missing last closing bracket for some contracts downloaded
- "pragma abicoder v2;" missing when needed in POC.t.sol
- remember to provide checksumed address otherwise tests will not build
- no edge case for import paths using ' and not " (uni v3)
- forge-std won't compile for <0.6.2
- ...more
best to run forge build
inside the directory and just resolve manually
other best is to just re-write in python
requiring always different type of intervention. after resolving contracts will compile.
UniswapV3Factory: 0x1F98431c8aD98523631AE4a59f267346ea31F984 RocketETH: 0xae78736Cd615f374D3085123A210448E74Fc6393 Comet (Compound): 0x1C1853Bc7C6bFf0D276Da53972C0b1a066DB1AE7 (bracket) stEth: 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84 (diff proxy)
from the command line, call quickpoc 0x.. [folder_name]
to generate a ready-to-go sandbox for running POCs for the given address against mainnet, including:
- forge template with name mirroring contract name
src/
folder populated with all contracts and libraries- test file autogenerated with contract import
- test setup with contract variable and mainnet forking
cd folder_name
copied to clipboard to save you 1 extra second
you can run forge test
to confirm it's working, then go into tests/POC.t.sol
to interact with the contract (saved in storage as c
).
- on a UNIX machine with bash installed, install all dependencies:
- foundry (follow instructions here)
- jq (
brew install jq
) - graphviz (
brew install graphviz
) - surya (
npm i -g surya
) - sol2uml (
npm i -g sol2uml
)
-
download the
quickpoc
file from this repo. -
set up two environment variables by calling the following from your terminal:
export ETH_RPC_URL="..."
export ETHERSCAN_API_KEY="..."
-
you can then run it directly by calling the file (
./quickpoc
) -
more conveniently, install it globally:
- put it somewhere you won't touch it (usually
~/bin
) - if this folder isn't already in your path, open your bash run control file (for example,
~/.zshrc
) and add the following line:export PATH="$PATH:/Users/path_to_folder_holding_file
- call
chmod +x path_to_file
to make the file executable - you should then be able to call
quickpoc 0x..
from any folder to generate the POC folder within it.
- support non-mainnet networks
- allow inputting multiple addresses
- automatically pull all contracts listed on an immunefi page
please submit issues for any additional features you'd like to see :)
big thanks to deliriusz for adding graph viz tools, proxy checks, and professionalism.