What you’ll build
Step 1: Index quotes and settlements
StableFX settlements are onchain events. Decode them from Arc’sraw_logs with the StableFX ABI, extracting the currency pair, the amounts on each leg, and the counterparties.
stablefx-settlements.yaml
Step 2: Compute FX analytics
With settlements in your warehouse, the desk’s core metrics are SQL:Step 3: Publish an FX rate oracle
Other contracts and apps need the rate you just computed. A scheduled Compose task reads the VWAP and publishes it on-chain - the same mechanism as the NAV oracle, pointed at an FX pair.src/tasks/publish-fx-rate.ts
Step 4: Monitor exposure and enforce limits
FX desks live and die by position limits. Because you have every fill, net exposure per currency is a running sum - and a Compose task can watch it and act (alert, hedge, or halt quoting) when a limit is breached. Compose’s durable execution guarantees the control fires, and every decision is traced for the desk’s risk review - a live version of the circuit-breaker pattern.Business outcomes
- Every quote and fill is data - true VWAP, realized spreads, and corridor flows, not a dealer’s end-of-day summary.
- Multi-currency treasury - real-time positions across USD, EUR, and regional stablecoins in one warehouse.
- A rate you can publish and defend - on-chain FX oracle sourced from actual settlements, with an audit trail.
- Automated limit enforcement - exposure breaches trigger controls in seconds.