Kairu
Simulator

Swap-Repay

How the swap-repay simulation works, including the CowSwap integration and oracle fallback.

Swap-repay models the scenario of selling one of your collateral assets to repay part of your debt — without first withdrawing the collateral to a separate wallet. This is equivalent to Aave's "Repay with Collateral" feature.

How it works

  1. You specify: which collateral to sell, which debt to repay, and an amount
  2. Kairu fetches a live quote from CowSwap for that exact swap
  3. The quote includes the expected output amount and slippage
  4. The simulation shows your position state after the swap and repayment, using the live quote

CowSwap integration

CowSwap is used because it provides MEV-protected swaps and often achieves better rates than on-chain DEXes for large amounts. The quote is fetched at simulation time — it is the best available price at that moment.

The quote includes:

  • Expected output amount (in the repayment asset)
  • Minimum output with slippage (what you're guaranteed to receive)
  • Fee estimate

Oracle fallback

If CowSwap is unreachable or returns an error, Kairu falls back to a price-oracle-based estimate using the protocol's own price feeds. The fallback is noted in the simulation result so you know it's an estimate rather than a live quote.

What the simulation shows

Selling: 1,000 USDC worth of WBTC
Receiving: ~$985 USDC (1.5% slippage)
Net debt reduction: $985 USDC
HF before: 1.38
HF after: 1.52

When to use swap-repay

Swap-repay is most useful when:

  • Your health factor is approaching a risk threshold and you want to de-risk without adding external funds
  • You have excess collateral in a lower-yield asset you want to rotate out of
  • You want to reduce a specific debt position without sourcing the repayment asset externally
The simulation is a model. Actual swap execution happens on CowSwap and is subject to price movement between the time you simulate and the time you execute. Always check the live quote on CowSwap before proceeding.
Copyright © 2026