Skip to content

Commit 6825d01

Browse files
authored
Merge pull request #430 from kalloc/feat/pump-swap-update
feat: update pumpswap to 09.2025 update
2 parents 41b37af + 424d7cc commit 6825d01

23 files changed

+255
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use super::super::types::*;
2+
3+
use carbon_core::{
4+
borsh::{self, maybestd::vec::Vec},
5+
CarbonDeserialize,
6+
};
7+
8+
#[derive(
9+
CarbonDeserialize, Debug, serde::Deserialize, serde::Serialize, PartialEq, Eq, Clone, Hash,
10+
)]
11+
#[carbon(discriminator = "0x8f3492bbdb7b4c9b")]
12+
pub struct FeeConfig {
13+
pub bump: u8,
14+
pub admin: solana_pubkey::Pubkey,
15+
pub flat_fees: Fees,
16+
pub fee_tiers: Vec<FeeTier>,
17+
}

decoders/pump-swap-decoder/src/accounts/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ use crate::PROGRAM_ID;
55

66
use super::PumpSwapDecoder;
77
pub mod bonding_curve;
8+
pub mod fee_config;
89
pub mod global_config;
910
pub mod global_volume_accumulator;
1011
pub mod pool;
1112
pub mod user_volume_accumulator;
1213

1314
pub enum PumpSwapAccount {
1415
BondingCurve(bonding_curve::BondingCurve),
16+
FeeConfig(fee_config::FeeConfig),
1517
GlobalConfig(global_config::GlobalConfig),
1618
GlobalVolumeAccumulator(global_volume_accumulator::GlobalVolumeAccumulator),
1719
Pool(pool::Pool),
@@ -40,6 +42,16 @@ impl AccountDecoder<'_> for PumpSwapDecoder {
4042
});
4143
}
4244

