1mod automation;
2mod board;
3mod config;
4mod miner;
5mod round;
6mod seeker;
7mod stake;
8mod treasury;
9
10pub use automation::*;
11pub use board::*;
12pub use config::*;
13pub use miner::*;
14pub use round::*;
15pub use seeker::*;
16pub use stake::*;
17pub use treasury::*;
18
19use crate::consts::*;
20
21use steel::*;
22
23#[repr(u8)]
24#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
25pub enum OreAccount {
26 Automation = 100,
27 Config = 101,
28 Miner = 103,
29 Treasury = 104,
30
31 Board = 105,
33 Seeker = 107,
34 Stake = 108,
35 Round = 109,
36}
37
38#[repr(u8)]
39#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
40pub enum OreAccountOLD {
41 ConfigOLD = 101,
42}
43
44pub fn automation_pda(authority: Pubkey) -> (Pubkey, u8) {
45 Pubkey::find_program_address(&[AUTOMATION, &authority.to_bytes()], &crate::ID)
46}
47
48pub fn board_pda() -> (Pubkey, u8) {
49 Pubkey::find_program_address(&[BOARD], &crate::ID)
50}
51
52pub fn config_pda() -> (Pubkey, u8) {
53 Pubkey::find_program_address(&[CONFIG], &crate::ID)
54}
55
56pub fn miner_pda(authority: Pubkey) -> (Pubkey, u8) {
57 Pubkey::find_program_address(&[MINER, &authority.to_bytes()], &crate::ID)
58}
59
60pub fn seeker_pda(mint: Pubkey) -> (Pubkey, u8) {
61 Pubkey::find_program_address(&[SEEKER, &mint.to_bytes()], &crate::ID)
62}
63
64pub fn round_pda(id: u64) -> (Pubkey, u8) {
65 Pubkey::find_program_address(&[ROUND, &id.to_le_bytes()], &crate::ID)
66}
67
68pub fn stake_pda(authority: Pubkey) -> (Pubkey, u8) {
69 Pubkey::find_program_address(&[STAKE, &authority.to_bytes()], &crate::ID)
70}
71
72pub fn treasury_pda() -> (Pubkey, u8) {
73 Pubkey::find_program_address(&[TREASURY], &crate::ID)
74}
75
76pub fn treasury_tokens_address() -> Pubkey {
77 spl_associated_token_account::get_associated_token_address(&TREASURY_ADDRESS, &MINT_ADDRESS)
78}