raydium_launchlab/generated/
types.rs

1//! Type definitions for Raydium LaunchLab
2
3// =============================================================================
4// Enums (Simple types - manual implementation)
5// =============================================================================
6
7/// Pool status enum
8#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
9#[repr(u8)]
10pub enum PoolStatus {
11    /// Pool is funding
12    #[default]
13    Fund = 0,
14    /// Pool funding is end, waiting for migration
15    Migrate = 1,
16    /// Pool migration is done
17    Trade = 2,
18}
19
20impl PoolStatus {
21    pub fn from_u8(value: u8) -> Self {
22        match value {
23            0 => PoolStatus::Fund,
24            1 => PoolStatus::Migrate,
25            2 => PoolStatus::Trade,
26            _ => PoolStatus::Fund,
27        }
28    }
29}
30
31/// Trade direction enum
32#[derive(Clone, Copy, Debug, PartialEq, Eq)]
33#[repr(u8)]
34pub enum TradeDirection {
35    Buy = 0,
36    Sell = 1,
37}
38
39impl TradeDirection {
40    pub fn from_u8(value: u8) -> Self {
41        match value {
42            0 => TradeDirection::Buy,
43            _ => TradeDirection::Sell,
44        }
45    }
46}
47
48/// AMM creator fee on enum
49#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
50#[repr(u8)]
51pub enum AmmCreatorFeeOn {
52    /// No creator fee
53    #[default]
54    Off = 0,
55    /// Creator fee on quote token only
56    Quote = 1,
57    /// Creator fee on both tokens
58    Both = 2,
59}
60
61impl AmmCreatorFeeOn {
62    pub fn from_u8(value: u8) -> Self {
63        match value {
64            0 => AmmCreatorFeeOn::Off,
65            1 => AmmCreatorFeeOn::Quote,
66            2 => AmmCreatorFeeOn::Both,
67            _ => AmmCreatorFeeOn::Off,
68        }
69    }
70}
71
72/// Curve type enum
73#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
74#[repr(u8)]
75pub enum CurveType {
76    #[default]
77    ConstantProduct = 0,
78    FixedPrice = 1,
79    LinearPrice = 2,
80}
81
82/// Migrate type enum
83#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
84#[repr(u8)]
85pub enum MigrateType {
86    #[default]
87    Amm = 0,
88    CpSwap = 1,
89}
90
91// =============================================================================
92// Structs - Using Default implementations
93// =============================================================================
94
95/// Vesting schedule stored in pool state
96#[derive(Clone, Debug, Default)]
97pub struct VestingSchedule {
98    pub total_locked_amount: u64,
99    pub cliff_period: u64,
100    pub unlock_period: u64,
101    pub start_time: u64,
102    pub allocated_share_amount: u64,
103}
104
105// =============================================================================
106// Discriminators (8-byte instruction prefixes)
107// =============================================================================
108
109pub mod discriminators {
110    pub const BUY_EXACT_IN: [u8; 8] = [250, 234, 13, 123, 213, 156, 19, 236];
111    pub const BUY_EXACT_OUT: [u8; 8] = [24, 211, 116, 40, 105, 3, 153, 56];
112    pub const SELL_EXACT_IN: [u8; 8] = [149, 39, 222, 155, 211, 124, 152, 26];
113    pub const SELL_EXACT_OUT: [u8; 8] = [95, 200, 71, 34, 8, 9, 11, 166];
114    pub const INITIALIZE: [u8; 8] = [175, 175, 109, 31, 13, 152, 155, 237];
115}
116
117pub mod account_discriminators {
118    pub const GLOBAL_CONFIG: [u8; 8] = [149, 8, 156, 202, 160, 252, 176, 217];
119    pub const PLATFORM_CONFIG: [u8; 8] = [160, 78, 128, 0, 248, 83, 230, 160];
120    pub const POOL_STATE: [u8; 8] = [247, 237, 227, 245, 215, 195, 222, 70];
121    pub const VESTING_RECORD: [u8; 8] = [106, 243, 221, 205, 230, 126, 85, 83];
122}