This commit is contained in:
2026-08-06 04:14:07 +02:00
parent 13ab11c74d
commit b42c59e01b
2 changed files with 14 additions and 8 deletions
+2 -2
View File
@@ -4,6 +4,6 @@ use solana_sdk::pubkey::Pubkey;
#[allow(async_fn_in_trait)]
pub trait Executor {
async fn buy(&self, token: Pubkey, amount: f64) -> anyhow::Result<()>;
async fn sell(&self, token: Pubkey, amount: f64) -> anyhow::Result<()>;
async fn buy(&self, token: Pubkey, amount: u64) -> anyhow::Result<()>;
async fn sell(&self, token: Pubkey, amount: u64) -> anyhow::Result<()>;
}
+12 -6
View File
@@ -1,4 +1,6 @@
use pump_rust_client::PumpSdk;
use pump_rust_client::{
AccountWrapper, PumpSdk, pump::pump::accounts::BondingCurve, state::Global,
};
use crate::executor::Executor;
@@ -7,16 +9,20 @@ pub const PROGRAM_ID: &str = "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";
pub struct PumpFun {
pub private_key: String,
pub sdk: PumpSdk,
pub global: Global,
}
impl Executor for PumpFun {
async fn buy(&self, token: solana_sdk::pubkey::Pubkey, amount: f64) -> anyhow::Result<()> {
async fn buy(&self, token: solana_sdk::pubkey::Pubkey, amount: u64) -> anyhow::Result<()> {
log::info!("Buying {token}");
// let bonding_curve: AccountWrapper<BondingCurve> = _;
// self.sdk.buy_v2_instructions(
// global,
// bonding_curve,
// base_mint,
// &self.global,
// &bonding_curve,
// token,
// quote_token_program,
// user,
// amount,
@@ -26,7 +32,7 @@ impl Executor for PumpFun {
Ok(())
}
async fn sell(&self, token: solana_sdk::pubkey::Pubkey, amount: f64) -> anyhow::Result<()> {
async fn sell(&self, token: solana_sdk::pubkey::Pubkey, amount: u64) -> anyhow::Result<()> {
log::info!("Selling {token}");
Ok(())