LogoLogo
back to urani.trade
  • Welcome
  • URANI App
    • The Urani App
    • MEV Projects
  • URANI SWAP
    • Swap tl; dr
    • Technicals
      • MEV tl; dr
      • Urani's Intents
      • Intent Transaction Flow
      • Batch Auctions
      • Urani's Intent Specs
      • Order Types
  • URANI PROTOCOL
    • Protocol tl; dr
    • Technicals
      • Optimization Problems
      • Raking the Agents' Solution
      • Batch Auction Specs
      • Ring (DAG) Trades
      • Order Execution
      • Multidimensional Price Free Market
        • On Solana
          • Solana Fees Overview
          • Solana Transactions Overview
          • Understanding Slippage
        • Urani's Dynamic Fees
      • Oracle Market Data Proxy
      • Security Considerations
      • Intent Gossip Layer Specs
      • Settlement Specs
  • URANI ARENA
    • Arena tl; dr
    • Technicals
      • The PvP Competition
      • Incentives for Operators
      • Reputation Dashboard
      • The Competition Seasons
  • MEV AGENTS
    • Agents tl; dr
    • Technicals
      • Urani's In-house Agents
        • MEV Agent Aleph
        • MEV Agent Bet
      • The Onboarding Process
      • Economic Incentives
      • MEV Agent Specs
      • Setting up an Agent's Graph
      • Building an initial AMM Strategy
      • Liquidity Strategies
        • On Solana
          • Raydium
          • Phoenix
          • Orca
          • Meteora
          • Jupiter
      • Performance and Reputation
      • Solving Cryptomarkets
        • Quantitative Theories and AI-Centric Agents
        • DeFi Glossary
        • In Honor of Jim Simons (1938-2024)
Powered by GitBook
  1. URANI PROTOCOL
  2. Technicals
  3. Multidimensional Price Free Market
  4. On Solana

Understanding Slippage

PreviousSolana Transactions OverviewNextUrani's Dynamic Fees

Last updated 8 months ago

Slippage and MEV

Setting a low slippage tolerance is the simplest defense against toxic-MEV. Since searchers exploit slippage for price manipulation, transactions with lower slippage tolerance could provide less opportunity for toxic-MEV exploitation from trades.

Additionally, slippage modeling generally incorporates statistics into a smart order routing algorithm to deliver the optimal trade route.

Nevertheless, these solutions are incomplete. Even with optimal slippage, MEV bots may still derive value from your trades.


On Solana

In , a generic swap involves the input amount_in, which represents the amount of token the user wants to trade, and minimum_amount_out, which denotes the minimum amount of output tokens necessary to avoid excessive slippage:

/// Swap instruction data
pub struct Swap {
    /// SOURCE amount to transfer, output to DESTINATION is based on the exchange rate
    pub amount_in: u64,
    /// Minimum amount of DESTINATION token to output, prevents excessive slippage
    pub minimum_amount_out: u64,
}

The minimum amount of output tokens is connected to the actual number of output tokens by the slippage, ensuring that:

min⁡(NoutA)=NoutA−SA×NoutA\min(N_{out}^A) = N_{out}^A - S^A \times N_{out}^Amin(NoutA​)=NoutA​−SA×NoutA​

The slippage can be derived as follows:

SA=NoutA−min⁡(NoutA)NoutA%S^A = \frac{N_{out}^A - \min(N_{out}^A)}{N_{out}^A} \%SA=NoutA​NoutA​−min(NoutA​)​%
Solana's Token Swap Program