solana_central/protocol_idls/
pumpswap.rs

1use borsh::BorshDeserialize;
2use solana_sdk::pubkey::Pubkey;
3
4/*
5Anchor IDL extracted representation of the PumpSwap pool account. Only the subset of fields that we
6actually need to reconstruct our high-level `PumpswapPool` type are included here. The layout order
7MUST match the on-chain structure so that `BorshDeserialize` can succeed.
8*/
9#[derive(BorshDeserialize)]
10pub struct PumpAmmPoolAccount {
11  pub padding1: u64,
12  pub pool_bump: u8,
13  pub index: u16,
14  pub creator: Pubkey,
15  pub base_mint: Pubkey,
16  pub quote_mint: Pubkey,
17  pub lp_mint: Pubkey,
18  pub pool_base_token_account: Pubkey,
19  pub pool_quote_token_account: Pubkey,
20  pub lp_supply: u64,
21  pub coin_creator: Pubkey,
22  pub padding: [u8; 57],
23}
24
25#[derive(BorshDeserialize)]
26pub struct PumpAmmCreatePoolInstructionDataIdl {
27  pub discriminator: [u8; 8],
28  pub index: u16,
29  pub base_amount_in: u64,
30  pub quote_amount_in: u64,
31  pub coin_creator: Pubkey,
32}
33
34/**
35 * OLD Pumpswap BUY Event (401 bytes)
36 * Used before min_base_amount_out and ix_name were added
37 */
38#[derive(BorshDeserialize)]
39pub struct PumpswapBuyEventIdl {
40  pub discriminator: [u8; 16],
41  pub timestamp: i64,
42  pub base_amount_out: u64,
43  pub max_quote_amount_in: u64,
44  pub user_base_token_reserves: u64,
45  pub user_quote_token_reserves: u64,
46  pub pool_base_token_reserves: u64,
47  pub pool_quote_token_reserves: u64,
48  pub quote_amount_in: u64,
49  pub lp_fee_basis_points: u64,
50  pub lp_fee: u64,
51  pub protocol_fee_basis_points: u64,
52  pub protocol_fee: u64,
53  pub quote_amount_in_with_lp_fee: u64,
54  pub user_quote_amount_in: u64,
55  pub pool: Pubkey,
56  pub user: Pubkey,
57  pub user_base_token_account: Pubkey,
58  pub user_quote_token_account: Pubkey,
59  pub protocol_fee_recipient: Pubkey,
60  pub protocol_fee_recipient_token_account: Pubkey,
61  pub coin_creator: Pubkey,
62  pub coin_creator_fee_basis_points: u64,
63  pub coin_creator_fee: u64,
64  pub track_volume: bool,
65  pub total_unclaimed_tokens: u64,
66  pub total_claimed_tokens: u64,
67  pub current_sol_volume: u64,
68  pub last_update_timestamp: u64,
69}
70
71/**
72 * Pumpswap SELL Event (360 bytes)
73 * This event structure has NOT changed - no old/new versions
74 */
75#[derive(BorshDeserialize)]
76pub struct PumpswapSellEventIdl {
77  pub discriminator: [u8; 16],
78  pub timestamp: i64,
79  pub base_amount_in: u64,
80  pub min_quote_amount_out: u64,
81  pub user_base_token_reserves: u64,
82  pub user_quote_token_reserves: u64,
83  pub pool_base_token_reserves: u64,
84  pub pool_quote_token_reserves: u64,
85  pub quote_amount_out: u64,
86  pub lp_fee_basis_points: u64,
87  pub lp_fee: u64,
88  pub protocol_fee_basis_points: u64,
89  pub protocol_fee: u64,
90  pub quote_amount_out_without_lp_fee: u64,
91  pub user_quote_amount_out: u64,
92  pub pool: Pubkey,
93  pub user: Pubkey,
94  pub user_base_token_account: Pubkey,
95  pub user_quote_token_account: Pubkey,
96  pub protocol_fee_recipient: Pubkey,
97  pub protocol_fee_recipient_token_account: Pubkey,
98  pub coin_creator: Pubkey,
99  pub coin_creator_fee_basis_points: u64,
100  pub coin_creator_fee: u64,
101}