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

# Contract methods

> The player-path ChancePool call surface — place, claim, stake, and the views you'll actually use.

Curated player and integrator methods on **ChancePool**. Admin and keeper methods (epoch rotation, params, pause) are intentionally omitted.

## Place

All three share the same tail: `clientSeed` (non-zero), `expectedCommitId` (must equal `currentCommitId()`), optional `affiliate` (zero address = none), and optional `platform` / `game` attribution strings (≤ 64 bytes, emit-only). Each returns the new `betId`.

### placeStrike

```solidity Solidity theme={"theme":"css-variables"}
function placeStrike(
    uint256 stakeAmount,
    uint256 multipleBps,
    bytes32 clientSeed,
    uint64 expectedCommitId,
    address affiliate,
    string calldata platform,
    string calldata game
) external returns (uint256 betId);
```

| Arg           | Meaning                                                                      |
| ------------- | ---------------------------------------------------------------------------- |
| `stakeAmount` | USDG stake (pool pulls it via `transferFrom` — approve first)                |
| `multipleBps` | Payout multiple in bps: `20000` = 2×. Win pays `stake × multipleBps / 10000` |

### placeRange

```solidity Solidity theme={"theme":"css-variables"}
function placeRange(
    uint256 stakeAmount,
    uint256 payoutMin,
    uint256 payoutMax,
    bytes32 clientSeed,
    uint64 expectedCommitId,
    address affiliate,
    string calldata platform,
    string calldata game
) external returns (uint256 betId);
```

| Arg                       | Meaning                                     |
| ------------------------- | ------------------------------------------- |
| `payoutMin` / `payoutMax` | USDG payout band; must bracket `EV × stake` |

### placeLadder

```solidity Solidity theme={"theme":"css-variables"}
function placeLadder(
    uint256 stakeAmount,
    uint256[] calldata payouts,
    uint256[] calldata massWad,
    bytes32 clientSeed,
    uint64 expectedCommitId,
    address affiliate,
    string calldata platform,
    string calldata game
) external returns (uint256 betId);
```

| Arg       | Meaning                                                                                                             |
| --------- | ------------------------------------------------------------------------------------------------------------------- |
| `payouts` | USDG payout per bucket (1–16 buckets)                                                                               |
| `massWad` | Probability mass per bucket in WAD; must sum to 1e18 and satisfy the exact [EV identity](/protocol/bet-constraints) |

## Claim

All claim methods are **bettor-only** (`msg.sender` must be the bet's player) and share the payout choice: `claimAsChance = false` pays USDG from bankroll cash; `true` spends the full payout buying CHANCE on the V4 pool and transfers it to your wallet, with `minChanceOut` as the slippage floor.

| Method           | Signature                                                                                               | Use when                                                                                                                                                                         |
| ---------------- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `claim`          | `claim(uint256 betId, bool claimAsChance, uint256 minChanceOut)`                                        | The bet is settled, or its epoch seed is already revealed (it settles then claims in one tx). Reverts `NotRevealed` if pending and unrevealed                                    |
| `claimWithProof` | `claimWithProof(uint256 betId, uint256 entropy, bytes proof, bool claimAsChance, uint256 minChanceOut)` | You have the API's entropy + Groth16 proof — settle and claim in one tx before the epoch closes                                                                                  |
| `claimBets`      | `claimBets(ClaimBetRequest[] requests, bool claimAsChance, uint256 minChanceOut)`                       | Batch claim; each request is `(betId, entropy, proof)` with an optional per-bet proof. When claiming CHANCE, one V4 buy covers the total and `minChanceOut` floors the **total** |

Losses never revert a claim — a settled zero-payout bet is a silent no-op. USDG claims revert `InsufficientBankroll` if the pool's free cash cannot cover the payout.

## Stake (bankroll)

| Method                 | Signature                           | What it does                                                                                                 |
| ---------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `stake`                | `stake(uint256 assets)`             | Deposit USDG into the bankroll. Public only when `stakingEnabled` is on, otherwise reverts `StakingDisabled` |
| `requestUnstake`       | `requestUnstake(uint256 assets)`    | Start the two-step exit for a fixed amount; restarts the cooldown on repeat calls                            |
| `requestUnstakeAll`    | `requestUnstakeAll()`               | Exit the whole position, including rewards that compound in during the cooldown                              |
| `cancelUnstakeRequest` | `cancelUnstakeRequest()`            | Abort a pending exit                                                                                         |
| `unstake`              | `unstake(uint256 assets)`           | Execute an unlocked request — see [Deposit & withdraw](/staking/deposit-and-withdraw)                        |
| `setRewardMode`        | `setRewardMode(RewardMode mode)`    | Choose USD-compound vs CHANCE rewards — see [Rewards](/staking/rewards)                                      |
| `claimStakerChance`    | `claimStakerChance(uint256 amount)` | Withdraw accrued CHANCE rewards                                                                              |

## Views you'll use

| View                                                                     | Returns                                                                       |
| ------------------------------------------------------------------------ | ----------------------------------------------------------------------------- |
| `currentCommitId()`                                                      | Live epoch id — pass as `expectedCommitId` when placing                       |
| `getBet(betId)`                                                          | Full `Bet` struct (player, mode, stake, liability, status, payout, …)         |
| `getLadderBuckets(betId)`                                                | Ladder `payouts[]` + cumulative masses (empty for other modes)                |
| `pendingBetCount(player)` / `getPendingBetIds(player, offset, limit)`    | Actionable bets (pending, or settled with unclaimed payout); pages cap at 100 |
| `availableBankroll()`                                                    | Free USDG underwriting new bets                                               |
| `maxStakeCap()` / `maxBetLiabilityCap()` / `effectiveMaxMultiplierBps()` | Live place gates — see [Bet constraints](/protocol/bet-constraints)           |
| `computeCommitment(seed)` / `computeEntropy(seed, clientSeed, betId)`    | Poseidon helpers for [fairness verification](/protocol/provably-fair)         |
| `withdrawableNow(staker)` / `unstakeUnlocked(staker)`                    | Staker exit readiness                                                         |

## Permissionless settlement

`settleBet(betId)`, `settleBets(betIds)`, `settleWithSeed(betId, serverSeed)`, `settleWithProof(betId, entropy, proof)`, and `forceRefundOnTimeout(betId)` are callable by **anyone** — settlement never depends on the operator being online. In practice the claim methods above fold settlement into the claim transaction, so most integrations never call these directly.
