Skip to content

Instantly share code, notes, and snippets.

@patrickd-
Created February 14, 2022 18:06
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save patrickd-/f56a54133726e3819698361fc543fdc3 to your computer and use it in GitHub Desktop.
Save patrickd-/f56a54133726e3819698361fc543fdc3 to your computer and use it in GitHub Desktop.

Setup

Install virtualenv

sudo apt install virtualenv

Install virtualenvwrapper

sudo pip install virtualenv
sudo pip install virtualenvwrapper

Add the following to the end of the .bashrc file

export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source ~/.local/bin/virtualenvwrapper.sh

Execute the .bashrc file

source ~/.bashrc
sudo ln /usr/bin/python3 /usr/bin/python
git clone https://github.com/crytic/slither.git && cd slither
mkvirtualenv --python=`which python3` slither-dev
python setup.py develop

Usage

cd slither
git pull
workon slither-dev
python setup.py develop

# analyze complete (eg. hardhat) project
cd ../project
slither .

# print info
slither --print variable-order

Troubleshooting

  • Install solc-select and select correct version
  • Various solc versions used in project? Analyze individual files
  • Individual files have dependencies in node_modules?
    • like: solc --allow-paths=$(pwd) @openzeppelin/=$(pwd)/node_modules/@openzeppelin/ contracts/Contract.sol
    • run: slither --solc-remaps @openzeppelin/=$(pwd)/node_modules/@openzeppelin/ contracts/Contract.sol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment