% solidity, audit, smartcontract, ethereum, foundry # Foundry - create new project forge init # Foundry - build/compile forge build # Foundry - run tests forge test # Foundry - run tests verbose forge test -vvvv # Foundry - run specific test forge test --match-test # Foundry - gas report forge test --gas-report # Foundry - coverage forge coverage # Foundry - deploy contract forge create --rpc-url --private-key # Foundry - verify contract forge verify-contract
--chain # Cast - call read function cast call "" --rpc-url # Cast - send transaction cast send "" --rpc-url --private-key # Cast - decode calldata cast calldata-decode "" # Cast - get storage slot cast storage --rpc-url # Cast - keccak256 hash cast keccak "" # Cast - convert to wei cast to-wei ether # Cast - convert from wei cast from-wei # Slither - full analysis slither # Slither - specific detectors slither --detect # Slither - print contract summary slither --print contract-summary # Slither - print function summary slither --print function-summary # Slither - print inheritance slither --print inheritance-graph # Slither - human summary slither --print human-summary # Slither - list detectors slither --list-detectors # Mythril - analyze contract myth analyze # Mythril - analyze deployed contract myth analyze --address --rpc # Mythril - execution timeout myth analyze --execution-timeout 300 # Echidna - fuzz testing echidna --contract # Echidna - with config echidna --contract --config echidna.yaml # Aderyn - static analysis (Rust-based, fast) aderyn # Solhint - linter solhint # Solhint - init config solhint --init # Common vulnerability patterns to check: # - Reentrancy (external calls before state changes) # - Integer overflow/underflow (pre-0.8.0) # - Unchecked return values # - Access control issues # - Front-running susceptibility # - Oracle manipulation # - Flash loan attacks # - Delegate call to untrusted contract # Check for selfdestruct grep -rn "selfdestruct\|suicide" # Check for delegatecall grep -rn "delegatecall" # Check for tx.origin grep -rn "tx.origin" # Check for inline assembly grep -rn "assembly" $ project_name: echo "my_project" $ contract: find . -name "*.sol" 2>/dev/null | head -10 $ contract_or_dir: echo "." $ contract_address: echo "0x..." $ rpc_url: echo "https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY" $ private_key: echo "" $ function_sig: echo "balanceOf(address)" $ test_name: echo "test" $ detector: echo "reentrancy-eth\nreentrancy-no-eth\narbitrary-send\nsuicide\nuninitialized-storage" $ chain_id: echo "1\n5\n137\n42161" --- --header "1=mainnet, 5=goerli, 137=polygon, 42161=arbitrum" $ slot: echo "0" $ dir: echo "src/"