MCPcopy Index your code
hub / github.com/0xKitsune/sstan

github.com/0xKitsune/sstan @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
347 symbols 919 edges 73 files 24 documented · 7%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

sstan Github Actions

sstan is a Solidity static analyzer specifically designed for the Code4Arena Bot Races. With the constantly changing landscape of the bot races, this design prioritizes DevX, using an Extractor pattern and macros to enable extremely quick development times when implementing new patterns. sstan comes "out of the box" with patterns to identify 50+ optimizations, vulnerabilities and QA patterns.

Table of Contents

 

Installation

First, make sure that you have Rust installed. Then you can enter the following commands in your terminal.

git clone https://github.com/0xKitsune/sstan &&
cd sstan &&
cargo install --path .

 

Usage

Now that you have sstan installed, you can use the sstan command from anywhere in your terminal. By default, sstan looks for a ./src directory and analyzes every file within the folder. If you would like to specify the directory sstan should target, you can pass the --path flag (ex. sstan --path <path_to_dir>).

In the default configuration, sstan runs analysis for every currently included optimization, vulnerability and QA pattern, however if you would like to run analysis for select patterns, you can create a .toml file for your custom configuration. You can use the default sstan.toml configuration for reference. After creating a custom .toml file, make sure to pass the --toml flag when running sstan (ex. sstan --toml <path_to_toml_file>).

Usage: sstan [OPTIONS]

Options:
  -p, --path <PATH>      Path to the root directory to analyze. The default directory is `./src`
  -o, --output <OUTPUT>  Path to the directory where the report will be written. The default directory is `./`
  -g, --git <GIT>        Github repository link for the codebase being analyzed (e.g `https://github.com/repo/blob/main`). This will create hyperlinks to line numbers within the final report.
  -t, --toml <TOML>      Path to `.toml` file containing a custom sstan configuration.
  -h, --help             Print help

 

Contributing

Check out Contributing.md for adding new features.

Extension points exported contracts — how you extend this code

Visitor (Interface)
A trait that is invoked while traversing the Solidity Parse Tree. Each method of the [Visitor] trait is a hook that can [23 …
src/extractors/visitor.rs
VulnerabilityPattern (Interface)
(no doc) [7 implementers]
src/vulnerabilities/mod.rs
OptimizationPattern (Interface)
(no doc) [26 implementers]
src/optimizations/mod.rs
QAPattern (Interface)
(no doc) [25 implementers]
src/qa/mod.rs
Pushable (Interface)
TODO: FIXME: maybe update this name [1 implementers]
src/engine.rs
Visitable (Interface)
All [`solang_parser::pt`] types, such as [Statement], should implement the [Visitable] trait that accepts a trait [Visit [14 …
src/extractors/visitable.rs
EngineModule (Interface)
(no doc) [3 implementers]
src/engine.rs
Extractor (Interface)
(no doc) [19 implementers]
src/extractors/mod.rs

Core symbols most depended-on inside this repo

push_or_insert
called by 73
src/engine.rs
add_source
called by 65
src/utils.rs
visit_expr
called by 44
src/extractors/visitor.rs
visit_ident
called by 34
src/extractors/visitor.rs
visit_yul_block
called by 11
src/extractors/visitor.rs
visit_statement
called by 10
src/extractors/visitor.rs
visit_yul_expr
called by 10
src/extractors/visitor.rs
visit_ident_path
called by 6
src/extractors/visitor.rs

Shape

Method 222
Function 89
Class 23
Interface 9
Enum 4

Languages

Rust100%

Modules by API surface

src/extractors/visitor.rs128 symbols
src/report.rs24 symbols
src/extractors/primitive.rs17 symbols
src/utils.rs14 symbols
src/engine.rs11 symbols
src/vulnerabilities/unprotected_self_destruct.rs6 symbols
src/extractors/mod.rs6 symbols
src/optimizations/safe_math.rs5 symbols
bin/sstan.rs5 symbols
src/qa/public_functions.rs4 symbols
src/optimizations/increment_decrement.rs4 symbols
src/optimizations/immutable_variable.rs4 symbols

For agents

$ claude mcp add sstan \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact