Skip to main content

OracleReportEvent

Struct OracleReportEvent 

Source
pub struct OracleReportEvent {
    pub oracle_id: OracleId,
}
Expand description

Event emitted when an oracle report is stored.

This event is emitted after a report is successfully written to the report PDA. Subscribers can listen to this event to react to oracle data updates.

§Topic Format

The event uses a parameterized topic with the oracle_id as the dynamic parameter. Topic format: rialo_oracle_processor_interface::event::OracleReportEvent::{oracle_id} where oracle_id is in the string format {nonce}:{creator}.

§Example Usage

Subscribers can:

  1. Create an event instance: let event = OracleReportEvent::new(oracle_id);
  2. Get the instance topic: let topic = event.instance_topic();
  3. Subscribe to the topic for a specific oracle
  4. Use derive_report_address() to get the report PDA from the oracle_id
  5. Read the full OracleReport data from the PDA

Fields§

§oracle_id: OracleId

The oracle ID - marked with #[topic] to create instance-specific topics

Implementations§

Source§

impl OracleReportEvent

Source

pub fn to_attribute_map(&self) -> AttributeMap<String, AttributeValue>

Converts this struct to an AttributeMap

This method provides a convenient way to convert the struct instance into an AttributeMap without explicitly using the From trait.

§Returns

An AttributeMap representation of this struct with all fields as attributes.

Source

pub fn topic() -> &'static str

Returns the event topic as a string

The topic is constructed from the module path and struct name, creating a unique identifier for this event type.

§Returns

A static string representing this event’s topic.

Source

pub fn emit( &self, program_id: &Pubkey, accounts: &[AccountInfo<'_>], ) -> ProgramResult

Emits this event using the provided program ID (legacy method)

This method converts the struct to an AttributeMap and emits it through the Rialo event system. The topic is extracted from the AttributeMap’s “topic” field.

§Arguments
  • program_id - The Solana program ID to associate with this event
  • accounts - The accounts required for event emission
§Returns

A ProgramResult indicating success or failure of the event emission.

Source

pub fn emit_with_topic( &self, topic: &str, program_id: &Pubkey, accounts: &[AccountInfo<'_>], ) -> ProgramResult

Emits this event using the provided program ID with a specific topic

This method converts the struct to an AttributeMap and emits it through the Rialo event system using the provided topic instead of extracting it from the AttributeMap.

§Arguments
  • topic - The topic identifier for the event
  • program_id - The Solana program ID to associate with this event
  • accounts - The accounts required for event emission
§Returns

A ProgramResult indicating success or failure of the event emission.

Source

pub fn initialize_storage( &self, program_id: &Pubkey, accounts: &[AccountInfo<'_>], ) -> ProgramResult

Initializes storage for this event type (legacy method)

This method sets up the necessary storage for this event type in the Rialo event system. The topic is extracted from the AttributeMap’s “topic” field. It should be called before emitting events of this type.

§Arguments
  • program_id - The Solana program ID to associate with this event type
  • accounts - The accounts required for storage initialization
§Returns

A ProgramResult indicating success or failure of the storage initialization.

Source

pub fn initialize_storage_with_topic( &self, topic: &str, program_id: &Pubkey, accounts: &[AccountInfo<'_>], ) -> ProgramResult

Initializes storage for this event type with a specific topic

This method sets up the necessary storage for this event type in the Rialo event system using the provided topic instead of extracting it from the AttributeMap. It should be called before emitting events of this type.

§Arguments
  • topic - The topic identifier for the event
  • program_id - The Solana program ID to associate with this event type
  • accounts - The accounts required for storage initialization
§Returns

A ProgramResult indicating success or failure of the storage initialization.

Source

pub fn instance_topic(&self) -> String

Returns the instance-specific topic for this event

This topic includes the dynamic parameter from the #[topic] field, creating a unique topic for each instance (e.g., per oracle).

§Returns

A string in the format: {base_topic}::{topic_field_value}

Source

pub fn to_attribute_map_with_dynamic_topic( &self, ) -> AttributeMap<String, AttributeValue>

Converts this struct to an AttributeMap with the dynamic topic

This method is a convenience wrapper that converts the struct to an AttributeMap and overrides the “topic” key with the instance-specific topic.

§Returns

An AttributeMap with the dynamic topic from instance_topic().

Source§

impl OracleReportEvent

Source

pub fn new(oracle_id: OracleId) -> Self

Creates a new OracleReportEvent.

§Arguments
  • oracle_id - The oracle ID

Trait Implementations§

Source§

impl Clone for OracleReportEvent

Source§

fn clone(&self) -> OracleReportEvent

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 OracleReportEvent

Source§

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

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

impl Default for OracleReportEvent

Source§

fn default() -> OracleReportEvent

Returns the “default value” for a type. Read more
Source§

impl From<&OracleReportEvent> for AttributeMap<String, AttributeValue>

Source§

fn from(value: &OracleReportEvent) -> Self

Converts to this type from the input type.
Source§

impl Serialize for OracleReportEvent

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

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> 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more