pub struct PythOracleConfig {
pub feed_id: [u8; 32],
pub price_update_account: [u8; 32],
pub max_age_seconds: u64,
pub max_confidence_bps: u16,
pub price_decimals: u8,
/* private fields */
}Expand description
Pyth pull-oracle configuration stored with the asset it prices.
feed_id is the 32-byte Pyth price feed id expected inside the submitted
price update account. price_decimals is the scale Roshi exposes through
OraclePrice; for example, a Pyth price of 123456789 * 10^-8 with
price_decimals = 8 is returned as 123456789.
max_confidence_bps must be nonzero for an active Pyth leg —
OracleConfig::validate rejects an unbounded confidence interval. The
raw reader still treats 0 as “no width check” for inactive configs.
price_update_account optionally pins the price update account by address;
all-zeros (the default) accepts any Pyth-verified update account carrying
feed_id, which is the intended pull-oracle posture.
Fields§
§feed_id: [u8; 32]§price_update_account: [u8; 32]§max_age_seconds: u64§max_confidence_bps: u16§price_decimals: u8Implementations§
Source§impl PythOracleConfig
impl PythOracleConfig
pub const fn new( feed_id: [u8; 32], price_decimals: u8, max_age_seconds: u64, max_confidence_bps: u16, ) -> Self
Sourcepub const fn pin_price_update_account(
self,
price_update_account: [u8; 32],
) -> Self
pub const fn pin_price_update_account( self, price_update_account: [u8; 32], ) -> Self
Pin pricing to one specific price update account (e.g. a sponsored
Pyth feed account) instead of accepting any verified update for
feed_id.
Sourcepub fn pinned_price_update_account(&self) -> Option<[u8; 32]>
pub fn pinned_price_update_account(&self) -> Option<[u8; 32]>
The pinned price update account, or None when any verified update
for feed_id is accepted (price_update_account all-zeros).
Trait Implementations§
Source§impl Clone for PythOracleConfig
impl Clone for PythOracleConfig
Source§fn clone(&self) -> PythOracleConfig
fn clone(&self) -> PythOracleConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PythOracleConfig
Source§impl Debug for PythOracleConfig
impl Debug for PythOracleConfig
Source§impl Default for PythOracleConfig
impl Default for PythOracleConfig
Source§fn default() -> PythOracleConfig
fn default() -> PythOracleConfig
impl Eq for PythOracleConfig
Source§impl PartialEq for PythOracleConfig
impl PartialEq for PythOracleConfig
Source§fn eq(&self, other: &PythOracleConfig) -> bool
fn eq(&self, other: &PythOracleConfig) -> bool
self and other values to be equal, and is used by ==.Source§impl<'de, WincodeConfig: Config> SchemaRead<'de, WincodeConfig> for PythOracleConfig
impl<'de, WincodeConfig: Config> SchemaRead<'de, WincodeConfig> for PythOracleConfig
type Dst = PythOracleConfig
Source§fn read(
reader: impl Reader<'de>,
dst: &mut MaybeUninit<Self::Dst>,
) -> ReadResult<()>
fn read( reader: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> ReadResult<()>
Source§impl<WincodeConfig: Config> SchemaWrite<WincodeConfig> for PythOracleConfig
impl<WincodeConfig: Config> SchemaWrite<WincodeConfig> for PythOracleConfig
impl StructuralPartialEq for PythOracleConfig
Source§impl<WincodeConfig: Config> ZeroCopy<WincodeConfig> for PythOracleConfigwhere
for<'_wincode_internal, '_wincode_internal> [u8; 32]: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> u64: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> u16: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> u8: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> [u8; 5]: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> Assert<{ _ }>: IsTrue,
impl<WincodeConfig: Config> ZeroCopy<WincodeConfig> for PythOracleConfigwhere
for<'_wincode_internal, '_wincode_internal> [u8; 32]: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> u64: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> u16: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> u8: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> [u8; 5]: ZeroCopy<WincodeConfig>,
for<'_wincode_internal> Assert<{ _ }>: IsTrue,
Source§fn from_bytes<'de>(bytes: &'de [u8], config: C) -> Result<&'de Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
fn from_bytes<'de>(bytes: &'de [u8], config: C) -> Result<&'de Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
crate::ZeroCopy::from_bytes, but allows the caller to provide a custom configuration.Source§fn from_bytes_mut<'de>(
bytes: &'de mut [u8],
config: C,
) -> Result<&'de mut Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
fn from_bytes_mut<'de>(
bytes: &'de mut [u8],
config: C,
) -> Result<&'de mut Self, ReadError>where
Self: Sized + SchemaRead<'de, C, Dst = Self>,
crate::ZeroCopy::from_bytes_mut, but allows the caller to provide a custom configuration.Auto Trait Implementations§
impl Freeze for PythOracleConfig
impl RefUnwindSafe for PythOracleConfig
impl Send for PythOracleConfig
impl Sync for PythOracleConfig
impl Unpin for PythOracleConfig
impl UnsafeUnpin for PythOracleConfig
impl UnwindSafe for PythOracleConfig
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<'de, T, C> Deserialize<'de, C> for Twhere
C: Config,
T: SchemaRead<'de, C>,
impl<'de, T, C> Deserialize<'de, C> for Twhere
C: Config,
T: SchemaRead<'de, C>,
Source§impl<'de, T> Deserialize<'de> for Twhere
T: SchemaRead<'de, Configuration>,
impl<'de, T> Deserialize<'de> for Twhere
T: SchemaRead<'de, Configuration>,
Source§impl<T> DeserializeOwned for Twhere
T: SchemaReadOwned<Configuration>,
impl<T> DeserializeOwned for Twhere
T: SchemaReadOwned<Configuration>,
Source§fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
Reader into a new Self::Dst.Source§fn deserialize_from_into<'de>(
src: impl Reader<'de>,
dst: &mut MaybeUninit<Self::Dst>,
) -> Result<(), ReadError>
fn deserialize_from_into<'de>( src: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>
Reader into dst.Source§impl<T, C> DeserializeOwned<C> for Twhere
C: Config,
T: SchemaReadOwned<C>,
impl<T, C> DeserializeOwned<C> for Twhere
C: Config,
T: SchemaReadOwned<C>,
Source§fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>
Reader into a new Self::Dst.Source§fn deserialize_from_into<'de>(
src: impl Reader<'de>,
dst: &mut MaybeUninit<Self::Dst>,
) -> Result<(), ReadError>
fn deserialize_from_into<'de>( src: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>
Reader into dst.impl<T, C> SchemaReadOwned<C> for Twhere
C: ConfigCore,
T: for<'de> SchemaRead<'de, C>,
Source§impl<T> Serialize for T
impl<T> Serialize for T
Source§fn serialize(src: &Self::Src) -> Result<Vec<u8>, WriteError>
fn serialize(src: &Self::Src) -> Result<Vec<u8>, WriteError>
Vec of bytes.Source§fn serialize_into(dst: impl Writer, src: &Self::Src) -> Result<(), WriteError>
fn serialize_into(dst: impl Writer, src: &Self::Src) -> Result<(), WriteError>
Source§fn serialized_size(src: &Self::Src) -> Result<u64, WriteError>
fn serialized_size(src: &Self::Src) -> Result<u64, WriteError>
Source§impl<T, C> Serialize<C> for T
impl<T, C> Serialize<C> for T
Source§fn serialize(src: &Self::Src, config: C) -> Result<Vec<u8>, WriteError>
fn serialize(src: &Self::Src, config: C) -> Result<Vec<u8>, WriteError>
Vec of bytes.Source§fn serialize_into(
dst: impl Writer,
src: &Self::Src,
config: C,
) -> Result<(), WriteError>
fn serialize_into( dst: impl Writer, src: &Self::Src, config: C, ) -> Result<(), WriteError>
Writer.