1mod position;
2mod protocol;
3mod stable;
4mod vault;
5
6pub use position::*;
7pub use protocol::*;
8pub use stable::*;
9pub use vault::*;
10
11use crate::consts::*;
12
13use steel::*;
14
15#[repr(u8)]
16#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
17pub enum BucksAccount {
18 Stable = 100,
19 Vault = 101,
20 ProtocolRegistry = 102,
21 StableProtocolPosition = 103,
22}
23
24pub fn stable_pda(mint: Pubkey) -> (Pubkey, u8) {
26 Pubkey::find_program_address(&[STABLE, mint.as_ref()], &crate::ID)
27}
28
29pub fn vault_pda() -> (Pubkey, u8) {
31 Pubkey::find_program_address(&[VAULT], &crate::ID)
32}
33
34pub fn protocol_pda(protocol_id: u8) -> (Pubkey, u8) {
36 Pubkey::find_program_address(&[PROTOCOL, &[protocol_id]], &crate::ID)
37}
38
39pub fn position_pda(stable: Pubkey, protocol_id: u8) -> (Pubkey, u8) {
41 Pubkey::find_program_address(&[POSITION, stable.as_ref(), &[protocol_id]], &crate::ID)
42}