MCPcopy Index your code
hub / github.com/cakevm/kabu

github.com/cakevm/kabu @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
1,997 symbols 4,913 edges 291 files 186 documented · 9%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Kabu

Kabu Logo

CI status Book status Telegram Chat

| User Book | Crate Docs |

⚠️ WARNING: This codebase is under heavy development and far from ready for production use.

The code is currently being actively refactored and modernized. Many features are incomplete, broken, or subject to breaking changes without notice. It is a long road from custom types to reth node types and using all providers from reth. With limited time, it will take a while. In the meantime, feel free to join the Telegram group for discussion.

What is Kabu?

Kabu is a backrunning bot, currently under heavy development. It continues the journey of loom. Since then many breaking changes have been made to revm, reth and alloy. The goal here is to make everything work again and modernize the codebase. Currently, Kabu is a work in progress and not yet ready for production use.

Who is Kabu for?

For everyone that does not like to reinvent the wheel all the time. Have foundation to work with, extend it, rewrite it or use it as playground to learn about MEV and backrunning.

Kabu is opinionated

  • Kabu will only support node (reth embedded) and remote (json-rpc).
  • We reuse as much as possible from reth, alloy and revm

Roadmap

  • Remove KabuDataTypes
  • Remove Actor model and use trait based components like in reth ✅
  • Remove topology and simplify the config / codebase ✅
  • Refactor the extra db pool cache layer to make it optional 🛠️
  • Have components that can be replaced with custom implementations 🛠️
  • Make complex arb strategies work

Kabu contract

Find the Kabu contract here.

Why "Kabu"?

In Japanese, kabu (株) means "stock" — both in the financial sense and as a metaphor for growth.

Setup

Prerequisites

  • Rust
  • Optional: PostgreSQL (for database)
  • Optional: InfluxDB (for metrics)
  • RPC node (e.g. your own node)

Building Kabu

# Development build
make
# Release build (optimized)
make release
# Maximum performance build
make maxperf

Configuration

Kabu supports two modes: - Remote mode: Connect to an external Reth or Geth node via RPC - Node mode: Run with reth embedded with direct access to node internals and db [PREFERRED]

Acknowledgements

Many thanks to dexloom! This project is a hard-fork from loom, based on this branch. The flashbots crate is fork of ethers-flashbots. The uniswap-v3-math crate is a fork of uniswap-v3-math. Additionally, some code for the Uniswap V3 pools is derived from amms-rs. Last but not least, a big shoutout to Paradigm — without their work, this project would not have been possible.

License

This project is licensed under the Apache 2.0 or MIT.

Extension points exported contracts — how you extend this code

Component (Interface)
A component is a long-running task that processes data [36 implementers]
crates/core/components/src/lib.rs
Pool (Interface)
(no doc) [7 implementers]
crates/types/market/src/pool.rs
ProtocolAbiSwapEncoderTrait (Interface)
(no doc) [6 implementers]
crates/execution/multicaller/src/pool_abi_encoder/mod.rs
Protocol (Interface)
(no doc) [3 implementers]
crates/defi/pools/src/protocols/protocol.rs
KabuRethFullProvider (Interface)
A trait that matches exactly what `reth_storage_rpc_provider::RpcBlockchainProvider` implements as minimum requirements. [1 …
crates/node/reth-api/src/traits.rs
DatabaseKabuExt (Interface)
(no doc) [1 implementers]
crates/evm/db/src/database_loom.rs
ComponentBuilder (Interface)
Trait for building components from context [11 implementers]
crates/core/node/src/traits.rs
PoolAbiEncoder (Interface)
(no doc) [6 implementers]
crates/types/market/src/pool.rs

Core symbols most depended-on inside this repo

clone
called by 609
crates/types/market/src/pool.rs
unwrap
called by 347
crates/types/swap/src/swap_line.rs
clone
called by 204
crates/defi/pools/src/curvepool.rs
insert
called by 124
crates/types/blockchain/src/opcodes.rs
unwrap_or_default
called by 110
crates/types/swap/src/swap_line.rs
len
called by 100
crates/types/swap/src/swap_step.rs
get
called by 97
crates/types/blockchain/src/opcodes.rs
call
called by 71
crates/node/debug-provider/src/httpcached.rs

Shape

Method 1,327
Function 337
Class 249
Interface 44
Enum 40

Languages

Rust100%

Modules by API surface

crates/evm/db/src/kabu_db.rs58 symbols
crates/types/market/src/swap_path.rs47 symbols
crates/types/market/src/market.rs45 symbols
crates/defi/pools/src/uniswapv3pool.rs42 symbols
crates/defi/pools/src/protocols/curve.rs42 symbols
crates/types/entities/src/block_history/block_history_impl.rs40 symbols
crates/defi/pools/src/curvepool.rs40 symbols
crates/types/swap/src/swap_line.rs37 symbols
crates/defi/pools/src/uniswapv2pool.rs36 symbols
crates/defi/pools/src/pancakev3pool.rs36 symbols
crates/defi/pools/src/maverickpool.rs33 symbols
crates/types/swap/src/swap_step.rs31 symbols

Datastores touched

kabuDatabase · 1 repos

For agents

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

⬇ download graph artifact