carbon_points_store_decoder/instructions/
mod.rs

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