carbon_solayer_restaking_program_decoder/accounts/
mod.rs1use {
2 super::SolayerRestakingProgramDecoder,
3 crate::PROGRAM_ID,
4 carbon_core::{account::AccountDecoder, deserialize::CarbonDeserialize},
5};
6pub mod restaking_pool;
7
8pub enum SolayerRestakingProgramAccount {
9 RestakingPool(restaking_pool::RestakingPool),
10}
11
12impl AccountDecoder<'_> for SolayerRestakingProgramDecoder {
13 type AccountType = SolayerRestakingProgramAccount;
14 fn decode_account(
15 &self,
16 account: &solana_account::Account,
17 ) -> Option<carbon_core::account::DecodedAccount<Self::AccountType>> {
18 if !account.owner.eq(&PROGRAM_ID) {
19 return None;
20 }
21 if let Some(decoded_account) =
22 restaking_pool::RestakingPool::deserialize(account.data.as_slice())
23 {
24 return Some(carbon_core::account::DecodedAccount {
25 lamports: account.lamports,
26 data: SolayerRestakingProgramAccount::RestakingPool(decoded_account),
27 owner: account.owner,
28 executable: account.executable,
29 rent_epoch: account.rent_epoch,
30 });
31 }
32
33 None
34 }
35}