firelaunch_io_firelaunch_client/generated/accounts/
curve.rs1use crate::generated::types::FirelaunchCurveType;
9use borsh::BorshDeserialize;
10use borsh::BorshSerialize;
11use solana_program::pubkey::Pubkey;
12
13#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
14#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
15pub struct Curve {
16 pub discriminator: [u8; 8],
17 pub bump: u8,
19 #[cfg_attr(
21 feature = "serde",
22 serde(with = "serde_with::As::<serde_with::DisplayFromStr>")
23 )]
24 pub mint: Pubkey,
25 #[cfg_attr(
27 feature = "serde",
28 serde(with = "serde_with::As::<serde_with::DisplayFromStr>")
29 )]
30 pub curve_pool: Pubkey,
31 #[cfg_attr(
33 feature = "serde",
34 serde(with = "serde_with::As::<serde_with::DisplayFromStr>")
35 )]
36 pub curve_native_pool: Pubkey,
37 pub curve_type: FirelaunchCurveType,
39}
40
41impl Curve {
42 #[inline(always)]
43 pub fn from_bytes(data: &[u8]) -> Result<Self, std::io::Error> {
44 let mut data = data;
45 Self::deserialize(&mut data)
46 }
47}
48
49impl<'a> TryFrom<&solana_program::account_info::AccountInfo<'a>> for Curve {
50 type Error = std::io::Error;
51
52 fn try_from(
53 account_info: &solana_program::account_info::AccountInfo<'a>,
54 ) -> Result<Self, Self::Error> {
55 let mut data: &[u8] = &(*account_info.data).borrow();
56 Self::deserialize(&mut data)
57 }
58}
59
60#[cfg(feature = "anchor")]
61impl anchor_lang::AccountDeserialize for Curve {
62 fn try_deserialize_unchecked(buf: &mut &[u8]) -> anchor_lang::Result<Self> {
63 Ok(Self::deserialize(buf)?)
64 }
65}
66
67#[cfg(feature = "anchor")]
68impl anchor_lang::AccountSerialize for Curve {}
69
70#[cfg(feature = "anchor")]
71impl anchor_lang::Owner for Curve {
72 fn owner() -> Pubkey {
73 crate::FIRELAUNCH_ID
74 }
75}
76
77#[cfg(feature = "anchor-idl-build")]
78impl anchor_lang::IdlBuild for Curve {}
79
80#[cfg(feature = "anchor-idl-build")]
81impl anchor_lang::Discriminator for Curve {
82 const DISCRIMINATOR: [u8; 8] = [0; 8];
83}