Adding slither static analyzer #478
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Verify Smart Contracts | |
on: | |
push: | |
branches: | |
- main | |
- staging | |
- development | |
pull_request: | |
branches: | |
- main | |
- staging | |
- development | |
types: | |
- opened | |
- synchronize | |
env: | |
BSC_MAINNET_RPC_URL: ${{ vars.BSC_MAINNET_RPC_URL }} | |
jobs: | |
lint: | |
name: Lint contracts | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
cache: "yarn" | |
- name: Install dependencies | |
run: yarn --ignore-scripts | |
- name: Lint code | |
run: |- | |
cd packages/contracts | |
yarn solhint 'src/**/*.sol' -w 0 | |
- name: Check license type | |
run: |- | |
cd packages/contracts | |
yarn lint:license | |
test: | |
name: Test contracts | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
cache: "yarn" | |
- name: Install dependencies | |
run: yarn --ignore-scripts | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly-e15e33a07c0920189fc336391f538c3dad53da73 # https://github.com/foundry-rs/foundry/releases/tag/nightly-e15e33a07c0920189fc336391f538c3dad53da73 | |
- name: Install static analyzer | |
working-directory: ./packages/contracts | |
run: |- | |
chmod +x slither.sh | |
./slither.sh | |
# Need for hardhat scripts | |
- name: Link packages | |
run: yarn bootstrap | |
- name: Run tests (foundry) | |
run: |- | |
cd packages/contracts | |
FOUNDRY_FUZZ_RUNS=1000 forge test -vvv --gas-report | |
- name: Run tests (hardhat) | |
env: | |
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }} | |
run: |- | |
cd packages/contracts | |
USE_BSC_FORK=true yarn test:hardhat | |