---
name: oxpanda-mint
description: Mint 0xPanda NFTs on BNB Smart Chain via a Binance Agentic Wallet holding a .ai Agent ID. Covers the pricing logic (first mint free with a 0.00022 BNB anti-sybil fee, then 0.00088 BNB per piece), the Agent ID gate check, and the preview -> confirm -> execute flow.
---

# 0xPanda — Mint Skill

Mint 0xPanda NFTs on BNB Smart Chain mainnet (chain ID 56) via the
user's Binance Agentic Wallet (`baw`).

## Fixed parameters

| Item | Value |
|---|---|
| NFT contract | `0x0000000000000000000000000000000000000000` → **REPLACE WITH DEPLOYED ADDRESS** |
| Marketplace contract | `0x0000000000000000000000000000000000000000` → **REPLACE WITH DEPLOYED ADDRESS** |
| SPACE ID Agent ID registry | `0x60B9262456dE011F7d15a54CdD8c48bAaa8B022F` |
| Total supply | 2,000 |
| Per-wallet cap | 10 NFTs total |
| Price | First mint per wallet FREE — only a 0.00022 BNB anti-sybil fee; from the 2nd mint, 0.00088 BNB each. Each payment mints exactly 1 NFT; gas extra |

Rarity tiers (random at mint, ratio approx 5560:2780:1390:270):
Common x5 (~55.6%), Uncommon x20 (~27.8%), Rare x50 (~13.9%), Legendary x100 (~2.7%).
Read a token's tier on-chain with `rarityOf(tokenId)` (0/1/2/3).

## Function selectors

| Function | Selector |
|---|---|
| `mint()` | `0x1249c58b` |
| `nextMintQuote(address)` | `0x50e3aeae` |
| `remainingQuota(address)` | `0xd872e413` |
| `rarityOf(uint256)` | `0xdd3b5f9a` |
| `totalMinted()` | `0xa2309ff8` |
| `mintedCount(address)` | `0xfddcb5ea` |
| `balanceOf(address)` | `0x70a08231` |

### Marketplace selectors (on `marketplace` contract)

| Function | Selector |
|---|---|
| `list(uint256 tokenId, uint256 priceWei)` | `0x50fd7367` |
| `buy(uint256 tokenId)` (payable, value = price) | `0xd96a094a` |
| `cancel(uint256 tokenId)` | `0x40e58ee5` |
| `getActiveListings()` → `(uint256[] tokenIds, address[] sellers, uint256[] prices)` | `0x87c35bc0` |
| `getListing(uint256)` → `(address seller, uint256 price, bool active)` | `0x107a274a` |
| `activeListingCount()` | `0x4681a7c6` |
| `FEE_BPS()` (= 250, i.e. 2.5%) | `0xbf333f2c` |
| `setApprovalForAll(address,bool)` (on NFT contract) | `0xa22cb465` |

## Hard stops — check before anything else

1. **Contract mismatch**: the NFT contract address above must match the one
   published on the official website. If they differ, STOP and report.
   Never invent or guess an address.
2. **Agent ID gate**: the wallet must hold a .ai Agent ID
   (`balanceOf(wallet) > 0` on the registry). If not, STOP — regular wallets
   cannot mint.

## Pricing logic (apply exactly)

Let `m` = number of 0xPanda NFTs the wallet already minted (read `mintedCount`
from the contract immediately before the transaction; do not cache).

- Remaining quota = `10 - m`. If 0, STOP (cap reached).
- If `m == 0`, the next mint is **FREE** — pay only the anti-sybil fee of
  **0.00022 BNB**. The fee is due in full: never pay 0, always pay the exact
  `nextMintQuote` amount.
- If `m >= 1`, each mint costs **0.00088 BNB** — one payment mints exactly 1 NFT.
- Always refresh the price from the contract right before preview
  (call `nextMintQuote(wallet)`). If the on-chain quote differs from the
  values above, STOP and report the mismatch instead of paying.

## Mint flow (preview -> confirm -> execute)

1. Do balance and gate checks silently (BNB for price + gas, Agent ID check).
   Report and stop on failure.
2. Compute the payment plan and show it to the user: number of NFTs,
   per-payment breakdown, total BNB, gas estimate.
3. Build the `mint()` call on the NFT contract: `to` = NFT contract,
   `value` = exact quoted BNB in wei, `inputData` = `0x1249c58b`.
   Run **preview**. Confirm: target = NFT contract, function = mint,
   value = planned BNB. If anything differs, STOP.
4. Ask the user for **one explicit confirmation**, then **execute**.
5. After execution, verify the receipt (status = success) and the wallet's
   updated NFT balance / received tokenId(s) from the Transfer event.
6. Report: tx hash, tokenId(s), tier of each token via `rarityOf`,
   amount actually paid, remaining quota.

Never pay by transferring BNB directly to any other address — a direct
transfer mints nothing. All payments go through `mint()` on the NFT contract.

## Marketplace (on-chain, no backend)

The marketplace contract (`0xPandaMarket`) lets holders trade 0xPanda NFTs
peer-to-peer. Every sale pays a **2.5% fee** to the contract owner; the rest
goes to the seller. There is no backend — listings live on-chain and are
enumerated via `getActiveListings()`.

### List an NFT for sale

1. The wallet must own the tokenId.
2. Approve the marketplace once: call `setApprovalForAll(marketplace, true)`
   on the **NFT contract** (selector `0xa22cb465`; no value). Skip if already
   approved (`isApprovedForAll(wallet, marketplace)` is true).
3. Call `list(tokenId, priceWei)` on the **marketplace contract**
   (selector `0x50fd7367`; no value). Price must be > 0.
4. Preview → confirm → execute. Verify the `Listed` event.

### Buy a listed NFT

1. Read the listing: `getListing(tokenId)` or `getActiveListings()` on the
   marketplace. Confirm it is active and note the exact price.
2. Call `buy(tokenId)` on the **marketplace contract**
   (selector `0xd96a094a`) with **value = exact price in wei**.
   Overpayment is refunded by the contract, but always pay the exact amount.
3. Preview → confirm → execute. Verify the `Sold` event and the wallet's
   updated NFT balance.

### Cancel a listing

Only the seller can cancel: call `cancel(tokenId)` on the marketplace
(selector `0x40e58ee5`; no value). The NFT stays in the seller's wallet.
Verify the `Cancelled` event.

### Hard stops (marketplace)

- Never buy a tokenId that is not actively listed — read the chain first.
- Never send BNB directly to the seller — all purchases go through `buy()`.
- The 2.5% fee is enforced by the contract; do not try to bypass it.
