Skip to main content

P&L Calculation — WAOP Batch Accounting

FX swaps create inventory imbalances in the Active Pool. These imbalances are always settled internally by the Reserve Pool (Phase 1), which absorbs the inventory risk. The Reserve Pool is then rebalanced externally via RFQ/OTC partners (Phase 2). The cost of this external rebalancing determines whether the protocol is truly profitable.

WAOP (Weighted Average Oracle Price) batch accounting tracks this end-to-end.

1. Two-Phase Rebalancing & Batch Lifecycle

The Active Pool is never rebalanced externally. It is always restored by the Reserve Pool. Only the Reserve Pool interacts with external markets.

StageDescription
OPENCollecting user swaps. Each swap is assigned to the active batch for its corridor pair (e.g., Batch #101 for USDT-IDRX). Oracle rate and volume are recorded.
SETTLED_INTERNALLY (Phase 1)Reserve Pool sends USDT to Active Pool and takes IDRX at oracle rate. Active Pool is restored to target balance. Reserve Pool now holds the inventory risk (the accumulated IDRX position).
CLOSED (Phase 2)Reserve Pool clears its accumulated inventory via external trade (Binance/Wintermute/OTC). Realised PnL is calculated against WAOP. Batch is finalised.

2. WAOP Calculation

WAOP = Σ(Volume_i × OracleRate_i) / Σ(Volume_i)

WAOP represents the break-even rebalancing price for the batch. It is the cost basis of the inventory accumulated from user swaps.

Worked Example

  • Swap 1 (10:00 AM): 100 USD swapped, Oracle = 15,000 IDR/USD. Imbalance: −15,000 IDR.
  • Swap 2 (2:00 PM): 200 USD swapped, Oracle = 15,200 IDR/USD. Imbalance: −30,400 IDR.
  • Total imbalance: −45,400 IDR from 300 USD received.
WAOP = ((100 × 15,000) + (200 × 15,200)) / 300 = 15,133.33

3. Rebalancing PnL

Rebalancing_PnL = Volume × (WAOP − R_executed)
ConditionResultTreatment
R_executed > WAOP (better rate)Rebalancing ProfitAdded to protocol surplus
R_executed < WAOP (worse rate)Rebalancing Loss (COGS)Absorbed by KF. Must be covered by spread revenue.

4. Net Profit Formula

Net_Profit = Gross_Revenue − Rebalancing_COGS + Rebalancing_Profit
Distribution Timing vs. P&L Recognition

The 50/30/20 split happens at execution time on Gross Revenue (ensuring LPs receive rewards immediately). Net Profit is calculated when the rebalancing batch closes. If a batch realises COGS, KF absorbs it. This separation means LP rewards are never clawed back — the protocol bears the rebalancing risk, not individual LPs.

5. On-Chain Audit Events

EventData CapturedPurpose
NewSwaporacle_rate, fee_bps, volume, pair, batch_id, timestampBuilds WAOP cost basis per batch
RebalanceSettledbatch_id, amount_in, amount_out, waop, executed_rateLinks inventory to user trades; calculates realised PnL