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