pub struct OraclePrice {
pub price: u128,
pub confidence: u128,
pub timestamp: i64,
}Fields§
§price: u128§confidence: u128§timestamp: i64Implementations§
Source§impl OraclePrice
impl OraclePrice
pub fn try_from_raw( price: i64, confidence: u64, exponent: i32, timestamp: i64, ) -> Result<OraclePrice, CoreError>
Sourcepub fn try_from_scaled(
price: i128,
confidence: u128,
exponent: i32,
timestamp: i64,
) -> Result<OraclePrice, CoreError>
pub fn try_from_scaled( price: i128, confidence: u128, exponent: i32, timestamp: i64, ) -> Result<OraclePrice, CoreError>
Convert a signed mantissa (Pyth i64, Switchboard/Chainlink i128) into Q64.64.
Sourcepub fn combine(
price_in: &OraclePrice,
price_out: &OraclePrice,
decimals_in: u8,
decimals_out: u8,
) -> Result<u128, CoreError>
pub fn combine( price_in: &OraclePrice, price_out: &OraclePrice, decimals_in: u8, decimals_out: u8, ) -> Result<u128, CoreError>
Pair rate in / out in atomic B/A Q64.64, using the confidence bounds
that minimize output tokens per input token, then scaling by
10^(decimals_out - decimals_in) with floor division.
Trait Implementations§
Source§impl Clone for OraclePrice
impl Clone for OraclePrice
Source§fn clone(&self) -> OraclePrice
fn clone(&self) -> OraclePrice
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for OraclePrice
Source§impl Debug for OraclePrice
impl Debug for OraclePrice
impl Eq for OraclePrice
Source§impl PartialEq for OraclePrice
impl PartialEq for OraclePrice
impl StructuralPartialEq for OraclePrice
Auto Trait Implementations§
impl Freeze for OraclePrice
impl RefUnwindSafe for OraclePrice
impl Send for OraclePrice
impl Sync for OraclePrice
impl Unpin for OraclePrice
impl UnsafeUnpin for OraclePrice
impl UnwindSafe for OraclePrice
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
Mutably borrows from an owned value. Read more