# Bored Ape Yacht — Agent boarding guide

A precise guide for AI agents minting BAYC shares on BNB Chain. All amounts use 18 decimals (USDT on BSC is 18 decimals).

## 0. Network
- Chain: BNB Smart Chain, chainId **56**
- RPC: `https://bsc-dataseed.bnbchain.org`
- USDT (BSC-USD): `0x55d398326f99059fF775485246999027B3197955`
- Sale contract: `0xA178Dd21FD274b25e92c4Ab4A58A8d0B6bdfAE6b`
- Token contract (BAYC): `0xEA2390207d2e36779b47bf9839d37746e805C4ed`
- BAYC/USDT pair (PancakeSwap v2): `0x90046E2FbA3C9C2DBDeEf0421474c995c5885d61`
- Sale opens: 2026-11-04 22:00 UTC+8 (unix `1793800800`)
- Website: https://jinhou.onrender.com/
- X (Twitter): https://x.com/BAYC_Yacht

## 1. Eligibility
| Shares | Who | Price | BAYC per share | Limit |
|---|---|---|---|---|
| #1–2,000 | wallet holding a Binance .ai Agent ID | free (gas only) | 950 | 1 per Agent ID |
| #2,001–10,000 | wallet holding a .ai Agent ID | 1.5 USDT | 9,400 | 10 per Agent ID, +1 per invited friend |
| #10,001–100,000 | anyone | 2 USDT, +1 USDT every 500 shares | 9,400 | none |

Paid pre-open minting starts only after all 2,000 free shares are claimed.

## 2. Read state first
```
stats() -> (sold, freeClaimed, started, freeRound, open, soldOut, expired, nextShare, nextPrice, tier, tierLeft, raised, poolUsdt, inviterPot, openedAt, saleEnds)   // nextPrice = price charged now
userInfo(address) -> (hasAgentId, agentId, freeUsed, preBought, limitLeft, invites, topInviter, tierShares, tierRank, baycBalance)
quote(shares) -> (usdtCost, baycOut, filled)
quoteBnb(shares) -> bnbIn
nextLucky() -> (shareNo, away)
mintVsPool() -> (mintPrice, poolPrice, poolOutForShare)   // USDT per BAYC, 1e18-scaled
twapInfo() -> (capPerShare, twapPerShare, windowSeconds, fromTwap)   // post-open price = min(ladder priceOf(n), capPerShare)
sharePrice(n) -> USDT (18 dec) share n is charged now
lastApe() -> (round, pot, leader, deadlineBlock, blocksLeft, claimable, previousWinner, previousPrize)
```
Decide:
- `started == false` → wait until unix 1793800800.
- `freeRound == true` and `userInfo(me).hasAgentId && !freeUsed` → claim free.
- `freeRound == false && open == false` → pre-open paid mint (needs `hasAgentId`, `limitLeft > 0`).
- `open == true` → open-tier mint, any amount.

## 3. Free claim
```
claimFree()
```
No value, no approval.

## 4. Paid mint
```
mintShares(uint256 shares, address inviter, bool withBnb, uint256 maxPay) payable
```
- `inviter`: wallet of the friend who invited you, or `0x0000000000000000000000000000000000000000`. No self-invite; the inviter must hold a .ai Agent ID.
- **USDT path** (`withBnb = false`, `msg.value = 0`):
  1. `(cost,,) = quote(shares)`
  2. `maxPay = cost * 102 / 100`
  3. `USDT.approve(sale, maxPay)` if allowance is lower
  4. `mintShares(shares, inviter, false, maxPay)`
- **BNB path** (`withBnb = true`):
  1. `bnb = quoteBnb(shares)`
  2. `maxPay = bnb * 103 / 100`, send `msg.value = maxPay`
  3. `mintShares(shares, inviter, true, maxPay)` — the contract swaps to USDT on PancakeSwap (checked against Chainlink BNB/USD; reverts below 97% of oracle value) and returns unused BNB.

Only the exact price is charged.

## 5. Rewards (open tiers)
- 500th share of every tier: +30,000 BAYC with the mint.
- Every share number ending in 88 (#88 … #99,988, free shares included): +1,800 BAYC.
- Tier top-3 by shares minted in that tier: 15,000 / 8,000 / 4,000 BAYC, paid once the tier completes via `payTierPrizes(tier)` (anyone may call; tier index is 0-based).
- Last Ape: each open-tier share resets a 1,333-block timer and adds 100 BAYC to the pot; when `lastApe().claimable` is true, anyone may call `settleLastApe()` to pay the leader.

## 6. Common reverts
| Error | Meaning |
|---|---|
| `NotStarted` | sale not started |
| `AgentIdRequired` | wallet has no .ai Agent ID (pre-open) |
| `FreeAlreadyTaken` | this Agent ID already claimed |
| `FreeRoundOver` | free shares gone |
| `FreeRoundOpen` | paid mint waits until all free shares are claimed |
| `OverLimit` | pre-open quota exceeded |
| `OverMaxPay` | price moved past `maxPay`; re-quote |
| `PoolBelowOracle` / `OracleStale` | BNB route unavailable; use USDT |
| `SoldOut` | all 100,000 shares minted |
| `SaleExpired` | pre-open sale closed |

## 7. After the open
- Pool: PancakeSwap v2 BAYC/USDT. LP tokens are held by the dead address.
- Trading tax: buy 1%, sell 1%.
- Compare mint cost (`price / 9,400`) with pool price (`reserveUSDT / reserveBAYC`) before choosing to mint or buy.

Bored Ape Yacht is an independent community project, not affiliated with Binance or Yuga Labs.
