mod boost;
mod member;
mod proof;
mod share;
mod stake;
pub use boost::*;
pub use member::*;
pub use proof::*;
pub use share::*;
pub use stake::*;
use crate::consts::*;
use steel::*;
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
pub enum LegacyAccount {
Proof = 102,
}
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
pub enum BoostAccount {
Boost = 100,
Config = 101,
Stake = 102,
}
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
pub enum PoolAccount {
Member = 100,
Share = 102,
}
pub fn proof_pda(authority: Pubkey) -> (Pubkey, u8) {
Pubkey::find_program_address(&[PROOF, &authority.to_bytes()], &ORE_V2_PROGRAM_ID)
}
pub fn member_pda(authority: Pubkey, pool: Pubkey) -> (Pubkey, u8) {
Pubkey::find_program_address(
&[MEMBER, &authority.to_bytes(), &pool.to_bytes()],
&POOL_PROGRAM_ID,
)
}
pub fn share_pda(authority: Pubkey, pool: Pubkey, mint: Pubkey) -> (Pubkey, u8) {
Pubkey::find_program_address(
&[
SHARE,
&authority.to_bytes(),
&pool.to_bytes(),
&mint.to_bytes(),
],
&POOL_PROGRAM_ID,
)
}
pub fn boost_v2_pda(mint: Pubkey) -> (Pubkey, u8) {
Pubkey::find_program_address(&[BOOST, mint.as_ref()], &BOOST_V2_PROGRAM_ID)
}
pub fn boost_v2_config_pda() -> (Pubkey, u8) {
Pubkey::find_program_address(&[CONFIG], &BOOST_V2_PROGRAM_ID)
}
pub fn stake_v2_pda(authority: Pubkey, boost: Pubkey) -> (Pubkey, u8) {
Pubkey::find_program_address(
&[STAKE, authority.as_ref(), boost.as_ref()],
&BOOST_V2_PROGRAM_ID,
)
}
pub fn boost_v1_pda(mint: Pubkey) -> (Pubkey, u8) {
Pubkey::find_program_address(&[BOOST, mint.as_ref()], &BOOST_V1_PROGRAM_ID)
}
pub fn stake_v1_pda(authority: Pubkey, boost: Pubkey) -> (Pubkey, u8) {
Pubkey::find_program_address(
&[STAKE, authority.as_ref(), boost.as_ref()],
&BOOST_V1_PROGRAM_ID,
)
}