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