/ components / delta / D006-oracles.component.cspec
D006-oracles.component.cspec
  1  # D006-oracles.component.cspec
  2  
  3  metadata:
  4    id: D006
  5    name: oracles
  6    version: 1.1.0
  7    domain: delta
  8    stability: high_change
  9    updated: 2026-01-15
 10    cascade_priority: 30
 11    roles:
 12      primary: [Dev]
 13      review: [Security]
 14    expertise:
 15      required: [oracles, pricing]
 16      helpful: [chainlink, aggregation]
 17    context_tags: [oracles, price_feeds, twap, fx_pairs, staleness]
 18  
 19  dependencies:
 20    upstream: []
 21    downstream: [D005, D007]
 22  
 23  interface:
 24    types_ref: _registry/types.cspec
 25    types:
 26      AX: alpha_native, decimals:4, microcredits:10000/AX, supply:variable, mint:GOV_only, privacy:zk_full, state:record_utxo
 27    functions:
 28      submit_price: pair_id, price, timestamp
 29      get_twap_1000: 1000_block_average
 30      get_twap_30: 30_day_average
 31      aggregate_prices: trimmean_per_pair
 32    events:
 33      - price_updated
 34      - source_added
 35      - source_removed
 36      - staleness_alert
 37  
 38  spec:
 39    # === D006: ORACLE INTEGRATION ===
 40    oracles:
 41      architecture: source_agnostic
 42      launch_config: chainlink_preconfigured (replaceable_via_governance)
 43  
 44      fx_pairs:
 45        count: 21 (all_required_for_ax_pricing)
 46        currencies:
 47          - EUR/USD, GBP/USD, JPY/USD, CHF/USD, AUD/USD
 48          - CAD/USD, NZD/USD, HKD/USD, SGD/USD, SEK/USD
 49          - NOK/USD, DKK/USD, MXN/USD, ZAR/USD, BRL/USD
 50          - INR/USD, CNY/USD, KRW/USD, PLN/USD, THB/USD
 51          - XAU/USD (gold)
 52  
 53      price_feeds:
 54        update_frequency:
 55          target_interval: ~1_minute
 56          current_blocks: 6  # At 10s blocks = 1 minute
 57          governance_note: adjust_blocks_when_blocktime_changes
 58          # Example: at 3s blocks, use 20 blocks to maintain ~1 minute
 59        precision: 8_decimals
 60        aggregation: trimmean_per_pair
 61        staleness_threshold:
 62          target_interval: ~1_hour
 63          current_blocks: 360  # At 10s blocks = 1 hour
 64          governance_note: adjust_blocks_when_blocktime_changes
 65  
 66      trimmean:
 67        purpose: per_pair_outlier_rejection
 68        trim_percentage: 20% (from_each_end)
 69        when: multiple_sources_for_same_pair
 70        manipulation_resistance: yes
 71  
 72      source_registry:
 73        model: unified (all_sources_equal)
 74        genesis_sources: proposal_id_0
 75        governance_sources: proposal_id_nonzero
 76        operations: [add, remove, deactivate, reactivate]
 77  
 78      governance_actions:
 79        type_9: AddOracleSource (standard_proposal)
 80        type_10: RemoveOracleSource (critical_proposal, can_break_ax_pricing)
 81        type_11: DeactivateSource (standard_proposal, reversible)
 82        type_12: ReactivateSource (standard_proposal)
 83        type_13: UpdateOracleConfig (standard_proposal)
 84  
 85      ax_rate_derivation:
 86        formula: AX/CCY = AX/USD / CCY/USD
 87        requires: all_21_fx_pairs_valid
 88        fail_behavior: reject_update_if_any_missing
 89  
 90      twap:
 91        twap_1000: 1000_block_average (offramp_rate)
 92        twap_30: 30_day_average (buyback_price)
 93  
 94      staleness_handling:
 95        if: current_block - last_update > MAX_STALENESS
 96        then:
 97          - reject_new_position_opens
 98          - allow_position_closes
 99          - trigger_governance_alert
100  
101  changelog:
102    - version: 1.1.0
103      date: 2026-01-15
104      type: enhancement
105      description: "Oracle block counts are governance-adjustable when blocktime changes"
106      breaking: false
107  
108    - version: 1.0.0
109      date: 2026-01-07
110      type: initial
111      description: "Migrated from delta_chain.cspec"
112      breaking: false