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

# Accept a Bet

> How to accept an existing bet and lock funds.

## Overview

When a bet is created and directed at you (or is open), you can accept it by depositing funds. The acceptance flow differs depending on whether it's a **PvP bet** (1v1) or an **Open PvP Bet** (partially fillable by multiple opponents).

***

## PvP Bets (1v1)

### Flow

```mermaid theme={null}
sequenceDiagram
    participant O as Opponent
    participant App as Mouth Web App
    participant BE as Backend
    participant SC as Smart Contract
    participant Bot as Mouth Bot
    participant X as X (Twitter)

    O->>App: Clicks same bet URL (pvp.mouth.app/challenge/{id})
    App-->>O: Shows bet details + "Accept Bet" button
    O->>App: Clicks "Accept Bet"
    App->>BE: POST /bets/:id/accept
    BE->>SC: Deposits matching USDC from opponent's wallet (gasless, server-side)
    SC-->>SC: 2% fee collected on total pot → treasury
    SC-->>SC: Bet status → Active (remaining funds locked)
    BE-->>App: Confirmation
    App-->>O: Confirmation shown
    Bot->>X: Posts that the bet is now live (optional)
```

### Step by Step

1. **Opponent sees the bet** — via the **same URL** the bot posted when the Challenger initiated the bet, or via the web app directly
2. **Views the bet details** on pvp.mouth.app:
   * Title, description, resolution criteria
   * Amount required to match
   * Expiration date
   * Challenger's X profile
3. **Logs in with X** (via Privy) if not already logged in — if the opponent was pre-registered by the backend, Privy assigns them the same wallet that was used in the bet contract
4. **Clicks "Accept Bet"**
5. **Confirms the deposit** — the backend deposits the required USDC from the opponent's embedded wallet via a gasless server-side transaction. The required amount depends on the bet's odds setting: at default odds (50/50), the deposit matches the Challenger's exactly. If the Challenger set custom odds, the required deposit is adjusted proportionally.
6. **Bet becomes Active:**
   * The **2% protocol fee** is collected on the total pot (challenger + opponent deposits) and sent to the Mouth treasury
   * The remaining deposits are now **locked** in the smart contract
   * Neither party can withdraw
   * The Mouth bot posts on X confirming the bet is live

### Access Control

* **Only the specified X account** can accept the bet — the smart contract checks the opponent's wallet address, which is resolved from the X handle by the backend via Privy
* If the opponent hasn't signed up yet, a wallet is pre-generated for them (see [Identity & Wallets](/architecture/identity-and-wallets))
* No one else can deposit or accept

***

## Open PvP Bets (Partially Fillable)

Open PvP Bets have no specific opponent — **anyone** with a Mouth account can take the other side, and **multiple opponents** can each fill a portion of the total amount.

### Flow

```mermaid theme={null}
sequenceDiagram
    participant O1 as Opponent 1
    participant O2 as Opponent 2
    participant O3 as Opponent 3
    participant App as Mouth Web App
    participant SC as Smart Contract

    O1->>App: Views Open PvP Bet (1,000 USDC)
    O1->>SC: Deposits 400 USDC
    SC-->>SC: Filled: 400 / 1,000
    O2->>App: Views Open PvP Bet (600 remaining)
    O2->>SC: Deposits 350 USDC
    SC-->>SC: Filled: 750 / 1,000
    O3->>SC: Deposits 250 USDC
    SC-->>SC: Fully filled → Bet Active
```

### Step by Step

1. **Open PvP Bet is visible** on pvp.mouth.app explore page, or shared via X / direct link
2. **Any user** can view the bet details, including:
   * Total amount
   * Amount already filled vs remaining
   * Acceptance deadline
   * Number of current opponents
3. **User chooses an amount** to deposit (any amount up to the remaining unfilled portion)
4. **Deposits USDC** into the bet contract
5. **Bet updates:**
   * The deposited amount is recorded for that opponent
   * The "filled" progress is updated
   * The **2% protocol fee** is collected proportionally on each deposit and sent to the Mouth treasury
   * If fully filled → the bet becomes **Active** immediately
   * If not fully filled → remains **Filling** until deadline

### Acceptance Deadline

All PvP Bets have a **mandatory acceptance deadline**. This is critical to prevent abuse:

<Warning>
  Without an acceptance deadline, someone could snipe the remaining unfilled amount right before the bet's expiration date, giving themselves an unfair informational advantage (they already know the likely outcome).
</Warning>

**What happens at the acceptance deadline:**

| Scenario                          | Result                                                                           |
| --------------------------------- | -------------------------------------------------------------------------------- |
| **Fully filled** before deadline  | Bet is already Active, deadline is irrelevant                                    |
| **Partially filled** at deadline  | Bet activates with the filled amount. Challenger's unfilled portion is returned. |
| **Not filled at all** at deadline | Bet expires. Challenger reclaims their full deposit. No fee charged.             |

**Example — partially filled:**

* Challenger creates an Open PvP Bet for \$1,000 with a 48h acceptance deadline
* After 48h: opponents have deposited a total of \$700
* Bet activates for \$700 each side (Challenger's \$300 unfilled is returned)
* Total pot: \$1,400

### Proportional Payouts

When an Open PvP Bet resolves, payouts are **proportional** to each opponent's deposit. The 2% protocol fee was already collected at deposit time, so claiming distributes the remaining contract balance.

**If Challenger wins:**

* Challenger receives all remaining funds in the contract

**If Opponents win:**

* Each opponent receives their proportional share of the remaining contract balance, based on their deposit ratio: `payout = (opponentDeposit / filledAmount) * claimableBalance`

**Example** — \$700 Challenger vs \$700 Opponents (3 users), fee = 2% of \$1,400 = \$28, claimable = \$1,372:

| Opponent | Deposited | Share of Pool | Payout if Win |
| -------- | --------- | ------------- | ------------- |
| User A   | \$400     | 57.1%         | \$784.00      |
| User B   | \$200     | 28.6%         | \$392.00      |
| User C   | \$100     | 14.3%         | \$196.00      |

<Note>
  The 2% protocol fee is collected **at deposit time** (proportionally as each opponent deposits), not at claim time. Each winning opponent gets their proportional share of the entire remaining contract balance.
</Note>

***

## What Happens After Acceptance

### PvP Bet

| State Change           | Before                    | After                       |
| ---------------------- | ------------------------- | --------------------------- |
| **Bet status**         | Pending                   | Active                      |
| **Challenger's funds** | Withdrawable              | Locked                      |
| **Opponent's funds**   | N/A                       | Locked                      |
| **Cancellation**       | Allowed (Challenger only) | Not allowed (unless mutual) |

### Open PvP Bet

| State Change           | Before Deadline                 | After Deadline (Partially/Fully Filled) |
| ---------------------- | ------------------------------- | --------------------------------------- |
| **Bet status**         | Pending                         | Active                                  |
| **Challenger's funds** | Withdrawable (unfilled portion) | Locked (filled portion)                 |
| **Opponents' funds**   | Locked once deposited           | Locked                                  |
| **New opponents**      | Can still deposit               | Cannot deposit                          |

## Declining a Bet

There is no explicit "decline" action. If the opponent doesn't want to accept:

* They simply don't deposit
* For PvP bets: the Challenger can withdraw their funds at any time
* For Open PvP Bets: the acceptance deadline handles the cutoff automatically
