1use serde::{Deserialize, Serialize};
2use steel::*;
3
4use crate::state::rig_pda;
5
6use super::OilAccount;
7
8#[repr(C)]
10#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
11pub struct Rig {
12 pub authority: Pubkey,
14
15 pub current_epoch_id: [u64; 4],
17
18 pub checkpointed_epoch_id: [u64; 4],
20
21 pub buffer_a: u64,
23
24 pub buffer_b: u64,
26
27 pub buffer_c: u64,
29}
30
31impl Rig {
32 pub fn pda(authority: Pubkey) -> (Pubkey, u8) {
33 rig_pda(authority)
34 }
35
36 pub fn initialize(&mut self, authority: Pubkey) {
37 self.authority = authority;
38 self.current_epoch_id = [0; 4];
39 self.checkpointed_epoch_id = [0; 4];
40 self.buffer_a = 0;
41 self.buffer_b = 0;
42 self.buffer_c = 0;
43 }
44}
45
46account!(OilAccount, Rig);