> ## 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.

# Integration overview

> Who signs what, what an app needs, and the three ways to call Fade.

An integration is one instruction, `open_wager`, plus a way to get the wager settled. Everything after the open is permissionless.

## Who signs what

`open_wager` names four parties. They can all be the same key, or four different ones.

| Account | Signs | Role |
| - | - | - |
| `integratorAuthority` | Yes | **The app's identity.** A server or wallet signs with its own key; a program signs over CPI with the PDA `["fade-integrator"]` derived from its own program id. The app's record lives at `["integrator", integratorAuthority]` and is created by its first wager. |
| `payer` | Yes, writable | Pays the SOL side: the wager account's rent, the oracle prefund and the crank fee (and, on the first wager, the app record's rent). Receives every refund when the wager closes. |
| `stakeOwner` | Yes | Owns `stakeSource`, the legacy SPL USDC account the stake is taken from. The user, or the app staking funds it holds or its own budget. |
| `beneficiary` | No | The legacy SPL USDC account the payout goes to. Stored at open and never changeable. |

Two more accounts belong to the app:

* `feeAccount`: the USDC account that receives the app fee. Set by the app's first wager, and afterwards must match the record; it moves only through `set_fee_account`, signed by the app.
* `nonce`: must equal the record's `next_nonce` (0 for a new app). The wager address is `["wager", integrator, nonce]`, so it is known before the transaction lands.

### Common shapes

| Shape | `integratorAuthority` | `payer` | `stakeOwner` | `beneficiary` |
| - | - | - | - | - |
| User signs their own stake (DeFi-native) | App key or program PDA | App or user | User | User |
| Merchant or platform promotion | App | App | Merchant or platform | User |
| Operator holding player balances | Operator | Operator | Operator | Operator, which credits the player |
| A wallet playing for itself (the devnet demos) | Wallet | Wallet | Wallet | Wallet |

<Note>
  Fade verifies the odds and pays the beneficiary named at open. It does not verify that the beneficiary is the app's own user. An operator that is its own beneficiary is trusted by its users to credit them; it can make that checkable by showing each user the public wager behind their bet.
</Note>

## What an app needs

* **No capital, no deposit, no registration.** The first `open_wager` creates the app record.
* **A paytable that clears the edge floor**: declared edge ≥ 100 bps (LP floor) + 20 bps (protocol fee) + the app's fee. See [Paytables](/build/paytables).
* **A USDC account for its fee** (it may be the stake's own source when the app takes no fee).
* **SOL on the payer** for the open, most of which comes back when the wager closes. See [Fees](/build/fees).
* **A keeper**, or its own transactions, to request randomness and settle. See [Settlement and keepers](/build/settlement).

## Three ways to call Fade

<Tabs>
  <Tab title="From a server or wallet">
    Build `open_wager` with the TypeScript client generated from the IDL, sign it with your keys (and the user's wallet when the user stakes), and send it. Hand the wager to a keeper. This is the [Quickstart](/build/quickstart).
  </Tab>

  <Tab title="From a program (CPI)">
    Your program calls `open_wager` through CPI and signs `integrator_authority` with `invoke_signed` on seeds `[b"fade-integrator", &[bump]]` under **your** program id. Only your program can produce that signature, so nobody can act as your app. The user's signature as `stake_owner` passes through the CPI when the user stakes. Fade never calls back into your program: there is no reentrancy and no compute inherited from third-party code. Read the outcome later from the `WagerSettled` event or by watching the wager close.
  </Tab>

  <Tab title="Over HTTP">
    Put a gateway in front: one paid HTTP request opens a wager. See [Any HTTP service](/use-cases/http-gateway).
  </Tab>
</Tabs>

## Composing with other instructions

`open_wager` can sit in any transaction: after a payment, a swap, a mint. If any instruction fails, nothing lands. It takes about 65 000 compute units. The only composition rule in the program applies to liquidity providers: `request_deposit` and `request_withdraw` refuse a transaction containing top-level instructions outside a short allowlist.

## Before you sign: simulate

Every refusal is decided in `open_wager`, against the pool as it stands. Simulate the transaction first: a refusal comes back with the program's error name and message, and costs nothing. [Errors](/build/errors) lists every code and what to do about it. The sizing rules are explained in [Paytables](/build/paytables), so an interface can show the largest prize or the largest stake the pool accepts instead of letting a user hit a refusal.

## The client

Fade publishes the devnet program's Anchor IDL at [`fade.finance/idl/fade.json`](https://fade.finance/idl/fade.json). Generate a typed TypeScript client from it with [Codama](https://github.com/codama-idl/codama), on top of `@solana/kit`. The [Quickstart](/build/quickstart) walks through it.


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