1use solana_program::pubkey::Pubkey;
2
3use crate::consts::*;
4
5pub fn config_pda() -> (Pubkey, u8) {
6 Pubkey::find_program_address(&[CONFIG_SEED], &crate::id())
7}
8
9pub fn treasury_pda() -> (Pubkey, u8) {
10 Pubkey::find_program_address(&[TREASURY_SEED], &crate::id())
11}
12
13pub fn round_pda(index: u64) -> (Pubkey, u8) {
14 Pubkey::find_program_address(&[ROUND_SEED, &index.to_le_bytes()], &crate::id())
15}
16
17pub fn miner_pda(authority: &Pubkey) -> (Pubkey, u8) {
18 Pubkey::find_program_address(&[MINER_SEED, authority.as_ref()], &crate::id())
19}
20
21pub fn ata(wallet: &Pubkey, mint: &Pubkey) -> Pubkey {
23 Pubkey::find_program_address(
24 &[
25 wallet.as_ref(),
26 SPL_TOKEN_PROGRAM_ID.as_ref(),
27 mint.as_ref(),
28 ],
29 &ASSOCIATED_TOKEN_PROGRAM_ID,
30 )
31 .0
32}