Skip to content

Implemented decentralized oracle#84

Merged
gabito1451 merged 4 commits intoGalactiGuild:mainfrom
Kaylahray:feat/decentralized-oracle
Feb 24, 2026
Merged

Implemented decentralized oracle#84
gabito1451 merged 4 commits intoGalactiGuild:mainfrom
Kaylahray:feat/decentralized-oracle

Conversation

@Kaylahray
Copy link
Contributor

Summary

Implemented a decentralized oracle network for NovaFund on Soroban and wired it into the contracts workspace. closes #81

What was done

  • Added shared oracle primitives:
    • New oracle types in shared (OracleFeedType, OracleFeedConfig, OracleFeedState, OracleReport)
    • New oracle-related events (ORACLE_FEED_CREATED, ORACLE_FEED_UPDATED, staking/unstaking/slashing)
    • Oracle-related constants for heartbeat, deviation limits, and max oracles per feed
  • Created a new oracle-network contract:
    • Feed registry with typed configs (price, event, statistic) and bounded oracle sets
    • Median-based aggregation of oracle reports with per-feed rounds
    • Simple staking and slashing model for oracle operators
    • Per-oracle reward accounting with claimable rewards paid in a reward token
    • Safe read APIs: get_latest, get_latest_safe, and get_latest_with_fallback for primary/fallback feeds
  • Implemented economic and safety mechanisms:
    • Oracles must be authorized per feed and stake a token before participating
    • Rewards are issued only for valid submissions contributing to finalized rounds
    • Admin-controlled slashing reduces stake on misbehavior and emits events for monitoring
    • Heartbeat and timestamp checks prevent stale or wildly skewed submissions
  • Added test coverage:
    • End-to-end test that initializes the oracle network, stakes two oracles, submits price data, finalizes a round via median aggregation, and verifies both the stored feed state and accrued rewards

Validation

  • oracle-network compiles cleanly with shared types/events/constants.
  • Tests confirm:
    • Aggregation produces the expected median-based price
    • Feeds only finalize when min_oracles submissions are reached
    • Rewards are properly tracked per oracle and can be claimed.

@gabito1451 gabito1451 merged commit d31d2ab into GalactiGuild:main Feb 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decentralized Oracle Network

2 participants