Capital & Data Flows
This page maps how capital moves through the protocol across the five primary flow types: user swaps, Phase 1 internal settlement, Phase 2 external rebalancing, LP deposits, and LP withdrawals.
1. User Swap Flow
Every FX swap is an atomic on-chain transaction that touches only the Active Pool.
A user selling USDT for IDRX causes the Active USDT Pool balance to increase (protocol goes long USDT) and the Active IDRX Pool balance to decrease (protocol goes short IDRX). The Inventory Skew system reads this imbalance and adjusts the mid-rate to attract corrective flow.
Revenue from the swap is split atomically: 50% to Treasury, 20% to the Fee Contract (global yield), and 30% to the Vault Contract (LP reward via Liquidity Index).
2. Phase 1 — Internal Settlement
Phase 1 restores the Active Pool to its target balance using the Reserve Pool as the internal counterparty. This is the critical mechanism that separates user experience (instant execution) from market risk management.
Trigger: Automated cron job (high frequency / hourly) or threshold trigger (deficit > $X).
Mechanics: The Reserve Pool sends the deficit stablecoin to Active and takes the surplus stablecoin from Active. This transfer occurs at the Oracle Rate (book value), ensuring the Active Pool remains mathematically neutral. After settlement, the Active Pool is balanced and safe. The Reserve Pool now holds the actual market risk — "The Bag."
Key insight — Bidirectional netting: Because Ratio uses single-sided pools, Phase 1 settlement is naturally bidirectional. Morning USD→IDR remittance flow causes Reserve USDT to accumulate surplus. Afternoon IDR→USD commerce flow reverses this. The smart rebalancing system exploits this cyclical pattern by introducing cooldown periods that let natural reverse flow reduce Reserve positions before committing to external rebalancing.
3. Phase 2 — External Rebalancing
Phase 2 clears accumulated inventory from the Reserve Pool via external market execution. This is where the protocol realises its final PnL.
Trigger: Smart Rebalancing thresholds (Soft → cooldown, Hard → immediate, Emergency → bypass all).
Execution: The Off-Chain Rebalancing Bot aggregates total inventory risk per stablecoin, submits RFQ to external partners (Binance, Wintermute, OTC desks), and settles the trade. Proceeds return to the Reserve Pool.
Volume optimisation: The system does not clear to zero. It targets a residual amount (Soft_Threshold × Residual_Factor) to absorb the next flow cycle without immediately re-triggering Phase 2. This reduces external execution frequency by 30–50%.
PnL Tracking
Since rebalancing is asynchronous, the system tracks whether the protocol made or lost money on held inventory:
PnL = Execution_Price − WAOP (Weighted Average Oracle Price at time of Phase 1 batch)
WAOP is the break-even cost basis for each rebalancing batch, calculated as the weighted average of Oracle MID rates across all Phase 1 settlements that contributed to the current Reserve position.
4. LP Deposit Flow
LP deposits never enter the Active Pool directly. Capital flows through the Deposit Routing Engine into Reserve and/or Yield pools based on intent class.
Class A deposits route 100% to Reserve Pool (never touches Yield). Class B deposits split between Reserve and Yield per admin-configured ratio (default 50/50). If Reserve is at capacity, Class B overflow redirects to Yield Pool (tagged for priority recall). Class A overflow enters the Pending Queue — it must never be routed to Yield.
The Active Pool is populated exclusively when Smart Rebalancing detects an Active Pool deficit and initiates internal settlement from Reserve. This ensures Active Pool composition is controlled by the rebalancing engine, not by deposit timing.
5. LP Withdrawal Flow
LP withdrawals are sourced from Reserve Pool (standard) or Yield Pool (large/whale/fallback) — never from the Active Pool.
| Tier | Size | Source | Processing |
|---|---|---|---|
| Standard | < $50K | Reserve Pool (if healthy) | Normal FIFO queue |
| Large | $50K–$200K | Yield Pool recall | 24h advance notice; $50K tranches every 12h |
| Whale | > $200K | Yield Pool recall + coordination | 72h advance notice; $100K daily tranches; OTC offered |
The withdrawal queue operates in three states (NORMAL, SLOW, PAUSED) gated by Reserve Pool health, State Engine output, and VaR level. The most restrictive condition wins. When the queue is slowed or paused, Smart Rebalancing simultaneously accelerates inflows via Yield Pool recall — creating a self-stabilising feedback loop.
6. Deficit Recovery Flow
When the Reserve Pool falls below target, the response depends on the cause:
Swap-driven deficit is an inventory problem — Phase 2 buys back the short stablecoin from external partners. This does NOT affect the LP withdrawal queue.
LP withdrawal-driven deficit is a capital drain — the Yield Pool recalls deployed capital to replenish Reserve. This directly controls the LP withdrawal queue states (SLOW at 30–60%, PAUSED at < 30%).
In mixed scenarios, both responses fire in parallel because they source from different places (external market vs. internal Yield Pool) and do not conflict.