Oracle System

TL;DR: XCCY uses two oracle systems — OracleHub for asset prices (USD valuation) and AprOracle for yield rates (VY tracking). These power margin calculations and settlements.

Overview

┌─────────────────────────────────────────────────────────────┐
│                    ORACLE ARCHITECTURE                      │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌──────────────────┐          ┌──────────────────┐         │
│  │    OracleHub     │          │    AprOracle     │         │
│  │    (Prices)      │          │    (Yields)      │         │
│  └────────┬─────────┘          └────────┬─────────┘         │
│           │                             │                   │
│           ▼                             ▼                   │
│  ┌──────────────────┐          ┌──────────────────┐         │
│  │  Price Sources   │          │   APR Adapters   │         │
│  │  • Chainlink     │          │   • Aave         │         │
│  │  • Pendle TWAP   │          │   • Compound     │         │
│  │  • Custom        │          │   • Lido         │         │
│  └──────────────────┘          │   • Pendle       │         │
│                                │   • ERC-4626     │         │
│                                └──────────────────┘         │
│                                                             │
└─────────────────────────────────────────────────────────────┘

OracleHub (Price Oracle)

Purpose

Provides USD prices for all supported assets. Used for:

  • Collateral valuation

  • Margin calculations

  • Cross-asset comparisons

Interface

Supported Sources

Source
Use Case
Update Frequency

Chainlink

Major assets (ETH, BTC, stablecoins)

Heartbeat + deviation

Pendle TWAP

Yield-bearing tokens

Continuous

Custom

Protocol-specific assets

Configurable

Price Flow Example

Source Architecture

AprOracle (Yield Oracle)

Purpose

Tracks Variable Yield rates for yield-bearing tokens. Used for:

  • Settlement calculations

  • Margin requirement estimation

  • VY exposure tracking

Interface

Rate Calculation

APR Adapters

Each yield source has a dedicated adapter:

Adapter
Token Type
Source

AaveAprAdapter

aTokens (aUSDC, aETH)

Aave lending rates

Erc4626AprAdapter

ERC-4626 vaults

Share price growth

WstEthAprAdapter

wstETH

Lido staking rates

WeEthAprAdapter

weETH

EtherFi rates

PendleAprAdapter

PT/YT tokens

Pendle yield

Adapter Interface

Rate Accumulation

How VY is Tracked

The oracle stores periodic rate snapshots:

Oracle Buffer

Rates are stored in a circular buffer for gas efficiency:

Integration with CollateralEngine

Settlement Calculation

Margin Requirement

Adding New Sources

New Price Source

New APR Adapter

Error Handling

Price Validation

Rate Validation

Security Considerations

Oracle Manipulation Protection

Protection
Description

Multiple sources

Cross-reference prices where possible

Staleness checks

Reject old data

Deviation bounds

Reject extreme price movements

TWAP

Time-weighted averages resist flash manipulation

Admin Controls

Current Deployments (Polygon)

Contract
Address

OracleHub

0x7a5084DEc5Fd89Ee1079005cE9cEa094c2A66E8E

AprOracle

0xA192144F89edC9fBB3D225856FaF284d9287EDb8

Key Takeaways

  1. Two oracle types — Prices (OracleHub) and yields (AprOracle)

  2. Multiple sources — Chainlink, Pendle, protocol-specific

  3. Adapter pattern — Easy to add new yield sources

  4. Validation built-in — Staleness and validity checks

  5. Gas optimized — Circular buffers for rate storage

Next Steps

  • Margin System — How oracles power margin

  • Smart Contracts — Contract references

  • Deployed Contracts — All addresses

Last updated