diff --git a/src/executor/mod.rs b/src/executor/mod.rs index ca02d19..87416a8 100644 --- a/src/executor/mod.rs +++ b/src/executor/mod.rs @@ -26,6 +26,16 @@ pub trait Executor { ) -> anyhow::Result<()> { Ok(()) } + + async fn sell_percent( + &self, + mint: String, + amount: u8, + priority: Decimal, + slippage: u16, + ) -> anyhow::Result<()> { + Ok(()) + } } impl Account { diff --git a/src/executor/pump_fun.rs b/src/executor/pump_fun.rs index a67106c..9ca1070 100644 --- a/src/executor/pump_fun.rs +++ b/src/executor/pump_fun.rs @@ -40,7 +40,7 @@ impl PumpDev { &self, action: &str, mint: String, - amount: Decimal, + amount: String, priority: Decimal, slippage: u16, denominated_in_sol: bool, @@ -92,8 +92,15 @@ impl Executor for PumpDev { priority: Decimal, slippage: u16, ) -> anyhow::Result<()> { - self.trade("buy", mint, amount, priority, slippage, true) - .await + self.trade( + "buy", + mint, + amount.round_dp(3).to_string(), + priority, + slippage, + true, + ) + .await } async fn sell( @@ -103,7 +110,32 @@ impl Executor for PumpDev { priority: Decimal, slippage: u16, ) -> anyhow::Result<()> { - self.trade("sell", mint, amount, priority, slippage, false) - .await + self.trade( + "sell", + mint, + amount.round_dp(3).to_string(), + priority, + slippage, + false, + ) + .await + } + + async fn sell_percent( + &self, + mint: String, + amount: u8, + priority: Decimal, + slippage: u16, + ) -> anyhow::Result<()> { + self.trade( + "sell", + mint, + format!("{amount}%"), + priority, + slippage, + false, + ) + .await } }