Skip to main content

carbon_pumpfun_decoder/instructions/
get_minimum_distributable_fee.rs

1//! This code was AUTOGENERATED using the Codama library.
2use carbon_core::{account_utils::next_account, deserialize::ArrangeAccounts};
3/// Permissionless instruction to check the minimum required fees for
4/// distribution Returns the minimum required balance from the creator_vault and
5/// whether distribution can proceed
6#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
7#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
8pub struct GetMinimumDistributableFee {}
9
10#[derive(Debug, Clone, PartialEq)]
11#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
12pub struct GetMinimumDistributableFeeInstructionAccounts {
13    pub mint: solana_pubkey::Pubkey,
14    pub bonding_curve: solana_pubkey::Pubkey,
15    pub sharing_config: solana_pubkey::Pubkey,
16    pub creator_vault: solana_pubkey::Pubkey,
17    pub remaining: Vec<solana_instruction::AccountMeta>,
18}
19
20impl GetMinimumDistributableFee {
21    pub fn decode(data: &[u8]) -> Option<Self> {
22        if data.len() < 8 {
23            return None;
24        }
25        let discriminator = &data[0..8];
26        if discriminator != [117, 225, 127, 202, 134, 95, 68, 35] {
27            return None;
28        }
29
30        let mut data_slice = data;
31
32        data_slice = &data_slice[8..];
33
34        borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
35    }
36}
37
38impl ArrangeAccounts for GetMinimumDistributableFee {
39    type ArrangedAccounts = GetMinimumDistributableFeeInstructionAccounts;
40
41    fn arrange_accounts(
42        accounts: &[solana_instruction::AccountMeta],
43    ) -> Option<Self::ArrangedAccounts> {
44        let mut iter = accounts.iter();
45
46        let mint = next_account(&mut iter)?;
47        let bonding_curve = next_account(&mut iter)?;
48        let sharing_config = next_account(&mut iter)?;
49        let creator_vault = next_account(&mut iter)?;
50
51        let remaining = iter.as_slice();
52
53        Some(GetMinimumDistributableFeeInstructionAccounts {
54            mint,
55            bonding_curve,
56            sharing_config,
57            creator_vault,
58            remaining: remaining.to_vec(),
59        })
60    }
61}