Hybrid demo (production-style): a high-performance Rust executor for the execution hot-path, and a flexible Node.js / TypeScript orchestrator for event listening, heuristics and orchestration.
⚠️ This repository is a demo intended for testnet / forked mainnet use only. Do NOT use with real funds on mainnet until you fully audit, harden, and secure your deployment.
If you have any question or something, feel free to reach out me anytime via telegram, discord or twitter.
WhatsApp: @Leo
Telegram: @Leo
Discord: @Leo
This project demonstrates a pragmatic production-style architecture used for high-frequency DeFi operations:
-
- PairCreated: Node.js orchestrator subscribes to liquidity events.
-
- Pre-Buy Checks: owner check, transfer simulation, ERC20 metadata, getAmountsOut validation.
-
- Volume Bot: monitors BNB volume on pairs; triggers alerts or bundler buys when thresholds exceeded.
-
- Token Bundler: batches multiple buy tasks and sends them concurrently to the Rust executor.
-
- Telegram Notifier: alerts you on: High-volume pairs Bundler buy success/failure Pre-buy check results
- Node orchestrator (TypeScript) — listens for
PairCreatedand liquidity events, performs heuristics/pre-checks, posts buy requests to executor. (Signal Handler, Bundler Execution Signal, Volume Execution Signal) - Rust executor (Actix + ethers-rs) — minimal, deterministic hot-path that builds/signs/submits swap transactions (
swapExactETHForTokensSupportingFeeOnTransferTokens).
The split keeps fast deterministic transaction logic in Rust and flexible orchestration logic in Node for quick iteration.
Post / buy Content-Type: application/json
- Rust Executor: deterministic, low-latency, compiled binary for the critical path. Ideal for signing & sending txs reliably.
- Node orchestrator: fast iteration, rich DeFi tooling, easier to write heuristics/token-safety scans, and integrations (alerts, UIs).
- Keep the hot-path as small as possible — business logic, heavy checks, ML scoring should live in orchestrator or a separate service.
Copy .env.example -> .env and edit. Never commit secrets.
WS_RPC=wss://bsc-testnet.example/ws
HTTP_RPC=https://bsc-testnet.example
PRIVATE_KEY=0xYOUR_TESTNET_PRIVATE_KEY
FACTORY_ADDRESS=0xCA143Ce32Fe78f1f7019d7d551a6402fC5350c73
ROUTER_ADDRESS=0x6725F303b657a9451d8BA641348b6761A6CC7a17
WBNB_ADDRESS=0x... # optional override
EXECUTOR_URL=http://127.0.0.1:8080
# Demo knobs
BUY_AMOUNT_BNB=0.02
SLIPPAGE=0.30
DEADLINE_SECS=60
# Volume Bot
VOLUME_WINDOW_SECS=60
VOLUME_ALERT_THRESHOLD_BNB=1.0
# Bundler
BUNDLER_CONCURRENCY=3
# Telegram Notifier
TELEGRAM_BOT_TOKEN=123456:ABCDEF
TELEGRAM_CHAT_ID=987654321
### 🚀 CI / Docker / Deployment notes
- **Add GitHub Actions workflows**:
Rust: cargo fmt -- --check, cargo clippy, cargo build --release
Node: npm ci, npm run lint, npm run build
- Dockerize executor & orchestrator with environment variables injected at runtime (do NOT bake secrets).
- Use container orchestration (K8s) or systemd with secret mounts for production.

