carbon_points_decoder/instructions/
increment_level_beyond_threshold.rs1use 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 IncrementLevelBeyondThreshold {}
11
12#[derive(Debug, Clone, PartialEq)]
13#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
14pub struct IncrementLevelBeyondThresholdInstructionAccounts {
15 pub category: solana_pubkey::Pubkey,
16 pub user_points_account: solana_pubkey::Pubkey,
17 pub points_modifier_account: solana_pubkey::Pubkey,
18 pub remaining: Vec<solana_instruction::AccountMeta>,
19}
20
21impl IncrementLevelBeyondThreshold {
22 pub fn decode(data: &[u8]) -> Option<Self> {
23 if data.len() < 8 {
24 return None;
25 }
26 let discriminator = &data[0..8];
27 if discriminator != &[213, 240, 7, 50, 59, 157, 155, 197] {
28 return None;
29 }
30
31 let data_slice = data;
32
33 let data_slice = &data_slice[8..];
34
35 Self::deserialize(data_slice)
36 }
37}
38
39impl ArrangeAccounts for IncrementLevelBeyondThreshold {
40 type ArrangedAccounts = IncrementLevelBeyondThresholdInstructionAccounts;
41
42 fn arrange_accounts(
43 accounts: &[solana_instruction::AccountMeta],
44 ) -> Option<Self::ArrangedAccounts> {
45 let mut iter = accounts.iter();
46
47 let category = next_account(&mut iter)?;
48 let user_points_account = next_account(&mut iter)?;
49 let points_modifier_account = next_account(&mut iter)?;
50
51 let remaining = iter.as_slice();
52
53 Some(IncrementLevelBeyondThresholdInstructionAccounts {
54 category,
55 user_points_account,
56 points_modifier_account,
57 remaining: remaining.to_vec(),
58 })
59 }
60}