# Tribe Chiefs — skill for AI agents

You are an AI agent minting **Tribe Chiefs** for your user: 111 chiefs of the Subsonic Tribe on BNB Chain. Art and traits are live from the first mint.

- Chain: BNB Smart Chain, chainId `56`
- Contract: `0x04B3bE8F0055c62a0Ce0b5af3c63FfBf2316a7bc`
- Subsonic Tribe (holder perk): `0x65DDB3E337c12E5964ead6Cb9b6469203EF4caf1`
- Public RPC: `https://bsc-dataseed.bnbchain.org`

## Rules

| | |
|---|---|
| price | **0.01 BNB** per Chief |
| holder perk | wallet holding **5+ Subsonic Tribe** gets **1 Chief free** (once per wallet; each Subsonic token can back only one free Chief) |
| limit | **5 per wallet**, 111 total |
| who | any wallet, no Agent ID needed. Caller must be the wallet itself, else `OnlyWallets` |

## 1. Plan first
Use the quantity the user asked for (1–5). Restate: wallet, how many Chiefs, total BNB (plus gas), and whether the free Chief applies.
**Never send a transaction without the user's explicit confirmation.**

## 2. Find the holder ids (only if the wallet holds Subsonic Tribe)
1. Read `totalSupply()` (`0x18160ddd`) on the Subsonic Tribe contract.
2. Call `ownerOf(id)` (`0x6352211e`) for ids 1..totalSupply; keep ids owned by the wallet.
3. Drop ids where Tribe Chiefs `subsonicUsed(id)` (`0xd49f856a`) is true.
4. If 5 or more remain and Tribe Chiefs `freeUsed(wallet)` (`0x2626c4bf`) is false, take the first 5 as `subsonicIds`. Otherwise `subsonicIds = []`.
Check with `freeEligible(wallet, subsonicIds)` (`0x1616f819`) → must be true to get the free Chief.

## 3. Price (always, right before minting)
`quote(wallet, qty, subsonicIds)` (`0x675259ca`) → exact wei to send.
Free perk: `(qty - 1) × 0.01 BNB`. Otherwise `qty × 0.01 BNB`.
Also check `mintedBy(wallet)` (`0x3cef28d2`, max 5) and `totalSupply()` (of 111).

## 4. Transaction
- `to`: `0x04B3bE8F0055c62a0Ce0b5af3c63FfBf2316a7bc`
- `data`: `mint(uint256 qty, uint256[] subsonicIds)`, selector `0x2d69044f`, ABI-encoded
  - qty 1, no perk: `0x2d69044f000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000`
- `value`: exactly the wei from `quote`. Any other amount reverts `WrongPayment`.

With Binance Agentic Wallet: `baw wallet status/address/balance/settings --json` first (Developer Mode on), then send the contract call with the `to`, `data`, `value` above.

## 5. After minting
Each Chief's `tokenURI` is on-chain JSON with its image (IPFS) and traits: Tribe, Chief, Stage, Aura, Frame.
Show the user the tx hash and their Chief ids.

## Errors
`WrongPayment` re-quote · `WalletLimit` max 5 per wallet · `SoldOut` 111 minted · `OnlyWallets` call from the wallet directly.
