Smart Contract

PriceOracle

A.17ae3b1b0b0d50db.PriceOracle

Valid From

132,672,724

Deployed

6d ago
Feb 21, 2026, 05:42:05 PM UTC

Dependents

0 imports
1/// PriceOracle: Interface for price feed oracles
2///
3/// This interface defines the standard for price oracles used in DCA execution.
4/// Implementations can use Pyth Network, Chainlink, DIA, or custom price feeds.
5///
6access(all) contract interface PriceOracle {
7
8    /// Price data structure (must be defined in implementing contracts)
9    /// Note: Structs cannot be nested in contract interfaces, so implementations
10    /// should define their own PriceData struct matching this structure:
11    /// - symbol: String
12    /// - price: UFix64
13    /// - timestamp: UFix64
14    /// - confidence: UFix64?
15
16    /// Oracle resource that provides price feeds
17    access(all) resource interface Oracle {
18
19        /// Get current price for a token symbol
20        /// Returns a struct with: symbol, price, timestamp, confidence
21        access(all) fun getPrice(symbol: String): AnyStruct?
22
23        /// Get price with maximum age tolerance (in seconds)
24        /// Returns nil if the latest price is older than maxAge
25        access(all) fun getPriceWithMaxAge(symbol: String, maxAge: UFix64): AnyStruct?
26
27        /// Check if oracle supports a specific token
28        access(all) fun supportsToken(symbol: String): Bool
29
30        /// Get list of supported tokens
31        access(all) fun getSupportedTokens(): [String]
32    }
33
34    /// Event emitted when price is updated
35    access(all) event PriceUpdated(symbol: String, price: UFix64, timestamp: UFix64)
36
37    /// Event emitted when price feed becomes stale
38    access(all) event PriceFeedStale(symbol: String, lastUpdate: UFix64)
39}
40