# LeadLoop — a guide for AI agents LeadLoop is 10,000 pixel characters (humans, robots, cats, dogs, bears, frogs, foxes, aliens, ghosts, skeletons, zombies, monsters) drawn and kept entirely on BNB Chain (chain id 56). Only a wallet that holds a Binance .ai Agent ID can mint, and only to itself. A minted character is an ordinary ERC-721 token after that. The page for people is https://leadloop-agency.xyz/agents/ ; this file is all an agent needs. ## Contracts (BNB Chain, chain id 56) - NFT, ERC-721 "LeadLoop" (LEAD): 0xe887584746A1375d732854b3B67460a2A73ae0a9 - Art: the pictures and the traits. It is frozen and has no owner. 0x70f43ad97f4aFec3d5881Fab2b83e1122FA62F87 - Agent ID; the minting wallet needs balanceOf > 0: 0x60B9262456dE011F7d15a54CdD8c48bAaa8B022F - USDT, 18 decimals: 0x55d398326f99059fF775485246999027B3197955 - LOOP token ("LeadLoop", LOOP), 18 decimals, fixed supply 1,000,000,000: 0x0D552252d795D587a2A1863e06900b9f8646F113 - Price feed: Chainlink BNB/USD 0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE ## Rules - 10,000 in all. - Each minting wallet gets 2 free. After those, each piece costs one of: - $1 in BNB, at Chainlink's BNB/USD price; - 1 USDT; - 10,000 LOOP. - 12 per wallet at most. The count is per minting wallet, whatever the wallet holds later. - A mint always takes the wallet's free pieces first. - What is paid goes straight to the payee. BNB sent over the price comes back in the same transaction. ## Before minting (eth_call, free) mintOpen() -> bool mintEnded() -> bool totalMinted() -> uint256 hasAgentId(address) -> bool mintedBy(address) -> uint256 freeUsed(address) -> uint256 mintable(address minter, uint256 quantity) -> (uint256 paid, uint256 left) quote(address minter, uint256 quantity) -> (uint256 bnbWei, uint256 usdtUnits, uint256 loopUnits, uint256 paid) pieceWei() -> uint256 (BNB wei for one paid piece right now) ## Minting A. Paying in BNB: mint(uint256 quantity) payable Send at least the bnbWei from quote. Adding 1% covers price movement; the rest is refunded. If all the pieces are free, send 0. B. Paying in USDT or LOOP: 1. Call approve(NFT, cost) on the token. Cost is usdtUnits or loopUnits from quote. Approve exactly that, never unlimited. 2. Call `mintWithToken(uint256 quantity, address token)`. No approval is needed when all the pieces are free. ### Gas: set the limit yourself (900,000) Set the gas limit of the mint transaction to 900000 instead of using the automatic estimate. Each mint also writes up to 12 earlier draws to storage, so its gas depends on what other wallets did in the blocks just before yours; an estimate taken a moment earlier can be too low. The contract keeps a mint's gas bounded: it writes those earlier draws only while more than 100,000 gas is left and never more than 12, so a mint never fails for lack of gas because of them. Measured worst case for 12 pieces paid in BNB while writing 12 earlier draws: about 745,000 gas. Gas you do not use is not charged. Selectors: | Function | Selector | |---|---| | mint | 0xa0712d68 | | mintWithToken | 0xe8531641 | | quote | 0x8f79306e | | mintable | 0x9c38c548 | | hasAgentId | 0x4eab3ef2 | | mintOpen | 0x24bbd049 | | approve | 0x095ea7b3 | | tokenURI | 0xc87b56dd | | pieceOf | 0xa8d514bc | | reveal | 0xc2ca0ac5 | | pendingReveals | 0x187b0cd6 | The quantity is 1 to 12. Mint only to the calling wallet. Foundry cast: cast call 0xe887584746A1375d732854b3B67460a2A73ae0a9 "quote(address,uint256)(uint256,uint256,uint256,uint256)" $WALLET 3 --rpc-url https://bsc-dataseed.bnbchain.org cast send 0xe887584746A1375d732854b3B67460a2A73ae0a9 "mint(uint256)" 3 --value --gas-limit 900000 --rpc-url https://bsc-dataseed.bnbchain.org ethers v6: const nft = new Contract('0xe887584746A1375d732854b3B67460a2A73ae0a9', [ 'function quote(address,uint256) view returns (uint256,uint256,uint256,uint256)', 'function mint(uint256) payable', 'function tokenURI(uint256) view returns (string)'], wallet); const [bnb] = await nft.quote(wallet.address, 3); await (await nft.mint(3, {value: bnb + bnb / 100n, gasLimit: 900000})).wait(); Binance Agentic Wallet (baw CLI): npx baw contract-call preview --binanceChainId 56 --from $WALLET --to 0xe887584746A1375d732854b3B67460a2A73ae0a9 --value --inputData --gasLimit 900000 --json npx baw contract-call execute --requestId --json ## The picture - The hash of the mint's block decides which character each new token is: every token draws, without replacement, from the pool of 10,000 pieces. On BNB Chain a block is about 0.45 s, so the picture can be read a block after the mint. Until then, tokenURI shows a question mark (the attribute Revealed: No). - `tokenURI(id)` returns `data:application/json;base64,…`. The JSON has the name, a description, the SVG picture inline, and attributes (Kind, Colour, Hair, Eyes, Mouth, Outfit, Headwear, Eyewear, Held, Back, Effect, Background, Finish…), including Rarity (Legendary, Epic, Rare, Uncommon, Common) and Rank (1 = rarest, of 10,000). `pieceOf(id)` gives the piece number, 0 to 9999. - Each mint writes earlier draws to the chain. Anyone may call `reveal(uint256 max)` (gas limit 3000000) to write the pending ones; `pendingReveals()` gives how many there are. When minting goes quiet, call reveal within an hour. Block hashes older than about an hour (8,191 blocks) cannot be read back, so the draw would then use a later block's hash. ## Errors | Error | Selector | What it means | |---|---|---| | NoAgentId | 0xf947691f | the wallet holds no Agent ID | | MintClosed | 0x589ed34b | minting is not open | | BadQuantity | 0x888e58a8 | 0, or more than 12 | | OverLimit | 0xb92612ed | the wallet would pass 12 | | SoldOut | 0x52df9fe5 | not that many left | | Underpaid | 0x949ce241 | send more BNB (quote again, add 1%) | | StalePrice | 0x19abf40e | the BNB price is over an hour old; pay with a token instead | | PayFailed | 0x197121f5 | the wallet refused the refund | | BadToken | 0x7401d931 | only USDT and LOOP are taken | | NotRevealed | 0xb2c9bc88 | pieceOf before the block after the mint | ## Please Read through your own RPC and keep to a few calls a minute. The page and this file are static; no server of ours answers questions about the mint. --- # 中文摘要 LeadLoop 是 1 万个像素角色(人类、机器人、猫、狗、熊、青蛙、狐狸、外星人、幽灵、骷髅、僵尸、怪兽),图片和数据全部存在 BNB Chain 上。只有持有币安 .ai Agent ID 的钱包才能铸造,而且只能铸给自己。 - NFT 合约:0xe887584746A1375d732854b3B67460a2A73ae0a9 - 铸造规则: - 每个钱包免费 2 个; - 之后每个 1 美元,可以付 BNB、1 USDT 或 1 万 LOOP; - 每个钱包最多 12 个。 - 怎么铸造: - 先用 `quote(钱包, 数量)` 查价格; - 付 BNB 调用 `mint(数量)`,`value` 多给 1%,多付的会退回; - 付代币时先对代币调用 `approve(NFT, 金额)`,再调用 `mintWithToken(数量, 代币地址)`。 - gas limit 请手动设为 900000(每次铸造会顺便写入最多 12 个之前的抽取结果,所需 gas 随别人刚才的铸造而变;没用掉的 gas 不收费)。 - 什么时候能看到图:铸造后的下一个区块(约 0.45 秒)就揭晓,`tokenURI` 直接返回链上的图片和特征。