Swap

How to Apply Slippage to Your Swaps

  • Understanding Slippage: Slippage refers to the difference between the expected price of a trade and the price at which the trade is executed.

  • Applying Slippage:

    • To apply slippage, request less amountOut for the amountIn you are swapping.

    • For example, to apply a 3% slippage tolerance:

      • Subtract 3% from the amountOut value.

      • Use this adjusted amountOut in your swap request.

Swap Processing:

  • Program Behavior:

    • The program checks if you are entitled to receive more tokenOut than specified in the transaction.

    • If Yes:

      • Swap from Rune to BTC: The program will include the additional BTC you should receive in the transaction.

      • Swap from BTC to Rune: The program will hold the extra Rune you should have received. In your next call to the program, it will send you your corresponding portion.

Last updated