Skip to main content

Slippage Considerations in the Morpho Interface

When interacting with Morpho and Morpho Vaults through the Morpho Interface, slippage protection is implemented to safeguard users against unexpected price movements between transaction submission and execution. Understanding how slippage is handled is crucial for both users and developers.

Types of Slippage Protection

  1. Token Wrapping Operations

    • Applied to: stETH → wstETH conversions, ERC4626 deposits (including Morpho Vaults deposits)
    • Fixed maximum slippage: 3 basis points (0.03%)
  2. Market Operations

    • Formula: e4rtargetd1e^{4 \cdot r_{\text{target}} \cdot d} - 1
    • Where:
      • rtargetr_{target} is the target interest rate
      • dd is the expected transaction duration (15 minutes for EOA, 45 minutes for Safe)
  3. Vault Operations

    • Formula: (1+rapy)dyearInSeconds1\left( 1 + r_{apy} \right)^{\frac{d}{yearInSeconds}} - 1
    • Where:
      • rapyr_{apy} is the Annual Percentage Yield
      • dd is the expected transaction duration (15 minutes for EOA, 45 minutes for Safe)
      • yearInSecondsyearInSeconds is the number of seconds in a year

Shares Conversion and Slippage

In operations involving asset-to-share conversions (e.g., borrowing, repaying, Morpho Vaults deposits/withdrawals), the interface accounts for worst-case slippage scenarios. This is particularly important in the following cases:

  • Asset-Based Operations: Borrowing, partial repayments, Morpho Vaults deposits/partial withdrawals, supplying/withdrawing collateral
  • Shares-Based Operations: Maximum repayments, Morpho Vaults deposits in rehypothecation, maximum Morpho Vaults withdrawals

Note: Slippage can significantly impact transactions combining asset-based and shares-based operations for the same token.

Special Considerations for Morpho Vaults

Morpho Vaults ERC4626-compliant tokens are treated differently depending on the context:

  • As assets when supplied as collateral
  • As shares when supplied as deposits

In rehypothecation, they are treated as shares during Morpho Vaults Deposit and as assets during Supply Collateral.

At which level is it implemented?

These slippage calculations are automatically applied in relevant bundlerActions to protect users from adverse price movements during transaction processing.

For a more detailed explanation of how these slippage considerations are implemented in bundlerActions, please refer to the Bundlers TypeScript Tutorial.