carbon_vertigo_decoder/accounts/
mod.rs

1use carbon_core::account::AccountDecoder;
2use carbon_core::deserialize::CarbonDeserialize;
3
4use super::VertigoDecoder;
5pub mod pool;
6
7pub enum AmmAccount {
8    Pool(pool::Pool),
9}
10
11impl AccountDecoder<'_> for VertigoDecoder {
12    type AccountType = AmmAccount;
13    fn decode_account(
14        &self,
15        account: &solana_account::Account,
16    ) -> Option<carbon_core::account::DecodedAccount<Self::AccountType>> {
17        if let Some(decoded_account) = pool::Pool::deserialize(account.data.as_slice()) {
18            return Some(carbon_core::account::DecodedAccount {
19                lamports: account.lamports,
20                data: AmmAccount::Pool(decoded_account),
21                owner: account.owner,
22                executable: account.executable,
23                rent_epoch: account.rent_epoch,
24            });
25        }
26
27        None
28    }
29}