1
0
mirror of https://github.com/payden/libwsclient synced 2025-06-13 12:53:52 +00:00
payden_libwsclient/bot/optimizer.rs

23 lines
627 B
Rust
Raw Normal View History

2025-05-16 06:09:24 +00:00
use crate::models::mev_opportunity::MevOpportunity;
use solana_client::rpc_client::RpcClient;
use solana_sdk::transaction::Transaction;
pub struct Optimizer {
rpc_client: RpcClient,
}
impl Optimizer {
pub fn new(rpc_client: RpcClient) -> Self {
Self { rpc_client }
}
pub async fn optimize(&self, opportunity: &MevOpportunity) -> Vec<Transaction> {
let mut optimized_txs = Vec::new();
for (tx, profit) in &opportunity.transactions {
if *profit >= opportunity.min_profit {
optimized_txs.push(tx.clone());
}
}
optimized_txs
}
}