carbon_points_decoder/instructions/
register_point_modifier.rs

1//! This code was AUTOGENERATED using the Codama library.
2use carbon_core::CarbonDeserialize;
3use carbon_core::account_utils::next_account;
4use carbon_core::borsh;
5use carbon_core::deserialize::ArrangeAccounts;
6use carbon_core::deserialize::CarbonDeserialize;
7
8#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9#[derive(Debug, Clone, borsh::BorshSerialize, CarbonDeserialize, PartialEq)]
10pub struct RegisterPointModifier {
11    pub can_increment: bool,
12    pub can_decrement: bool,
13    pub key_index: u16,
14}
15
16#[derive(Debug, Clone, PartialEq)]
17#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
18pub struct RegisterPointModifierInstructionAccounts {
19    pub key: solana_pubkey::Pubkey,
20    pub profile: solana_pubkey::Pubkey,
21    pub funder: solana_pubkey::Pubkey,
22    pub category: solana_pubkey::Pubkey,
23    pub points_modifier_account: solana_pubkey::Pubkey,
24    pub system_program: solana_pubkey::Pubkey,
25    pub remaining: Vec<solana_instruction::AccountMeta>,
26}
27
28impl RegisterPointModifier {
29    pub fn decode(data: &[u8]) -> Option<Self> {
30        if data.len() < 8 {
31            return None;
32        }
33        let discriminator = &data[0..8];
34        if discriminator != &[82, 163, 78, 237, 165, 59, 54, 178] {
35            return None;
36        }
37
38        let data_slice = data;
39
40        let data_slice = &data_slice[8..];
41
42        Self::deserialize(data_slice)
43    }
44}
45
46impl ArrangeAccounts for RegisterPointModifier {
47    type ArrangedAccounts = RegisterPointModifierInstructionAccounts;
48
49    fn arrange_accounts(
50        accounts: &[solana_instruction::AccountMeta],
51    ) -> Option<Self::ArrangedAccounts> {
52        let mut iter = accounts.iter();
53
54        let key = next_account(&mut iter)?;
55        let profile = next_account(&mut iter)?;
56        let funder = next_account(&mut iter)?;
57        let category = next_account(&mut iter)?;
58        let points_modifier_account = next_account(&mut iter)?;
59        let system_program = next_account(&mut iter)?;
60
61        let remaining = iter.as_slice();
62
63        Some(RegisterPointModifierInstructionAccounts {
64            key,
65            profile,
66            funder,
67            category,
68            points_modifier_account,
69            system_program,
70            remaining: remaining.to_vec(),
71        })
72    }
73}