TokenConfig

Struct TokenConfig 

Source
pub struct TokenConfig {
    pub name: [u8; 32],
    pub flags: TokenConfigFlagContainer,
    pub token_decimals: u8,
    pub precision: u8,
    pub expected_provider: u8,
    pub feeds: [FeedConfig; 4],
    pub heartbeat_duration: u32,
    /* private fields */
}

Fields§

§name: [u8; 32]

Name.

§flags: TokenConfigFlagContainer

Flags.

§token_decimals: u8

Token decimals.

§precision: u8

Precision.

§expected_provider: u8

Expected provider.

§feeds: [FeedConfig; 4]

Price Feeds.

§heartbeat_duration: u32

Heartbeat duration.

Implementations§

Source§

impl TokenConfig

Source

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

Get the corresponding price feed config.

Source

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

Get the mutable reference of feed config by kind.

Source

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

Set feed config.

Source

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

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, TokenConfigError>

Get expected price provider kind.

Source

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

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 is_price_adjustment_allowed(&self) -> bool

Returns true if price adjustment is allowed.

Source

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

Set flag

Source

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

Get flag.

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, TokenConfigError>

Get timestamp adjustment.

Source

pub fn max_deviation_factor( &self, price_provider: &PriceProviderKind, ) -> Result<Option<u128>, TokenConfigError>

Get max deviation factor.

Source

pub fn heartbeat_duration(&self) -> u32

Heartbeat duration.

Source

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

Get token name.

Trait Implementations§

Source§

impl Clone for TokenConfig

Source§

fn clone(&self) -> TokenConfig

Returns a duplicate 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

Available on crate feature display only.
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 IdlBuild for TokenConfig

Source§

fn create_type() -> Option<IdlTypeDef>

Create an IDL type definition for the type. Read more
Source§

fn insert_types(types: &mut BTreeMap<String, IdlTypeDef>)

Insert all types that are included in the current type definition to the given map.
Source§

fn get_full_path() -> String

Get the full module path of the type. Read more
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

Source§

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

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

Source§

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

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> 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.
Source§

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

Source§

fn vzip(self) -> V

Source§

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

Source§

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

Source§

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