oil_api/state/
auction_pool.rs

1use serde::{Deserialize, Serialize};
2use steel::*;
3
4use crate::state::auction_pool_pda;
5
6use super::OilAccount;
7
8/// Auction Pool account (per-epoch pool)
9/// PDA: [AUCTION_POOL, well_id, epoch_id]
10/// This account holds SOL contributions for this specific epoch/auction
11#[repr(C)]
12#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
13pub struct AuctionPool {
14    /// Well ID (0-3) - which well this pool is for
15    pub well_id: u64,
16    
17    /// Epoch ID - which auction round this pool belongs to
18    pub epoch_id: u64,
19    
20    /// Total SOL in this pool (sum of all contributions for this epoch, in lamports)
21    pub pool_total: u64,
22    
23    /// Status: 0 = active, 1 = settled/abandoned (for refunds)
24    /// When pool doesn't win and auction ends, status = 1
25    pub status: u64,
26    
27    /// Buffer fields
28    pub buffer_a: u64,
29    pub buffer_b: u64,
30    pub buffer_c: u64,
31    pub buffer_d: u64,
32}
33
34impl AuctionPool {
35    pub fn pda(well_id: u64, epoch_id: u64) -> (Pubkey, u8) {
36        auction_pool_pda(well_id, epoch_id)
37    }
38}
39
40account!(OilAccount, AuctionPool);
41