#[repr(packed(1))]pub struct AggregatorAccountData {Show 36 fields
pub name: [u8; 32],
pub metadata: [u8; 128],
pub _reserved1: [u8; 32],
pub queue_pubkey: Pubkey,
pub oracle_request_batch_size: u32,
pub min_oracle_results: u32,
pub min_job_results: u32,
pub min_update_delay_seconds: u32,
pub start_after: i64,
pub variance_threshold: SwitchboardDecimal,
pub force_report_period: i64,
pub expiration: i64,
pub consecutive_failure_count: u64,
pub next_allowed_update_time: i64,
pub is_locked: bool,
pub crank_pubkey: Pubkey,
pub latest_confirmed_round: AggregatorRound,
pub current_round: AggregatorRound,
pub job_pubkeys_data: [Pubkey; 16],
pub job_hashes: [Hash; 16],
pub job_pubkeys_size: u32,
pub jobs_checksum: [u8; 32],
pub authority: Pubkey,
pub history_buffer: Pubkey,
pub previous_confirmed_round_result: SwitchboardDecimal,
pub previous_confirmed_round_slot: u64,
pub disable_crank: bool,
pub job_weights: [u8; 16],
pub creation_timestamp: i64,
pub resolution_mode: AggregatorResolutionMode,
pub base_priority_fee: u32,
pub priority_fee_bump: u32,
pub priority_fee_bump_period: u32,
pub max_priority_fee_multiplier: u32,
pub parent_function: Pubkey,
pub _ebuf: [u8; 90],
}
Fields§
§name: [u8; 32]
Name of the aggregator to store on-chain.
metadata: [u8; 128]
Metadata of the aggregator to store on-chain.
_reserved1: [u8; 32]
Reserved.
queue_pubkey: Pubkey
Pubkey of the queue the aggregator belongs to.
oracle_request_batch_size: u32
CONFIGS Number of oracles assigned to an update request.
min_oracle_results: u32
Minimum number of oracle responses required before a round is validated.
min_job_results: u32
Minimum number of job results before an oracle accepts a result.
min_update_delay_seconds: u32
Minimum number of seconds required between aggregator rounds.
start_after: i64
Unix timestamp for which no feed update will occur before.
variance_threshold: SwitchboardDecimal
Change percentage required between a previous round and the current round. If variance percentage is not met, reject new oracle responses.
force_report_period: i64
Number of seconds for which, even if the variance threshold is not passed, accept new responses from oracles.
expiration: i64
Timestamp when the feed is no longer needed.
consecutive_failure_count: u64
Counter for the number of consecutive failures before a feed is removed from a queue. If set to 0, failed feeds will remain on the queue.
next_allowed_update_time: i64
Timestamp when the next update request will be available.
is_locked: bool
Flag for whether an aggregators configuration is locked for editing.
crank_pubkey: Pubkey
Optional, public key of the crank the aggregator is currently using. Event based feeds do not need a crank.
latest_confirmed_round: AggregatorRound
Latest confirmed update request result that has been accepted as valid.
current_round: AggregatorRound
Oracle results from the current round of update request that has not been accepted as valid yet.
job_pubkeys_data: [Pubkey; 16]
List of public keys containing the job definitions for how data is sourced off-chain by oracles.
job_hashes: [Hash; 16]
Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment.
job_pubkeys_size: u32
Number of jobs assigned to an oracle.
jobs_checksum: [u8; 32]
Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment.
The account delegated as the authority for making account changes.
history_buffer: Pubkey
Optional, public key of a history buffer account storing the last N accepted results and their timestamps.
previous_confirmed_round_result: SwitchboardDecimal
The previous confirmed round result.
previous_confirmed_round_slot: u64
The slot when the previous confirmed round was opened.
disable_crank: bool
Whether an aggregator is permitted to join a crank.
job_weights: [u8; 16]
Job weights used for the weighted median of the aggregator’s assigned job accounts.
creation_timestamp: i64
Unix timestamp when the feed was created.
resolution_mode: AggregatorResolutionMode
Use sliding window or round based resolution NOTE: This changes result propogation in latest_round_result
base_priority_fee: u32
§priority_fee_bump: u32
§priority_fee_bump_period: u32
§max_priority_fee_multiplier: u32
§parent_function: Pubkey
§_ebuf: [u8; 90]
Reserved for future info.
Implementations§
source§impl AggregatorAccountData
impl AggregatorAccountData
pub fn size() -> usize
sourcepub fn new<'info>(
switchboard_feed: &'info AccountInfo<'info>
) -> Result<Ref<'info, AggregatorAccountData>>
pub fn new<'info>( switchboard_feed: &'info AccountInfo<'info> ) -> Result<Ref<'info, AggregatorAccountData>>
sourcepub fn new_from_bytes(data: &[u8]) -> Result<&AggregatorAccountData>
pub fn new_from_bytes(data: &[u8]) -> Result<&AggregatorAccountData>
sourcepub fn get_result(&self) -> Result<SwitchboardDecimal>
pub fn get_result(&self) -> Result<SwitchboardDecimal>
If sufficient oracle responses, returns the latest on-chain result in SwitchboardDecimal format
§Examples
use switchboard_solana::AggregatorAccountData;
use std::convert::TryInto;
let feed_result = AggregatorAccountData::new(feed_account_info)?.get_result()?;
let decimal: f64 = feed_result.try_into()?;
sourcepub fn check_confidence_interval(
&self,
max_confidence_interval: SwitchboardDecimal
) -> Result<()>
pub fn check_confidence_interval( &self, max_confidence_interval: SwitchboardDecimal ) -> Result<()>
sourcepub fn check_variance(&self, max_variance: Decimal) -> Result<()>
pub fn check_variance(&self, max_variance: Decimal) -> Result<()>
Check the variance (as a percentage difference from the max delivered oracle value) from all oracles.
sourcepub fn check_staleness(
&self,
unix_timestamp: i64,
max_staleness: i64
) -> Result<()>
pub fn check_staleness( &self, unix_timestamp: i64, max_staleness: i64 ) -> Result<()>
pub fn is_expired(&self) -> Result<bool>
pub fn fetch(client: &RpcClient, pubkey: Pubkey) -> Result<Self, SbError>
pub async fn fetch_async( client: &RpcClient, pubkey: Pubkey ) -> Result<Self, SbError>
pub fn fetch_sync<T: SyncClient>( client: &T, pubkey: Pubkey ) -> Result<Self, SbError>
Trait Implementations§
source§impl AccountDeserialize for AggregatorAccountData
impl AccountDeserialize for AggregatorAccountData
source§fn try_deserialize(buf: &mut &[u8]) -> Result<Self>
fn try_deserialize(buf: &mut &[u8]) -> Result<Self>
Mint
account into a token
Account
.source§fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self>
fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self>
source§impl Clone for AggregatorAccountData
impl Clone for AggregatorAccountData
source§fn clone(&self) -> AggregatorAccountData
fn clone(&self) -> AggregatorAccountData
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Default for AggregatorAccountData
impl Default for AggregatorAccountData
source§impl Discriminator for AggregatorAccountData
impl Discriminator for AggregatorAccountData
const DISCRIMINATOR: [u8; 8] = _
fn discriminator() -> [u8; 8]
source§impl PartialEq for AggregatorAccountData
impl PartialEq for AggregatorAccountData
source§fn eq(&self, other: &AggregatorAccountData) -> bool
fn eq(&self, other: &AggregatorAccountData) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl TryInto<AggregatorAccountData> for Option<Vec<u8>>
impl TryInto<AggregatorAccountData> for Option<Vec<u8>>
§type Error = SwitchboardError
type Error = SwitchboardError
impl Copy for AggregatorAccountData
impl Pod for AggregatorAccountData
impl StructuralPartialEq for AggregatorAccountData
impl ZeroCopy for AggregatorAccountData
Auto Trait Implementations§
impl RefUnwindSafe for AggregatorAccountData
impl Send for AggregatorAccountData
impl Sync for AggregatorAccountData
impl Unpin for AggregatorAccountData
impl UnwindSafe for AggregatorAccountData
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§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
.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self
.