Skip to main content

oil_api/state/
micro.rs

1use serde::{Deserialize, Serialize};
2use steel::*;
3
4use crate::state::micro_pda;
5
6use super::OilAccount;
7
8/// Micro account stores per-epoch totals for a specific well and epoch
9#[repr(C)]
10#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
11pub struct Micro {
12    /// Well ID (0-3)
13    pub well_id: u64,
14    
15    /// Epoch ID
16    pub epoch_id: u64,
17    
18    /// Total pooled FOGO for this epoch (original total before pool bid deduction)
19    pub total_contributed: u64,
20    
21    /// Total OIL mined during this epoch
22    pub total_oil_mined: u64,
23    
24    /// Total refund when outbid (86% of new bid + leftover FOGO)
25    pub total_refund: u64,
26    
27    /// Number of unique contributors (optional, for stats)
28    pub pool_members: u64,
29    
30    /// Buffer field for future extensions
31    pub buffer_a: u64,
32    
33    /// Buffer field for future extensions
34    pub buffer_b: u64,
35    
36    /// Buffer field for future extensions
37    pub buffer_c: u64,
38}
39
40impl Micro {
41    pub fn pda(well_id: u64, epoch_id: u64) -> (Pubkey, u8) {
42        micro_pda(well_id, epoch_id)
43    }
44}
45
46account!(OilAccount, Micro);