oil_api/state/bid.rs
1use serde::{Deserialize, Serialize};
2use steel::*;
3
4use crate::state::bid_pda;
5
6use super::OilAccount;
7
8/// Bid account tracks individual user contributions to auction pools for a specific epoch
9#[repr(C)]
10#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
11pub struct Bid {
12 /// Authority who made the contribution
13 pub authority: Pubkey,
14
15 /// Well ID this bid is for (0-3)
16 pub well_id: u64,
17
18 /// Epoch ID this bid is for (included in PDA, stored here for convenience)
19 pub epoch_id: u64,
20
21 /// Total amount of SOL contributed to this epoch's pool (in lamports)
22 pub contribution: u64,
23
24 /// Timestamp when bid was created (first contribution to this epoch)
25 pub created_at: u64,
26
27 /// Buffer field (for future use)
28 pub buffer_a: u64,
29
30 /// Buffer field (for future use)
31 pub buffer_b: u64,
32}
33
34impl Bid {
35 pub fn pda(authority: Pubkey, well_id: u64, epoch_id: u64) -> (Pubkey, u8) {
36 bid_pda(authority, well_id, epoch_id)
37 }
38}
39
40account!(OilAccount, Bid);
41