feat: upgrade to v0.5.3
This commit is contained in:
@@ -32,6 +32,8 @@ pub mod seeds {
|
||||
|
||||
/// Seed for global volume accumulator PDAs
|
||||
pub const GLOBAL_VOLUME_ACCUMULATOR_SEED: &[u8] = b"global_volume_accumulator";
|
||||
|
||||
pub const FEE_CONFIG_SEED: &[u8] = b"fee_config";
|
||||
}
|
||||
|
||||
pub mod global_constants {
|
||||
@@ -108,6 +110,8 @@ pub mod accounts {
|
||||
pub const RENT: Pubkey = pubkey!("SysvarRent111111111111111111111111111111111");
|
||||
|
||||
pub const AMM_PROGRAM: Pubkey = pubkey!("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8");
|
||||
|
||||
pub const FEE_PROGRAM: Pubkey = pubkey!("pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ");
|
||||
}
|
||||
|
||||
pub struct Symbol;
|
||||
|
||||
@@ -8,7 +8,7 @@ use spl_token::instruction::close_account;
|
||||
use crate::{
|
||||
constants,
|
||||
trading::pumpfun::common::{
|
||||
get_bonding_curve_pda, get_global_volume_accumulator_pda, get_user_volume_accumulator_pda,
|
||||
get_bonding_curve_pda, get_fee_config_pda, get_global_volume_accumulator_pda, get_user_volume_accumulator_pda
|
||||
},
|
||||
utils::calc::{
|
||||
common::{calculate_with_slippage_buy, calculate_with_slippage_sell},
|
||||
@@ -209,6 +209,8 @@ pub fn buy(
|
||||
AccountMeta::new_readonly(constants::pumpfun::accounts::PUMPFUN, false),
|
||||
AccountMeta::new(get_global_volume_accumulator_pda().unwrap(), false),
|
||||
AccountMeta::new(get_user_volume_accumulator_pda(&payer.pubkey()).unwrap(), false),
|
||||
AccountMeta::new_readonly(get_fee_config_pda().unwrap(), false),
|
||||
AccountMeta::new_readonly(constants::pumpfun::accounts::FEE_PROGRAM, false),
|
||||
],
|
||||
)
|
||||
}
|
||||
@@ -237,8 +239,8 @@ pub fn sell(
|
||||
AccountMeta::new_readonly(constants::pumpfun::accounts::TOKEN_PROGRAM, false),
|
||||
AccountMeta::new_readonly(constants::pumpfun::accounts::EVENT_AUTHORITY, false),
|
||||
AccountMeta::new_readonly(constants::pumpfun::accounts::PUMPFUN, false),
|
||||
AccountMeta::new(get_global_volume_accumulator_pda().unwrap(), false),
|
||||
AccountMeta::new(get_user_volume_accumulator_pda(&payer.pubkey()).unwrap(), false),
|
||||
AccountMeta::new_readonly(get_fee_config_pda().unwrap(), false),
|
||||
AccountMeta::new_readonly(constants::pumpfun::accounts::FEE_PROGRAM, false),
|
||||
],
|
||||
)
|
||||
}
|
||||
|
||||
@@ -73,6 +73,17 @@ pub fn get_global_volume_accumulator_pda() -> Option<Pubkey> {
|
||||
pda.map(|pubkey| pubkey.0)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_fee_config_pda() -> Option<Pubkey> {
|
||||
let seeds: &[&[u8]; 2] = &[
|
||||
constants::pumpfun::seeds::FEE_CONFIG_SEED,
|
||||
constants::pumpfun::accounts::PUMPFUN.as_ref(),
|
||||
];
|
||||
let program_id: &Pubkey = &constants::pumpfun::accounts::FEE_PROGRAM;
|
||||
let pda: Option<(Pubkey, u8)> = Pubkey::try_find_program_address(seeds, program_id);
|
||||
pda.map(|pubkey| pubkey.0)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_metadata_pda(mint: &Pubkey) -> Pubkey {
|
||||
Pubkey::find_program_address(
|
||||
|
||||
Reference in New Issue
Block a user