ore_stake_api/state/
mod.rs1mod stake;
2mod treasury;
3
4pub use stake::*;
5pub use treasury::*;
6
7use crate::consts::*;
8
9use steel::*;
10
11#[repr(u8)]
12#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
13pub enum OreAccount {
14 Treasury = 104,
15 Stake = 108,
16}
17
18pub fn stake_pda(authority: Pubkey) -> (Pubkey, u8) {
19 Pubkey::find_program_address(&[STAKE, &authority.to_bytes()], &crate::ID)
20}
21
22pub fn treasury_pda() -> (Pubkey, u8) {
23 Pubkey::find_program_address(&[TREASURY], &crate::ID)
24}
25
26pub fn treasury_tokens_address() -> Pubkey {
27 let treasury_address = treasury_pda().0;
28 spl_associated_token_account::get_associated_token_address(&treasury_address, &MINT_ADDRESS)
29}