45+
if let Some(decoded_account) = fee_config::FeeConfig::deserialize(account.data.as_slice()) {
46+
return Some(carbon_core::account::DecodedAccount {
47+
lamports: account.lamports,
48+
data: PumpSwapAccount::FeeConfig(decoded_account),
49+
owner: account.owner,
50+
executable: account.executable,
51+
rent_epoch: account.rent_epoch,
52+
});
53+
}
54+
4355
if let Some(decoded_account) =
4456
global_config::GlobalConfig::deserialize(account.data.as_slice())
4557
{

decoders/pump-swap-decoder/src/instructions/admin_update_token_incentives_event.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ pub struct AdminUpdateTokenIncentivesEvent {
99
pub end_time: i64,
1010
pub day_number: u64,
1111
pub token_supply_per_day: u64,
12+
pub mint: solana_pubkey::Pubkey,
13+
pub seconds_in_a_day: i64,
14+
pub timestamp: i64,
1215
}

decoders/pump-swap-decoder/src/instructions/buy.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use carbon_core::{account_utils::next_account, borsh, CarbonDeserialize};
77
pub struct Buy {
88
pub base_amount_out: u64,
99
pub max_quote_amount_in: u64,
10+
pub track_volume: Option<bool>,
1011
}
1112

1213
#[derive(Debug, PartialEq, Eq, Clone, Hash, serde::Serialize, serde::Deserialize)]
@@ -32,6 +33,8 @@ pub struct BuyInstructionAccounts {
3233
pub coin_creator_vault_authority: solana_pubkey::Pubkey,
3334
pub global_volume_accumulator: solana_pubkey::Pubkey,
3435
pub user_volume_accumulator: solana_pubkey::Pubkey,
36+
pub fee_config: solana_pubkey::Pubkey,
37+
pub fee_program: solana_pubkey::Pubkey,
3538
}
3639

3740
impl carbon_core::deserialize::ArrangeAccounts for Buy {
@@ -62,6 +65,8 @@ impl carbon_core::deserialize::ArrangeAccounts for Buy {
6265
let coin_creator_vault_authority = next_account(&mut iter)?;
6366
let global_volume_accumulator = next_account(&mut iter)?;
6467
let user_volume_accumulator = next_account(&mut iter)?;
68+
let fee_config = next_account(&mut iter)?;
69+
let fee_program = next_account(&mut iter)?;
6570

6671
Some(BuyInstructionAccounts {
6772
pool,
@@ -85,6 +90,8 @@ impl carbon_core::deserialize::ArrangeAccounts for Buy {
8590
coin_creator_vault_authority,
8691
global_volume_accumulator,
8792
user_volume_accumulator,
93+
fee_config,
94+
fee_program,
8895
})
8996
}
9097
}

decoders/pump-swap-decoder/src/instructions/buy_event.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,9 @@ pub struct BuyEvent {
2828
pub coin_creator: solana_pubkey::Pubkey,
2929
pub coin_creator_fee_basis_points: u64,
3030
pub coin_creator_fee: u64,
31+
pub track_volume: bool,
32+
pub total_unclaimed_tokens: u64,
33+
pub total_claimed_tokens: u64,
34+
pub current_sol_volume: u64,
35+
pub last_update_timestamp: i64,
3136
}

decoders/pump-swap-decoder/src/instructions/claim_token_incentives_event.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ pub struct ClaimTokenIncentivesEvent {
88
pub user: solana_pubkey::Pubkey,
99
pub mint: solana_pubkey::Pubkey,
1010
pub amount: u64,
11+
pub timestamp: i64,
12+
pub total_claimed_tokens: u64,
13+
pub current_sol_volume: u64,
1114
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
use carbon_core::{account_utils::next_account, borsh, CarbonDeserialize};
2+
3+
#[derive(
4+
CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone, Hash,
5+
)]
6+
#[carbon(discriminator = "0xf945a4da9667548a")]
7+
pub struct CloseUserVolumeAccumulator {}
8+
9+
#[derive(Debug, PartialEq, Eq, Clone, Hash, serde::Serialize, serde::Deserialize)]
10+
pub struct CloseUserVolumeAccumulatorInstructionAccounts {
11+
pub user: solana_pubkey::Pubkey,
12+
pub user_volume_accumulator: solana_pubkey::Pubkey,
13+
pub event_authority: solana_pubkey::Pubkey,
14+
pub program: solana_pubkey::Pubkey,
15+
}
16+
17+
impl carbon_core::deserialize::ArrangeAccounts for CloseUserVolumeAccumulator {
18+
type ArrangedAccounts = CloseUserVolumeAccumulatorInstructionAccounts;
19+
20+
fn arrange_accounts(
21+
accounts: &[solana_instruction::AccountMeta],
22+
) -> Option<Self::ArrangedAccounts> {
23+
let mut iter = accounts.iter();
24+
let user = next_account(&mut iter)?;
25+
let user_volume_accumulator = next_account(&mut iter)?;
26+
let event_authority = next_account(&mut iter)?;
27+
let program = next_account(&mut iter)?;
28+
29+
Some(CloseUserVolumeAccumulatorInstructionAccounts {
30+
user,
31+
user_volume_accumulator,
32+
event_authority,
33+
program,
34+
})
35+
}
36+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use carbon_core::{borsh, CarbonDeserialize};
2+
3+
#[derive(
4+
CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone, Hash,
5+
)]
6+
#[carbon(discriminator = "0xe445a52e51cb9a1d929fbdac925838f4")]
7+
pub struct CloseUserVolumeAccumulatorEvent {
8+
pub user: solana_pubkey::Pubkey,
9+
pub timestamp: i64,
10+
pub total_unclaimed_tokens: u64,
11+
pub total_claimed_tokens: u64,
12+
pub current_sol_volume: u64,
13+
pub last_update_timestamp: i64,
14+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
use carbon_core::{account_utils::next_account, borsh, CarbonDeserialize};
2+
3+
#[derive(
4+
CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone, Hash,
5+
)]
6+
#[carbon(discriminator = "0x5e06ca73ff60e8b7")]
7+
pub struct InitUserVolumeAccumulator {}
8+
9+
#[derive(Debug, PartialEq, Eq, Clone, Hash, serde::Serialize, serde::Deserialize)]
10+
pub struct InitUserVolumeAccumulatorInstructionAccounts {
11+
pub payer: solana_pubkey::Pubkey,
12+
pub user: solana_pubkey::Pubkey,
13+
pub user_volume_accumulator: solana_pubkey::Pubkey,
14+
pub system_program: solana_pubkey::Pubkey,
15+
pub event_authority: solana_pubkey::Pubkey,
16+
pub program: solana_pubkey::Pubkey,
17+
}
18+
19+
impl carbon_core::deserialize::ArrangeAccounts for InitUserVolumeAccumulator {
20+
type ArrangedAccounts = InitUserVolumeAccumulatorInstructionAccounts;
21+
22+
fn arrange_accounts(
23+
accounts: &[solana_instruction::AccountMeta],
24+
) -> Option<Self::ArrangedAccounts> {
25+
let mut iter = accounts.iter();
26+
let payer = next_account(&mut iter)?;
27+
let user = next_account(&mut iter)?;
28+
let user_volume_accumulator = next_account(&mut iter)?;
29+
let system_program = next_account(&mut iter)?;
30+
let event_authority = next_account(&mut iter)?;
31+
let program = next_account(&mut iter)?;
32+
33+
Some(InitUserVolumeAccumulatorInstructionAccounts {
34+
payer,
35+
user,
36+
user_volume_accumulator,
37+
system_program,
38+
event_authority,
39+
program,
40+
})
41+
}
42+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use carbon_core::{borsh, CarbonDeserialize};
2+
3+
#[derive(
4+
CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone, Hash,
5+
)]
6+
#[carbon(discriminator = "0xe445a52e51cb9a1d86240d48e86582d8")]
7+
pub struct InitUserVolumeAccumulatorEvent {
8+
pub payer: solana_pubkey::Pubkey,
9+
pub user: solana_pubkey::Pubkey,
10+
pub timestamp: i64,
11+
}

0 commit comments

Comments
 (0)