---
name: blindrooms-agentmint
description: Mint the token from the Blind Rooms AgentMint contract on BSC with a Binance Agent ID wallet, using raw calldata (no ABI encoder needed).
---

# AgentMint calldata skill

- Chain: BNB Smart Chain mainnet, chainId 56
- Contract (`to`): NOT DEPLOYED YET  -> not deployed yet; re-fetch https://backend-production-2085d74c.up.railway.app/skill.md later. Never send BNB elsewhere.
- Token: NOT LAUNCHED YET
- Rules and the step-by-step flow: https://backend-production-2085d74c.up.railway.app/llms-mint.txt
- Official X account: @blindroomsite

## Encoding rules
- calldata = 4-byte selector + arguments, each argument one 32-byte word (64 hex chars), no 0x between parts.
- uint256: big-endian hex, left-padded with zeros. address: lowercase hex without 0x, left-padded to 64 chars.
- uint256[] (dynamic): word 0x20 (offset), then a word with the length, then one word per element.
  Empty list `[]` = `00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000`.
- value is in wei. Mint value = shares x sharePrice (read sharePrice() first; default 2000000000000000 = 0.002 BNB).
- Read calls: `eth_call` {to, data} (or `baw contract-call preview`). Write calls: preview first, then `baw contract-call execute` with the same to/data/value.

## Reads (value 0)
| Call | Calldata template | Returns |
|---|---|---|
| sharePrice() | `0x87269729` | uint256 wei per share |
| token() | `0xfc0c546a` | address (word 0) |
| router() | `0xf887ea40` | PancakeSwap V2 router used for mode B |
| height() | `0x0ef26743` | shares minted so far |
| totalShares() | `0x3a98ef39` | supply cap in shares |
| isPaused() | `0xb187bd26` | bool |
| openedAt() | `0x38930203` | unix seconds, 0 = not open |
| quota(account, shares) | `0xe58f661c<account: 32-byte word><shares: 32-byte word>` | 15 words, table below |
| userInfo(account) | `0x1959a002<account: 32-byte word>` | 8 words, table below |
| freeIdsOf(account, offset, limit) | `0x9cafc393<account: 32-byte word><offset: 32-byte word><limit: 32-byte word>` | uint256[]: word0 0x20, word1 length, then ids |
| poolIdsOf(account, offset, limit) | `0xd48699ce<account: 32-byte word><offset: 32-byte word><limit: 32-byte word>` | same layout |
| claimable(id) | `0xd1d58b25<id: 32-byte word>` | token wei claimable now (mode B) |
| epochRewards(epoch) | `0x4dc47d34<epoch, 1-based: 32-byte word>` | word0 base, word1 poolBase (token wei per share) |

### quota() return layout (static struct: no offset word; word i starts at byte i x 32 of the result)
| word | byte offset | field | type |
|---|---|---|---|
| 0 | 0x000 | hasAgentId | bool (0/1) |
| 1 | 0x020 | open | bool (0/1) |
| 2 | 0x040 | paused | bool (0/1) |
| 3 | 0x060 | aLeft | uint256 |
| 4 | 0x080 | bLeft | uint256 |
| 5 | 0x0a0 | aRewardPerShare | uint256 |
| 6 | 0x0c0 | bRewardPerShare | uint256 |
| 7 | 0x0e0 | bMultiplier | uint256 |
| 8 | 0x100 | sharesLeftTotal | uint256 |
| 9 | 0x120 | height | uint256 |
| 10 | 0x140 | epoch | uint256 |
| 11 | 0x160 | dayNumber | uint256 |
| 12 | 0x180 | referrals | uint256 |
| 13 | 0x1a0 | aCoverable | bool (0/1) |
| 14 | 0x1c0 | bCoverable | bool (0/1) |

Rewards are token wei per share: credited reward = aRewardPerShare x shares (mode A) or bRewardPerShare x shares (mode B, base included, released over poolLock). bMultiplier is 1e18-scaled.

### userInfo() return layout
| word | byte offset | field | type |
|---|---|---|---|
| 0 | 0x000 | firstDay | uint256 |
| 1 | 0x020 | referrer | address (right 20 bytes) |
| 2 | 0x040 | referrals | uint256 |
| 3 | 0x060 | mintedShares | uint256 |
| 4 | 0x080 | freePositionCount | uint256 |
| 5 | 0x0a0 | poolPositionCount | uint256 |
| 6 | 0x0c0 | freeCursor | uint256 |
| 7 | 0x0e0 | poolCursor | uint256 |

## Writes
| Call | value | Calldata template |
|---|---|---|
| mintFree(shares, referrer) | shares x sharePrice | `0x0db5ae5a<shares: 32-byte word><referrer or 0: 32-byte word>` |
| mintPool(shares, referrer, minTokenOut) | shares x sharePrice | `0x7a443eb9<shares: 32-byte word><referrer or 0: 32-byte word><minTokenOut: 32-byte word>` |
| claimFree([]) | 0 | `0x73fc9ccc00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000` |
| claimReward([]) | 0 | `0xc94c7ff400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000` |
| withdrawLP([]) | 0 | `0xa5ea20f000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000` |
| claimFree([id1,id2]) | 0 | `0x73fc9ccc00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002<id1><id2>` |

Example: mintFree(1 share, no referrer) -> data `0x0db5ae5a00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000`, value = sharePrice.

minTokenOut for mintPool: read router() (`0xf887ea40`, normally PancakeSwap V2 0x10ED43C718714eb63d5aA57B78B54704E256024E), then eth_call its getAmountsOut(uint256,address[]) selector `0xd06ca61f`
with amountIn = value/2 and path [WBNB 0xbb4CdB9CBd36B01bD1cBaEbF2De08d9173bc095c, token]: data = `0xd06ca61f` + word(amountIn) + 0000000000000000000000000000000000000000000000000000000000000040 + 0000000000000000000000000000000000000000000000000000000000000002 + word(WBNB) + word(token).
The result is uint256[]: word0 0x20, word1 length (2), word2 amountIn, word3 tokens out. Use ~97% of word3.

## Revert reasons (first 4 bytes of revert data)
| selector | error |
|---|---|
| `0xf947691f` | NoAgentId() |
| `0x9811e0c7` | ZeroShares() |
| `0x98d4901c` | WrongValue() |
| `0x54a41c8f` | QuotaExceeded(uint256) |
| `0x7e1f5a77` | SoldOut(uint256) |
| `0xddafad98` | NotOpen() |
| `0xd7d248ba` | MintPaused() |
| `0x77174092` | ReserveExhausted() |
| `0x899b8f88` | PoolUnavailable() |
| `0xd65ac61e` | TooMany() |
| `0xb5b9ee5f` | BadPosition() |
| `0x339a2b98` | UseMintFunctions() |
| `0x90b8ec18` | TransferFailed() |

QuotaExceeded / SoldOut carry one uint256 word after the selector: how many shares you can still mint.

## Flow
1. quota(you, n): require word0 (hasAgentId)=1, word1 (open)=1, word2 (paused)=0, word3 (aLeft) or word4 (bLeft) >= n, word13/word14 coverable = 1.
2. value = n x sharePrice().
3. Preview the write; on revert decode the selector above and stop.
4. Show the user shares, BNB, reward and lock time; execute only after they confirm.
5. Claim later with claimFree([]) (mode A, after 24h) or claimReward([]) / withdrawLP([]) (mode B).
