pub struct OracleTracker { /* private fields */ }Expand description
Mutable typed oracle state.
Implementations§
Source§impl OracleTracker
impl OracleTracker
Sourcepub fn new(registry: OracleRegistry) -> Self
pub fn new(registry: OracleRegistry) -> Self
Create a tracker from an existing registry.
Sourcepub fn from_registrations_at_timestamp(
feeds: Vec<(FeedRegistration, RoundData)>,
now_timestamp: u64,
) -> Result<Self, OracleError>
pub fn from_registrations_at_timestamp( feeds: Vec<(FeedRegistration, RoundData)>, now_timestamp: u64, ) -> Result<Self, OracleError>
Seed a tracker from registrations and round data.
Sourcepub fn registrations(&self) -> impl Iterator<Item = FeedRegistration> + '_
pub fn registrations(&self) -> impl Iterator<Item = FeedRegistration> + '_
Return cloned registrations for rebuilding reactive routing.
Prefer Self::registrations_iter when read-only access is enough —
this iterator clones every registration it yields.
Sourcepub fn registrations_iter(&self) -> impl Iterator<Item = &FeedRegistration>
pub fn registrations_iter(&self) -> impl Iterator<Item = &FeedRegistration>
Iterate over registrations without cloning, in feed-id order.
Sourcepub fn feed_readiness(&self) -> Vec<OracleFeedReadinessReport>
pub fn feed_readiness(&self) -> Vec<OracleFeedReadinessReport>
Return feed/runtime readiness for all registered feeds.
Sourcepub fn insert_seeded_registration(
&mut self,
registration: FeedRegistration,
round: RoundData,
) -> Result<(), OracleError>
pub fn insert_seeded_registration( &mut self, registration: FeedRegistration, round: RoundData, ) -> Result<(), OracleError>
Insert a pre-discovered feed and seed its latest proxy-read snapshot.
Sourcepub fn remove_by_id(&mut self, id: FeedId) -> Option<FeedRegistration>
pub fn remove_by_id(&mut self, id: FeedId) -> Option<FeedRegistration>
Remove a feed by id, including its latest snapshot and pending reconciliation.
Sourcepub fn remove_by_proxy(&mut self, proxy: Address) -> Option<FeedRegistration>
pub fn remove_by_proxy(&mut self, proxy: Address) -> Option<FeedRegistration>
Remove a feed by proxy, including its latest snapshot and pending reconciliation.
Sourcepub fn now_timestamp(&self) -> u64
pub fn now_timestamp(&self) -> u64
Return the timestamp used for snapshot freshness classification.
Sourcepub fn latest(&self, proxy: Address) -> Option<&OracleSnapshot>
pub fn latest(&self, proxy: Address) -> Option<&OracleSnapshot>
Return the latest snapshot by proxy.
Sourcepub fn registration_for_proxy(
&self,
proxy: Address,
) -> Option<&FeedRegistration>
pub fn registration_for_proxy( &self, proxy: Address, ) -> Option<&FeedRegistration>
Return the feed registration for a proxy.
Sourcepub fn price(&self, id: impl AsRef<str>) -> Result<OraclePrice, OracleError>
pub fn price(&self, id: impl AsRef<str>) -> Result<OraclePrice, OracleError>
Return the latest actionable-facing price by feed id string.
§Errors
Returns OracleError::FeedNotFound when no feed is registered under
id or the feed has no current snapshot.
Sourcepub fn price_by_id(&self, id: FeedId) -> Result<OraclePrice, OracleError>
pub fn price_by_id(&self, id: FeedId) -> Result<OraclePrice, OracleError>
Return the latest actionable-facing price by feed id.
§Errors
Returns OracleError::FeedNotFound when no feed is registered under
id or the feed has no current snapshot.
Sourcepub fn price_by_proxy(&self, proxy: Address) -> Result<OraclePrice, OracleError>
pub fn price_by_proxy(&self, proxy: Address) -> Result<OraclePrice, OracleError>
Return the latest actionable-facing price by proxy address.
§Errors
Returns OracleError::FeedNotFound when no feed is registered under
proxy or the feed has no current snapshot.
Sourcepub fn latest_round(
&self,
id: impl AsRef<str>,
) -> Result<RoundData, OracleError>
pub fn latest_round( &self, id: impl AsRef<str>, ) -> Result<RoundData, OracleError>
Return the latest round by feed id string.
§Errors
Returns OracleError::FeedNotFound when no feed is registered under
id or the feed has no current snapshot.
Sourcepub fn latest_round_by_proxy(
&self,
proxy: Address,
) -> Result<RoundData, OracleError>
pub fn latest_round_by_proxy( &self, proxy: Address, ) -> Result<RoundData, OracleError>
Return the latest round by proxy address.
Sourcepub fn pending_reconciliations(&self) -> &[OracleReconciliationRequest]
pub fn pending_reconciliations(&self) -> &[OracleReconciliationRequest]
Return event-specific proxy reconciliations waiting to be processed.
Sourcepub fn apply_batch_report<N: Network>(
&mut self,
report: &ReactiveBatchReport<N>,
) -> Result<(), OracleError>
pub fn apply_batch_report<N: Network>( &mut self, report: &ReactiveBatchReport<N>, ) -> Result<(), OracleError>
Apply committed reactive reports to typed oracle state.
Built-in handlers emit each update twice for compatibility: as a rich
oracle.price_update signal and as a legacy oracle.answer_updated
signal. A legacy signal is skipped only when the same batch carries a
rich update for the same proxy and event round — legacy-only signals
from custom handlers still apply even when unrelated rich updates
share the batch. Legacy signals update typed state but are not decoded
into OracleHookEvents, so runtime on_event/on_price_update
callbacks do not fire for them.
Sourcepub async fn reconcile<P: ChainlinkFeedProvider>(
&mut self,
provider: &P,
) -> Result<ReconcileReport, OracleError>
pub async fn reconcile<P: ChainlinkFeedProvider>( &mut self, provider: &P, ) -> Result<ReconcileReport, OracleError>
Reconcile all registered feeds with authoritative proxy reads.
Sourcepub fn reconcile_derived_pending_with<R: OracleDerivedReader>(
&mut self,
reader: &mut R,
) -> DerivedReconcileReport
pub fn reconcile_derived_pending_with<R: OracleDerivedReader>( &mut self, reader: &mut R, ) -> DerivedReconcileReport
Reconcile every pending derived-source request through reader.
Derived sources (Morpho, Euler) are confirmed by their protocol’s own
view call rather than a Chainlink proxy read: a read equal to the
event-recomputed value promotes the snapshot to
OracleValueStatus::Confirmed; a differing read installs the
authoritative value as OracleValueStatus::Corrected with
read-time timestamps. Either way the resulting snapshot carries
OracleValueSource::Proxy, because the value now comes from the
feed’s authoritative source path. Failed reads leave their request
queued and are reported in
DerivedReconcileReport::failed instead of failing the pass.
Proxy-kind requests are untouched; drive those through the
provider-backed OracleTracker::reconcile / OracleReconciler
paths.
Note: correction does not refresh the dependency baselines stored in
the feed’s FeedSource legs; subsequent dependency events recompute
from the original discovery baselines until the feed is re-discovered.
Trait Implementations§
Source§impl Clone for OracleTracker
impl Clone for OracleTracker
Source§fn clone(&self) -> OracleTracker
fn clone(&self) -> OracleTracker
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for OracleTracker
impl RefUnwindSafe for OracleTracker
impl Send for OracleTracker
impl Sync for OracleTracker
impl Unpin for OracleTracker
impl UnsafeUnpin for OracleTracker
impl UnwindSafe for OracleTracker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.