1#![deny(missing_docs)]
2
3pub mod error;
6pub mod inline_mpl_token_metadata;
7pub mod instruction;
8pub mod processor;
9pub mod state;
10
11#[cfg(not(feature = "no-entrypoint"))]
12pub mod entrypoint;
13
14use {solana_native_token::LAMPORTS_PER_SOL, solana_pubkey::Pubkey};
15
16solana_pubkey::declare_id!("SVSPxpvHdN29nkVg9rPapPNDddN5DipNLRUFhyjFThE");
17
18pub const DEPOSIT_SOL_FEE_BPS: u64 = 100;
23const MAX_BPS: u64 = 10_000;
24
25const POOL_PREFIX: &[u8] = b"pool";
26const POOL_STAKE_PREFIX: &[u8] = b"stake";
27const POOL_ONRAMP_PREFIX: &[u8] = b"onramp";
28const POOL_MINT_PREFIX: &[u8] = b"mint";
29const POOL_MINT_AUTHORITY_PREFIX: &[u8] = b"mint_authority";
30const POOL_STAKE_AUTHORITY_PREFIX: &[u8] = b"stake_authority";
31const POOL_MPL_AUTHORITY_PREFIX: &[u8] = b"mpl_authority";
32
33const PHANTOM_TOKEN_AMOUNT: u64 = LAMPORTS_PER_SOL;
34const MINT_DECIMALS: u8 = 9;
35const PERPETUAL_NEW_WARMUP_COOLDOWN_RATE_EPOCH: Option<u64> = Some(0);
36
37const VOTE_STATE_DISCRIMINATOR_END: usize = 4;
38const VOTE_STATE_AUTHORIZED_WITHDRAWER_START: usize = 36;
39const VOTE_STATE_AUTHORIZED_WITHDRAWER_END: usize = 68;
40
41fn find_pool_address_and_bump(program_id: &Pubkey, vote_account_address: &Pubkey) -> (Pubkey, u8) {
42 Pubkey::find_program_address(&[POOL_PREFIX, vote_account_address.as_ref()], program_id)
43}
44
45fn find_pool_stake_address_and_bump(program_id: &Pubkey, pool_address: &Pubkey) -> (Pubkey, u8) {
46 Pubkey::find_program_address(&[POOL_STAKE_PREFIX, pool_address.as_ref()], program_id)
47}
48
49fn find_pool_onramp_address_and_bump(program_id: &Pubkey, pool_address: &Pubkey) -> (Pubkey, u8) {
50 Pubkey::find_program_address(&[POOL_ONRAMP_PREFIX, pool_address.as_ref()], program_id)
51}
52
53fn find_pool_mint_address_and_bump(program_id: &Pubkey, pool_address: &Pubkey) -> (Pubkey, u8) {
54 Pubkey::find_program_address(&[POOL_MINT_PREFIX, pool_address.as_ref()], program_id)
55}
56
57fn find_pool_stake_authority_address_and_bump(
58 program_id: &Pubkey,
59 pool_address: &Pubkey,
60) -> (Pubkey, u8) {
61 Pubkey::find_program_address(
62 &[POOL_STAKE_AUTHORITY_PREFIX, pool_address.as_ref()],
63 program_id,
64 )
65}
66
67fn find_pool_mint_authority_address_and_bump(
68 program_id: &Pubkey,
69 pool_address: &Pubkey,
70) -> (Pubkey, u8) {
71 Pubkey::find_program_address(
72 &[POOL_MINT_AUTHORITY_PREFIX, pool_address.as_ref()],
73 program_id,
74 )
75}
76
77fn find_pool_mpl_authority_address_and_bump(
78 program_id: &Pubkey,
79 pool_address: &Pubkey,
80) -> (Pubkey, u8) {
81 Pubkey::find_program_address(
82 &[POOL_MPL_AUTHORITY_PREFIX, pool_address.as_ref()],
83 program_id,
84 )
85}
86
87pub fn find_pool_address(program_id: &Pubkey, vote_account_address: &Pubkey) -> Pubkey {
89 find_pool_address_and_bump(program_id, vote_account_address).0
90}
91
92pub fn find_pool_stake_address(program_id: &Pubkey, pool_address: &Pubkey) -> Pubkey {
94 find_pool_stake_address_and_bump(program_id, pool_address).0
95}
96
97pub fn find_pool_onramp_address(program_id: &Pubkey, pool_address: &Pubkey) -> Pubkey {
99 find_pool_onramp_address_and_bump(program_id, pool_address).0
100}
101
102pub fn find_pool_mint_address(program_id: &Pubkey, pool_address: &Pubkey) -> Pubkey {
104 find_pool_mint_address_and_bump(program_id, pool_address).0
105}
106
107pub fn find_pool_stake_authority_address(program_id: &Pubkey, pool_address: &Pubkey) -> Pubkey {
109 find_pool_stake_authority_address_and_bump(program_id, pool_address).0
110}
111
112pub fn find_pool_mint_authority_address(program_id: &Pubkey, pool_address: &Pubkey) -> Pubkey {
114 find_pool_mint_authority_address_and_bump(program_id, pool_address).0
115}
116
117pub fn find_pool_mpl_authority_address(program_id: &Pubkey, pool_address: &Pubkey) -> Pubkey {
119 find_pool_mpl_authority_address_and_bump(program_id, pool_address).0
120}