use crate::{MeteoraDbcDecoder, PROGRAM_ID};
#[cfg(feature = "postgres")]
pub mod postgres;
#[cfg(feature = "graphql")]
pub mod graphql;
pub mod claim_fee_operator;
pub mod config;
pub mod lock_escrow;
pub mod meteora_damm_migration_metadata;
pub mod operator;
pub mod partner_metadata;
pub mod pool_config;
pub mod virtual_pool;
pub mod virtual_pool_metadata;
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
pub enum MeteoraDbcAccount {
ClaimFeeOperator(Box<claim_fee_operator::ClaimFeeOperator>),
Config(Box<config::Config>),
LockEscrow(Box<lock_escrow::LockEscrow>),
MeteoraDammMigrationMetadata(
Box<meteora_damm_migration_metadata::MeteoraDammMigrationMetadata>,
),
Operator(Box<operator::Operator>),
PartnerMetadata(Box<partner_metadata::PartnerMetadata>),
PoolConfig(Box<pool_config::PoolConfig>),
VirtualPool(Box<virtual_pool::VirtualPool>),
VirtualPoolMetadata(Box<virtual_pool_metadata::VirtualPoolMetadata>),
}
impl<'a> carbon_core::account::AccountDecoder<'a> for MeteoraDbcDecoder {
type AccountType = MeteoraDbcAccount;
fn decode_account(
&self,
account: &'a solana_account::Account,
) -> Option<carbon_core::account::DecodedAccount<Self::AccountType>> {
if account.owner != PROGRAM_ID {
return None;
}
let data = account.data.as_slice();
{
if let Some(decoded) = claim_fee_operator::ClaimFeeOperator::decode(data) {
return Some(carbon_core::account::DecodedAccount {
lamports: account.lamports,
data: MeteoraDbcAccount::ClaimFeeOperator(Box::new(decoded)),
owner: account.owner,
executable: account.executable,
rent_epoch: account.rent_epoch,
});
}
}
{
if let Some(decoded) = config::Config::decode(data) {
return Some(carbon_core::account::DecodedAccount {
lamports: account.lamports,
data: MeteoraDbcAccount::Config(Box::new(decoded)),
owner: account.owner,
executable: account.executable,
rent_epoch: account.rent_epoch,
});
}
}
{
if let Some(decoded) = lock_escrow::LockEscrow::decode(data) {
return Some(carbon_core::account::DecodedAccount {
lamports: account.lamports,
data: MeteoraDbcAccount::LockEscrow(Box::new(decoded)),
owner: account.owner,
executable: account.executable,
rent_epoch: account.rent_epoch,
});
}
}
{
if let Some(decoded) =
meteora_damm_migration_metadata::MeteoraDammMigrationMetadata::decode(data)
{
return Some(carbon_core::account::DecodedAccount {
lamports: account.lamports,
data: MeteoraDbcAccount::MeteoraDammMigrationMetadata(Box::new(decoded)),
owner: account.owner,
executable: account.executable,
rent_epoch: account.rent_epoch,
});
}
}
{
if let Some(decoded) = operator::Operator::decode(data) {
return Some(carbon_core::account::DecodedAccount {
lamports: account.lamports,
data: MeteoraDbcAccount::Operator(Box::new(decoded)),
owner: account.owner,
executable: account.executable,
rent_epoch: account.rent_epoch,
});
}
}
{
if let Some(decoded) = partner_metadata::PartnerMetadata::decode(data) {
return Some(carbon_core::account::DecodedAccount {
lamports: account.lamports,
data: MeteoraDbcAccount::PartnerMetadata(Box::new(decoded)),
owner: account.owner,
executable: account.executable,
rent_epoch: account.rent_epoch,
});
}
}
{
if let Some(decoded) = pool_config::PoolConfig::decode(data) {
return Some(carbon_core::account::DecodedAccount {
lamports: account.lamports,
data: MeteoraDbcAccount::PoolConfig(Box::new(decoded)),
owner: account.owner,
executable: account.executable,
rent_epoch: account.rent_epoch,
});
}
}
{
if let Some(decoded) = virtual_pool::VirtualPool::decode(data) {
return Some(carbon_core::account::DecodedAccount {
lamports: account.lamports,
data: MeteoraDbcAccount::VirtualPool(Box::new(decoded)),
owner: account.owner,
executable: account.executable,
rent_epoch: account.rent_epoch,
});
}
}
{
if let Some(decoded) = virtual_pool_metadata::VirtualPoolMetadata::decode(data) {
return Some(carbon_core::account::DecodedAccount {
lamports: account.lamports,
data: MeteoraDbcAccount::VirtualPoolMetadata(Box::new(decoded)),
owner: account.owner,
executable: account.executable,
rent_epoch: account.rent_epoch,
});
}
}
None
}
}