1use solana_program::pubkey::Pubkey;
2use crate::consts::{ALLOCATION, CAMPAIGN, CONFIG, FEE_ACCOUNT, MINT, MINT_AUTHORITY, TREASURY};
5
6pub fn config_pda() -> (Pubkey, u8) {
8 Pubkey::find_program_address(&[CONFIG], &crate::id())
9}
10
11pub fn fee_account_pda() -> (Pubkey, u8) {
13 Pubkey::find_program_address(&[FEE_ACCOUNT], &crate::id())
14}
15
16pub fn campaign_pda(campaign_id: &[u8]) -> (Pubkey, u8) {
18 Pubkey::find_program_address(&[CAMPAIGN, campaign_id], &crate::id())
19}
20
21pub fn mint_pda(mint_id: &[u8], noise: &[u8; 4]) -> (Pubkey, u8) {
30 Pubkey::find_program_address(&[MINT, mint_id, noise], &crate::id())
31}
32
33pub fn mint_authority_pda(mint: &Pubkey) -> (Pubkey, u8) {
36 Pubkey::find_program_address(&[MINT_AUTHORITY, mint.as_ref()], &crate::id())
37}
38
39pub fn mint_treasury_pda(mint: &Pubkey) -> (Pubkey, u8) {
43 Pubkey::find_program_address(&[TREASURY, mint.as_ref()], &crate::id())
44}
45
46pub fn campaign_treasury_pda(campaign_id: &[u8]) -> (Pubkey, u8) {
48 Pubkey::find_program_address(&[TREASURY, campaign_id], &crate::id())
49}
50
51pub fn allocation_pda(campaign: Pubkey, recipient: Pubkey) -> (Pubkey, u8) {
53 Pubkey::find_program_address(
54 &[ALLOCATION, campaign.as_ref(), recipient.as_ref()],
55 &crate::id(),
56 )
57}