1mod automation;
2mod auction;
3mod board;
4mod config;
5mod micro;
6mod miner;
7mod pool;
8mod referral;
9mod round;
10mod share;
11mod well;
12mod stake;
13mod treasury;
14mod whitelist;
15mod plot;
16mod rig;
17mod refinery;
18
19pub use automation::*;
20pub use auction::*;
21pub use board::*;
22pub use config::*;
23pub use micro::*;
24pub use miner::*;
25pub use pool::*;
26pub use referral::*;
27pub use round::*;
28pub use share::*;
29pub use well::*;
30pub use stake::*;
31pub use treasury::*;
32#[allow(unused_imports)] pub use whitelist::*;
34pub use plot::*;
35pub use rig::*;
36pub use refinery::*;
37use crate::consts::*;
38
39use steel::*;
40
41#[repr(u8)]
42#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
43pub enum OilAccount {
44 Automation = 100,
45 Config = 101,
46 Miner = 103,
47 Treasury = 104,
48 Board = 105,
49 Stake = 108,
50 Round = 109,
51 Referral = 110,
52 Pool = 111,
53 Auction = 114,
54 Well = 115,
55 Whitelist = 117,
56 Micro = 118,
57 Share = 119,
58 Plot = 120,
59 Rig = 121,
60 Refinery = 122,
61}
62
63pub fn automation_pda(authority: Pubkey) -> (Pubkey, u8) {
64 Pubkey::find_program_address(&[AUTOMATION, &authority.to_bytes()], &crate::ID)
65}
66
67pub fn board_pda() -> (Pubkey, u8) {
68 Pubkey::find_program_address(&[BOARD], &crate::ID)
69}
70
71pub fn config_pda() -> (Pubkey, u8) {
72 Pubkey::find_program_address(&[CONFIG], &crate::ID)
73}
74
75pub fn miner_pda(authority: Pubkey) -> (Pubkey, u8) {
76 Pubkey::find_program_address(&[MINER, &authority.to_bytes()], &crate::ID)
77}
78
79pub fn round_pda(id: u64) -> (Pubkey, u8) {
80 Pubkey::find_program_address(&[ROUND, &id.to_le_bytes()], &crate::ID)
81}
82
83pub fn stake_pda(authority: Pubkey) -> (Pubkey, u8) {
84 Pubkey::find_program_address(&[STAKE, &authority.to_bytes()], &crate::ID)
85}
86
87pub fn stake_pda_with_id(authority: Pubkey, stake_id: u64) -> (Pubkey, u8) {
88 Pubkey::find_program_address(&[STAKE, &authority.to_bytes(), &stake_id.to_le_bytes()], &crate::ID)
89}
90
91pub fn referral_pda(authority: Pubkey) -> (Pubkey, u8) {
92 Pubkey::find_program_address(&[REFERRAL, &authority.to_bytes()], &crate::ID)
93}
94
95pub fn treasury_pda() -> (Pubkey, u8) {
96 Pubkey::find_program_address(&[TREASURY], &crate::ID)
97}
98
99pub fn treasury_tokens_address() -> Pubkey {
100 spl_associated_token_account::get_associated_token_address(&TREASURY_ADDRESS, &MINT_ADDRESS)
101}
102
103pub fn pool_pda() -> (Pubkey, u8) {
104 Pubkey::find_program_address(&[POOL], &crate::ID)
105}
106
107pub fn pool_tokens_address() -> Pubkey {
108 let pool_address = pool_pda().0;
109 spl_associated_token_account::get_associated_token_address(&pool_address, &MINT_ADDRESS)
110}
111
112pub fn auction_pda() -> (Pubkey, u8) {
113 Pubkey::find_program_address(&[AUCTION], &crate::ID)
114}
115
116pub fn well_pda(well_id: u64) -> (Pubkey, u8) {
117 Pubkey::find_program_address(&[WELL, &well_id.to_le_bytes()], &crate::ID)
118}
119
120pub fn whitelist_pda(code_hash: [u8; 32]) -> (Pubkey, u8) {
121 Pubkey::find_program_address(&[WHITELIST, &code_hash], &crate::ID)
122}
123
124pub fn micro_pda(well_id: u64, epoch_id: u64) -> (Pubkey, u8) {
125 Pubkey::find_program_address(&[MICRO, &well_id.to_le_bytes(), &epoch_id.to_le_bytes()], &crate::ID)
126}
127
128pub fn share_pda(authority: Pubkey, well_id: u64, epoch_id: u64) -> (Pubkey, u8) {
129 Pubkey::find_program_address(&[SHARE, &authority.to_bytes(), &well_id.to_le_bytes(), &epoch_id.to_le_bytes()], &crate::ID)
130}
131
132pub fn plot_pda(authority: Pubkey) -> (Pubkey, u8) {
133 Pubkey::find_program_address(&[PLOT, &authority.to_bytes()], &crate::ID)
134}
135
136pub fn rig_pda(mint: Pubkey) -> (Pubkey, u8) {
137 Pubkey::find_program_address(&[RIG, &mint.to_bytes()], &crate::ID)
138}
139
140pub fn refinery_pda() -> (Pubkey, u8) {
141 Pubkey::find_program_address(&[REFINERY], &crate::ID)
142}