1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) Subzero Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! Events emitted by the REX Processor program.
//!
//! This module defines the events that are emitted when REX reports are stored.
//! Subscribers can use these events to react to REX data updates without relying
//! on aggregator programs.
use RialoEvent;
use RexId;
use Serialize;
/// Event emitted when an REX 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 REX data updates.
///
/// # Topic Format
///
/// The event uses a parameterized topic with the rex_id as the dynamic parameter.
/// Topic format: `rialo_rex_processor_interface::event::RexReportEvent::{rex_id}`
/// where `rex_id` is in the string format `{nonce}:{creator}`.
///
/// # Example Usage
///
/// Subscribers can:
/// 1. Create an event instance: `let event = RexReportEvent::new(rex_id);`
/// 2. Get the instance topic: `let topic = event.instance_topic();`
/// 3. Subscribe to the topic for a specific REX request
/// 4. Use `derive_report_address()` to get the report PDA from the rex_id
/// 5. Read the full `RexReport` data from the PDA