ore_legacy_api/state/
mod.rs1mod boost;
2mod member;
3mod proof;
4mod share;
5mod stake;
6
7pub use boost::*;
8pub use member::*;
9pub use proof::*;
10pub use share::*;
11pub use stake::*;
12
13use crate::consts::*;
14
15use steel::*;
16
17#[repr(u8)]
18#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
19pub enum LegacyAccount {
20 Proof = 102,
21}
22
23#[repr(u8)]
24#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
25pub enum BoostAccount {
26 Boost = 100,
27 Config = 101,
28 Stake = 102,
29}
30
31#[repr(u8)]
32#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
33pub enum PoolAccount {
34 Member = 100,
35 Share = 102,
36}
37
38pub fn proof_pda(authority: Pubkey) -> (Pubkey, u8) {
39 Pubkey::find_program_address(&[PROOF, &authority.to_bytes()], &ORE_V2_PROGRAM_ID)
40}
41
42pub fn member_pda(authority: Pubkey, pool: Pubkey) -> (Pubkey, u8) {
43 Pubkey::find_program_address(
44 &[MEMBER, &authority.to_bytes(), &pool.to_bytes()],
45 &POOL_PROGRAM_ID,
46 )
47}
48
49pub fn share_pda(authority: Pubkey, pool: Pubkey, mint: Pubkey) -> (Pubkey, u8) {
50 Pubkey::find_program_address(
51 &[
52 SHARE,
53 &authority.to_bytes(),
54 &pool.to_bytes(),
55 &mint.to_bytes(),
56 ],
57 &POOL_PROGRAM_ID,
58 )
59}
60
61pub fn boost_v2_pda(mint: Pubkey) -> (Pubkey, u8) {
63 Pubkey::find_program_address(&[BOOST, mint.as_ref()], &BOOST_V2_PROGRAM_ID)
64}
65
66pub fn boost_v2_config_pda() -> (Pubkey, u8) {
67 Pubkey::find_program_address(&[CONFIG], &BOOST_V2_PROGRAM_ID)
68}
69
70pub fn stake_v2_pda(authority: Pubkey, boost: Pubkey) -> (Pubkey, u8) {
71 Pubkey::find_program_address(
72 &[STAKE, authority.as_ref(), boost.as_ref()],
73 &BOOST_V2_PROGRAM_ID,
74 )
75}
76
77pub fn boost_v1_pda(mint: Pubkey) -> (Pubkey, u8) {
79 Pubkey::find_program_address(&[BOOST, mint.as_ref()], &BOOST_V1_PROGRAM_ID)
80}
81
82pub fn stake_v1_pda(authority: Pubkey, boost: Pubkey) -> (Pubkey, u8) {
83 Pubkey::find_program_address(
84 &[STAKE, authority.as_ref(), boost.as_ref()],
85 &BOOST_V1_PROGRAM_ID,
86 )
87}