Oracle architecture
1
External price sources
Raw FX rate data from Pyth Network (primary) and Web2 FX APIs (fallback).
2
Oracle Keeper service
Fetches prices from external sources and pushes them to the on-chain Oracle Aggregator contract.
3
Oracle Aggregator contract
Validates, aggregates, and stores the latest prices on-chain. Single source of truth.
4
FX Engine reads prices
The pricing pipeline reads aggregated prices from the on-chain contract when constructing quotes.
The FX Engine never reads oracle prices directly from external sources. All prices flow through the on-chain aggregator, ensuring a single source of truth with full auditability.
Pyth Network (primary source)
Pyth Network is Ratio’s primary oracle. Key characteristics:
Ratio uses Pyth feeds for all Phase 1 corridors: USD/IDR, USD/SGD, and USD/MYR. For MYR/IDR, where a direct Pyth feed may not be available, the rate is derived from USD/IDR and USD/MYR — using USD purely as a pricing reference.
Web2 FX API (fallback source)
For redundancy, Ratio integrates traditional Web2 FX data providers as fallback sources. These are used when the primary oracle is unavailable or when an independent reference is needed for validation. The Web2 adapter is pluggable — the system can switch between providers without changing core logic.Price validation
Every oracle price is validated before use:Cross-currency rate construction
For pairs without a direct oracle feed (e.g., MYR/IDR), the system constructs a reference rate:Reliability design
Multiple sources
Independent oracle providers prevent single-point-of-failure dependency.
On-chain aggregation
Oracle data is immutably recorded and auditable on Kaia.
Automatic failover
Switches between sources based on freshness and reliability.
Circuit breakers
Halts trading rather than executing at unreliable prices.