multi-dex-peg-kit
v0.3.0
Published
Bounded multi-DEX peg / market-maker kit for Polygon, Base, Arbitrum, Optimism, and BSC (dry-run first).
Downloads
32
Maintainers
Readme
multi-dex-peg-kit
Bounded multi-DEX peg bot for Polygon, Base, Arbitrum, Optimism, and BSC — dry-run first, pluggable adapters, YAML config, CLI.
Soft-peg or rebalance a USDC/base pool toward an HTTP target price (raw / EMA / TWAP) with circuit breakers, reserve floors, and optional multi-leg fills.
Features
- Adapters: Uniswap V3, Uni V2 (QuickSwap / Pancake V2), Pancake V3 (BSC), Aerodrome (Base), multi-hop V3
- Chains: Polygon, Base, Arbitrum, Optimism, BSC
- CLI:
peg status|peg dry-run|peg run|peg simulate --amount <USDC> - Risk: max daily notional, drawdown bps, max absolute USDC loss, min reserves
- Alerts: generic webhook + Telegram + Discord
- Metrics: JSONL + optional Prometheus
- Live CI smoke against public Polygon RPC
- Default
dryRun: true
Demo (peg status)

Text capture: docs/demo-status.txt · regenerate GIF: npm run gif
Quick start
git clone https://github.com/nad33mahm3d/multi-dex-peg-kit.git
cd multi-dex-peg-kit
npm install
cp config.example.yaml config.yaml
cp .env.example .env
# edit config.yaml + .env
npm run peg -- status
npm run peg -- simulate --amount 100
npm run peg -- dry-runnpx (after publish)
npm run build
# npm publish # maintainer
npx multi-dex-peg-kit helpArchitecture
peg CLI → YAML+env → smoother (raw|ema|twap) → loop
→ circuit breaker / reserve floors
→ adapter registry → strategy all|best → multi-leg → execute
→ JSONL + Prometheus + webhook/Telegram/DiscordConfig highlights
See config.example.yaml.
| Area | Keys |
|------|------|
| Target | indexApi.mode: raw | ema | twap |
| Circuit | maxDailyNotionalUsdc, maxDrawdownBps, maxLossUsdc |
| Floors | minReserveUsdc, minReserveBase |
| Alerts | webhookUrl, telegramBotToken+telegramChatId, discordWebhookUrl |
| Chain | polygon | base | arbitrum | optimism | bsc |
USDC / stables
- Polygon: native + USDC.e
- Base / Optimism / Arbitrum: native USDC
- BSC: USDC (
0x8AC76a51…) — Pancake pools
Adapters
| Name | Typical chain |
|------|----------------|
| uniswap_v3 | Polygon, Base, Arbitrum, Optimism; Pancake V3 on BSC |
| univ2 | QuickSwap (Polygon), Pancake V2 (BSC) |
| aerodrome | Base |
| multihop_v3 | hop via WETH/WMATIC/WBNB |
Plugin guide: docs/adapters.md · stub: examples/stub-adapter.ts
Deploy & CI
- Docker:
docker-compose.yml - systemd:
deploy/ - Live RPC smoke:
npm run live-smoke(CI joblive-rpc)
Non-goals
- MEV / private transactions
- Cross-DEX arb as a product
- Financial advice
License
MIT — LICENSE. Security: SECURITY.md.
