|
|
3 هفته پیش | |
|---|---|---|
| public | 3 هفته پیش | |
| src | 3 هفته پیش | |
| .dockerignore | 3 هفته پیش | |
| .env.example | 3 هفته پیش | |
| .gitignore | 3 هفته پیش | |
| .prettierrc | 3 هفته پیش | |
| AGENTS.md | 3 هفته پیش | |
| CLAUDE.md | 3 هفته پیش | |
| Dockerfile | 3 هفته پیش | |
| README.md | 3 هفته پیش | |
| components.json | 3 هفته پیش | |
| docker-compose.yml | 3 هفته پیش | |
| docker-entrypoint.sh | 3 هفته پیش | |
| eslint.config.mjs | 3 هفته پیش | |
| next.config.ts | 3 هفته پیش | |
| package.json | 3 هفته پیش | |
| pnpm-lock.yaml | 3 هفته پیش | |
| pnpm-workspace.yaml | 3 هفته پیش | |
| postcss.config.mjs | 3 هفته پیش | |
| tsconfig.json | 3 هفته پیش |
Monad mainnet MON/USDC concentrated liquidity auto-rebalancer for LFJ (Liquidity Book) DEX.
Maintains a narrow (3-10 bin) LP position around the active price. When price moves out of range, automatically removes liquidity and re-adds at the new active bin to keep earning rewards.
# Install
pnpm install
# Configure
cp .env.example .env.local
# Edit .env.local with your PRIVATE_KEY and RPC
# Run
pnpm dev
Open http://localhost:3000, go to Config page, click Start.
# Required
PRIVATE_KEY=0x...
MONAD_RPC_URL=https://your-rpc-endpoint
# Contracts (pre-filled defaults)
LB_ROUTER_ADDRESS=0x18556DA13313f3532c54711497A8FedAC273220E
LB_PAIR_ADDRESS=0x5afd3ec861f6104af26e8755abcc1f876de77620
# Strategy
NUM_BINS=3 # 3-10 bins
POSITION_SIZE_USD=50 # USD value per position
POLL_INTERVAL_MS=3000 # polling frequency
REBALANCE_COOLDOWN_MS=10000 # min time between rebalances
SLIPPAGE_BPS=50 # slippage tolerance (0.5%)
MAX_DAILY_REBALANCES=50
# Notifications (optional)
NOTIFY_PROVIDER=bark # bark | ntfy | pushover
NOTIFY_ENDPOINT=https://api.day.app/YOUR_KEY
Every 3s:
1. Read active bin from LBPair
2. If no position → open new position
3. If active bin outside position range:
a. Remove all liquidity (removeLiquidityNATIVE)
b. Swap to rebalance if needed
c. Open new position at current active bin (addLiquidityNATIVE)
d. Log event + send notification
| Page | Description |
|---|---|
/ |
Real-time status: engine state, price, position range, wallet balances, bin chart |
/config |
Strategy settings, engine control (start/pause/stop), emergency withdraw |
/history |
Rebalance event history table with stats |
docker compose up -d --build
Data persisted in ./data/rebalancer.db.
src/
lib/
config.ts # Environment config + types
chain/ # viem clients, ABIs, on-chain operations
engine/ # Rebalancer engine (poll loop, state machine)
db/ # SQLite schema + queries
notifications/ # Push notification providers
app/
page.tsx # Dashboard
config/page.tsx # Configuration
history/page.tsx # History
api/ # SSE, control, history API routes
hooks/
useEngineStatus.ts # SSE client hook
| Contract | Address | Chain |
|---|---|---|
| LBPair (MON/USDC) | 0x5afd...7620 |
Monad (143) |
| LBRouter V2.2 | 0x1855...220E |
Monad (143) |
| WMON (tokenX) | 0x3bd3...433A |
Monad (143) |
| USDC (tokenY) | 0x7547...b603 |
Monad (143) |
Bin step: 5 (0.05% per bin)