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: TokenConfigFlagContainerFlags.
token_decimals: u8Token decimals.
precision: u8Precision.
expected_provider: u8Expected provider.
feeds: [FeedConfig; 4]Price Feeds.
heartbeat_duration: u32Heartbeat duration.
Implementations§
Source§impl TokenConfig
impl TokenConfig
Sourcepub fn get_feed_config(
&self,
kind: &PriceProviderKind,
) -> Result<&FeedConfig, TokenConfigError>
pub fn get_feed_config( &self, kind: &PriceProviderKind, ) -> Result<&FeedConfig, TokenConfigError>
Get the corresponding price feed config.
Sourcepub fn get_feed_config_mut(
&mut self,
kind: &PriceProviderKind,
) -> Result<&mut FeedConfig, TokenConfigError>
pub fn get_feed_config_mut( &mut self, kind: &PriceProviderKind, ) -> Result<&mut FeedConfig, TokenConfigError>
Get the mutable reference of feed config by kind.
Sourcepub fn set_feed_config(
&mut self,
kind: &PriceProviderKind,
new_config: FeedConfig,
) -> Result<(), TokenConfigError>
pub fn set_feed_config( &mut self, kind: &PriceProviderKind, new_config: FeedConfig, ) -> Result<(), TokenConfigError>
Set feed config.
Sourcepub fn get_feed(
&self,
kind: &PriceProviderKind,
) -> Result<Pubkey, TokenConfigError>
pub fn get_feed( &self, kind: &PriceProviderKind, ) -> Result<Pubkey, TokenConfigError>
Get the corresponding price feed address.
Sourcepub fn set_expected_provider(&mut self, provider: PriceProviderKind)
pub fn set_expected_provider(&mut self, provider: PriceProviderKind)
Set expected provider.
Sourcepub fn expected_provider(&self) -> Result<PriceProviderKind, TokenConfigError>
pub fn expected_provider(&self) -> Result<PriceProviderKind, TokenConfigError>
Get expected price provider kind.
Sourcepub fn get_expected_feed(&self) -> Result<Pubkey, TokenConfigError>
pub fn get_expected_feed(&self) -> Result<Pubkey, TokenConfigError>
Get price feed address for the expected provider.
Sourcepub fn set_enabled(&mut self, enable: bool)
pub fn set_enabled(&mut self, enable: bool)
Set enabled.
Sourcepub fn set_synthetic(&mut self, is_synthetic: bool)
pub fn set_synthetic(&mut self, is_synthetic: bool)
Set synthetic.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Is enabled.
Sourcepub fn is_synthetic(&self) -> bool
pub fn is_synthetic(&self) -> bool
Is synthetic.
Sourcepub fn is_valid_pool_token_config(&self) -> bool
pub fn is_valid_pool_token_config(&self) -> bool
Returns whether the config is a valid pool token config.
Sourcepub fn is_price_adjustment_allowed(&self) -> bool
pub fn is_price_adjustment_allowed(&self) -> bool
Returns true if price adjustment is allowed.
Sourcepub fn set_flag(&mut self, flag: TokenConfigFlag, value: bool)
pub fn set_flag(&mut self, flag: TokenConfigFlag, value: bool)
Set flag
Sourcepub fn flag(&self, flag: TokenConfigFlag) -> bool
pub fn flag(&self, flag: TokenConfigFlag) -> bool
Get flag.
Sourcepub fn token_decimals(&self) -> u8
pub fn token_decimals(&self) -> u8
Token decimals.
Sourcepub fn timestamp_adjustment(
&self,
price_provider: &PriceProviderKind,
) -> Result<u32, TokenConfigError>
pub fn timestamp_adjustment( &self, price_provider: &PriceProviderKind, ) -> Result<u32, TokenConfigError>
Get timestamp adjustment.
Sourcepub fn max_deviation_factor(
&self,
price_provider: &PriceProviderKind,
) -> Result<Option<u128>, TokenConfigError>
pub fn max_deviation_factor( &self, price_provider: &PriceProviderKind, ) -> Result<Option<u128>, TokenConfigError>
Get max deviation factor.
Sourcepub fn heartbeat_duration(&self) -> u32
pub fn heartbeat_duration(&self) -> u32
Heartbeat duration.
Sourcepub fn name(&self) -> Result<&str, TokenConfigError>
pub fn name(&self) -> Result<&str, TokenConfigError>
Get token name.
Trait Implementations§
Source§impl Clone for TokenConfig
impl Clone for TokenConfig
Source§fn clone(&self) -> TokenConfig
fn clone(&self) -> TokenConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TokenConfig
impl Debug for TokenConfig
Source§impl<'de> Deserialize<'de> for TokenConfig
impl<'de> Deserialize<'de> for TokenConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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.
impl Display for TokenConfig
Available on crate feature
display only.Source§impl<'a> From<&'a TokenConfig> for UpdateTokenConfigParams
impl<'a> From<&'a TokenConfig> for UpdateTokenConfigParams
Source§fn from(config: &'a TokenConfig) -> Self
fn from(config: &'a TokenConfig) -> Self
Converts to this type from the input type.
Source§impl IdlBuild for TokenConfig
impl IdlBuild for TokenConfig
Source§fn create_type() -> Option<IdlTypeDef>
fn create_type() -> Option<IdlTypeDef>
Create an IDL type definition for the type. Read more
Source§fn insert_types(types: &mut BTreeMap<String, IdlTypeDef>)
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
fn get_full_path() -> String
Get the full module path of the type. Read more
Source§impl InitSpace for TokenConfig
impl InitSpace for TokenConfig
Source§const INIT_SPACE: usize = 328usize
const INIT_SPACE: usize = 328usize
Init Space.
Source§impl PartialEq for TokenConfig
impl PartialEq for TokenConfig
Source§impl Serialize for TokenConfig
impl Serialize for TokenConfig
impl Copy for TokenConfig
impl Eq for TokenConfig
impl Pod for TokenConfig
impl StructuralPartialEq for TokenConfig
Auto Trait Implementations§
impl Freeze for TokenConfig
impl RefUnwindSafe for TokenConfig
impl Send for TokenConfig
impl Sync for TokenConfig
impl Unpin for TokenConfig
impl UnwindSafe for TokenConfig
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
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
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
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.