feat: v0.4.5 - add immediate sell functionality and default implementations
- Bump version to 0.4.5 - Add Default traits for BondingCurveAccount and BonkParams - Add immediate_sell methods for PumpFun and Bonk params - Update README version references
This commit is contained in:
@@ -32,7 +32,7 @@ use crate::{constants::pumpfun::global_constants::{INITIAL_REAL_TOKEN_RESERVES,
|
||||
use crate::solana_streamer_sdk::streaming::event_parser::protocols::pumpfun::PumpFunTradeEvent;
|
||||
|
||||
/// Represents the global configuration account for token pricing and fees
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct BondingCurveAccount {
|
||||
/// Unique identifier for the bonding curve
|
||||
pub discriminator: u64,
|
||||
|
||||
@@ -104,6 +104,13 @@ pub struct PumpFunParams {
|
||||
}
|
||||
|
||||
impl PumpFunParams {
|
||||
pub fn immediate_sell(close_token_account_when_sell: bool) -> Self {
|
||||
Self {
|
||||
bonding_curve: Arc::new(BondingCurveAccount { ..Default::default() }),
|
||||
close_token_account_when_sell: Some(close_token_account_when_sell),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_dev_trade(
|
||||
mint: &Pubkey,
|
||||
dev_token_amount: u64,
|
||||
@@ -221,7 +228,7 @@ impl ProtocolParams for PumpSwapParams {
|
||||
|
||||
/// Bonk protocol specific parameters
|
||||
/// Configuration parameters specific to Bonk trading protocol
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Default)]
|
||||
pub struct BonkParams {
|
||||
pub virtual_base: u128,
|
||||
pub virtual_quote: u128,
|
||||
@@ -234,6 +241,9 @@ pub struct BonkParams {
|
||||
}
|
||||
|
||||
impl BonkParams {
|
||||
pub fn immediate_sell() -> Self {
|
||||
Self { auto_handle_wsol: true, ..Default::default() }
|
||||
}
|
||||
pub fn from_trade(trade_info: BonkTradeEvent) -> Self {
|
||||
Self {
|
||||
virtual_base: trade_info.virtual_base as u128,
|
||||
|
||||
Reference in New Issue
Block a user