> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fade.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# Swap win-back

> A ticket in the same transaction as the swap. Start with the fees.

## What the user sees

> **Swap complete. This trade was free.**
> 4.20 SOL → 622.44 USDC, fees on us.

Or, at a smaller scale: "Your swap fees are on us."

## Atomic with the swap

`open_wager` can sit in the same transaction as the swap. Fade only restricts what may sit next to a liquidity provider's deposit or withdrawal request, never what sits next to `open_wager`. The swap and the ticket therefore land together or not at all. Two slots later the randomness can be requested, ORAO answers in a few seconds, and the settlement pays a win. The platform or a keeper sends those two steps, so the user signs once.

## Start with the fees

Paying back a whole 600 USDC trade is a liability the pool can only carry once it is large. Paying back the trade's **fees** is a small liability per trade at a very high frequency, which is the shape a pool serves best.

**Fees on us, 1 trade in 20.** A trade pays 2.50 USDC of fees. The platform stakes 0.1296 USDC from its fee revenue on a paytable that pays 2.50 USDC or nothing, at a 3.5 % declared edge:

| | Value |
| - | - |
| Multiplier | `m = 192 902` bps, 19.29× |
| Probability | `p = 50 025 401`, about 1 in 20 |
| Payout if won | 2.50 USDC to the user |
| Liability | 2.37 USDC |
| Pool that carries it, idle | from about 160 USDC of assets |

A stake this small fits devnet's 0.10 USDC minimum. Under the protocol's reference minimum for the direct path (7.5 USDC), fee win-backs either bundle several trades' fees into one ticket or take the [shared beacon](/protocol/shared-beacon) design built for small stakes.

**The whole trade, 1 trade in 100.** Paying back the 622.44 USDC of the trade above at 1 in 100 needs a stake of about 6.45 USDC and reserves about 616 USDC of liability. That fits an idle pool from about 41 000 USDC. "1 trade in 100 is fee-free" fits a young pool; "1 trade in 100 is free" waits for a larger one.

## Who funds the stake

The platform, out of its fee revenue: a promotion, and the variant to lead with. A user paying a surcharge for the chance is staking their own money, which is a wager with the legal consequences described on [Checkout win-back](/use-cases/checkout-win-back).

## Farming

A user could split one swap into many to multiply their chances. Keep the rule economic: the promotion's expected cost per trade must stay below the fees that trade pays. Splitting then costs the user more in fees than it wins on average.

## Who integrates

* DEX aggregators and wallets with a swap screen.
* Launchpads and mint platforms ("this mint might be free").
* Liquid staking and vaults, on deposits ("your deposit fee is on us").

## How it is wired

| Account | Platform-funded fees |
| - | - |
| `integratorAuthority` | The platform's key or program PDA |
| `payer` | The platform |
| `stakeOwner`, `stakeSource` | The platform's fee account, which signs |
| `beneficiary` | The user's USDC account |

The devnet demo at [app.fade.finance/#swap](https://app.fade.finance/#swap) simulates the swap leg at an indicative price; the payout that may pay the trade back is real (test USDC).

<Warning>
  Prize-linked payouts are subject to local gaming and promotion law. A platform-funded promotion is generally treated differently from a user paying for a chance. Check each market.
</Warning>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.