carbon_score_decoder/instructions/
mod.rs

1//! This code was AUTOGENERATED using the Codama library.
2use crate::PROGRAM_ID;
3use crate::ScoreDecoder;
4
5pub mod process_close_accounts;
6pub mod process_deregister_ship;
7pub mod process_harvest;
8pub mod process_initial_deposit;
9pub mod process_initialize;
10pub mod process_partial_deposit;
11pub mod process_rearm;
12pub mod process_refeed;
13pub mod process_refuel;
14pub mod process_register_ship;
15pub mod process_repair;
16pub mod process_settle;
17pub mod process_update_reward_rate;
18pub mod process_withdraw_arms;
19pub mod process_withdraw_food;
20pub mod process_withdraw_fuel;
21pub mod process_withdraw_ships;
22
23pub use self::process_close_accounts::*;
24pub use self::process_deregister_ship::*;
25pub use self::process_harvest::*;
26pub use self::process_initial_deposit::*;
27pub use self::process_initialize::*;
28pub use self::process_partial_deposit::*;
29pub use self::process_rearm::*;
30pub use self::process_refeed::*;
31pub use self::process_refuel::*;
32pub use self::process_register_ship::*;
33pub use self::process_repair::*;
34pub use self::process_settle::*;
35pub use self::process_update_reward_rate::*;
36pub use self::process_withdraw_arms::*;
37pub use self::process_withdraw_food::*;
38pub use self::process_withdraw_fuel::*;
39pub use self::process_withdraw_ships::*;
40
41#[derive(Debug, Clone, PartialEq, Eq, Hash)]
42#[cfg_attr(
43    feature = "serde",
44    derive(carbon_core::InstructionType, serde::Serialize, serde::Deserialize)
45)]
46#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
47pub enum ScoreInstruction {
48    ProcessCloseAccounts(ProcessCloseAccounts),
49    ProcessDeregisterShip(ProcessDeregisterShip),
50    ProcessHarvest(ProcessHarvest),
51    ProcessInitialDeposit(ProcessInitialDeposit),
52    ProcessInitialize(ProcessInitialize),
53    ProcessPartialDeposit(ProcessPartialDeposit),
54    ProcessRearm(ProcessRearm),
55    ProcessRefeed(ProcessRefeed),
56    ProcessRefuel(ProcessRefuel),
57    ProcessRegisterShip(ProcessRegisterShip),
58    ProcessRepair(ProcessRepair),
59    ProcessSettle(ProcessSettle),
60    ProcessUpdateRewardRate(ProcessUpdateRewardRate),
61    ProcessWithdrawArms(ProcessWithdrawArms),
62    ProcessWithdrawFood(ProcessWithdrawFood),
63    ProcessWithdrawFuel(ProcessWithdrawFuel),
64    ProcessWithdrawShips(ProcessWithdrawShips),
65}
66
67impl carbon_core::instruction::InstructionDecoder<'_> for ScoreDecoder {
68    type InstructionType = ScoreInstruction;
69
70    fn decode_instruction(
71        &self,
72        instruction: &solana_instruction::Instruction,
73    ) -> Option<carbon_core::instruction::DecodedInstruction<Self::InstructionType>> {
74        if !instruction.program_id.eq(&PROGRAM_ID) {
75            return None;
76        }
77
78        let data = instruction.data.as_slice();
79
80        {
81            if let Some(decoded) = process_close_accounts::ProcessCloseAccounts::decode(data) {
82                return Some(carbon_core::instruction::DecodedInstruction {
83                    program_id: instruction.program_id,
84                    data: ScoreInstruction::ProcessCloseAccounts(decoded),
85                    accounts: instruction.accounts.clone(),
86                });
87            }
88        }
89        {
90            if let Some(decoded) = process_deregister_ship::ProcessDeregisterShip::decode(data) {
91                return Some(carbon_core::instruction::DecodedInstruction {
92                    program_id: instruction.program_id,
93                    data: ScoreInstruction::ProcessDeregisterShip(decoded),
94                    accounts: instruction.accounts.clone(),
95                });
96            }
97        }
98        {
99            if let Some(decoded) = process_harvest::ProcessHarvest::decode(data) {
100                return Some(carbon_core::instruction::DecodedInstruction {
101                    program_id: instruction.program_id,
102                    data: ScoreInstruction::ProcessHarvest(decoded),
103                    accounts: instruction.accounts.clone(),
104                });
105            }
106        }
107        {
108            if let Some(decoded) = process_initial_deposit::ProcessInitialDeposit::decode(data) {
109                return Some(carbon_core::instruction::DecodedInstruction {
110                    program_id: instruction.program_id,
111                    data: ScoreInstruction::ProcessInitialDeposit(decoded),
112                    accounts: instruction.accounts.clone(),
113                });
114            }
115        }
116        {
117            if let Some(decoded) = process_initialize::ProcessInitialize::decode(data) {
118                return Some(carbon_core::instruction::DecodedInstruction {
119                    program_id: instruction.program_id,
120                    data: ScoreInstruction::ProcessInitialize(decoded),
121                    accounts: instruction.accounts.clone(),
122                });
123            }
124        }
125        {
126            if let Some(decoded) = process_partial_deposit::ProcessPartialDeposit::decode(data) {
127                return Some(carbon_core::instruction::DecodedInstruction {
128                    program_id: instruction.program_id,
129                    data: ScoreInstruction::ProcessPartialDeposit(decoded),
130                    accounts: instruction.accounts.clone(),
131                });
132            }
133        }
134        {
135            if let Some(decoded) = process_rearm::ProcessRearm::decode(data) {
136                return Some(carbon_core::instruction::DecodedInstruction {
137                    program_id: instruction.program_id,
138                    data: ScoreInstruction::ProcessRearm(decoded),
139                    accounts: instruction.accounts.clone(),
140                });
141            }
142        }
143        {
144            if let Some(decoded) = process_refeed::ProcessRefeed::decode(data) {
145                return Some(carbon_core::instruction::DecodedInstruction {
146                    program_id: instruction.program_id,
147                    data: ScoreInstruction::ProcessRefeed(decoded),
148                    accounts: instruction.accounts.clone(),
149                });
150            }
151        }
152        {
153            if let Some(decoded) = process_refuel::ProcessRefuel::decode(data) {
154                return Some(carbon_core::instruction::DecodedInstruction {
155                    program_id: instruction.program_id,
156                    data: ScoreInstruction::ProcessRefuel(decoded),
157                    accounts: instruction.accounts.clone(),
158                });
159            }
160        }
161        {
162            if let Some(decoded) = process_register_ship::ProcessRegisterShip::decode(data) {
163                return Some(carbon_core::instruction::DecodedInstruction {
164                    program_id: instruction.program_id,
165                    data: ScoreInstruction::ProcessRegisterShip(decoded),
166                    accounts: instruction.accounts.clone(),
167                });
168            }
169        }
170        {
171            if let Some(decoded) = process_repair::ProcessRepair::decode(data) {
172                return Some(carbon_core::instruction::DecodedInstruction {
173                    program_id: instruction.program_id,
174                    data: ScoreInstruction::ProcessRepair(decoded),
175                    accounts: instruction.accounts.clone(),
176                });
177            }
178        }
179        {
180            if let Some(decoded) = process_settle::ProcessSettle::decode(data) {
181                return Some(carbon_core::instruction::DecodedInstruction {
182                    program_id: instruction.program_id,
183                    data: ScoreInstruction::ProcessSettle(decoded),
184                    accounts: instruction.accounts.clone(),
185                });
186            }
187        }
188        {
189            if let Some(decoded) = process_update_reward_rate::ProcessUpdateRewardRate::decode(data)
190            {
191                return Some(carbon_core::instruction::DecodedInstruction {
192                    program_id: instruction.program_id,
193                    data: ScoreInstruction::ProcessUpdateRewardRate(decoded),
194                    accounts: instruction.accounts.clone(),
195                });
196            }
197        }
198        {
199            if let Some(decoded) = process_withdraw_arms::ProcessWithdrawArms::decode(data) {
200                return Some(carbon_core::instruction::DecodedInstruction {
201                    program_id: instruction.program_id,
202                    data: ScoreInstruction::ProcessWithdrawArms(decoded),
203                    accounts: instruction.accounts.clone(),
204                });
205            }
206        }
207        {
208            if let Some(decoded) = process_withdraw_food::ProcessWithdrawFood::decode(data) {
209                return Some(carbon_core::instruction::DecodedInstruction {
210                    program_id: instruction.program_id,
211                    data: ScoreInstruction::ProcessWithdrawFood(decoded),
212                    accounts: instruction.accounts.clone(),
213                });
214            }
215        }
216        {
217            if let Some(decoded) = process_withdraw_fuel::ProcessWithdrawFuel::decode(data) {
218                return Some(carbon_core::instruction::DecodedInstruction {
219                    program_id: instruction.program_id,
220                    data: ScoreInstruction::ProcessWithdrawFuel(decoded),
221                    accounts: instruction.accounts.clone(),
222                });
223            }
224        }
225        {
226            if let Some(decoded) = process_withdraw_ships::ProcessWithdrawShips::decode(data) {
227                return Some(carbon_core::instruction::DecodedInstruction {
228                    program_id: instruction.program_id,
229                    data: ScoreInstruction::ProcessWithdrawShips(decoded),
230                    accounts: instruction.accounts.clone(),
231                });
232            }
233        }
234
235        None
236    }
237}