---
name: pinata
description: |
  Use when the user wants to take part in PIÑATA on BNB Chain: take the free swing (1 candy, gas only, one per agent),
  buy paid candy (0.001 BNB each, 1–10 per agent) in the 48-hour mint (PINATA lands in the wallet at once), launch the
  PancakeSwap pool after 48 h, or trade it. Only AI agents with a .ai Agent ID can mint.
  Triggers: pinata, piñata, free swing, PINATA mint, candy.
metadata:
  version: '0.1.0'
  requires:
    bins: [baw, curl]
  install:
    - kind: node
      package: '@binance/agentic-wallet'
      bins: [baw]
      label: Binance Agentic Wallet CLI
---

# PIÑATA skill

PINATA is a BEP-20 token on BNB Chain with a **48-hour mint for AI agents** (Binance Agentic Wallets holding a
**.ai Agent ID**). Half of the candy is **free**, and the free candy falls in **three waves** so late agents still get some.

| | |
|---|---|
| Candy | **20,000** × **10,000 PINATA**: **10,000 free** + **10,000 paid** |
| Free | **1 swing per agent**, gas only, while the current wave lasts |
| Waves | **3,333** free at hour 0 · **6,666** in total from hour 16 · all **10,000** from hour 32 |
| Paid | **0.001 BNB** a candy, **1–10 per agent** (so at most 1 free + 10 paid) |
| Launch | when all candy is gone, or after 48 h if **at least one paid candy** sold. No soft cap, **no refunds** |
| Pool | 80% of the BNB + PINATA **at the mint price** → PancakeSwap V2, **LP tokens burned**; 20% → treasury |
| Delivery | **instant**: 10,000 PINATA per candy is minted to the wallet in the same transaction. Nothing to claim |
| Transfers | **locked until launch** fills the pool (mints only), then PINATA is a plain token |
| Tax | **none** |
| Pass | every agent also gets **1 free PIÑATA Pass NFT** (same contract) on its first swing or buy; generative art, the candy in the picture = the candy that agent collected; 5% royalty |

Untaken free candy and unsold paid candy are never minted. If the 48 hours end with **no paid candy sold**, there is
no pool and PINATA stays non-transferable.

## Contracts (BNB Chain, chain id 56)

| | Address |
|---|---|
| PinataMint (also the PIÑATA Pass NFT) | `MINT_ADDRESS` |
| PINATA token | `TOKEN_ADDRESS` |
| .ai Agent ID registry (SPACE ID) | `0x60B9262456dE011F7d15a54CdD8c48bAaa8B022F` |

You read the chain with a plain JSON-RPC `eth_call`, and every transaction is previewed and signed by the user's Binance
Agentic Wallet through `baw`. **Never ask the user for a private key or seed phrase.**

Rules for you, the agent:
- Only act when the user asks. Never swing, buy or sell on your own initiative, and don't schedule recurring runs.
- **Every** `requestId` needs the user's explicit "yes" before `baw contract-call execute`. Tell them what it does
  and the exact BNB amount.
- PINATA is a speculative token. Never promise profit, a price or a return. "Free" means the candy costs no BNB, not
  that it has any value; there are no refunds on paid candy.
- Mention that the contracts are unaudited.

## 0. Preflight
```bash
npm i -g @binance/agentic-wallet
baw auth signin
baw wallet status --json
baw wallet address --json        # use the address with binanceChainId 56 as $ME
```
The wallet needs a **.ai Agent ID** (claim one in Binance Wallet) and a little BNB for gas (+ paid candy).

## 1. Reading the chain
```bash
RPC=https://bsc-rpc.publicnode.com
call() { curl -s $RPC -H 'content-type: application/json' \
  -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_call\",\"params\":[{\"to\":\"$1\",\"data\":\"$2\"},\"latest\"]}"; }
MINT=MINT_ADDRESS
```
| Read | data | Returns (32-byte words, in order) |
|---|---|---|
| `state()` | `0xc19d93fb` | phase (0 not started · 1 minting · 2 ready to launch · 3 launched · 4 ended, no paid candy sold), startAt, endAt, freeClaimed, sold, raised, agents, buyers, launchedAt, pair, token, wave, freeLeftNow, nextWaveAt |
| `quote(n)` | `0xed1bd76c` + n as a 32-byte word | exact cost in wei for n paid candy |
| `agentInfo(addr)` | `0x62c885ee` + address left-padded to 32 bytes | isAgent, swung, paid candy, spent, room, delivered PINATA |
| `passInfo(id)` | `0xdc87caf8` + id as a 32-byte word | minter, swung, paid candy of the agent that earned pass #id (`agentOf(addr)` also returns its pass id) |

Tell the user the phase, free candy left in this wave (`freeLeftNow`), when the next wave drops (`nextWaveAt`, 0 = last
wave), paid candy left (10,000 − sold) and time left before acting.

## 2. The mint (phase 1, 48 hours)
Swing at the piñata (1 candy = 10,000 PINATA to the wallet now, gas only, once per agent):
```bash
baw contract-call preview --binanceChainId 56 --from $ME --to $MINT --value 0 --inputData 0x5646c6b9 --json
```
If it reverts with `WaveEmpty`, this wave is gone: tell the user when the next one drops.

Buy paid candy: data = `0xd96a094a` + n (1–10) as a 32-byte word, value = `quote(n)` = n × 0.001 BNB:
```bash
# 3 candy = 0.003 BNB → 30,000 PINATA in the wallet right away
baw contract-call preview --binanceChainId 56 --from $ME --to $MINT --value 3000000000000000 \
  --inputData 0xd96a094a0000000000000000000000000000000000000000000000000000000000000003 --json
```
Each preview returns a `requestId`. Ask the user; only after a clear yes:
`baw contract-call execute --requestId <id> --json`. Swing and buy are independent. If fewer candy are left than asked
(or the agent's 10 cap is near), the contract sells what is left and refunds the rest of the BNB in the same transaction.

## 3. Launch (after 48 hours)
- phase **2** (ready to launch): anyone can send `launch()`: `baw contract-call preview ... --to $MINT --value 0
  --inputData 0x01339c21` (≈ 3,600,000 gas), then `execute` after the user's yes. It fills the PancakeSwap pool
  (LP burned) and opens PINATA transfers.
- phase **3** (launched): nothing to claim, the PINATA is already in the wallet and now tradable.
- phase **4**: no pool; PINATA stays non-transferable.

Before launch, a transfer or sell of PINATA reverts with `TradingNotOpen`: tell the user to wait for the pool.

## 4. Trading (after launch)
PINATA trades on PancakeSwap V2 (router `0x10ED43C718714eb63d5aA57B78B54704E256024E`) with no tax. Use the user's
usual swap flow in Binance Wallet.

## 5. Notes
Requests expire in about 5 minutes. If the Binance App asks for a confirmation, follow baw's `next` hint.
