carbon_points_store_decoder/instructions/
mod.rs

1//! This code was AUTOGENERATED using the Codama library.
2use crate::PROGRAM_ID;
3use crate::PointsStoreDecoder;
4
5pub mod add_redemption_epoch;
6pub mod buy;
7pub mod change_store_price;
8pub mod claim_tokens;
9pub mod close_redemption_config;
10pub mod close_store;
11pub mod contribute_to_redemption;
12pub mod create_points_store;
13pub mod create_redemption_config;
14pub mod remove_redemption_epoch;
15pub mod remove_store_items;
16pub mod start_redemption;
17pub mod update_redemption_epoch;
18
19pub use self::add_redemption_epoch::*;
20pub use self::buy::*;
21pub use self::change_store_price::*;
22pub use self::claim_tokens::*;
23pub use self::close_redemption_config::*;
24pub use self::close_store::*;
25pub use self::contribute_to_redemption::*;
26pub use self::create_points_store::*;
27pub use self::create_redemption_config::*;
28pub use self::remove_redemption_epoch::*;
29pub use self::remove_store_items::*;
30pub use self::start_redemption::*;
31pub use self::update_redemption_epoch::*;
32
33#[derive(Debug, Clone, PartialEq, Eq, Hash)]
34#[cfg_attr(
35    feature = "serde",
36    derive(carbon_core::InstructionType, serde::Serialize, serde::Deserialize)
37)]
38#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
39pub enum PointsStoreInstruction {
40    AddRedemptionEpoch(AddRedemptionEpoch),
41    Buy(Buy),
42    ChangeStorePrice(ChangeStorePrice),
43    ClaimTokens(ClaimTokens),
44    CloseRedemptionConfig(CloseRedemptionConfig),
45    CloseStore(CloseStore),
46    ContributeToRedemption(ContributeToRedemption),
47    CreatePointsStore(CreatePointsStore),
48    CreateRedemptionConfig(CreateRedemptionConfig),
49    RemoveRedemptionEpoch(RemoveRedemptionEpoch),
50    RemoveStoreItems(RemoveStoreItems),
51    StartRedemption(StartRedemption),
52    UpdateRedemptionEpoch(UpdateRedemptionEpoch),
53}
54
55impl carbon_core::instruction::InstructionDecoder<'_> for PointsStoreDecoder {
56    type InstructionType = PointsStoreInstruction;
57
58    fn decode_instruction(
59        &self,
60        instruction: &solana_instruction::Instruction,
61    ) -> Option<carbon_core::instruction::DecodedInstruction<Self::InstructionType>> {
62        if !instruction.program_id.eq(&PROGRAM_ID) {
63            return None;
64        }
65
66        let data = instruction.data.as_slice();
67
68        {
69            if let Some(decoded) = add_redemption_epoch::AddRedemptionEpoch::decode(data) {
70                return Some(carbon_core::instruction::DecodedInstruction {
71                    program_id: instruction.program_id,
72                    data: PointsStoreInstruction::AddRedemptionEpoch(decoded),
73                    accounts: instruction.accounts.clone(),
74                });
75            }
76        }
77        {
78            if let Some(decoded) = buy::Buy::decode(data) {
79                return Some(carbon_core::instruction::DecodedInstruction {
80                    program_id: instruction.program_id,
81                    data: PointsStoreInstruction::Buy(decoded),
82                    accounts: instruction.accounts.clone(),
83                });
84            }
85        }
86        {
87            if let Some(decoded) = change_store_price::ChangeStorePrice::decode(data) {
88                return Some(carbon_core::instruction::DecodedInstruction {
89                    program_id: instruction.program_id,
90                    data: PointsStoreInstruction::ChangeStorePrice(decoded),
91                    accounts: instruction.accounts.clone(),
92                });
93            }
94        }
95        {
96            if let Some(decoded) = claim_tokens::ClaimTokens::decode(data) {
97                return Some(carbon_core::instruction::DecodedInstruction {
98                    program_id: instruction.program_id,
99                    data: PointsStoreInstruction::ClaimTokens(decoded),
100                    accounts: instruction.accounts.clone(),
101                });
102            }
103        }
104        {
105            if let Some(decoded) = close_redemption_config::CloseRedemptionConfig::decode(data) {
106                return Some(carbon_core::instruction::DecodedInstruction {
107                    program_id: instruction.program_id,
108                    data: PointsStoreInstruction::CloseRedemptionConfig(decoded),
109                    accounts: instruction.accounts.clone(),
110                });
111            }
112        }
113        {
114            if let Some(decoded) = close_store::CloseStore::decode(data) {
115                return Some(carbon_core::instruction::DecodedInstruction {
116                    program_id: instruction.program_id,
117                    data: PointsStoreInstruction::CloseStore(decoded),
118                    accounts: instruction.accounts.clone(),
119                });
120            }
121        }
122        {
123            if let Some(decoded) = contribute_to_redemption::ContributeToRedemption::decode(data) {
124                return Some(carbon_core::instruction::DecodedInstruction {
125                    program_id: instruction.program_id,
126                    data: PointsStoreInstruction::ContributeToRedemption(decoded),
127                    accounts: instruction.accounts.clone(),
128                });
129            }
130        }
131        {
132            if let Some(decoded) = create_points_store::CreatePointsStore::decode(data) {
133                return Some(carbon_core::instruction::DecodedInstruction {
134                    program_id: instruction.program_id,
135                    data: PointsStoreInstruction::CreatePointsStore(decoded),
136                    accounts: instruction.accounts.clone(),
137                });
138            }
139        }
140        {
141            if let Some(decoded) = create_redemption_config::CreateRedemptionConfig::decode(data) {
142                return Some(carbon_core::instruction::DecodedInstruction {
143                    program_id: instruction.program_id,
144                    data: PointsStoreInstruction::CreateRedemptionConfig(decoded),
145                    accounts: instruction.accounts.clone(),
146                });
147            }
148        }
149        {
150            if let Some(decoded) = remove_redemption_epoch::RemoveRedemptionEpoch::decode(data) {
151                return Some(carbon_core::instruction::DecodedInstruction {
152                    program_id: instruction.program_id,
153                    data: PointsStoreInstruction::RemoveRedemptionEpoch(decoded),
154                    accounts: instruction.accounts.clone(),
155                });
156            }
157        }
158        {
159            if let Some(decoded) = remove_store_items::RemoveStoreItems::decode(data) {
160                return Some(carbon_core::instruction::DecodedInstruction {
161                    program_id: instruction.program_id,
162                    data: PointsStoreInstruction::RemoveStoreItems(decoded),
163                    accounts: instruction.accounts.clone(),
164                });
165            }
166        }
167        {
168            if let Some(decoded) = start_redemption::StartRedemption::decode(data) {
169                return Some(carbon_core::instruction::DecodedInstruction {
170                    program_id: instruction.program_id,
171                    data: PointsStoreInstruction::StartRedemption(decoded),
172                    accounts: instruction.accounts.clone(),
173                });
174            }
175        }
176        {
177            if let Some(decoded) = update_redemption_epoch::UpdateRedemptionEpoch::decode(data) {
178                return Some(carbon_core::instruction::DecodedInstruction {
179                    program_id: instruction.program_id,
180                    data: PointsStoreInstruction::UpdateRedemptionEpoch(decoded),
181                    accounts: instruction.accounts.clone(),
182                });
183            }
184        }
185
186        None
187    }
188}