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

# Sprint

> Sprint, a short Minute round: the terms, what a player sees, and how to open one with the SDK.

**Sprint is a short Minute round, live on mainnet on SOL, BTC and ETH.** A player picks a direction and a ticket in one
tap. The round ends at its bell, at the knockout line or at the take-profit. There is no double-down and no early close.

| Term | Value |
| - | - |
| Markets | SOL, BTC, ETH |
| Ticket | $1 to $10, in whole cents |
| Round length | 20 seconds, from the commit |
| Fees | On the exit value: 2.5 % on a win and 12 % on a loss. These are Sprint's own fee terms on that market, frozen when the round opens |
| Knockout | None in the first 5 seconds of the round |
| Close | the keeper settles it; the payout returns to the wallet |

The values change only by a governed write. Read them from `SprintConfig` (below) and the Sprint slot of the market's
fee-terms account (`sprintCurSlot(market)`), not from this page.

## The life of a round

1. **Tap.** One `open_sprint` transaction, signed by the wallet, or `open_sprint_session`, signed by a session key. The
   ticket leaves the wallet when it lands. There is no entry price yet.
2. **Fill.** The venue's next price after a short delay is the entry price. If no price comes in time, the round is
   voided and the whole ticket returns.
3. **Bell.** At `opened_at + timer_s` the round is marked, and its exit price is the venue's price a short delay later.
   The result arrives a few seconds after the bell.
4. **Knockout or take-profit.** A price at the knockout line ends the round at a loss of the ticket. There is no knockout
   on a price from the first 5 seconds of the round (the slot's `noKoS`). A booked knockout is final, even if the price
   comes back. A price at the take-profit ends it at the capped win.
5. **Money home.** `reconcile_round` moves the payout to the wallet's USDC account. Anyone may send it.

A round with no fresh price at its close returns the ticket at par.

## Open one with the SDK

```ts theme={"dark"}
import {
  buildOpenSprint,
  computeUnitLimit,
  decodeSprintConfig,
  sprintConfigPda,
} from '@rekt-trading/1000x';

const terms = decodeSprintConfig((await connection.getAccountInfo(sprintConfigPda().address))!.data);
if (!terms.opensOn) throw new Error('Sprint is not open');

const open = buildOpenSprint(
  accounts, // the account list of Minute's open_round: the player, its custody, the venue book, market and vault
  { direction: 0, total_in: 2_000_000n, min_collateral_out: 2_000_000n }, // long, $2.00; the floor is the ticket
  market, // decodeMarket of the Knockout market
  config, // decodeConfig of the venue config
);
const limit = computeUnitLimit('open_sprint');
```

* **Read `SprintConfig` before every open.** `opensOn`, `minStake`, `maxStake` and `timerS` are the live terms. A ticket
  outside `[minStake, maxStake]` is refused (Minute 6056); a closed Sprint is refused (Minute 6055).
* **The ticket is a whole number of cents** (`SPRINT_TICKET_STEP`, 10,000 base units). `buildOpenSprint`,
  `buildOpenSprintSession` and `buildMinuteInstruction` refuse any other ticket and never round it
  (`refuseOddSprintTicket`). The program does not check this. If you write the instruction bytes yourself, check it.
* **The trailing accounts** come from `sprintTrailingAccounts`: `SprintConfig`, the market's fee-terms table (writable),
  the game config, the governance table, the Instructions sysvar and the pool's `CapitalState` (writable). The builders
  append them in this order.
* **The session form** (`buildOpenSprintSession`) is funded by a session key. Set `payer` and `funder` to the session
  key and `player_wallet` to the owner; three more accounts follow, last.
* **Compute.** `computeUnitLimit('open_sprint')` and `computeUnitLimit('open_sprint_session')` are the limits to set. A
  transaction that also carries `resize_player` sets the sum: add `computeUnitLimit('resize_player')`.

## One tap, one transaction

* **Make every tap's transaction unique** with a Compute Budget value that differs per tap, for example a counter in
  the compute-unit price. Two identical taps signed on one blockhash are one transaction, and the network keeps one.
* **A retry re-sends the same signed bytes.** If a tap's result is unknown, send the bytes you signed, and keep checking
  that signature until its blockhash expires. A rebuilt or re-signed transaction is a second trade and takes a second
  ticket. A new tap stays immediate while another tap's result is unknown.
* **Keep each tap's signature.** It links the tap to the `RoundOpened` event in its logs.

## Slots

A player account holds one live round per slot. Classic rounds and Sprint rounds share the slots. A new account takes
the config's `defaultRoundSlots` (4 on mainnet; read the live value from `MinuteConfig`), and `resize_player` grows it to at most 8: put it
**after** the open in the same transaction. A round's slot is in use until its settle lands (for Sprint, the venue
`settle` and then `reconcile_round`), not when its timer ends. Check before you send:
`fetchFreeRoundSlots(connection, wallet)` returns `{ exists, capacity, live, free }`; do not open when `free` is 0. In front of a Sprint open, a transaction may
hold only Compute Budget instructions and at most one each of `init_trader_account`, `set_referral`, `bind_referral` and
Minute's `init_player`. A full account refuses the open (Minute 6017).

## The line to show

`sprintBreakEvenPrice(input)` walks the program's own payout from the fill's entry price and returns two exit prices.
`input` is `{ direction, entryPrice, stake, terms, params, tier, marketTier }`: `params` is the venue config's
`params`, `tier` is `SprintConfig.tier` and `marketTier` is the market's tier.

| Field | What it is |
| - | - |
| `profitPrice` | From this price on, up to the take-profit, the program pays more than the ticket. Show this line for a win. |
| `breakEvenPrice` | From this price on, the program pays at least the ticket. It can sit on the losing side of the entry. |

`sprintPayout(input, exitPrice)` is the program's settlement of one exit price. `terms` is the round's game entry:
the market's Sprint slot of its fee-terms table (`sprintCurSlot(market)`), or `feeTermsOfGameArgs` of the game terms.
Draw no line before the fill: the entry price is 0 until then.

## Reading results and errors

* The close is the keeper's: the venue `settle`, then `reconcile_round`. `settle_round` refuses a Sprint.
* A finished round's slot is cleared. Take its kind and result from `RoundOpened` and the settle events, not from the
  slot.
* **Minute and the venue use the same error numbers for different errors.** Read the failing program from the logs (the
  first `Program … failed` line) before you read the code. The fee-terms table and `CapitalState` must be writable, or
  the venue refuses (6380, 6265).
* A win can be paid partly now and partly later (`SettlementQueued`).


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