Struct TokenConfig

Source
#[repr(C)]
pub struct TokenConfig { /* private fields */ }

Implementations§

Source§

impl TokenConfig

Source

pub fn get_feed_config(&self, kind: &PriceProviderKind) -> Result<&FeedConfig>

Get the corresponding price feed config.

Source

pub fn set_feed_config( &mut self, kind: &PriceProviderKind, new_config: FeedConfig, ) -> Result<()>

Set feed config.

Source

pub fn get_feed(&self, kind: &PriceProviderKind) -> Result<Pubkey>

Get the corresponding price feed address.

Source

pub fn set_expected_provider(&mut self, provider: PriceProviderKind)

Set expected provider.

Source

pub fn expected_provider(&self) -> Result<PriceProviderKind>

Get expected price provider kind.

Source

pub fn get_expected_feed(&self) -> Result<Pubkey>

Get price feed address for the expected provider.

Source

pub fn set_enabled(&mut self, enable: bool)

Set enabled.

Source

pub fn set_synthetic(&mut self, is_synthetic: bool)

Set synthetic.

Source

pub fn is_enabled(&self) -> bool

Is enabled.

Source

pub fn is_synthetic(&self) -> bool

Is synthetic.

Source

pub fn is_valid_pool_token_config(&self) -> bool

Returns whether the config is a valid pool token config.

Source

pub fn set_flag(&mut self, flag: Flag, value: bool)

Set flag

Source

pub fn flag(&self, flag: Flag) -> bool

Get flag.

Source

pub fn update( &mut self, name: &str, synthetic: bool, token_decimals: u8, builder: UpdateTokenConfigParams, enable: bool, init: bool, ) -> Result<()>

Create a new token config from builder.

Source

pub fn token_decimals(&self) -> u8

Token decimals.

Source

pub fn precision(&self) -> u8

Price Precision.

Source

pub fn timestamp_adjustment( &self, price_provider: &PriceProviderKind, ) -> Result<u32>

Get timestamp adjustment.

Source

pub fn heartbeat_duration(&self) -> u32

Heartbeat duration.

Source

pub fn name(&self) -> Result<&str>

Get token name.

Trait Implementations§

Source§

impl Clone for TokenConfig

Source§

fn clone(&self) -> TokenConfig

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TokenConfig

Source§

fn fmt(&self, __derive_more_f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TokenConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for TokenConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a TokenConfig> for UpdateTokenConfigParams

Source§

fn from(config: &'a TokenConfig) -> Self

Converts to this type from the input type.
Source§

impl InitSpace for TokenConfig

Source§

const INIT_SPACE: usize = 328usize

Init Space.
Source§

impl PartialEq for TokenConfig

Source§

fn eq(&self, other: &TokenConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for TokenConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Zeroable for TokenConfig

§

fn zeroed() -> Self

Source§

impl Copy for TokenConfig

Source§

impl Eq for TokenConfig

Source§

impl Pod for TokenConfig

Source§

impl StructuralPartialEq for TokenConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> NoUninit for T
where T: Pod,