pub struct LiquiditySnapshot {
pub asset: Address,
pub volume_30m_usd: i128,
pub unique_trades_1h: u32,
pub timestamp: u64,
pub attester: Address,
}Expand description
Mirror of liquidity-registry::LiquiditySnapshot.
Defined independently here to avoid making safe-oracle depend on the
liquidity-registry crate. Soroban’s contracttype serialization is
structural, so a snapshot written by the contract round-trips into this
type as long as the field order, names, and types stay aligned. Any change
to the registry’s snapshot shape must be mirrored here in lockstep — Phase
4 tests will catch a drift via integration round-trip.
Precision: All USD-denominated fields use 7-decimal precision
(Stellar stroop convention). 1 USD = 10_000_000 (10^7). This matches
SafeOracleConfig::min_liquidity_usd for direct comparison without scaling.
Reflector uses 14-decimal precision for prices, but liquidity volumes are
dollar-denominated and follow the project-wide 7-decimal convention.
Fields§
§asset: AddressAsset this snapshot describes.
volume_30m_usd: i128SDEX trading volume during the last 30 minutes, denominated in USD with
7-decimal precision. Example: $50,000 = 500_000_000_000.
unique_trades_1h: u32Count of unique trades on SDEX during the last 1 hour. Used by
safe_oracle::check_thin_sampling (Layer 2 Guardrail #5) to reject
markets where price discovery is too thin to trust.
timestamp: u64Snapshot creation time, in Unix seconds (matching ledger timestamp).
Consumers compare against env.ledger().timestamp() and their own
max_snapshot_age_seconds threshold to enforce freshness.
attester: AddressAddress that wrote this snapshot. Must be in the attester whitelist;
equality with the caller is enforced in write_snapshot.
Implementations§
Trait Implementations§
Source§impl Clone for LiquiditySnapshot
impl Clone for LiquiditySnapshot
Source§fn clone(&self) -> LiquiditySnapshot
fn clone(&self) -> LiquiditySnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LiquiditySnapshot
impl Debug for LiquiditySnapshot
Source§impl PartialEq for LiquiditySnapshot
impl PartialEq for LiquiditySnapshot
Source§fn eq(&self, other: &LiquiditySnapshot) -> bool
fn eq(&self, other: &LiquiditySnapshot) -> bool
self and other values to be equal, and is used by ==.Source§impl TryFromVal<Env, &LiquiditySnapshot> for Val
impl TryFromVal<Env, &LiquiditySnapshot> for Val
type Error = ConversionError
fn try_from_val( env: &Env, val: &&LiquiditySnapshot, ) -> Result<Self, ConversionError>
Source§impl TryFromVal<Env, LiquiditySnapshot> for Val
impl TryFromVal<Env, LiquiditySnapshot> for Val
type Error = ConversionError
fn try_from_val( env: &Env, val: &LiquiditySnapshot, ) -> Result<Self, ConversionError>
Source§impl TryFromVal<Env, Val> for LiquiditySnapshot
impl TryFromVal<Env, Val> for LiquiditySnapshot
type Error = ConversionError
fn try_from_val(env: &Env, val: &Val) -> Result<Self, ConversionError>
impl Eq for LiquiditySnapshot
impl StructuralPartialEq for LiquiditySnapshot
Auto Trait Implementations§
impl Freeze for LiquiditySnapshot
impl !RefUnwindSafe for LiquiditySnapshot
impl !Send for LiquiditySnapshot
impl !Sync for LiquiditySnapshot
impl Unpin for LiquiditySnapshot
impl UnsafeUnpin for LiquiditySnapshot
impl !UnwindSafe for LiquiditySnapshot
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, U, V, W, E, C> Compare<(T, U, V, W)> for C
impl<T, U, V, W, E, C> Compare<(T, U, V, W)> for C
type Error = E
fn compare( &self, a: &(T, U, V, W), b: &(T, U, V, W), ) -> Result<Ordering, <C as Compare<(T, U, V, W)>>::Error>
Source§impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for C
impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for C
type Error = E
fn compare( &self, a: &(T, U, V, W, X), b: &(T, U, V, W, X), ) -> Result<Ordering, <C as Compare<(T, U, V, W, X)>>::Error>
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<E, T, U> FromVal<E, T> for Uwhere
E: Env,
U: TryFromVal<E, T>,
impl<E, T, U> FromVal<E, T> for Uwhere
E: Env,
U: TryFromVal<E, T>,
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 more