carbon_points_decoder/instructions/
mod.rs

1use super::PointsDecoder;
2pub mod add_point_category_level;
3pub mod create_point_category;
4pub mod create_user_point_account;
5pub mod create_user_point_account_with_license;
6pub mod decrement_level;
7pub mod decrement_points;
8pub mod deregister_point_modifier;
9pub mod increment_level;
10pub mod increment_level_beyond_threshold;
11pub mod increment_points;
12pub mod register_point_modifier;
13pub mod remove_point_category_level;
14pub mod spend_points;
15pub mod update_point_category;
16
17#[derive(
18    carbon_core::InstructionType,
19    serde::Serialize,
20    serde::Deserialize,
21    PartialEq,
22    Eq,
23    Debug,
24    Clone,
25    Hash,
26)]
27pub enum PointsInstruction {
28    AddPointCategoryLevel(add_point_category_level::AddPointCategoryLevel),
29    CreatePointCategory(create_point_category::CreatePointCategory),
30    CreateUserPointAccount(create_user_point_account::CreateUserPointAccount),
31    CreateUserPointAccountWithLicense(
32        create_user_point_account_with_license::CreateUserPointAccountWithLicense,
33    ),
34    DecrementLevel(decrement_level::DecrementLevel),
35    DecrementPoints(decrement_points::DecrementPoints),
36    DeregisterPointModifier(deregister_point_modifier::DeregisterPointModifier),
37    IncrementLevel(increment_level::IncrementLevel),
38    IncrementLevelBeyondThreshold(increment_level_beyond_threshold::IncrementLevelBeyondThreshold),
39    IncrementPoints(increment_points::IncrementPoints),
40    RegisterPointModifier(register_point_modifier::RegisterPointModifier),
41    RemovePointCategoryLevel(remove_point_category_level::RemovePointCategoryLevel),
42    SpendPoints(spend_points::SpendPoints),
43    UpdatePointCategory(update_point_category::UpdatePointCategory),
44}
45
46impl<'a> carbon_core::instruction::InstructionDecoder<'a> for PointsDecoder {
47    type InstructionType = PointsInstruction;
48
49    fn decode_instruction(
50        &self,
51        instruction: &solana_instruction::Instruction,
52    ) -> Option<carbon_core::instruction::DecodedInstruction<Self::InstructionType>> {
53        carbon_core::try_decode_instructions!(instruction,
54            PointsInstruction::AddPointCategoryLevel => add_point_category_level::AddPointCategoryLevel,
55            PointsInstruction::CreatePointCategory => create_point_category::CreatePointCategory,
56            PointsInstruction::CreateUserPointAccount => create_user_point_account::CreateUserPointAccount,
57            PointsInstruction::CreateUserPointAccountWithLicense => create_user_point_account_with_license::CreateUserPointAccountWithLicense,
58            PointsInstruction::DecrementLevel => decrement_level::DecrementLevel,
59            PointsInstruction::DecrementPoints => decrement_points::DecrementPoints,
60            PointsInstruction::DeregisterPointModifier => deregister_point_modifier::DeregisterPointModifier,
61            PointsInstruction::IncrementLevel => increment_level::IncrementLevel,
62            PointsInstruction::IncrementLevelBeyondThreshold => increment_level_beyond_threshold::IncrementLevelBeyondThreshold,
63            PointsInstruction::IncrementPoints => increment_points::IncrementPoints,
64            PointsInstruction::RegisterPointModifier => register_point_modifier::RegisterPointModifier,
65            PointsInstruction::RemovePointCategoryLevel => remove_point_category_level::RemovePointCategoryLevel,
66            PointsInstruction::SpendPoints => spend_points::SpendPoints,
67            PointsInstruction::UpdatePointCategory => update_point_category::UpdatePointCategory,
68        )
69    }
70}