Fee & P&L Calculation Framework
1. Executive Summary
This section defines the Fee & P&L Calculation Framework for Ratio FX — the complete logic for how revenue is generated from FX swaps, how profit is distributed among protocol participants, and how rebalancing costs are accounted for.
Core Design Principles
- All distribution parameters are admin-configurable via ProtocolConfig contract and database. No hardcoded values.
- Volume-tiered fee schedule: fixed fee, variable fee, and base spread vary by transaction size per corridor. Larger transactions receive better rates. See Volume-Tiered Fee Schedule for the full tier tables and resolution logic.
- LP rewards are denominated in kUSD. LPs realise rewards by withdrawing directly (OffRamp) or converting via FX Engine — both paths generate additional protocol revenue.
- Two LP classes (A: FX-only, B: Full participation) with separate kToken indices and configurable per-partner fee tiers.
- WAOP-based batch accounting tracks rebalancing costs to determine true protocol profitability.
- Protocol Treasury (KF) acts as insurance — absorbs all losses. LP equities never decrease.
Dependencies
| Component | Dependency |
|---|---|
| FX Engine | Swap execution, spread construction, fee capture, atomic 50/30/20 split |
| VaR & Emergency RFQ | Risk monitoring; Emergency RFQ may produce swaps with different fee profiles |
| Inventory Skew | Dynamic mid-rate adjustment feeds into spread calculation |
| Smart Rebalancing | Triggers external rebalancing; WAOP batch close and COGS calculation |
| LP Withdrawals | kUSD withdrawal paths; OffRamp fee capture |
| Liquidity Onboarding | Class A/B classification, per-partner fee tier multipliers, dual kToken index |
2. Revenue Sources
The protocol generates revenue from three distinct sources, each with its own distribution logic.
Source 1: FX Swap Revenue
Every FX swap generates two fee components that together form the Swap Profit:
P_swap = Σ ( Spread_Profit + Platform_Fee_Profit )
P_swap = Σ ( (V_i × (R_oracle - R_quote)) + (V_i × F_platform × R_oracle) )
Platform Fee Structure (Volume-Tiered):
The platform fee varies by transaction size. Each corridor has a set of fee tiers with different fixed and variable rates. The applicable tier is resolved at quote time based on the transaction amount in source currency.
| Component | Calculation | Example ($5,000 swap, USD-IDR SMALL tier) |
|---|---|---|
| Fixed Fee | Per-tier amount in destination currency, converted to source at oracle rate | 10,000 IDR ÷ 15,800 = $0.633 |
| Variable Fee | Source Amount × tier's variable_fee_bips | $5,000 × 0.05% = $2.50 |
| Total Platform Fee | Fixed + Variable | $3.133 |
| Amount to Convert | Source Amount − Platform Fee | $4,996.87 |
For the complete tier tables and resolution logic, see Volume-Tiered Fee Schedule.
Spread Components:
Total Spread = Base (from tier or corridor default) + Volatility Add-on + Liquidity Add-on + Inventory Skew
The tier's spread_override_bps replaces only the Base component. Volatility, Liquidity, and Inventory Skew are still calculated dynamically based on real-time market conditions. The spread widens progressively across NORMAL → PROTECT → RESTRICT states as defined in the FX Engine.
Source 2: Yield Engine Revenue
Idle liquidity deployed to external strategies (e.g., SuperEarn) generates passive yield. This revenue is exclusive to Class B LPs.
| Attribute | Detail |
|---|---|
| Distribution | 100% to kXXX-full Vault via updateIndex(). Class A (kXXX-fx) index is never updated by yield. |
| Loss Handling | Yield losses are absorbed entirely by Class B kXXX-full index. Class A is firewalled with zero impact. |
| Revenue Split | Does NOT enter the 50/30/20 split. Flows directly to Class B LPs. |
Source 3: LP Reward Conversion Revenue (kUSD Flywheel)
When LPs realise their kUSD rewards, they generate additional protocol revenue through one of three exit paths:
| Exit Path | LP Action | Revenue to Ratio |
|---|---|---|
| A. OffRamp Withdrawal | LP withdraws kUSD as USDT/fiat via OffRamp partner | OffRamp fee charged (OFFRAMP_FEE_BIPS, default 20 bips). Fee goes to Protocol Treasury. |
| B. FX Engine Swap | LP converts kUSD to kIDR/kMYR/kSGD via FX Engine | Standard swap fees apply (tiered schedule based on amount). Treated as a regular FX transaction with full 50/30/20 split. |
| C. Hold & Compound | LP keeps kUSD in wallet. It compounds into equity for future distribution calculations. | No immediate revenue. Increases LP's future share of distributions. |
LP earns kUSD rewards → LP converts kUSD to IDRX via FX Engine → FX Engine charges tiered platform fee + spread → That fee is split 50/30/20 → Transaction LPs earn new kUSD → Those LPs may convert their kUSD too → cycle repeats. At scale, this organic volume becomes a meaningful percentage of total FX Engine throughput.