Loading...
Loading...
Monitors Bitflow HODLMM bins to keep LP positions in the active earning range. Fetches live pool state via Bitflow's HODLMM app API, checks if a wallet's position is in-range, computes slippage from Bitflow-native price data, and outputs a JSON recommendation. Read-only — rebalance actions require explicit human approval.
npx skill4agent add aibtcdev/skills hodlmm-bin-guardianbun run hodlmm-bin-guardian/hodlmm-bin-guardian.ts doctorbun run hodlmm-bin-guardian/hodlmm-bin-guardian.ts install-packs--wallet# Full check with wallet (recommended)
bun run hodlmm-bin-guardian/hodlmm-bin-guardian.ts run --wallet SP1234...
bun run hodlmm-bin-guardian/hodlmm-bin-guardian.ts run --wallet SP1234... --pool-id dlmm_1
# Pool-only check (no position check — in_range will be null)
bun run hodlmm-bin-guardian/hodlmm-bin-guardian.ts run{
"status": "ok",
"checks": [
{ "name": "Bitflow HODLMM API", "ok": true, "detail": "8 pools found, dlmm_1 active bin: 504" },
{ "name": "Bitflow Bins API (dlmm_1)", "ok": true, "detail": "active_bin_id=504, 1001 bins" },
{ "name": "Bitflow App Pools API", "ok": true, "detail": "dlmm_1 TVL: $77,142.99, vol_24h: $126,045, APR: 17.72%" },
{ "name": "Hiro Stacks API (fees)", "ok": true, "detail": "2 µSTX/byte" }
],
"message": "All data sources reachable. Ready to run."
}{
"status": "success",
"action": "HOLD — position out of range but rebalance blocked: price slippage 1.86% > 0.5% cap.",
"data": {
"in_range": false,
"active_bin": 504,
"user_bin_range": null,
"can_rebalance": false,
"refusal_reasons": [ "price slippage 1.86% > 0.5% cap" ],
"slippage_ok": false,
"slippage_pct": 1.8595,
"bin_price_raw": 66459654464,
"pool_price_usd": 66459.65,
"market_price_usd": 65246.37,
"slippage_source": "bitflow-app-price-vs-hodlmm-active-bin",
"gas_ok": true,
"gas_estimated_stx": 0.0144,
"cooldown_ok": true,
"cooldown_remaining_h": 0,
"last_rebalance_at": null,
"volume_ok": true,
"volume_24h_usd": 126045,
"liquidity_usd": 77143,
"apr_24h_pct": 17.72,
"pool_id": "dlmm_1",
"pool_name": "sBTC-USDCx-LP",
"fee_bps": 30,
"position_note": "No position found for SP219TWC8G12CSX5AB093127NC82KYQWEH8ADD1AY in pool dlmm_1."
},
"error": null
}{
"status": "success",
"action": "HOLD — position in range at active bin 504. APR (24h): 17.72%.",
"data": {
"in_range": true,
"active_bin": 504,
"user_bin_range": { "min": 500, "max": 508, "count": 3, "bins": [500, 504, 508] },
"can_rebalance": true,
"refusal_reasons": null,
"slippage_ok": true,
"slippage_pct": 0.04,
"bin_price_raw": 66459654464,
"pool_price_usd": 66459.65,
"market_price_usd": 66433.0,
"slippage_source": "bitflow-app-price-vs-hodlmm-active-bin",
"gas_ok": true,
"gas_estimated_stx": 0.0144,
"cooldown_ok": true,
"cooldown_remaining_h": 0,
"last_rebalance_at": null,
"volume_ok": true,
"volume_24h_usd": 126045,
"liquidity_usd": 77143,
"apr_24h_pct": 17.72,
"pool_id": "dlmm_1",
"pool_name": "sBTC-USDCx-LP",
"fee_bps": 30
},
"error": null
}| Field | Type | Description |
|---|---|---|
| | Overall result |
| | |
| | |
| | Pool's current active bin ID |
| | User's liquidity bin range |
| | Whether all safety gates pass |
| | Why REBALANCE is blocked |
| | Whether price deviation is within cap |
| | |
| | Raw active bin price from Bitflow bins API |
| | HODLMM derived USD price: |
| | Bitflow app reported token price in USD |
| | Price source identifier |
| | Whether estimated gas is within limit |
| | Estimated STX for 2-txn rebalance |
| | Whether cooldown has elapsed |
| | Hours until next rebalance allowed |
| | ISO timestamp of last recorded rebalance |
| | Whether 24h volume meets minimum |
| | 24h pool volume in USD |
| | Pool TVL in USD |
| | 24h fee APR from Bitflow app API |
| | Pool identifier |
| | Human-readable pool name |
| | Pool fee in basis points |
| | Present when position state needs explanation |
| Source | Data | Endpoint |
|---|---|---|
| Bitflow HODLMM API | Pool list, active bin | |
| Bitflow Bins API | Per-bin prices (raw, for slippage) | |
| Bitflow App Pools API | TVL, 24h volume, APR, token prices, decimals | |
| Bitflow Position API | User's position bins | |
| Hiro Stacks API | STX fee estimate | |
inRange = isFinite(pool.active_bin) && pool.active_bin > 0trueGET /api/app/v1/users/{address}/positions/{poolId}/binsuser_liquidity > 0active_bin_id(bin_price_raw / 1e8) × 10^(xDec − yDec)gas_estimated_stx: 0.006Hiro /v2/fees/transfer × 500 bytes × 2 txns × 3× contract multiplier × 1.2 safety buffer~/.hodlmm-guardian-state.jsoncooldown_remaining_hrequires: [bitflow]requires: ""