carbon_points_decoder/accounts/
points_modifier.rs

1//! This code was AUTOGENERATED using the Codama library.
2use carbon_core::CarbonDeserialize;
3use carbon_core::borsh;
4use carbon_core::deserialize::CarbonDeserialize;
5use solana_pubkey::Pubkey;
6
7/// PDA containing one account that can modify an Points type
8
9#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
10#[derive(Debug, Clone, borsh::BorshSerialize, CarbonDeserialize, PartialEq)]
11pub struct PointsModifier {
12    /// The data version of this account.
13    pub version: u8,
14    /// point_category
15    pub point_category: Pubkey,
16    /// can_increment
17    pub can_increment: u8,
18    /// can_decrement
19    pub can_decrement: u8,
20}
21
22impl PointsModifier {
23    pub fn decode(data: &[u8]) -> Option<Self> {
24        if data.len() < 8 {
25            return None;
26        }
27        let discriminator = &data[0..8];
28        if discriminator != &[191, 227, 217, 178, 58, 205, 44, 39] {
29            return None;
30        }
31
32        let data_slice = data;
33
34        let data_slice = &data_slice[8..];
35
36        Self::deserialize(data_slice)
37    }
38}