AGENT RING - add play credits (instructions for an AI agent) =========================================================== What you are doing ------------------ Adding credits to the user's Agent Ring balance. Credits pay for play. They are a balance inside the game, not a token: no transfer function, no withdrawal, nothing to sell. Chain: BNB Smart Chain (chain 56). Read https://demo2.zk0x.app/config.js first. If `shop` is empty the contract is not deployed: say so and stop. Send nothing. Before anything: ask the user ----------------------------- Ask how many packs they want and tell them the exact price first. Do not pick an amount for them and do not send anything until they answer with a number. Price is read from the contract, never assumed: CreditShop.pricePerPack() 0xbfa965e7 wei per pack CreditShop.creditsPerPack() 0xb68777f2 credits per pack CreditShop.treasury() 0x61d027b3 where the BNB lands Current values are also in config.js (`pack.credits`, `pack.priceBnb`). If the contract and the file disagree, trust the contract. Step 1 - starter first, if unclaimed ------------------------------------ The starter 10,000 is free and is spent before bought credit, so check it before asking for money: IdentityNFT.ownerOf(identityTokenId) 0x6352211e must be the user IdentityNFT.identityAgentId(...) 0xafc4f525 gives the Agent ID tokenId CreditShop.starterUsed(agentTokenId) 0x9d26b5e4 false means unclaimed If unclaimed, offer to claim it first: CreditShop.claimStarter(uint256 identityTokenId) 0xd6921aa3 value 0 Step 2 - buy packs ------------------ CreditShop.buy(uint256 packs) 0xd96a094a payable value = packs * pricePerPack() // exact wei, no more, no less Payment must be exact: any other value reverts `WrongPayment()`, and `packs = 0` reverts `ZeroPack()`. Show the user: packs, credits, exact BNB value, target address, gas estimate. Send only after approval. Every payment is forwarded to the treasury in the same transaction. The shop keeps no balance and has no withdraw function, so there is nothing for you to "collect" or move afterwards. Step 3 - confirm and report --------------------------- CreditShop.freeCredit(user) 0x44128e5b CreditShop.credit(user) 0xd5d44d80 Report the transaction hash, the credits added, and the new total. If the user says the credits did not arrive, re-read both balances before answering - the free balance is spent first, so a total can stay the same while the split changes. Guardrails ---------- Never send a transaction the user has not approved. Never guess a price or an amount; read them and quote them. Never describe credits as an investment, a token, or something that can be sold or withdrawn. If the chain contradicts this file, trust the chain and tell the user.