Files
cross-chain-pmm-lps/docs/04-bot-policy.md
2026-02-26 04:40:35 -08:00

44 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Bot Policy (What It Actually Does)
## Inputs (per pool)
- **Oracle price** `P_oracle(T)` — target peg: 1.00 for USD stables; FX for EUR tokens
- **Pool mid price** `P_pool(T)`
- **Deviation**: `δ = (P_pool - P_oracle) / P_oracle`
- **Inventory imbalance** on cW side (how much of your token remains vs baseline)
- Public chain liquidity/volatility conditions
- Bridge backlog / mint-burn queue status (if available)
## Actions
### 1. Tight-peg maintenance trades
- If `P_pool(T) > P_oracle + band` → bot **sells** `T` into pool (adds T inventory / absorbs quote)
- If `P_pool(T) < P_oracle - band` → bot **buys** `T` from pool (removes T inventory / spends quote)
### 2. Inventory re-centering
- If pool is “too drained” of T (or too full), bot adjusts by:
- Adding/removing single-sided liquidity on T side
- Optionally bridging more T from ChainID 138 or redeeming back
### 3. Cross-pool routing
When multiple quotes exist (USDT/USDC/DAI), the bot routes to the best edge:
- Trade where slippage + fee is lowest
- Optionally rebalance quote asset via existing DEX routes (USDC ↔ USDT ↔ DAI)
### 4. Bridge-aware throttling
- If the bridge is congested or risk flags trip, bot widens bands / reduces exposure
## Peg bands
See [../config/peg-bands.json](../config/peg-bands.json) and [05-oracles.md](05-oracles.md). Summary:
- **USD-pegged**: Normal ±1025 bps; stress ±50150 bps; circuit break >2%
- **EUR-pegged**: Normal ±2550 bps; stress ±100250 bps; anchor via EURUSD oracle
State machine and pseudo-code: [../spec/bot-state-machine.md](../spec/bot-state-machine.md), [../spec/bot-pseudo-code.md](../spec/bot-pseudo-code.md).