🪐Interaction with Exchanges

Solana MVP integrates seamlessly with Solana’s leading decentralized exchanges (DEXs) and automated market makers (AMMs) to execute trades, provide liquidity, and capture MEV opportunities. The bot interacts with exchanges via on-chain programs and off-chain APIs, ensuring low-latency execution and robust market coverage. Below are the key exchanges and interaction methods.

Supported Exchanges

  1. Raydium:

    • Interaction: Executes swaps, snipes new pools, and provides liquidity via Raydium’s AMM program (675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8).

    • Features: Token sniping, arbitrage, liquidity provision.

    • Jito Integration: Uses bundles for sniping and MEV protection.

  2. Orca:

    • Interaction: Swaps and liquidity provision through Orca’s program (9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP).

    • Features: Pool sniping, yield farming, low-slippage swaps.

    • Jito Integration: Optimizes swap execution with atomic bundles.

  3. Jupiter Aggregator:

    • Interaction: Queries optimal swap routes via Jupiter’s API (https://quote-api.jup.ag) and executes via on-chain instructions.

    • Features: Cross-DEX arbitrage, best-price swaps.

    • Jito Integration: Ensures low-latency execution for arbitrage.

  4. Serum DEX:

    • Interaction: Places limit orders via Serum’s orderbook program (9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin).

    • Features: Advanced order types (limit, stop-loss).

    • Jito Integration: Guarantees order placement with bundles.

  5. Saber:

    • Interaction: Stakes and provides liquidity via Saber’s program (SabER1gLji4A5KXgQVoCZMhD5NULjKDsy3PBER1V3t4).

    • Features: Yield farming, stablecoin swaps.

  6. Solend:

    • Interaction: Deposits and borrows via Solend’s lending program (So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo).

    • Features: Lending optimization, collateral management.

  7. Mango Markets:

    • Interaction: Trades and monitors governance via Mango’s program (MangoDAoqz2gAc86yL8NsoEXnA3r7i7NqM6m97pV8AMU).

    • Features: Governance-aware trading, leveraged trading.

  8. Marinade:

    • Interaction: Stakes SOL via Marinade’s program (MarBmsSgKXdrN1egZf5sqe1TMThrzekxdqA1jFzSy).

    • Features: Staking optimization, governance participation.

And other DEX's

Interaction Mechanisms

  • On-Chain: Uses solana-sdk and anchor-client to construct and submit transactions directly to exchange programs. Transactions are signed with the user’s wallet (wallet_manager.rs) and optimized via Jito bundles (jito_client.rs).

  • Off-Chain: Queries APIs (e.g., Jupiter’s quote API, Pyth’s price feed) for real-time data, processed by reqwest and serde.

  • Jito Optimization: Submits atomic bundles to Jito’s Block Engine for MEV protection and guaranteed execution order, critical for sniping and frontrunning.

  • Real-Time Monitoring: Tracks exchange events (e.g., pool creation, large trades) via Solana’s WebSocket API and mev_opportunity_monitor.rs.

  • Error Handling: Robust retry logic and fallback RPC nodes ensure reliability (async_utils.rs).

Example: Raydium Token Sniping

use crate::core::{jito_client::JitoClient, transaction_optimizer};
use solana_sdk::{pubkey::Pubkey, transaction::Transaction};
use anyhow::Result;

pub async fn snipe_raydium_pool(pool_id: &str, amount: f64, jito_client: &JitoClient) -> Result<String> {
    let program_id = Pubkey::from_str("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8")?;
    let tx = Transaction::new_with_payer(&[/* swap instruction */], None);
    let bundle = transaction_optimizer::optimize_transaction(tx, jito_client, 5000).await?;
    let bundle_id = jito_client.submit_bundle(&bundle, 5000).await?;
    Ok(bundle_id)
}

Last updated