ore_boost_api/state/
mod.rs

1mod boost;
2mod config;
3mod stake;
4
5pub use boost::*;
6pub use config::*;
7pub use stake::*;
8
9use steel::*;
10
11use crate::consts::{BOOST, CONFIG, STAKE};
12
13#[repr(u8)]
14#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
15pub enum BoostAccount {
16    Boost = 100,
17    Config = 101,
18    Stake = 102,
19}
20
21/// Fetch the PDA of the boost account.
22pub fn boost_pda(mint: Pubkey) -> (Pubkey, u8) {
23    Pubkey::find_program_address(&[BOOST, mint.as_ref()], &crate::id())
24}
25
26/// Fetch the PDA of the config account.
27pub fn config_pda() -> (Pubkey, u8) {
28    Pubkey::find_program_address(&[CONFIG], &crate::id())
29}
30
31/// Fetch the PDA of the stake account.
32pub fn stake_pda(authority: Pubkey, boost: Pubkey) -> (Pubkey, u8) {
33    Pubkey::find_program_address(&[STAKE, authority.as_ref(), boost.as_ref()], &crate::id())
34}