Skip to main content

carbon_pump_fees_decoder/accounts/
mod.rs

1//! This code was AUTOGENERATED using the Codama library.
2use crate::{PumpFeesDecoder, PROGRAM_ID};
3
4#[cfg(feature = "postgres")]
5pub mod postgres;
6
7#[cfg(feature = "graphql")]
8pub mod graphql;
9
10pub mod bonding_curve;
11pub mod fee_config;
12pub mod fee_program_global;
13pub mod global;
14pub mod pool;
15pub mod sharing_config;
16pub mod social_fee_pda;
17
18#[derive(Debug, Clone, PartialEq)]
19#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
20#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
21pub enum PumpFeesAccount {
22    BondingCurve(Box<bonding_curve::BondingCurve>),
23    FeeConfig(Box<fee_config::FeeConfig>),
24    FeeProgramGlobal(Box<fee_program_global::FeeProgramGlobal>),
25    Global(Box<global::Global>),
26    Pool(Box<pool::Pool>),
27    SharingConfig(Box<sharing_config::SharingConfig>),
28    SocialFeePda(Box<social_fee_pda::SocialFeePda>),
29}
30
31impl<'a> carbon_core::account::AccountDecoder<'a> for PumpFeesDecoder {
32    type AccountType = PumpFeesAccount;
33
34    fn decode_account(
35        &self,
36        account: &'a solana_account::Account,
37    ) -> Option<carbon_core::account::DecodedAccount<Self::AccountType>> {
38        if account.owner != PROGRAM_ID {
39            return None;
40        }
41
42        let data = account.data.as_slice();
43
44        {
45            if let Some(decoded) = bonding_curve::BondingCurve::decode(data) {
46                return Some(carbon_core::account::DecodedAccount {
47                    lamports: account.lamports,
48                    data: PumpFeesAccount::BondingCurve(Box::new(decoded)),
49                    owner: account.owner,
50                    executable: account.executable,
51                    rent_epoch: account.rent_epoch,
52                });
53            }
54        }
55        {
56            if let Some(decoded) = fee_config::FeeConfig::decode(data) {
57                return Some(carbon_core::account::DecodedAccount {
58                    lamports: account.lamports,
59                    data: PumpFeesAccount::FeeConfig(Box::new(decoded)),
60                    owner: account.owner,
61                    executable: account.executable,
62                    rent_epoch: account.rent_epoch,
63                });
64            }
65        }
66        {
67            if let Some(decoded) = fee_program_global::FeeProgramGlobal::decode(data) {
68                return Some(carbon_core::account::DecodedAccount {
69                    lamports: account.lamports,
70                    data: PumpFeesAccount::FeeProgramGlobal(Box::new(decoded)),
71                    owner: account.owner,
72                    executable: account.executable,
73                    rent_epoch: account.rent_epoch,
74                });
75            }
76        }
77        {
78            if let Some(decoded) = global::Global::decode(data) {
79                return Some(carbon_core::account::DecodedAccount {
80                    lamports: account.lamports,
81                    data: PumpFeesAccount::Global(Box::new(decoded)),
82                    owner: account.owner,
83                    executable: account.executable,
84                    rent_epoch: account.rent_epoch,
85                });
86            }
87        }
88        {
89            if let Some(decoded) = pool::Pool::decode(data) {
90                return Some(carbon_core::account::DecodedAccount {
91                    lamports: account.lamports,
92                    data: PumpFeesAccount::Pool(Box::new(decoded)),
93                    owner: account.owner,
94                    executable: account.executable,
95                    rent_epoch: account.rent_epoch,
96                });
97            }
98        }
99        {
100            if let Some(decoded) = sharing_config::SharingConfig::decode(data) {
101                return Some(carbon_core::account::DecodedAccount {
102                    lamports: account.lamports,
103                    data: PumpFeesAccount::SharingConfig(Box::new(decoded)),
104                    owner: account.owner,
105                    executable: account.executable,
106                    rent_epoch: account.rent_epoch,
107                });
108            }
109        }
110        {
111            if let Some(decoded) = social_fee_pda::SocialFeePda::decode(data) {
112                return Some(carbon_core::account::DecodedAccount {
113                    lamports: account.lamports,
114                    data: PumpFeesAccount::SocialFeePda(Box::new(decoded)),
115                    owner: account.owner,
116                    executable: account.executable,
117                    rent_epoch: account.rent_epoch,
118                });
119            }
120        }
121
122        None
123    }
124}