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
33pub fn automation_pda(authority: Pubkey) -> (Pubkey, u8) {
34 Pubkey::find_program_address(&[AUTOMATION, &authority.to_bytes()], &crate::ID)
35}
36
37pub fn board_pda() -> (Pubkey, u8) {
38 Pubkey::find_program_address(&[BOARD], &crate::ID)
39}
40
41pub fn config_pda() -> (Pubkey, u8) {
42 Pubkey::find_program_address(&[CONFIG], &crate::ID)
43}
44
45pub fn miner_pda(authority: Pubkey) -> (Pubkey, u8) {
46 Pubkey::find_program_address(&[MINER, &authority.to_bytes()], &crate::ID)
47}
48
49pub fn round_pda(id: u64) -> (Pubkey, u8) {
50 Pubkey::find_program_address(&[ROUND, &id.to_le_bytes()], &crate::ID)
51}
52
53pub fn stake_pda(authority: Pubkey) -> (Pubkey, u8) {
54 Pubkey::find_program_address(&[STAKE, &authority.to_bytes()], &crate::ID)
55}
56
57pub fn treasury_pda() -> (Pubkey, u8) {
58 Pubkey::find_program_address(&[TREASURY], &crate::ID)
59}
60
61pub fn treasury_tokens_address() -> Pubkey {
62 spl_associated_token_account::get_associated_token_address(&TREASURY_ADDRESS, &MINT_ADDRESS)
63}