Skip to main content

carbon_meteora_dbc_decoder/accounts/
mod.rs

1//! This code was AUTOGENERATED using the Codama library.
2use crate::{MeteoraDbcDecoder, PROGRAM_ID};
3
4#[cfg(feature = "postgres")]
5pub mod postgres;
6
7#[cfg(feature = "graphql")]
8pub mod graphql;
9
10pub mod claim_fee_operator;
11pub mod config;
12pub mod lock_escrow;
13pub mod meteora_damm_migration_metadata;
14pub mod operator;
15pub mod partner_metadata;
16pub mod pool_config;
17pub mod virtual_pool;
18pub mod virtual_pool_metadata;
19
20#[derive(Debug, Clone, PartialEq)]
21#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
22#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
23pub enum MeteoraDbcAccount {
24    ClaimFeeOperator(Box<claim_fee_operator::ClaimFeeOperator>),
25    Config(Box<config::Config>),
26    LockEscrow(Box<lock_escrow::LockEscrow>),
27    MeteoraDammMigrationMetadata(
28        Box<meteora_damm_migration_metadata::MeteoraDammMigrationMetadata>,
29    ),
30    Operator(Box<operator::Operator>),
31    PartnerMetadata(Box<partner_metadata::PartnerMetadata>),
32    PoolConfig(Box<pool_config::PoolConfig>),
33    VirtualPool(Box<virtual_pool::VirtualPool>),
34    VirtualPoolMetadata(Box<virtual_pool_metadata::VirtualPoolMetadata>),
35}
36
37impl<'a> carbon_core::account::AccountDecoder<'a> for MeteoraDbcDecoder {
38    type AccountType = MeteoraDbcAccount;
39
40    fn decode_account(
41        &self,
42        account: &'a solana_account::Account,
43    ) -> Option<carbon_core::account::DecodedAccount<Self::AccountType>> {
44        if account.owner != PROGRAM_ID {
45            return None;
46        }
47
48        let data = account.data.as_slice();
49
50        {
51            if let Some(decoded) = claim_fee_operator::ClaimFeeOperator::decode(data) {
52                return Some(carbon_core::account::DecodedAccount {
53                    lamports: account.lamports,
54                    data: MeteoraDbcAccount::ClaimFeeOperator(Box::new(decoded)),
55                    owner: account.owner,
56                    executable: account.executable,
57                    rent_epoch: account.rent_epoch,
58                });
59            }
60        }
61        {
62            if let Some(decoded) = config::Config::decode(data) {
63                return Some(carbon_core::account::DecodedAccount {
64                    lamports: account.lamports,
65                    data: MeteoraDbcAccount::Config(Box::new(decoded)),
66                    owner: account.owner,
67                    executable: account.executable,
68                    rent_epoch: account.rent_epoch,
69                });
70            }
71        }
72        {
73            if let Some(decoded) = lock_escrow::LockEscrow::decode(data) {
74                return Some(carbon_core::account::DecodedAccount {
75                    lamports: account.lamports,
76                    data: MeteoraDbcAccount::LockEscrow(Box::new(decoded)),
77                    owner: account.owner,
78                    executable: account.executable,
79                    rent_epoch: account.rent_epoch,
80                });
81            }
82        }
83        {
84            if let Some(decoded) =
85                meteora_damm_migration_metadata::MeteoraDammMigrationMetadata::decode(data)
86            {
87                return Some(carbon_core::account::DecodedAccount {
88                    lamports: account.lamports,
89                    data: MeteoraDbcAccount::MeteoraDammMigrationMetadata(Box::new(decoded)),
90                    owner: account.owner,
91                    executable: account.executable,
92                    rent_epoch: account.rent_epoch,
93                });
94            }
95        }
96        {
97            if let Some(decoded) = operator::Operator::decode(data) {
98                return Some(carbon_core::account::DecodedAccount {
99                    lamports: account.lamports,
100                    data: MeteoraDbcAccount::Operator(Box::new(decoded)),
101                    owner: account.owner,
102                    executable: account.executable,
103                    rent_epoch: account.rent_epoch,
104                });
105            }
106        }
107        {
108            if let Some(decoded) = partner_metadata::PartnerMetadata::decode(data) {
109                return Some(carbon_core::account::DecodedAccount {
110                    lamports: account.lamports,
111                    data: MeteoraDbcAccount::PartnerMetadata(Box::new(decoded)),
112                    owner: account.owner,
113                    executable: account.executable,
114                    rent_epoch: account.rent_epoch,
115                });
116            }
117        }
118        {
119            if let Some(decoded) = pool_config::PoolConfig::decode(data) {
120                return Some(carbon_core::account::DecodedAccount {
121                    lamports: account.lamports,
122                    data: MeteoraDbcAccount::PoolConfig(Box::new(decoded)),
123                    owner: account.owner,
124                    executable: account.executable,
125                    rent_epoch: account.rent_epoch,
126                });
127            }
128        }
129        {
130            if let Some(decoded) = virtual_pool::VirtualPool::decode(data) {
131                return Some(carbon_core::account::DecodedAccount {
132                    lamports: account.lamports,
133                    data: MeteoraDbcAccount::VirtualPool(Box::new(decoded)),
134                    owner: account.owner,
135                    executable: account.executable,
136                    rent_epoch: account.rent_epoch,
137                });
138            }
139        }
140        {
141            if let Some(decoded) = virtual_pool_metadata::VirtualPoolMetadata::decode(data) {
142                return Some(carbon_core::account::DecodedAccount {
143                    lamports: account.lamports,
144                    data: MeteoraDbcAccount::VirtualPoolMetadata(Box::new(decoded)),
145                    owner: account.owner,
146                    executable: account.executable,
147                    rent_epoch: account.rent_epoch,
148                });
149            }
150        }
151
152        None
153    }
154}