miracle_api/state/snapshot.rs
1use steel::*;
2
3use super::MiracleAccount;
4
5/// Snapshot data for the current epoch
6/// This is the current equivalent of the HistoricalSnapshot structure
7#[repr(C)]
8#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
9pub struct Snapshot {
10 /// The seal merkle root of all historical payment merkle roots
11 /// This is the root of the incremental seal merkle tree containing all payment roots
12 pub seal_merkle_root: [u8; 32],
13
14 /// Current epoch number.
15 pub epoch: u64,
16
17 /// Current epoch hash for tamper detection in the Epoch Hash Chain security solution
18 /// Epoch 0: `hashv(b"MIRACLE_EPOCH_0_EXTREME_WAYS")`
19 /// Epoch 1+: `hashv(previous_epoch_hash + current_epoch_number + current_payment_merkle_root)`
20 /// Fallback: If previous epoch hash is missing, use genesis hash as fallback
21 /// Empty Payment Support: Epoch numbers ensure uniqueness even with identical payment roots
22 pub epoch_hash: [u8; 32],
23
24 /// Timestamp when this epoch was created (oracle updates once per day)
25 pub created_at: i64,
26
27 /// Customer reward pool for this epoch
28 pub customer_reward_pool: u64,
29
30 /// Merchant reward pool for this epoch
31 pub merchant_reward_pool: u64,
32
33 /// Total customer participants in this epoch
34 pub customer_participants: u32,
35
36 /// Total merchant participants in this epoch
37 pub merchant_participants: u32,
38
39 /// Total customer activity in this epoch (for accurate reward calculation)
40 pub total_customer_activity: u32,
41
42 /// Total merchant activity in this epoch (for accurate reward calculation)
43 pub total_merchant_activity: u32,
44}
45
46account!(MiracleAccount, Snapshot);