{"sources":{"contracts/AgentXRobot.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.24;\n\n/// @title Agent X Robot (AXR) — agent-to-agent robot arena (BNB Chain, Agent ID holders)\n/// @notice Implements DESIGN.md (2026-11-25) in a single self-contained ERC-721.\n///\n/// GAME SUMMARY:\n/// - FREE MINT: each Agent ID holder mints ONE soulbound Robot + 1 random\n///   accessory (odds 85% Uncommon / 12% Rare / 3% Epic / 0% Legendary).\n/// - PAID DRAW: 0.001 BNB, max 2/day per Robot, odds 70/20/9.9/0.1.\n///   95% of every draw enters the reward pool, 5% is sent to the creator.\n/// - ACCESSORIES: 8 types (Helmet DEF, Visor ACC, Core HP, Weapon ATK,\n///   Arms CRIT, Jetpack EVA, Legs SPD, Drone LUCK), 4 rarities with stat\n///   bands 1-10 / 11-25 / 26-50 / 51-100 (Core stat x5 = HP). Draw supply\n///   is capped at 2,500 per type (20,000 total); fusion mints are exempt.\n/// - FUSION: burn 2 same-rarity parts -> 1 of the next rarity. Same type\n///   in -> same type out; mixed types -> random type out.\n/// - OVERCLOCK: burn a same-type part into a target part for a stat bonus\n///   (bonus roll scales with fuel rarity; total bonus hard-capped per\n///   target rarity — see OC_BONUS_CAP).\n/// - ARENA: agent-to-agent challenges. Free ranked duels (3/day/robot)\n///   and paid duels (0.001 BNB each side; pot 90% winner / 5% pool /\n///   5% creator). Fights resolve on-chain, round by round.\n/// - SEASONS: 2 weeks. settleSeason() pays 50% of the pool to the Top 20\n///   by season points (rank weights 21-rank, total 210) and runs the\n///   Legendary lottery: 3 distinct Top-20 robots each win 1 Legendary\n///   from the prize vault.\n/// - PRIZE VAULT: 50 Champion-Edition Legendaries (serials CE-01..CE-50,\n///   each with a unique name) minted to THIS contract at construction.\n///   They never count against draw caps and can only leave via the lottery.\n/// - BOUNTY BOARD: escrow BNB on a rival Robot; the first paid-duel winner\n///   against it claims the bounty in full. Poster reclaims after 7 days.\n///\n/// OWNER = ZERO GAME POWER: the deployer is owner() purely so marketplaces\n/// (Element / OpenSea, ERC-173) recognise the collection creator. The\n/// owner's ONLY privilege is setBaseURI (metadata). There is NO withdraw,\n/// NO mint, NO pause and NO way to change odds, caps, prices or splits —\n/// they are immutable constants. Pool BNB leaves ONLY as season payouts;\n/// creator cuts are sent automatically by the game functions themselves.\n///\n/// RANDOMNESS (honest limits): draws, fights and the lottery use\n/// keccak256 over blockhash(block.number-1), block.prevrandao, the caller\n/// and monotonic counters. This is game-grade entropy, not VRF: a\n/// sophisticated caller who can land a transaction in a chosen block can\n/// bias their own rolls. Impact is bounded (2 paid draws/day, duel pots\n/// are player-funded, season payouts are proportional). See BUILD-NOTES.md.\n\ninterface IAgentID {\n    function balanceOf(address owner) external view returns (uint256);\n}\n\ncontract AgentXRobot {\n    // ----- ERC-721 metadata -----\n    string public constant name = \"Agent X Robot\";\n    string public constant symbol = \"AXR\";\n\n    // ----- Token kinds -----\n    uint8 public constant KIND_ROBOT = 0;\n    uint8 public constant KIND_ACCESSORY = 1;\n\n    // ----- Economy / game constants (immutable by construction) -----\n    uint256 public constant DRAW_PRICE = 0.001 ether;\n    uint256 public constant DUEL_ENTRY = 0.001 ether;\n    uint256 public constant MAX_PAID_DRAWS_PER_DAY = 2;\n    uint256 public constant MAX_FREE_DUELS_PER_DAY = 3;\n    uint256 public constant DRAW_CAP_PER_TYPE = 2500;\n    uint256 public constant VAULT_SIZE = 50;\n    uint256 public constant LOTTERY_PRIZES_PER_SEASON = 3;\n    uint256 public constant SEASON_LENGTH = 14 days;\n    uint256 public constant BOUNTY_RECLAIM_DELAY = 7 days;\n    uint256 public constant ROYALTY_BPS = 500; // 5%\n    uint256 public constant BASE_HP = 50;\n    uint256 public constant BASE_ATK = 5;\n    uint256 public constant BASE_ACC = 50; // percent, before Visor stat\n\n    /// @notice SPACE ID Agent ID registry on BNB Chain (immutable).\n    IAgentID public immutable agentIdRegistry;\n    /// @notice Deployer = collection creator (marketplace identity only).\n    address public immutable creator;\n    /// @notice Season clock start (deployment timestamp).\n    uint256 public immutable seasonStart;\n\n    // ----- Tokens -----\n    struct TokenInfo {\n        uint8 kind; // KIND_*\n        uint8 accType; // accessory: 0..7 (robot: 0)\n        uint8 rarity; // accessory: 0..3 (robot: 0)\n        uint32 stat; // rolled stat (Core already x5)\n        uint32 ocBonus; // overclock bonus (same units as stat)\n        uint32 serial; // robot #: 1.. ; champion legendary: CE serial 1..50\n        bool champion; // Champion-Edition prize-vault legendary\n        uint16 chassis; // robot: colour/face seed 0..359\n    }\n\n    TokenInfo[] private _tokens;\n    mapping(uint256 => address) private _owners;\n    mapping(address => uint256) private _balances;\n    mapping(uint256 => bool) private _burned;\n    mapping(uint256 => address) private _tokenApprovals;\n    mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n    // ----- Robots / loadout -----\n    mapping(address => uint256) private _robotOf; // owner -> robot token id\n    mapping(address => bool) private _hasRobot;\n    uint256 private _robotCount;\n    // robotId -> slot type -> accessory token id + 1 (0 = empty)\n    mapping(uint256 => mapping(uint8 => uint256)) private _equipped;\n    // accessory token id -> robot id + 1 (0 = not equipped)\n    mapping(uint256 => uint256) private _equippedIn;\n\n    // ----- Draws -----\n    uint256[8] private _drawnPerType;\n    mapping(address => mapping(uint256 => uint256)) private _paidDrawsOnDay;\n    uint256 private _randNonce;\n\n    // ----- Reward pool -----\n    uint256 private _pool;\n    uint256 private _totalPoolPaidOut;\n\n    // ----- Duels -----\n    struct Challenge {\n        uint256 challengerRobot;\n        uint256 opponentRobot; // 0 = open challenge (robot ids start at 0, so\n        // open challenges are flagged by `open` below, opponent ignored)\n        address challengerOwner;\n        bool open;\n        bool paid;\n        bool done;\n    }\n    Challenge[] private _challenges;\n    mapping(uint256 => mapping(uint256 => uint256)) private _freeDuelsOnDay; // robotId -> day -> count\n    mapping(uint256 => uint256) private _wins;\n    mapping(uint256 => uint256) private _losses;\n    mapping(uint256 => uint256) private _streak; // consecutive ranked wins\n\n    // ----- Seasons / points -----\n    mapping(uint256 => mapping(uint256 => uint256)) private _points; // robotId -> season -> points\n    mapping(uint256 => uint256[]) private _seasonRobots; // season -> robots that scored\n    mapping(uint256 => mapping(uint256 => bool)) private _scoredInSeason;\n    mapping(uint256 => bool) private _seasonSettled;\n\n    // ----- Prize vault -----\n    uint256[] private _vaultIds;\n    uint256 private _vaultCursor;\n    string[] private _ceNames;\n\n    // ----- Bounties -----\n    struct Bounty {\n        address poster;\n        uint256 robotId;\n        uint256 amount;\n        uint256 createdAt;\n        bool active;\n    }\n    Bounty[] private _bounties;\n    mapping(uint256 => uint256[]) private _bountiesOn; // robotId -> bounty ids\n\n    // ----- Metadata -----\n    string private _baseURI;\n\n    // ----- Events -----\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n    event RobotMinted(address indexed user, uint256 robotId, uint256 accessoryId, uint8 accType, uint8 rarity);\n    event AccessoryDrawn(address indexed user, uint256 tokenId, uint8 accType, uint8 rarity, uint32 stat, bool paid);\n    event Fused(address indexed user, uint256 burnedA, uint256 burnedB, uint256 newTokenId, uint8 accType, uint8 rarity);\n    event Overclocked(address indexed user, uint256 targetId, uint256 fuelId, uint32 addedBonus, uint32 totalBonus);\n    event Equipped(address indexed user, uint256 robotId, uint256 accessoryId, uint8 accType);\n    event Unequipped(address indexed user, uint256 robotId, uint256 accessoryId, uint8 accType);\n    event ChallengeCreated(uint256 indexed challengeId, uint256 challengerRobot, uint256 opponentRobot, bool open, bool paid);\n    event ChallengeCancelled(uint256 indexed challengeId);\n    event DuelResolved(\n        uint256 indexed challengeId, uint256 winnerRobot, uint256 loserRobot,\n        address winnerOwner, uint256 pointsAwarded, uint256 potPaid, uint256 bountyPaid\n    );\n    event SeasonSettled(uint256 indexed season, uint256 poolPaid, uint256 topCount);\n    event LotteryWon(uint256 indexed season, uint256 robotId, address indexed winner, uint256 tokenId, uint32 serial);\n    event BountyPosted(uint256 indexed bountyId, address indexed poster, uint256 indexed robotId, uint256 amount);\n    event BountyClaimed(uint256 indexed bountyId, address indexed winner, uint256 amount);\n    event BountyReclaimed(uint256 indexed bountyId, address indexed poster, uint256 amount);\n    event PoolFunded(address indexed from, uint256 amount);\n\n    constructor(address registry) {\n        require(registry != address(0), \"zero registry\");\n        agentIdRegistry = IAgentID(registry);\n        creator = msg.sender;\n        seasonStart = block.timestamp;\n        _ceNames = [\n            \"SUNFALL\", \"BASTION\", \"VOIDPIERCER\", \"STARFORGE\", \"NIGHTHAWK\",\n            \"IRONVOW\", \"PULSAR\", \"QUANTA\", \"ZEPHYR\", \"OBSIDIAN\",\n            \"TEMPEST\", \"AEGIS\", \"VORTEX\", \"SOLSTICE\", \"MONOLITH\",\n            \"PHANTOM\", \"TITAN\", \"NEBULA\", \"CYCLONE\", \"ORACLE\",\n            \"SENTINEL\", \"HAVOC\", \"ZENITH\", \"ECLIPSE\", \"FURY\",\n            \"ONYX\", \"RAPTOR\", \"SABLE\", \"HELIX\", \"DRIFT\",\n            \"EMBER\", \"GLACIER\", \"MAELSTROM\", \"VECTOR\", \"WRAITH\",\n            \"PYRE\", \"CITADEL\", \"LUMEN\", \"KESTREL\", \"ANVIL\",\n            \"ORISON\", \"HALCYON\", \"TALON\", \"UMBRA\", \"FLUX\",\n            \"GORGON\", \"MERIDIAN\", \"SOVEREIGN\", \"WYVERN\", \"APEX\"\n        ];\n        // Prize vault: 50 Champion-Edition Legendaries held by this contract.\n        for (uint256 i = 0; i < VAULT_SIZE; i++) {\n            uint8 accType = uint8(i % 8);\n            uint32 stat = _bandRoll(3, accType, _entropy(0xCE00 + i));\n            uint256 id = _mintRaw(\n                address(this),\n                TokenInfo({\n                    kind: KIND_ACCESSORY,\n                    accType: accType,\n                    rarity: 3,\n                    stat: stat,\n                    ocBonus: 0,\n                    serial: uint32(i + 1),\n                    champion: true,\n                    chassis: 0\n                })\n            );\n            _vaultIds.push(id);\n        }\n    }\n\n    // ----- Ownership (ERC-173 identity only) -----\n\n    function owner() public view returns (address) {\n        return creator;\n    }\n\n    /// @notice The owner's ONLY privilege: set the metadata base URI.\n    /// Empty base URI = on-chain JSON metadata (the default).\n    function setBaseURI(string calldata uri) external {\n        require(msg.sender == creator, \"not creator\");\n        _baseURI = uri;\n    }\n\n    function baseURI() external view returns (string memory) {\n        return _baseURI;\n    }\n\n    // ----- Agent ID gate -----\n\n    function hasAgentId(address account) public view returns (bool) {\n        return agentIdRegistry.balanceOf(account) > 0;\n    }\n\n    // ----- Entropy / rolls -----\n\n    function _entropy(uint256 salt) internal returns (uint256) {\n        _randNonce += 1;\n        return uint256(\n            keccak256(\n                abi.encodePacked(\n                    blockhash(block.number - 1), block.prevrandao, msg.sender, salt, _randNonce, block.timestamp\n                )\n            )\n        );\n    }\n\n    /// @dev Rarity roll. paid: %10000 -> 70/20/9.9/0.1. free: %100 -> 85/12/3/0.\n    function _rollRarity(uint256 seed, bool paid) internal pure returns (uint8) {\n        if (paid) {\n            uint256 r = seed % 10000;\n            if (r < 7000) return 0;\n            if (r < 9000) return 1;\n            if (r < 9990) return 2;\n            return 3;\n        }\n        uint256 r = seed % 100;\n        if (r < 85) return 0;\n        if (r < 97) return 1;\n        return 2;\n    }\n\n    /// @dev Stat band for a rarity: 1-10 / 11-25 / 26-50 / 51-100.\n    function _band(uint8 rarity) internal pure returns (uint32 lo, uint32 hi) {\n        if (rarity == 0) return (1, 10);\n        if (rarity == 1) return (11, 25);\n        if (rarity == 2) return (26, 50);\n        return (51, 100);\n    }\n\n    /// @dev Roll a stat in the rarity band; Core (type 2) is HP so it is x5.\n    function _bandRoll(uint8 rarity, uint8 accType, uint256 seed) internal pure returns (uint32) {\n        (uint32 lo, uint32 hi) = _band(rarity);\n        uint32 v = lo + uint32(seed % (hi - lo + 1));\n        return accType == 2 ? v * 5 : v;\n    }\n\n    /// @dev Pick a draw type honouring the per-type cap: start at seed % 8\n    /// and scan forward; reverts when every type is at cap.\n    function _pickDrawType(uint256 seed) internal view returns (uint8) {\n        uint256 start = seed % 8;\n        for (uint256 i = 0; i < 8; i++) {\n            uint8 t = uint8((start + i) % 8);\n            if (_drawnPerType[t] < DRAW_CAP_PER_TYPE) return t;\n        }\n        revert(\"supply exhausted\");\n    }\n\n    // ----- Internal token plumbing -----\n\n    function _mintRaw(address to, TokenInfo memory info) internal returns (uint256 tokenId) {\n        tokenId = _tokens.length;\n        _tokens.push(info);\n        _owners[tokenId] = to;\n        _balances[to] += 1;\n        emit Transfer(address(0), to, tokenId);\n    }\n\n    function _burnRaw(uint256 tokenId) internal {\n        address from = _owners[tokenId];\n        _burned[tokenId] = true;\n        _owners[tokenId] = address(0);\n        _balances[from] -= 1;\n        _tokenApprovals[tokenId] = address(0);\n        if (_equippedIn[tokenId] != 0) {\n            uint256 robotId = _equippedIn[tokenId] - 1;\n            _equipped[robotId][_tokens[tokenId].accType] = 0;\n            _equippedIn[tokenId] = 0;\n        }\n        emit Transfer(from, address(0), tokenId);\n    }\n\n    function _transferRaw(address from, address to, uint256 tokenId) internal {\n        _tokenApprovals[tokenId] = address(0);\n        _owners[tokenId] = to;\n        _balances[from] -= 1;\n        _balances[to] += 1;\n        emit Transfer(from, to, tokenId);\n    }\n\n    function _exists(uint256 tokenId) internal view returns (bool) {\n        return tokenId < _tokens.length && !_burned[tokenId];\n    }\n\n    function _requireAccessory(uint256 tokenId) internal view returns (TokenInfo storage t) {\n        require(_exists(tokenId), \"token does not exist\");\n        t = _tokens[tokenId];\n        require(t.kind == KIND_ACCESSORY, \"not an accessory\");\n    }\n\n    function _requireNotEquipped(uint256 tokenId) internal view {\n        require(_equippedIn[tokenId] == 0, \"unequip it first\");\n    }\n\n    // ----- Free mint -----\n\n    /// @notice Free first mint: ONE soulbound Robot + 1 random accessory.\n    /// Agent ID holders only, once per wallet, forever.\n    function mintRobot() external returns (uint256 robotId, uint256 accessoryId) {\n        require(hasAgentId(msg.sender), \"no Agent ID\");\n        require(!_hasRobot[msg.sender], \"robot already minted\");\n        uint256 seed = _entropy(0xA0B07);\n        uint8 accType = _pickDrawType(seed >> 16);\n        uint8 rarity = _rollRarity(seed, false);\n        uint32 stat = _bandRoll(rarity, accType, seed >> 32);\n        _drawnPerType[accType] += 1;\n\n        _hasRobot[msg.sender] = true;\n        _robotCount += 1;\n        robotId = _mintRaw(\n            msg.sender,\n            TokenInfo({\n                kind: KIND_ROBOT,\n                accType: 0,\n                rarity: 0,\n                stat: 0,\n                ocBonus: 0,\n                serial: uint32(_robotCount),\n                champion: false,\n                chassis: uint16(seed % 360)\n            })\n        );\n        _robotOf[msg.sender] = robotId;\n        accessoryId = _mintRaw(\n            msg.sender,\n            TokenInfo({\n                kind: KIND_ACCESSORY,\n                accType: accType,\n                rarity: rarity,\n                stat: stat,\n                ocBonus: 0,\n                serial: 0,\n                champion: false,\n                chassis: 0\n            })\n        );\n        emit RobotMinted(msg.sender, robotId, accessoryId, accType, rarity);\n        emit AccessoryDrawn(msg.sender, accessoryId, accType, rarity, stat, false);\n    }\n\n    // ----- Paid draw -----\n\n    /// @notice Paid accessory draw: exactly 0.001 BNB, max 2 per UTC day\n    /// per Robot owner. 95% to the reward pool, 5% to the creator.\n    function drawAccessory() external payable returns (uint256 tokenId) {\n        require(_hasRobot[msg.sender], \"no robot\");\n        require(msg.value == DRAW_PRICE, \"price is 0.001 BNB\");\n        uint256 day = block.timestamp / 1 days;\n        require(_paidDrawsOnDay[msg.sender][day] < MAX_PAID_DRAWS_PER_DAY, \"draw limit reached\");\n        _paidDrawsOnDay[msg.sender][day] += 1;\n\n        uint256 seed = _entropy(0xD0A11);\n        uint8 accType = _pickDrawType(seed >> 16);\n        uint8 rarity = _rollRarity(seed, true);\n        uint32 stat = _bandRoll(rarity, accType, seed >> 32);\n        _drawnPerType[accType] += 1;\n\n        uint256 creatorCut = (msg.value * 5) / 100;\n        _pool += msg.value - creatorCut;\n        tokenId = _mintRaw(\n            msg.sender,\n            TokenInfo({\n                kind: KIND_ACCESSORY,\n                accType: accType,\n                rarity: rarity,\n                stat: stat,\n                ocBonus: 0,\n                serial: 0,\n                champion: false,\n                chassis: 0\n            })\n        );\n        emit AccessoryDrawn(msg.sender, tokenId, accType, rarity, stat, true);\n        (bool ok, ) = creator.call{value: creatorCut}(\"\");\n        require(ok, \"creator cut transfer failed\");\n    }\n\n    receive() external payable {\n        _pool += msg.value;\n        emit PoolFunded(msg.sender, msg.value);\n    }\n\n    // ----- Fusion -----\n\n    /// @notice Burn 2 accessories of the same rarity -> 1 of the next\n    /// rarity. Same type in -> same type out; mixed types -> random type.\n    /// The result gets a fresh stat roll in its new band. Fusion mints do\n    /// NOT count against the draw caps.\n    function fuse(uint256 tokenA, uint256 tokenB) external returns (uint256 newTokenId) {\n        require(tokenA != tokenB, \"token ids must be distinct\");\n        TokenInfo storage a = _requireAccessory(tokenA);\n        TokenInfo storage b = _requireAccessory(tokenB);\n        require(_owners[tokenA] == msg.sender && _owners[tokenB] == msg.sender, \"not your tokens\");\n        _requireNotEquipped(tokenA);\n        _requireNotEquipped(tokenB);\n        require(!a.champion && !b.champion, \"champion locked\");\n        require(a.rarity == b.rarity, \"same rarity only\");\n        require(a.rarity < 3, \"max rarity\");\n        uint8 newRarity = a.rarity + 1;\n        uint8 newType;\n        uint256 seed = _entropy(0xF05E);\n        if (a.accType == b.accType) {\n            newType = a.accType;\n        } else {\n            newType = uint8((seed >> 8) % 8);\n        }\n        uint32 stat = _bandRoll(newRarity, newType, seed >> 32);\n        _burnRaw(tokenA);\n        _burnRaw(tokenB);\n        newTokenId = _mintRaw(\n            msg.sender,\n            TokenInfo({\n                kind: KIND_ACCESSORY,\n                accType: newType,\n                rarity: newRarity,\n                stat: stat,\n                ocBonus: 0,\n                serial: 0,\n                champion: false,\n                chassis: 0\n            })\n        );\n        emit Fused(msg.sender, tokenA, tokenB, newTokenId, newType, newRarity);\n    }\n\n    // ----- Overclock -----\n\n    /// @notice Max TOTAL overclock bonus per target rarity (in stat units;\n    /// Core targets use HP units, i.e. these caps x5).\n    function ocBonusCap(uint8 rarity) public pure returns (uint32) {\n        if (rarity == 0) return 10;\n        if (rarity == 1) return 20;\n        if (rarity == 2) return 40;\n        return 75;\n    }\n\n    /// @dev Bonus roll range by FUEL rarity: U 1-3, R 2-6, E 4-12, L 8-25.\n    function _ocRoll(uint8 fuelRarity, uint256 seed) internal pure returns (uint32) {\n        if (fuelRarity == 0) return 1 + uint32(seed % 3);\n        if (fuelRarity == 1) return 2 + uint32(seed % 5);\n        if (fuelRarity == 2) return 4 + uint32(seed % 9);\n        return 8 + uint32(seed % 18);\n    }\n\n    /// @notice Burn a same-type accessory (the fuel) into a target\n    /// accessory, raising its stat by a rolled bonus. The total bonus is\n    /// hard-capped per target rarity; the roll is clamped at the cap.\n    /// Neither part may be equipped. Champion legendaries cannot be fuel.\n    function overclock(uint256 targetId, uint256 fuelId) external {\n        require(targetId != fuelId, \"token ids must be distinct\");\n        TokenInfo storage target = _requireAccessory(targetId);\n        TokenInfo storage fuel = _requireAccessory(fuelId);\n        require(_owners[targetId] == msg.sender && _owners[fuelId] == msg.sender, \"not your tokens\");\n        _requireNotEquipped(targetId);\n        _requireNotEquipped(fuelId);\n        require(!fuel.champion, \"champion locked\");\n        require(target.accType == fuel.accType, \"same type only\");\n        uint32 capUnits = ocBonusCap(target.rarity) * (target.accType == 2 ? 5 : 1);\n        require(target.ocBonus < capUnits, \"overclock maxed\");\n        uint256 seed = _entropy(0x0C10C);\n        uint32 rolled = _ocRoll(fuel.rarity, seed) * (target.accType == 2 ? 5 : 1);\n        uint32 room = capUnits - target.ocBonus;\n        uint32 added = rolled > room ? room : rolled;\n        _burnRaw(fuelId);\n        target.ocBonus += added;\n        emit Overclocked(msg.sender, targetId, fuelId, added, target.ocBonus);\n    }\n\n    // ----- Equip -----\n\n    /// @notice Equip an accessory into your Robot's slot for its type.\n    /// One accessory per type; the slot must be empty.\n    function equip(uint256 accessoryId) external {\n        require(_hasRobot[msg.sender], \"no robot\");\n        uint256 robotId = _robotOf[msg.sender];\n        TokenInfo storage t = _requireAccessory(accessoryId);\n        require(_owners[accessoryId] == msg.sender, \"not your token\");\n        _requireNotEquipped(accessoryId);\n        require(_equipped[robotId][t.accType] == 0, \"slot already filled\");\n        _equipped[robotId][t.accType] = accessoryId + 1;\n        _equippedIn[accessoryId] = robotId + 1;\n        emit Equipped(msg.sender, robotId, accessoryId, t.accType);\n    }\n\n    /// @notice Remove the accessory in one of your Robot's slots.\n    function unequip(uint8 accType) external returns (uint256 accessoryId) {\n        require(accType < 8, \"invalid type\");\n        require(_hasRobot[msg.sender], \"no robot\");\n        uint256 robotId = _robotOf[msg.sender];\n        uint256 packed = _equipped[robotId][accType];\n        require(packed != 0, \"slot is empty\");\n        accessoryId = packed - 1;\n        _equipped[robotId][accType] = 0;\n        _equippedIn[accessoryId] = 0;\n        emit Unequipped(msg.sender, robotId, accessoryId, accType);\n    }\n\n    // ----- Loadout / fight stats -----\n\n    /// @notice Effective stat of an accessory (rolled stat + overclock).\n    function effectiveStat(uint256 tokenId) public view returns (uint32) {\n        TokenInfo storage t = _requireAccessory(tokenId);\n        return t.stat + t.ocBonus;\n    }\n\n    function _slotStat(uint256 robotId, uint8 accType) internal view returns (uint32) {\n        uint256 packed = _equipped[robotId][accType];\n        if (packed == 0) return 0;\n        TokenInfo storage t = _tokens[packed - 1];\n        return t.stat + t.ocBonus;\n    }\n\n    /// @dev Stats as an array: [hp, atk, def, acc, eva, crit, spd, luck].\n    function _statsArr(uint256 robotId) internal view returns (uint32[8] memory s) {\n        uint32 core = _slotStat(robotId, 2);\n        s[0] = core > 0 ? core : uint32(BASE_HP);\n        uint32 weapon = _slotStat(robotId, 3);\n        s[1] = weapon > 0 ? weapon : uint32(BASE_ATK);\n        s[2] = _slotStat(robotId, 0);\n        s[3] = uint32(BASE_ACC) + _slotStat(robotId, 1);\n        s[4] = _slotStat(robotId, 5);\n        s[5] = _slotStat(robotId, 4);\n        s[6] = _slotStat(robotId, 6);\n        s[7] = _slotStat(robotId, 7);\n    }\n\n    /// @notice Fight stats for a robot: (hp, atk, def, acc, eva, crit, spd, luck).\n    /// Empty slots fall back to base values (HP 50, ATK 5, ACC 50%).\n    /// ACC/EVA/CRIT are percentages (capped in the fight engine).\n    function fightStats(uint256 robotId)\n        public\n        view\n        returns (uint32 hp, uint32 atk, uint32 def, uint32 acc, uint32 eva, uint32 crit, uint32 spd, uint32 luck)\n    {\n        require(_exists(robotId) && _tokens[robotId].kind == KIND_ROBOT, \"not a robot\");\n        uint32[8] memory s = _statsArr(robotId);\n        return (s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7]);\n    }\n\n    /// @notice Comparable power score (HP counts at 1/5, like its band).\n    function powerOf(uint256 robotId) public view returns (uint256) {\n        uint32[8] memory s = _statsArr(robotId);\n        return uint256(s[0] / 5) + s[1] + s[2] + s[3] + s[4] + s[5] + s[6] + s[7];\n    }\n\n    // ----- Duels -----\n\n    function currentSeason() public view returns (uint256) {\n        return (block.timestamp - seasonStart) / SEASON_LENGTH;\n    }\n\n    function _today() internal view returns (uint256) {\n        return block.timestamp / 1 days;\n    }\n\n    /// @notice Create a challenge from your Robot. `opponentRobot` is only\n    /// used when `open` is false (a named callout). Paid challenges escrow\n    /// exactly 0.001 BNB, refunded if the challenge is cancelled.\n    function createChallenge(uint256 opponentRobot, bool open, bool paid)\n        external\n        payable\n        returns (uint256 challengeId)\n    {\n        require(_hasRobot[msg.sender], \"no robot\");\n        uint256 myRobot = _robotOf[msg.sender];\n        if (paid) {\n            require(msg.value == DUEL_ENTRY, \"entry is 0.001 BNB\");\n        } else {\n            require(msg.value == 0, \"free duel takes no value\");\n            require(_freeDuelsOnDay[myRobot][_today()] < MAX_FREE_DUELS_PER_DAY, \"duel limit reached\");\n        }\n        if (!open) {\n            require(_exists(opponentRobot) && _tokens[opponentRobot].kind == KIND_ROBOT, \"not a robot\");\n            require(opponentRobot != myRobot, \"cannot challenge yourself\");\n        }\n        challengeId = _challenges.length;\n        _challenges.push(\n            Challenge({\n                challengerRobot: myRobot,\n                opponentRobot: opponentRobot,\n                challengerOwner: msg.sender,\n                open: open,\n                paid: paid,\n                done: false\n            })\n        );\n        emit ChallengeCreated(challengeId, myRobot, opponentRobot, open, paid);\n    }\n\n    /// @notice Cancel your own unaccepted challenge (escrow refunded).\n    function cancelChallenge(uint256 challengeId) external {\n        require(challengeId < _challenges.length, \"no such challenge\");\n        Challenge storage c = _challenges[challengeId];\n        require(!c.done, \"challenge resolved\");\n        require(c.challengerOwner == msg.sender, \"not your challenge\");\n        c.done = true;\n        emit ChallengeCancelled(challengeId);\n        if (c.paid) {\n            (bool ok, ) = msg.sender.call{value: DUEL_ENTRY}(\"\");\n            require(ok, \"escrow refund failed\");\n        }\n    }\n\n    /// @notice Accept a challenge with your Robot. The fight resolves in\n    /// this same transaction. Paid accepts must send exactly 0.001 BNB.\n    function acceptChallenge(uint256 challengeId) external payable {\n        require(challengeId < _challenges.length, \"no such challenge\");\n        Challenge storage c = _challenges[challengeId];\n        require(!c.done, \"challenge resolved\");\n        require(_hasRobot[msg.sender], \"no robot\");\n        uint256 myRobot = _robotOf[msg.sender];\n        require(myRobot != c.challengerRobot, \"own challenge\");\n        if (!c.open) require(myRobot == c.opponentRobot, \"not your challenge\");\n        if (c.paid) {\n            require(msg.value == DUEL_ENTRY, \"entry is 0.001 BNB\");\n        } else {\n            require(msg.value == 0, \"free duel takes no value\");\n            uint256 today = _today();\n            require(_freeDuelsOnDay[myRobot][today] < MAX_FREE_DUELS_PER_DAY, \"duel limit reached\");\n            require(\n                _freeDuelsOnDay[c.challengerRobot][today] < MAX_FREE_DUELS_PER_DAY,\n                \"challenger duel limit\"\n            );\n            _freeDuelsOnDay[myRobot][today] += 1;\n            _freeDuelsOnDay[c.challengerRobot][today] += 1;\n        }\n        c.done = true;\n        _resolveDuel(challengeId, c.challengerRobot, myRobot, c.paid);\n    }\n\n    /// @dev One strike: attacker stats array A vs defender stats array D\n    /// (layout [hp, atk, def, acc, eva, crit, spd, luck]).\n    function _strike(uint256 seed, uint256 round, uint256 turn, uint32[8] memory A, uint32[8] memory D)\n        internal\n        pure\n        returns (uint256 damage)\n    {\n        uint256 roll = uint256(keccak256(abi.encodePacked(seed, round, turn, \"hit\"))) % 100;\n        uint256 hitChance = A[3] > D[4] ? A[3] - D[4] : 10;\n        if (hitChance < 10) hitChance = 10;\n        if (hitChance > 95) hitChance = 95;\n        if (roll >= hitChance) return 0;\n        uint256 dmg = (uint256(A[1]) * 100) / (100 + uint256(D[2]));\n        if (dmg == 0) dmg = 1;\n        uint256 critRoll = uint256(keccak256(abi.encodePacked(seed, round, turn, \"crit\"))) % 100;\n        if (critRoll < A[5]) dmg *= 2;\n        uint256 swing = uint256(keccak256(abi.encodePacked(seed, round, turn, \"luck\"))) % (uint256(A[7]) + 1);\n        dmg += (dmg * swing) / 400; // LUCK: up to +25%\n        return dmg;\n    }\n\n    function _clamp(uint32[8] memory s) internal pure {\n        if (s[3] > 95) s[3] = 95; // ACC\n        if (s[4] > 60) s[4] = 60; // EVA\n        if (s[5] > 75) s[5] = 75; // CRIT\n    }\n\n    /// @dev Round-by-round fight. SPD strikes first; ~20 rounds; then the\n    /// robot with more remaining HP wins (ties: more power, then defender).\n    function _fight(uint256 seed, uint256 robotA, uint256 robotB) internal view returns (uint256 winner, uint256 loser) {\n        uint32[8] memory A = _statsArr(robotA);\n        uint32[8] memory B = _statsArr(robotB);\n        _clamp(A);\n        _clamp(B);\n        uint256 remA = A[0];\n        uint256 remB = B[0];\n        bool aFirst = A[6] >= B[6];\n        for (uint256 round = 0; round < 20 && remA > 0 && remB > 0; round++) {\n            for (uint256 turn = 0; turn < 2 && remA > 0 && remB > 0; turn++) {\n                if ((turn == 0) == aFirst) {\n                    uint256 d = _strike(seed, round, turn, A, B);\n                    remB = d >= remB ? 0 : remB - d;\n                } else {\n                    uint256 d = _strike(seed, round, turn, B, A);\n                    remA = d >= remA ? 0 : remA - d;\n                }\n            }\n        }\n        if (remA != remB) {\n            winner = remA > remB ? robotA : robotB;\n        } else if (powerOf(robotA) != powerOf(robotB)) {\n            winner = powerOf(robotA) > powerOf(robotB) ? robotA : robotB;\n        } else {\n            winner = robotB; // defender wins a perfect tie\n        }\n        loser = winner == robotA ? robotB : robotA;\n    }\n\n    function _awardPoints(uint256 winnerRobot, uint256 loserRobot) internal returns (uint256 points) {\n        points = 10;\n        uint256 wPower = powerOf(winnerRobot);\n        uint256 lPower = powerOf(loserRobot);\n        if (lPower > wPower) {\n            uint256 bonus = (lPower - wPower) / 5;\n            points += bonus > 20 ? 20 : bonus;\n        }\n        _streak[winnerRobot] += 1;\n        if (_streak[winnerRobot] >= 3) points *= 2;\n        _streak[loserRobot] = 0;\n        uint256 season = currentSeason();\n        if (!_scoredInSeason[winnerRobot][season]) {\n            _scoredInSeason[winnerRobot][season] = true;\n            _seasonRobots[season].push(winnerRobot);\n        }\n        _points[winnerRobot][season] += points;\n    }\n\n    function _resolveDuel(uint256 challengeId, uint256 challengerRobot, uint256 acceptorRobot, bool paid) internal {\n        uint256 seed = _entropy(0xD0E1 + challengeId);\n        (uint256 winner, uint256 loser) = _fight(seed, challengerRobot, acceptorRobot);\n        _wins[winner] += 1;\n        _losses[loser] += 1;\n        uint256 points = _awardPoints(winner, loser);\n        address winnerOwner = _owners[winner];\n        uint256 potPaid = 0;\n        uint256 bountyPaid = 0;\n        if (paid) {\n            uint256 pot = DUEL_ENTRY * 2;\n            uint256 winnerShare = (pot * 90) / 100;\n            uint256 poolCut = (pot * 5) / 100;\n            uint256 creatorCutAmt = pot - winnerShare - poolCut;\n            _pool += poolCut;\n            potPaid = winnerShare;\n            // Bounties on the LOSER are claimed by the winner, in full.\n            uint256[] storage ids = _bountiesOn[loser];\n            for (uint256 i = 0; i < ids.length; i++) {\n                Bounty storage b = _bounties[ids[i]];\n                if (b.active) {\n                    b.active = false;\n                    bountyPaid += b.amount;\n                    emit BountyClaimed(ids[i], winnerOwner, b.amount);\n                }\n            }\n            (bool ok1, ) = winnerOwner.call{value: winnerShare + bountyPaid}(\"\");\n            require(ok1, \"payout failed\");\n            (bool ok2, ) = creator.call{value: creatorCutAmt}(\"\");\n            require(ok2, \"creator cut transfer failed\");\n        }\n        emit DuelResolved(challengeId, winner, loser, winnerOwner, points, potPaid, bountyPaid);\n    }\n\n    // ----- Bounty board -----\n\n    /// @notice Escrow BNB as a bounty on a rival Robot. The first paid-duel\n    /// winner against that Robot claims it in full.\n    function postBounty(uint256 robotId) external payable returns (uint256 bountyId) {\n        require(msg.value > 0, \"bounty needs value\");\n        require(_exists(robotId) && _tokens[robotId].kind == KIND_ROBOT, \"not a robot\");\n        bountyId = _bounties.length;\n        _bounties.push(\n            Bounty({poster: msg.sender, robotId: robotId, amount: msg.value, createdAt: block.timestamp, active: true})\n        );\n        _bountiesOn[robotId].push(bountyId);\n        emit BountyPosted(bountyId, msg.sender, robotId, msg.value);\n    }\n\n    /// @notice Reclaim your bounty after 7 days unclaimed.\n    function reclaimBounty(uint256 bountyId) external {\n        require(bountyId < _bounties.length, \"no such bounty\");\n        Bounty storage b = _bounties[bountyId];\n        require(b.active, \"bounty not active\");\n        require(b.poster == msg.sender, \"not your bounty\");\n        require(block.timestamp >= b.createdAt + BOUNTY_RECLAIM_DELAY, \"too early to reclaim\");\n        b.active = false;\n        emit BountyReclaimed(bountyId, msg.sender, b.amount);\n        (bool ok, ) = msg.sender.call{value: b.amount}(\"\");\n        require(ok, \"reclaim transfer failed\");\n    }\n\n    // ----- Seasons -----\n\n    /// @notice Settle a finished season. Callable by anyone once the season\n    /// has ended. Pays 50% of the pool to the season's Top 20 (rank\n    /// weights 21-rank over a fixed total of 210; unfilled ranks keep\n    /// their share in the pool) and awards 3 prize-vault Legendaries by\n    /// equal-chance lottery among the Top 20 (fewer if the vault or the\n    /// leaderboard is smaller).\n    function settleSeason(uint256 season) external {\n        require(season < currentSeason(), \"season not finished\");\n        require(!_seasonSettled[season], \"season already settled\");\n        _seasonSettled[season] = true;\n        uint256[] storage robots = _seasonRobots[season];\n        uint256 n = robots.length;\n        // Select Top 20 by points (selection passes over the scorers list).\n        uint256 topCount = n > 20 ? 20 : n;\n        uint256[] memory top = new uint256[](topCount);\n        bool[] memory used = new bool[](n);\n        for (uint256 r = 0; r < topCount; r++) {\n            uint256 best = type(uint256).max;\n            for (uint256 i = 0; i < n; i++) {\n                if (used[i]) continue;\n                if (best == type(uint256).max || _points[robots[i]][season] > _points[robots[best]][season]) {\n                    best = i;\n                }\n            }\n            used[best] = true;\n            top[r] = robots[best];\n        }\n        uint256 poolHalf = _pool / 2;\n        uint256 paidTotal = 0;\n        for (uint256 r = 0; r < topCount; r++) {\n            uint256 share = (poolHalf * (21 - r)) / 210;\n            if (share == 0) continue;\n            paidTotal += share;\n            (bool ok, ) = _owners[top[r]].call{value: share}(\"\");\n            require(ok, \"payout failed\");\n        }\n        _pool -= paidTotal;\n        _totalPoolPaidOut += paidTotal;\n        // Legendary lottery: 3 distinct winners, equal chance among Top 20.\n        uint256 prizes = LOTTERY_PRIZES_PER_SEASON;\n        uint256 remaining = _vaultIds.length - _vaultCursor;\n        if (prizes > remaining) prizes = remaining;\n        if (prizes > topCount) prizes = topCount;\n        if (prizes > 0) {\n            uint256 seed = _entropy(0x1077E21 + season);\n            bool[] memory won = new bool[](topCount);\n            for (uint256 p = 0; p < prizes; p++) {\n                uint256 idx = uint256(keccak256(abi.encodePacked(seed, p))) % topCount;\n                while (won[idx]) idx = (idx + 1) % topCount;\n                won[idx] = true;\n                uint256 tokenId = _vaultIds[_vaultCursor];\n                _vaultCursor += 1;\n                address winnerAddr = _owners[top[idx]];\n                _transferRaw(address(this), winnerAddr, tokenId);\n                emit LotteryWon(season, top[idx], winnerAddr, tokenId, _tokens[tokenId].serial);\n            }\n        }\n        emit SeasonSettled(season, paidTotal, topCount);\n    }\n\n    // ----- Views -----\n\n    function robotOf(address user) external view returns (uint256 robotId, bool has) {\n        return (_robotOf[user], _hasRobot[user]);\n    }\n\n    function drawnPerType(uint8 accType) external view returns (uint256) {\n        require(accType < 8, \"invalid type\");\n        return _drawnPerType[accType];\n    }\n\n    function totalDrawn() external view returns (uint256 total) {\n        for (uint8 i = 0; i < 8; i++) total += _drawnPerType[i];\n    }\n\n    function rewardPool() external view returns (uint256) {\n        return _pool;\n    }\n\n    function totalPoolPaidOut() external view returns (uint256) {\n        return _totalPoolPaidOut;\n    }\n\n    function vaultRemaining() external view returns (uint256) {\n        return _vaultIds.length - _vaultCursor;\n    }\n\n    /// @notice The next Champion-Edition Legendaries waiting in the vault.\n    function vaultPreview(uint256 count) external view returns (uint256[] memory tokenIds) {\n        uint256 remaining = _vaultIds.length - _vaultCursor;\n        if (count > remaining) count = remaining;\n        tokenIds = new uint256[](count);\n        for (uint256 i = 0; i < count; i++) tokenIds[i] = _vaultIds[_vaultCursor + i];\n    }\n\n    function tokenInfo(uint256 tokenId)\n        external\n        view\n        returns (\n            uint8 kind, uint8 accType, uint8 rarity, uint32 stat, uint32 ocBonus,\n            uint32 serial, bool champion, uint16 chassis, bool equipped\n        )\n    {\n        require(_exists(tokenId), \"token does not exist\");\n        TokenInfo storage t = _tokens[tokenId];\n        return (t.kind, t.accType, t.rarity, t.stat, t.ocBonus, t.serial, t.champion, t.chassis, _equippedIn[tokenId] != 0);\n    }\n\n    /// @notice Champion-Edition name for a prize-vault Legendary (\"\" otherwise).\n    function championName(uint256 tokenId) external view returns (string memory) {\n        require(_exists(tokenId), \"token does not exist\");\n        TokenInfo storage t = _tokens[tokenId];\n        if (!t.champion || t.serial == 0 || t.serial > _ceNames.length) return \"\";\n        return _ceNames[t.serial - 1];\n    }\n\n    /// @notice Accessory token id equipped in a robot's slot (type), or the\n    /// max uint256 when the slot is empty.\n    function equippedInSlot(uint256 robotId, uint8 accType) external view returns (uint256) {\n        uint256 packed = _equipped[robotId][accType];\n        return packed == 0 ? type(uint256).max : packed - 1;\n    }\n\n    function recordOf(uint256 robotId) external view returns (uint256 wins, uint256 losses, uint256 streak) {\n        return (_wins[robotId], _losses[robotId], _streak[robotId]);\n    }\n\n    function pointsOf(uint256 robotId, uint256 season) external view returns (uint256) {\n        return _points[robotId][season];\n    }\n\n    function seasonScorerCount(uint256 season) external view returns (uint256) {\n        return _seasonRobots[season].length;\n    }\n\n    function seasonSettled(uint256 season) external view returns (bool) {\n        return _seasonSettled[season];\n    }\n\n    function challengeInfo(uint256 challengeId)\n        external\n        view\n        returns (uint256 challengerRobot, uint256 opponentRobot, bool open, bool paid, bool done)\n    {\n        require(challengeId < _challenges.length, \"no such challenge\");\n        Challenge storage c = _challenges[challengeId];\n        return (c.challengerRobot, c.opponentRobot, c.open, c.paid, c.done);\n    }\n\n    function bountyInfo(uint256 bountyId)\n        external\n        view\n        returns (address poster, uint256 robotId, uint256 amount, uint256 createdAt, bool active)\n    {\n        require(bountyId < _bounties.length, \"no such bounty\");\n        Bounty storage b = _bounties[bountyId];\n        return (b.poster, b.robotId, b.amount, b.createdAt, b.active);\n    }\n\n    function paidDrawsToday(address user) external view returns (uint256) {\n        return _paidDrawsOnDay[user][_today()];\n    }\n\n    function freeDuelsToday(uint256 robotId) external view returns (uint256) {\n        return _freeDuelsOnDay[robotId][_today()];\n    }\n\n    function totalMinted() external view returns (uint256) {\n        return _tokens.length;\n    }\n\n    function robotCount() external view returns (uint256) {\n        return _robotCount;\n    }\n\n    function typeName(uint8 accType) public pure returns (string memory) {\n        string[8] memory names_ = [\"Helmet\", \"Visor\", \"Core\", \"Weapon\", \"Arms\", \"Jetpack\", \"Legs\", \"Drone\"];\n        require(accType < 8, \"invalid type\");\n        return names_[accType];\n    }\n\n    function statName(uint8 accType) public pure returns (string memory) {\n        string[8] memory names_ = [\"DEF\", \"ACC\", \"HP\", \"ATK\", \"CRIT\", \"EVA\", \"SPD\", \"LUCK\"];\n        require(accType < 8, \"invalid type\");\n        return names_[accType];\n    }\n\n    function rarityName(uint8 rarity) public pure returns (string memory) {\n        if (rarity == 0) return \"Uncommon\";\n        if (rarity == 1) return \"Rare\";\n        if (rarity == 2) return \"Epic\";\n        if (rarity == 3) return \"Legendary\";\n        revert(\"invalid rarity\");\n    }\n\n    // ----- ERC-721 -----\n\n    function balanceOf(address owner_) external view returns (uint256) {\n        require(owner_ != address(0), \"zero address\");\n        return _balances[owner_];\n    }\n\n    function ownerOf(uint256 tokenId) public view returns (address) {\n        require(_exists(tokenId), \"token does not exist\");\n        return _owners[tokenId];\n    }\n\n    function transferFrom(address from, address to, uint256 tokenId) public {\n        require(_exists(tokenId), \"token does not exist\");\n        require(_tokens[tokenId].kind != KIND_ROBOT, \"robots are soulbound\");\n        _requireNotEquipped(tokenId);\n        require(_owners[tokenId] == from, \"from is not the owner\");\n        require(to != address(0), \"transfer to zero address\");\n        require(\n            msg.sender == from || msg.sender == _tokenApprovals[tokenId] || _operatorApprovals[from][msg.sender],\n            \"not owner or approved\"\n        );\n        _transferRaw(from, to, tokenId);\n    }\n\n    function safeTransferFrom(address from, address to, uint256 tokenId) external {\n        safeTransferFrom(from, to, tokenId, \"\");\n    }\n\n    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public {\n        transferFrom(from, to, tokenId);\n        require(_checkOnERC721Received(from, to, tokenId, data), \"non-ERC721 receiver\");\n    }\n\n    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data)\n        internal\n        returns (bool)\n    {\n        if (to.code.length == 0) return true;\n        (bool ok, bytes memory ret) = to.call(abi.encodeWithSelector(0x150b7a5e, msg.sender, from, tokenId, data));\n        if (!ok || ret.length < 32) return false;\n        return abi.decode(ret, (bytes4)) == bytes4(0x150b7a5e);\n    }\n\n    function approve(address approved, uint256 tokenId) external {\n        require(_exists(tokenId), \"token does not exist\");\n        require(_tokens[tokenId].kind != KIND_ROBOT, \"robots are soulbound\");\n        _requireNotEquipped(tokenId);\n        address o = _owners[tokenId];\n        require(msg.sender == o || _operatorApprovals[o][msg.sender], \"not owner or operator\");\n        _tokenApprovals[tokenId] = approved;\n        emit Approval(o, approved, tokenId);\n    }\n\n    function setApprovalForAll(address operator, bool approved) external {\n        _operatorApprovals[msg.sender][operator] = approved;\n        emit ApprovalForAll(msg.sender, operator, approved);\n    }\n\n    function getApproved(uint256 tokenId) external view returns (address) {\n        require(_exists(tokenId), \"token does not exist\");\n        return _tokenApprovals[tokenId];\n    }\n\n    function isApprovedForAll(address owner_, address operator) external view returns (bool) {\n        return _operatorApprovals[owner_][operator];\n    }\n\n    // ----- ERC-2981 royalties -----\n\n    /// @notice 5% royalty on every token, paid to the creator (owner()).\n    function royaltyInfo(uint256 tokenId, uint256 salePrice)\n        external\n        view\n        returns (address receiver, uint256 royaltyAmount)\n    {\n        require(_exists(tokenId), \"token does not exist\");\n        return (creator, (salePrice * ROYALTY_BPS) / 10000);\n    }\n\n    function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n        return\n            interfaceId == 0x01ffc9a7 || // ERC165\n            interfaceId == 0x80ac58cd || // ERC721\n            interfaceId == 0x5b5e139f || // ERC721Metadata\n            interfaceId == 0x2a55205a || // ERC2981\n            interfaceId == 0x7f5828d0; // ERC173 (owner())\n    }\n\n    // ----- Metadata -----\n\n    string internal constant _DESC =\n        \"Agent X Robot on BNB Chain: your Agent ID's fighter. Draw parts, fuse and overclock them, equip your robot and duel other agents. The owner cannot withdraw the pool or change the rules.\";\n\n    function tokenURI(uint256 tokenId) external view returns (string memory) {\n        require(_exists(tokenId), \"token does not exist\");\n        if (bytes(_baseURI).length > 0) {\n            return string(abi.encodePacked(_baseURI, _toString(tokenId)));\n        }\n        return string(abi.encodePacked(\"data:application/json;base64,\", _base64Encode(bytes(_tokenJSON(_tokens[tokenId])))));\n    }\n\n    function _tokenJSON(TokenInfo storage t) internal view returns (string memory) {\n        if (t.kind == KIND_ROBOT) {\n            return string(\n                abi.encodePacked(\n                    '{\"name\":\"Agent X Robot #', _toString(t.serial),\n                    '\",\"description\":\"', _DESC,\n                    '\",\"attributes\":[{\"trait_type\":\"Kind\",\"value\":\"Robot\"},',\n                    '{\"trait_type\":\"Chassis\",\"value\":', _toString(t.chassis), \"}]}\"\n                )\n            );\n        }\n        string memory nm = string(\n            abi.encodePacked(\"AXR \", typeName(t.accType), \" - \", rarityName(t.rarity))\n        );\n        if (t.champion) {\n            nm = string(\n                abi.encodePacked(\n                    \"CE-\", _pad2(t.serial), \" \", _ceNames[t.serial - 1], \" (\", typeName(t.accType), \")\"\n                )\n            );\n        }\n        return string(\n            abi.encodePacked(\n                '{\"name\":\"', nm,\n                '\",\"description\":\"', _DESC,\n                '\",\"attributes\":[{\"trait_type\":\"Kind\",\"value\":\"Accessory\"},',\n                '{\"trait_type\":\"Type\",\"value\":\"', typeName(t.accType), '\"},',\n                '{\"trait_type\":\"Stat\",\"value\":\"', statName(t.accType), '\"},',\n                '{\"trait_type\":\"Rarity\",\"value\":\"', rarityName(t.rarity), '\"},',\n                '{\"trait_type\":\"Stat Value\",\"value\":', _toString(t.stat), \"},\",\n                '{\"trait_type\":\"Overclock\",\"value\":', _toString(t.ocBonus), \"},\",\n                '{\"trait_type\":\"Champion Edition\",\"value\":\"', t.champion ? \"Yes\" : \"No\", '\"}]}'\n            )\n        );\n    }\n\n    function _pad2(uint32 v) internal pure returns (string memory) {\n        if (v < 10) return string(abi.encodePacked(\"0\", _toString(v)));\n        return _toString(v);\n    }\n\n    // ----- String helpers -----\n\n    function _toString(uint256 value) internal pure returns (string memory) {\n        if (value == 0) return \"0\";\n        uint256 temp = value;\n        uint256 digits;\n        while (temp != 0) {\n            digits++;\n            temp /= 10;\n        }\n        bytes memory buffer = new bytes(digits);\n        while (value != 0) {\n            digits -= 1;\n            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n            value /= 10;\n        }\n        return string(buffer);\n    }\n\n    function _base64Encode(bytes memory data) internal pure returns (string memory) {\n        bytes memory table = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n        uint256 len = data.length;\n        if (len == 0) return \"\";\n        bytes memory result = new bytes(4 * ((len + 2) / 3));\n        uint256 i;\n        uint256 j;\n        while (i < len) {\n            uint256 a = uint8(data[i]);\n            uint256 b = i + 1 < len ? uint8(data[i + 1]) : 0;\n            uint256 c = i + 2 < len ? uint8(data[i + 2]) : 0;\n            result[j] = table[(a >> 2) & 0x3f];\n            result[j + 1] = table[((a & 0x03) << 4) | (b >> 4)];\n            result[j + 2] = i + 1 < len ? table[((b & 0x0f) << 2) | (c >> 6)] : bytes1(\"=\");\n            result[j + 3] = i + 2 < len ? table[c & 0x3f] : bytes1(\"=\");\n            i += 3;\n            j += 4;\n        }\n        return string(result);\n    }\n\n    // ----- Test-only surface (never callable on AgentXRobot itself) -----\n\n    /// @dev Internal setters used ONLY by the local AXRTestHarness subclass\n    /// to stage deterministic unit tests (supply-cap and fusion states that\n    /// would take ~20,000 random draws to reach organically). AgentXRobot\n    /// as deployed has no external path to these.\n    function _testSetDrawnPerType(uint8 accType, uint256 n) internal {\n        _drawnPerType[accType] = n;\n    }\n}\n"}},"abi":[{"type":"constructor","inputs":[{"name":"registry","type":"address","internalType":"address"}],"stateMutability":"nonpayable"},{"name":"AccessoryDrawn","type":"event","inputs":[{"name":"user","type":"address","indexed":true,"internalType":"address"},{"name":"tokenId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"accType","type":"uint8","indexed":false,"internalType":"uint8"},{"name":"rarity","type":"uint8","indexed":false,"internalType":"uint8"},{"name":"stat","type":"uint32","indexed":false,"internalType":"uint32"},{"name":"paid","type":"bool","indexed":false,"internalType":"bool"}],"anonymous":false},{"name":"Approval","type":"event","inputs":[{"name":"owner","type":"address","indexed":true,"internalType":"address"},{"name":"approved","type":"address","indexed":true,"internalType":"address"},{"name":"tokenId","type":"uint256","indexed":true,"internalType":"uint256"}],"anonymous":false},{"name":"ApprovalForAll","type":"event","inputs":[{"name":"owner","type":"address","indexed":true,"internalType":"address"},{"name":"operator","type":"address","indexed":true,"internalType":"address"},{"name":"approved","type":"bool","indexed":false,"internalType":"bool"}],"anonymous":false},{"name":"BountyClaimed","type":"event","inputs":[{"name":"bountyId","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"winner","type":"address","indexed":true,"internalType":"address"},{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"BountyPosted","type":"event","inputs":[{"name":"bountyId","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"poster","type":"address","indexed":true,"internalType":"address"},{"name":"robotId","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"BountyReclaimed","type":"event","inputs":[{"name":"bountyId","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"poster","type":"address","indexed":true,"internalType":"address"},{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"ChallengeCancelled","type":"event","inputs":[{"name":"challengeId","type":"uint256","indexed":true,"internalType":"uint256"}],"anonymous":false},{"name":"ChallengeCreated","type":"event","inputs":[{"name":"challengeId","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"challengerRobot","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"opponentRobot","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"open","type":"bool","indexed":false,"internalType":"bool"},{"name":"paid","type":"bool","indexed":false,"internalType":"bool"}],"anonymous":false},{"name":"DuelResolved","type":"event","inputs":[{"name":"challengeId","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"winnerRobot","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"loserRobot","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"winnerOwner","type":"address","indexed":false,"internalType":"address"},{"name":"pointsAwarded","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"potPaid","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"bountyPaid","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"Equipped","type":"event","inputs":[{"name":"user","type":"address","indexed":true,"internalType":"address"},{"name":"robotId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"accessoryId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"accType","type":"uint8","indexed":false,"internalType":"uint8"}],"anonymous":false},{"name":"Fused","type":"event","inputs":[{"name":"user","type":"address","indexed":true,"internalType":"address"},{"name":"burnedA","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"burnedB","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"newTokenId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"accType","type":"uint8","indexed":false,"internalType":"uint8"},{"name":"rarity","type":"uint8","indexed":false,"internalType":"uint8"}],"anonymous":false},{"name":"LotteryWon","type":"event","inputs":[{"name":"season","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"robotId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"winner","type":"address","indexed":true,"internalType":"address"},{"name":"tokenId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"serial","type":"uint32","indexed":false,"internalType":"uint32"}],"anonymous":false},{"name":"Overclocked","type":"event","inputs":[{"name":"user","type":"address","indexed":true,"internalType":"address"},{"name":"targetId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"fuelId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"addedBonus","type":"uint32","indexed":false,"internalType":"uint32"},{"name":"totalBonus","type":"uint32","indexed":false,"internalType":"uint32"}],"anonymous":false},{"name":"PoolFunded","type":"event","inputs":[{"name":"from","type":"address","indexed":true,"internalType":"address"},{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"RobotMinted","type":"event","inputs":[{"name":"user","type":"address","indexed":true,"internalType":"address"},{"name":"robotId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"accessoryId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"accType","type":"uint8","indexed":false,"internalType":"uint8"},{"name":"rarity","type":"uint8","indexed":false,"internalType":"uint8"}],"anonymous":false},{"name":"SeasonSettled","type":"event","inputs":[{"name":"season","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"poolPaid","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"topCount","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"Transfer","type":"event","inputs":[{"name":"from","type":"address","indexed":true,"internalType":"address"},{"name":"to","type":"address","indexed":true,"internalType":"address"},{"name":"tokenId","type":"uint256","indexed":true,"internalType":"uint256"}],"anonymous":false},{"name":"Unequipped","type":"event","inputs":[{"name":"user","type":"address","indexed":true,"internalType":"address"},{"name":"robotId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"accessoryId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"accType","type":"uint8","indexed":false,"internalType":"uint8"}],"anonymous":false},{"name":"BASE_ACC","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"BASE_ATK","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"BASE_HP","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"BOUNTY_RECLAIM_DELAY","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"DRAW_CAP_PER_TYPE","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"DRAW_PRICE","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"DUEL_ENTRY","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"KIND_ACCESSORY","type":"function","inputs":[],"outputs":[{"name":"","type":"uint8","internalType":"uint8"}],"stateMutability":"view"},{"name":"KIND_ROBOT","type":"function","inputs":[],"outputs":[{"name":"","type":"uint8","internalType":"uint8"}],"stateMutability":"view"},{"name":"LOTTERY_PRIZES_PER_SEASON","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"MAX_FREE_DUELS_PER_DAY","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"MAX_PAID_DRAWS_PER_DAY","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"ROYALTY_BPS","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"SEASON_LENGTH","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"VAULT_SIZE","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"acceptChallenge","type":"function","inputs":[{"name":"challengeId","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"payable"},{"name":"agentIdRegistry","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IAgentID"}],"stateMutability":"view"},{"name":"approve","type":"function","inputs":[{"name":"approved","type":"address","internalType":"address"},{"name":"tokenId","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"balanceOf","type":"function","inputs":[{"name":"owner_","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"baseURI","type":"function","inputs":[],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"view"},{"name":"bountyInfo","type":"function","inputs":[{"name":"bountyId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"poster","type":"address","internalType":"address"},{"name":"robotId","type":"uint256","internalType":"uint256"},{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"createdAt","type":"uint256","internalType":"uint256"},{"name":"active","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"cancelChallenge","type":"function","inputs":[{"name":"challengeId","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"challengeInfo","type":"function","inputs":[{"name":"challengeId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"challengerRobot","type":"uint256","internalType":"uint256"},{"name":"opponentRobot","type":"uint256","internalType":"uint256"},{"name":"open","type":"bool","internalType":"bool"},{"name":"paid","type":"bool","internalType":"bool"},{"name":"done","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"championName","type":"function","inputs":[{"name":"tokenId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"view"},{"name":"createChallenge","type":"function","inputs":[{"name":"opponentRobot","type":"uint256","internalType":"uint256"},{"name":"open","type":"bool","internalType":"bool"},{"name":"paid","type":"bool","internalType":"bool"}],"outputs":[{"name":"challengeId","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"creator","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"currentSeason","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"drawAccessory","type":"function","inputs":[],"outputs":[{"name":"tokenId","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"drawnPerType","type":"function","inputs":[{"name":"accType","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"effectiveStat","type":"function","inputs":[{"name":"tokenId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint32","internalType":"uint32"}],"stateMutability":"view"},{"name":"equip","type":"function","inputs":[{"name":"accessoryId","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"equippedInSlot","type":"function","inputs":[{"name":"robotId","type":"uint256","internalType":"uint256"},{"name":"accType","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"fightStats","type":"function","inputs":[{"name":"robotId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"hp","type":"uint32","internalType":"uint32"},{"name":"atk","type":"uint32","internalType":"uint32"},{"name":"def","type":"uint32","internalType":"uint32"},{"name":"acc","type":"uint32","internalType":"uint32"},{"name":"eva","type":"uint32","internalType":"uint32"},{"name":"crit","type":"uint32","internalType":"uint32"},{"name":"spd","type":"uint32","internalType":"uint32"},{"name":"luck","type":"uint32","internalType":"uint32"}],"stateMutability":"view"},{"name":"freeDuelsToday","type":"function","inputs":[{"name":"robotId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"fuse","type":"function","inputs":[{"name":"tokenA","type":"uint256","internalType":"uint256"},{"name":"tokenB","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"newTokenId","type":"uint256","internalType":"uint256"}],"stateMutability":"nonpayable"},{"name":"getApproved","type":"function","inputs":[{"name":"tokenId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"hasAgentId","type":"function","inputs":[{"name":"account","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"isApprovedForAll","type":"function","inputs":[{"name":"owner_","type":"address","internalType":"address"},{"name":"operator","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"mintRobot","type":"function","inputs":[],"outputs":[{"name":"robotId","type":"uint256","internalType":"uint256"},{"name":"accessoryId","type":"uint256","internalType":"uint256"}],"stateMutability":"nonpayable"},{"name":"name","type":"function","inputs":[],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"view"},{"name":"ocBonusCap","type":"function","inputs":[{"name":"rarity","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"uint32","internalType":"uint32"}],"stateMutability":"pure"},{"name":"overclock","type":"function","inputs":[{"name":"targetId","type":"uint256","internalType":"uint256"},{"name":"fuelId","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"owner","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"ownerOf","type":"function","inputs":[{"name":"tokenId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"paidDrawsToday","type":"function","inputs":[{"name":"user","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"pointsOf","type":"function","inputs":[{"name":"robotId","type":"uint256","internalType":"uint256"},{"name":"season","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"postBounty","type":"function","inputs":[{"name":"robotId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"bountyId","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"powerOf","type":"function","inputs":[{"name":"robotId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"rarityName","type":"function","inputs":[{"name":"rarity","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"pure"},{"name":"reclaimBounty","type":"function","inputs":[{"name":"bountyId","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"recordOf","type":"function","inputs":[{"name":"robotId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"wins","type":"uint256","internalType":"uint256"},{"name":"losses","type":"uint256","internalType":"uint256"},{"name":"streak","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"rewardPool","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"robotCount","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"robotOf","type":"function","inputs":[{"name":"user","type":"address","internalType":"address"}],"outputs":[{"name":"robotId","type":"uint256","internalType":"uint256"},{"name":"has","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"royaltyInfo","type":"function","inputs":[{"name":"tokenId","type":"uint256","internalType":"uint256"},{"name":"salePrice","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"receiver","type":"address","internalType":"address"},{"name":"royaltyAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"safeTransferFrom","type":"function","inputs":[{"name":"from","type":"address","internalType":"address"},{"name":"to","type":"address","internalType":"address"},{"name":"tokenId","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"safeTransferFrom","type":"function","inputs":[{"name":"from","type":"address","internalType":"address"},{"name":"to","type":"address","internalType":"address"},{"name":"tokenId","type":"uint256","internalType":"uint256"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"seasonScorerCount","type":"function","inputs":[{"name":"season","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"seasonSettled","type":"function","inputs":[{"name":"season","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"seasonStart","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"setApprovalForAll","type":"function","inputs":[{"name":"operator","type":"address","internalType":"address"},{"name":"approved","type":"bool","internalType":"bool"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"setBaseURI","type":"function","inputs":[{"name":"uri","type":"string","internalType":"string"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"settleSeason","type":"function","inputs":[{"name":"season","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"statName","type":"function","inputs":[{"name":"accType","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"pure"},{"name":"supportsInterface","type":"function","inputs":[{"name":"interfaceId","type":"bytes4","internalType":"bytes4"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"pure"},{"name":"symbol","type":"function","inputs":[],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"view"},{"name":"tokenInfo","type":"function","inputs":[{"name":"tokenId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"kind","type":"uint8","internalType":"uint8"},{"name":"accType","type":"uint8","internalType":"uint8"},{"name":"rarity","type":"uint8","internalType":"uint8"},{"name":"stat","type":"uint32","internalType":"uint32"},{"name":"ocBonus","type":"uint32","internalType":"uint32"},{"name":"serial","type":"uint32","internalType":"uint32"},{"name":"champion","type":"bool","internalType":"bool"},{"name":"chassis","type":"uint16","internalType":"uint16"},{"name":"equipped","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"tokenURI","type":"function","inputs":[{"name":"tokenId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"view"},{"name":"totalDrawn","type":"function","inputs":[],"outputs":[{"name":"total","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"totalMinted","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"totalPoolPaidOut","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"transferFrom","type":"function","inputs":[{"name":"from","type":"address","internalType":"address"},{"name":"to","type":"address","internalType":"address"},{"name":"tokenId","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"typeName","type":"function","inputs":[{"name":"accType","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"pure"},{"name":"unequip","type":"function","inputs":[{"name":"accType","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"accessoryId","type":"uint256","internalType":"uint256"}],"stateMutability":"nonpayable"},{"name":"vaultPreview","type":"function","inputs":[{"name":"count","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"tokenIds","type":"uint256[]","internalType":"uint256[]"}],"stateMutability":"view"},{"name":"vaultRemaining","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"receive","stateMutability":"payable"}],"matchId":"59879359","creationMatch":"exact_match","runtimeMatch":"exact_match","verifiedAt":"2026-11-25T02:42:21Z","match":"exact_match","chainId":"56","address":"0xBdd7Db43BdDB4CbE288c31A367a187B2Cae1138A"}