{"sources":{"src/Ostrenne.sol":{"content":"// SPDX-License-Identifier: Unlicense\npragma solidity 0.8.28;\n\nimport {OstrenneCoin} from \"./OstrenneCoin.sol\";\nimport {OstrenneText} from \"./OstrenneText.sol\";\n\n/// @dev What this contract asks of the Agent ID registry.\ninterface OstrenneRegistry {\n    function handleOf(address account) external view returns (string memory handle);\n    function ownerOf(uint256 handleId) external view returns (address account);\n}\n\ninterface OstrenneReceiver {\n    function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data)\n        external\n        returns (bytes4);\n}\n\n/// @title Ostrenne\n/// @notice One contract holds two kinds of ERC-721 tokens and pays out a coin.\n///\n///  Cards (kind 1). Free. One per Agent ID per six-hour slot (slots start at 00:00, 06:00, 12:00, 18:00 UTC). A card\n///  is ripe when the next slot starts; its holder then pays `TOLL` to reap it and receives coins by grade.\n///  Grades: 75% Dust, 20% Spark, 4.5% Flare, 0.5% Nova (8k / 40k / 200k / 800k coins).\n///\n///  Stubs (kind 2). A stub costs `STUB_COST`, holds three free reaps, and is good for seven days from the moment it\n///  is bought. redeemStub(stub, cards) goes through the listed cards in order (the first 60 at most) and reaps the\n///  ones that can be reaped, until the stub's remaining uses are used, without the toll. Only a reap that really\n///  happens uses up one of the three. A listed card that is not yours, is not a card, was already reaped, is not ripe,\n///  whose slot has no readable seed yet, or whose amount no longer fits the coin supply, is skipped: it costs nothing\n///  and uses nothing, and the next listed card is tried. If every listed card is skipped the call still succeeds and\n///  reaps nothing; a slot that had no look block yet gets one written, so call again after about 5 blocks. A stub\n///  moves between wallets like any token and takes its remaining uses and its expiry with it; unused uses lapse at\n///  expiry and are not refunded. At most 20 stubs are ever sold, at most 5 per wallet, and none after the entry\n///  window closes. Stubs and tolls are never charged together for the same card.\n///\n///  Payment decides the quantity. A call to an entry name (mint, freeMint, claim() ...) first gives the\n///  caller's Agent ID this slot's free card if it has none yet, then buys as many stubs as the remaining value pays\n///  for (floor(value / STUB_COST)) within the two limits, and sends back the rest in the same transaction. Passing a\n///  quantity or an address changes nothing: the card and the stubs always go to the caller. claim(id) reaps one card for\n///  `TOLL` and reverts if that card cannot be reaped yet. claim(ids) and claimReward(ids) go through the listed cards\n///  in order (the first 60 at most), skip the ones that cannot be reaped as described above, and reap up to\n///  floor(value / TOLL) cards (at most 30). Only the cards actually reaped are charged `TOLL` each; the rest of the\n///  payment goes back in the same transaction.\n///\n///  Where a grade comes from. When a slot is over, the first call that touches it only writes down a look block, the\n///  current block plus 4. The slot seed is the hash of exactly that block, stored by the first touch that can read\n///  it; no address or argument enters it. The validator whose turn it is when the look block is produced can\n///  influence that hash, so grades are not tamper-proof against block producers. The hash is read with blockhash()\n///  for 256 blocks and from the EIP-2935 archive for 8191 blocks (about an hour on BSC); every entry and every reap\n///  also moves the two latest finished slots along. If nobody touches a slot within that hour, the whole slot is the\n///  lowest grade for every card: never better than a drawn grade, no re-roll, no choice.\n///\n///  Nobody holds a special key: nothing here can be paused, upgraded or drained, and a call never leaves BNB behind.\ncontract Ostrenne {\n    // ===== constants =====\n    uint256 public constant SLOT_SECS = 21_600;\n    uint256 public constant STUB_LIFE = 7 days;\n    uint256 public constant STUB_CAP = 20;\n    uint256 public constant STUBS_PER_WALLET = 5;\n    uint256 public constant STUB_USES = 3;\n    uint256 public constant BATCH_MAX = 30;\n    uint256 public constant SCAN_MAX = 60;\n    uint8 public constant KIND_CARD = 1;\n    uint8 public constant KIND_STUB = 2;\n    uint8 public constant NOT_READY = 255;\n    uint256 private constant LOOKAHEAD = 4;\n    uint256 private constant ARCHIVE_DEPTH = 8_191;\n    address private constant BLOCK_VAULT = 0x0000F90827F1C53a10cb7A02335B175320002935;\n    bytes32 private constant FLOOR_SEED = bytes32(uint256(11));\n    string public constant name = \"Ostrenne\";\n    string public constant symbol = \"OSTR\";\n\n    // ===== configuration =====\n    OstrenneRegistry public immutable HANDLE_LEDGER;\n    OstrenneCoin public immutable MOTES;\n    address public immutable TILL;\n    uint256 public immutable ENTRY_START;\n    uint256 public immutable ENTRY_END;\n    uint256 public immutable TOLL;\n    uint256 public immutable STUB_COST;\n\n    // ===== state =====\n    uint256 public totalSupply;\n    uint256 public stubsSold;\n    mapping(address => uint256) public balanceOf;\n    mapping(uint256 => address) public getApproved;\n    mapping(address => mapping(address => bool)) public isApprovedForAll;\n    mapping(address => uint256) public stubsBoughtBy;\n    mapping(uint32 => uint32) public cardsIn;\n    mapping(uint32 => uint64) public lookAt;\n    mapping(uint32 => bytes32) public slotSeed;\n    mapping(bytes32 => uint32) private _lastSlot; // slot + 1 of the agent's latest free card\n    mapping(uint256 => uint256) private _tokenWord; // holder | kind << 160 | tag << 168 | uses << 200\n    mapping(uint256 => uint256) private _reaped; // 0 = open, else (amount << 8) | (grade + 1)\n    uint256 private _bolt = 1;\n\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 CardIssued(address indexed holder, uint256 indexed id, uint256 slot);\n    event StubIssued(address indexed holder, uint256 indexed id, uint256 expiresAt);\n    event Reaped(address indexed holder, uint256 indexed id, uint8 grade, uint256 amount);\n    event BatchReaped(address indexed holder, uint256 asked, uint256 done, uint256 paid);\n    event StubUsed(uint256 indexed stubId, address indexed holder, uint256 used, uint256 left);\n    event LookRecorded(uint256 indexed slot, uint256 atBlock);\n    event SlotSeeded(uint256 indexed slot, bytes32 seed);\n\n    error ConfigRejected();\n    error TooEarly(uint256 opensAt);\n    error Shut(uint256 closedAt);\n    error NeedHandleOrFunds(uint256 stubCost, uint256 sent);\n    error OncePerSlot(uint256 nextAt);\n    error StubsGone(uint256 left, uint256 walletLeft);\n    error NoSuchToken(uint256 id);\n    error NotYourToken(uint256 id);\n    error NotACard(uint256 id);\n    error NotAStub(uint256 id);\n    error StubSpent(uint256 id);\n    error StubExpired(uint256 id, uint256 at);\n    error AlreadyReaped(uint256 id);\n    error NotRipeYet(uint256 id, uint256 ripeAt);\n    error NoSuchTier(uint8 tier);\n    error SlotNotReady(uint256 slot, uint256 lookBlock);\n    error SlotNotOver(uint256 slot, uint256 overAt);\n    error CoinsShort(uint256 need, uint256 left);\n    error NoTokensGiven();\n    error TollShort(uint256 required, uint256 sent);\n    error PaymentBounced(bytes reason);\n    error RefundDenied(bytes reason);\n    error Locked();\n    error BareSendRefused();\n    error NoSuchSelector(bytes4 selector);\n    error NoPermission();\n    error WrongHolder();\n    error ReceiverRefused();\n\n    constructor(address ledger, address till, uint256 delay, uint256 duration, uint256 toll, uint256 stubCost) {\n        if (\n            ledger.code.length == 0 || till == address(0) || delay > 365 days || duration == 0 || duration > 365 days\n                || toll == 0 || toll > 0.01 ether || stubCost <= toll || stubCost > 0.1 ether\n        ) revert ConfigRejected();\n        HANDLE_LEDGER = OstrenneRegistry(ledger);\n        TILL = till;\n        ENTRY_START = block.timestamp + delay;\n        ENTRY_END = block.timestamp + delay + duration;\n        TOLL = toll;\n        STUB_COST = stubCost;\n        MOTES = new OstrenneCoin(address(this));\n    }\n\n    receive() external payable { // plain BNB is not accepted\n        revert BareSendRefused();\n    }\n\n    fallback() external payable { // no such function here\n        revert NoSuchSelector(msg.sig);\n    }\n\n    function owner() external pure returns (address renounced) {\n        return address(0);\n    }\n\n    // ===== entry: every name does the same thing =====\n    function claim() external payable {\n        _admit();\n    }\n\n    function mint() external payable {\n        _admit();\n    }\n\n    function mint(uint256) external payable {\n        _admit();\n    }\n\n    function mint(address) external payable {\n        _admit();\n    }\n\n    function mint(address, uint256) external payable {\n        _admit();\n    }\n\n    function mint(uint256, address) external payable {\n        _admit();\n    }\n\n    function freeMint() external payable {\n        _admit();\n    }\n\n    function freeMint(uint256) external payable {\n        _admit();\n    }\n\n    function mintFree() external payable {\n        _admit();\n    }\n\n    function mintFree(uint256) external payable {\n        _admit();\n    }\n\n    function claimFree() external payable {\n        _admit();\n    }\n\n    function publicMint() external payable {\n        _admit();\n    }\n\n    function agentMint() external payable {\n        _admit();\n    }\n\n    function _admit() private {\n        if (_bolt != 1) revert Locked();\n        _bolt = 2;\n        if (block.timestamp < ENTRY_START) revert TooEarly(ENTRY_START);\n        if (block.timestamp >= ENTRY_END) revert Shut(ENTRY_END);\n        uint32 slot = uint32(block.timestamp / SLOT_SECS);\n        _chase(slot);\n        bytes32 key = _handleHash(msg.sender);\n        bool freeGiven;\n        if (key != bytes32(0) && _lastSlot[key] != slot + 1) {\n            _lastSlot[key] = slot + 1;\n            _issueCard(msg.sender, slot);\n            freeGiven = true;\n        }\n        uint256 spent;\n        uint256 sets;\n        if (msg.value >= STUB_COST) {\n            uint256 capLeft = STUB_CAP - stubsSold;\n            uint256 walletLeft = STUBS_PER_WALLET - stubsBoughtBy[msg.sender];\n            sets = msg.value / STUB_COST;\n            if (capLeft < sets) sets = capLeft;\n            if (walletLeft < sets) sets = walletLeft;\n            if (sets == 0 && !freeGiven) revert StubsGone(capLeft, walletLeft);\n            for (uint256 i = 0; i < sets; i++) _issueStub(msg.sender);\n            stubsSold += sets;\n            stubsBoughtBy[msg.sender] += sets;\n            spent = sets * STUB_COST;\n        } else if (!freeGiven) {\n            if (key == bytes32(0)) revert NeedHandleOrFunds(STUB_COST, msg.value);\n            revert OncePerSlot((uint256(slot) + 1) * SLOT_SECS);\n        }\n        _forward(spent);\n        _bolt = 1;\n    }\n\n    function _issueCard(address to, uint32 slot) private {\n        uint256 id = totalSupply + 1;\n        totalSupply = id;\n        _tokenWord[id] = uint256(uint160(to)) | (uint256(KIND_CARD) << 160) | (uint256(slot) << 168);\n        unchecked {\n            balanceOf[to] += 1;\n        }\n        cardsIn[slot] += 1;\n        emit Transfer(address(0), to, id);\n        emit CardIssued(to, id, slot);\n    }\n\n    function _issueStub(address to) private {\n        uint256 id = totalSupply + 1;\n        totalSupply = id;\n        uint256 expiry = block.timestamp + STUB_LIFE;\n        _tokenWord[id] = uint256(uint160(to)) | (uint256(KIND_STUB) << 160) | (expiry << 168) | (STUB_USES << 200);\n        unchecked {\n            balanceOf[to] += 1;\n        }\n        emit Transfer(address(0), to, id);\n        emit StubIssued(to, id, expiry);\n    }\n\n    // ===== reaping =====\n    function claim(uint256 id) external payable {\n        if (_bolt != 1) revert Locked();\n        _bolt = 2;\n        uint256 room = _coinsRoom();\n        (uint256 got,, bool done) = _pluck(id, room, false);\n        if (!done) {\n            // got == 0: the card's slot had no look block yet and one was just written; every wei sent goes back\n            if (got != 0) revert CoinsShort(got, room);\n            _forward(0);\n            _bolt = 1;\n            return;\n        }\n        MOTES.mint(msg.sender, got);\n        _chase(uint32(block.timestamp / SLOT_SECS));\n        _forward(TOLL);\n        _bolt = 1;\n    }\n\n    function claim(uint256[] calldata ids) external payable {\n        _reapMany(ids);\n    }\n\n    function claimReward(uint256[] calldata ids) external payable {\n        _reapMany(ids);\n    }\n\n    function _reapMany(uint256[] calldata ids) private {\n        if (_bolt != 1) revert Locked();\n        _bolt = 2;\n        if (ids.length == 0) revert NoTokensGiven();\n        uint256 n = msg.value / TOLL;\n        if (n == 0) revert TollShort(TOLL, msg.value);\n        if (BATCH_MAX < n) n = BATCH_MAX;\n        uint256 look = ids.length < SCAN_MAX ? ids.length : SCAN_MAX;\n        uint256 room = _coinsRoom();\n        uint256 sum;\n        uint256 count;\n        for (uint256 i = 0; i < look && count < n; i++) {\n            (uint256 got,, bool done) = _pluck(ids[i], room - sum, true);\n            if (!done) continue;\n            sum += got;\n            count++;\n        }\n        if (sum != 0) MOTES.mint(msg.sender, sum);\n        _chase(uint32(block.timestamp / SLOT_SECS));\n        emit BatchReaped(msg.sender, ids.length, count, TOLL * count);\n        _forward(TOLL * count);\n        _bolt = 1;\n    }\n\n    /// @notice Reap listed ripe cards with a stub: up to its remaining uses, no toll. Everything sent comes back.\n    function redeemStub(uint256 stubId, uint256[] calldata ids) external payable {\n        if (_bolt != 1) revert Locked();\n        _bolt = 2;\n        uint256 c = _tokenWord[stubId];\n        if (address(uint160(c)) != msg.sender) revert NotYourToken(stubId);\n        if (uint8(c >> 160) != KIND_STUB) revert NotAStub(stubId);\n        uint256 expiry = uint32(c >> 168);\n        if (block.timestamp >= expiry) revert StubExpired(stubId, expiry);\n        uint256 uses = uint8(c >> 200);\n        if (uses == 0) revert StubSpent(stubId);\n        if (ids.length == 0) revert NoTokensGiven();\n        uint256 n = uses;\n        uint256 look = ids.length < SCAN_MAX ? ids.length : SCAN_MAX;\n        uint256 room = _coinsRoom();\n        uint256 sum;\n        uint256 count;\n        for (uint256 i = 0; i < look && count < n; i++) {\n            (uint256 got,, bool done) = _pluck(ids[i], room - sum, true);\n            if (!done) continue;\n            sum += got;\n            count++;\n        }\n        if (count != 0) {\n            _tokenWord[stubId] = (c & ~(uint256(0xff) << 200)) | ((uses - count) << 200);\n            emit StubUsed(stubId, msg.sender, count, uses - count);\n        }\n        if (sum != 0) MOTES.mint(msg.sender, sum);\n        _chase(uint32(block.timestamp / SLOT_SECS));\n        emit BatchReaped(msg.sender, ids.length, count, 0);\n        _forward(0);\n        _bolt = 1;\n    }\n\n    /// @dev done == false: either got == 0 (a look block was just written, the slot is still waiting, or, in a list,\n    ///      the card is not the caller's, not a card, already reaped or not ripe) or got is the grade amount that no\n    ///      longer fits `room`. Nothing else changed. A single claim(id) reverts for the first four instead.\n    function _pluck(uint256 id, uint256 room, bool inBatch) private returns (uint256 got, uint8 grade, bool done) {\n        uint256 c = _tokenWord[id];\n        if (address(uint160(c)) != msg.sender) {\n            if (inBatch) return (0, 0, false);\n            revert NotYourToken(id);\n        }\n        if (uint8(c >> 160) != KIND_CARD) {\n            if (inBatch) return (0, 0, false);\n            revert NotACard(id);\n        }\n        if (_reaped[id] != 0) {\n            if (inBatch) return (0, 0, false);\n            revert AlreadyReaped(id);\n        }\n        uint32 slot = uint32(c >> 168);\n        uint256 due = (uint256(slot) + 1) * SLOT_SECS;\n        if (block.timestamp < due) {\n            if (inBatch) return (0, 0, false);\n            revert NotRipeYet(id, due);\n        }\n        (uint8 st, bytes32 seed) = _peekSlot(slot);\n        if (st == 0) {\n            _settleSlot(slot);\n            return (0, 0, false);\n        }\n        if (st == 1) {\n            if (inBatch) return (0, 0, false);\n            revert SlotNotReady(slot, lookAt[slot]);\n        }\n        if (st != 3) _settleSlot(slot);\n        grade = _gradeFor(seed, id);\n        got = tierAmount(grade);\n        if (got > room) return (got, grade, false);\n        _reaped[id] = (got << 8) | (uint256(grade) + 1);\n        emit Reaped(msg.sender, id, grade, got);\n        return (got, grade, true);\n    }\n\n    function _forward(uint256 cost) private {\n        if (msg.value < cost) revert TollShort(cost, msg.value);\n        if (cost != 0) {\n            (bool ok, bytes memory why) = TILL.call{value: cost}(\"\");\n            if (!ok) revert PaymentBounced(why);\n        }\n        if (msg.value > cost) {\n            (bool back, bytes memory why2) = msg.sender.call{value: msg.value - cost}(\"\");\n            if (!back) revert RefundDenied(why2);\n        }\n    }\n\n    function _coinsRoom() private view returns (uint256) {\n        return MOTES.MOTE_LIMIT() - MOTES.totalSupply();\n    }\n\n    // ===== grades =====\n    function tierOfRoll(uint256 roll) public pure returns (uint8) {\n        roll %= 10_000;\n        if (roll < 50) return 3;\n        if (roll < 500) return 2;\n        if (roll < 2_500) return 1;\n        return 0;\n    }\n\n    function tierAmount(uint8 grade) public pure returns (uint256) {\n        if (grade == 0) return 8e3 ether;\n        if (grade == 1) return 4e4 ether;\n        if (grade == 2) return 2e5 ether;\n        if (grade == 3) return 8e5 ether;\n        revert NoSuchTier(grade);\n    }\n\n    function _gradeFor(bytes32 seed, uint256 id) private pure returns (uint8) {\n        if (seed == FLOOR_SEED) return 0;\n        return tierOfRoll(uint256(keccak256(abi.encodePacked(seed, id))));\n    }\n\n    // ===== slot seed (future block hash) =====\n    /// @dev st: 0 nothing recorded, 1 look block recorded but its hash not readable yet, 2 readable (not stored),\n    ///      3 stored, 4 stale (out of reach: the slot is the lowest grade). seed is set for 2, 3 and 4 only.\n    function _peekSlot(uint32 slot) private view returns (uint8 st, bytes32 seed) {\n        seed = slotSeed[slot];\n        if (seed != bytes32(0)) return (seed == FLOOR_SEED ? 4 : 3, seed);\n        uint256 at = lookAt[slot];\n        if (at == 0) return (0, bytes32(0));\n        if (block.number <= at) return (1, bytes32(0));\n        bytes32 h = blockhash(at);\n        if (h == bytes32(0)) {\n            if (block.number - at > ARCHIVE_DEPTH) return (4, FLOOR_SEED);\n            (bool ok, bytes memory data) = BLOCK_VAULT.staticcall(abi.encode(at));\n            if (!ok || data.length != 32) return (1, bytes32(0));\n            h = bytes32(data);\n            if (h == bytes32(0)) return (1, bytes32(0));\n        }\n        return (2, keccak256(abi.encodePacked(address(this), slot, h)));\n    }\n\n    function _settleSlot(uint32 slot) private returns (uint8 st, bytes32 seed) {\n        (st, seed) = _peekSlot(slot);\n        if (st == 0) {\n            uint256 at = block.number + LOOKAHEAD;\n            lookAt[slot] = uint64(at);\n            emit LookRecorded(slot, at);\n            return (1, bytes32(0));\n        }\n        if (st == 2 || (st == 4 && slotSeed[slot] == bytes32(0))) {\n            slotSeed[slot] = seed;\n            emit SlotSeeded(slot, seed);\n            if (st == 2) st = 3;\n        }\n    }\n\n    /// @dev Moves the two latest finished slots that hold cards forward (record the look block, or store the seed).\n    function _chase(uint32 current) private {\n        for (uint32 back = 1; back <= 2 && back <= current; back++) {\n            uint32 p = current - back;\n            if (cardsIn[p] != 0 && slotSeed[p] == bytes32(0)) _settleSlot(p);\n        }\n    }\n\n    /// @notice Anyone, for a finished slot: record its look block, or store its seed once readable.\n    function settleSlot(uint32 slot) external returns (uint8 st, bytes32 seed) {\n        if (uint256(slot) >= block.timestamp / SLOT_SECS) revert SlotNotOver(slot, (uint256(slot) + 1) * SLOT_SECS);\n        return _settleSlot(slot);\n    }\n\n    /// @notice Anyone: move the two latest finished slots forward.\n    function kick() external {\n        _chase(uint32(block.timestamp / SLOT_SECS));\n    }\n\n    /// @notice Where a slot's seed stands (0 none, 1 waiting, 2 readable, 3 stored, 4 stale). No seed before state 2.\n    function slotState(uint32 slot) external view returns (uint8 st, bytes32 seed) {\n        return _peekSlot(slot);\n    }\n\n    // ===== identity =====\n    function _handleHash(address who) private view returns (bytes32 key) {\n        try HANDLE_LEDGER.handleOf(who) returns (string memory h) {\n            if (bytes(h).length == 0) return bytes32(0);\n            key = keccak256(abi.encodePacked(h));\n        } catch {\n            return bytes32(0);\n        }\n        try HANDLE_LEDGER.ownerOf(uint256(key)) returns (address holder) {\n            if (holder != who) key = bytes32(0);\n        } catch {\n            key = bytes32(0);\n        }\n    }\n\n    function handleHashOf(address who) external view returns (bytes32) {\n        return _handleHash(who);\n    }\n\n    // ===== views =====\n    function currentSlot() external view returns (uint256) {\n        return block.timestamp / SLOT_SECS;\n    }\n\n    function nextSlotAt() external view returns (uint256) {\n        return (block.timestamp / SLOT_SECS + 1) * SLOT_SECS;\n    }\n\n    function entryOpen() public view returns (bool) {\n        return block.timestamp >= ENTRY_START && block.timestamp < ENTRY_END;\n    }\n\n    function MAX_SUPPLY() external pure returns (uint256 cap) {\n        return ~uint256(0);\n    }\n\n    function motesLeft() external view returns (uint256) {\n        return _coinsRoom();\n    }\n\n    function tollFor(uint256 n) external view returns (uint256) {\n        return TOLL * n;\n    }\n\n    function reapsFor(uint256 value) external view returns (uint256) {\n        return value / TOLL;\n    }\n\n    function stubsLeft() external view returns (uint256) {\n        return STUB_CAP - stubsSold;\n    }\n\n    /// @notice What an entry call from `who` with `value` would do now.\n    /// @return freeCard whether it gives this slot's free card\n    /// @return sets stubs it would buy\n    /// @return spent what is paid out\n    /// @return refund what is sent back\n    function entryQuote(address who, uint256 value)\n        external\n        view\n        returns (bool freeCard, uint256 sets, uint256 spent, uint256 refund)\n    {\n        if (!entryOpen()) return (false, 0, 0, value);\n        bytes32 key = _handleHash(who);\n        uint32 slot = uint32(block.timestamp / SLOT_SECS);\n        freeCard = key != bytes32(0) && _lastSlot[key] != slot + 1;\n        if (value >= STUB_COST) {\n            sets = value / STUB_COST;\n            uint256 capLeft = STUB_CAP - stubsSold;\n            uint256 walletLeft = STUBS_PER_WALLET - stubsBoughtBy[who];\n            if (capLeft < sets) sets = capLeft;\n            if (walletLeft < sets) sets = walletLeft;\n        }\n        spent = sets * STUB_COST;\n        refund = value - spent;\n    }\n\n    function typeOf(uint256 id) external view returns (uint8) {\n        uint256 c = _tokenWord[id];\n        if (address(uint160(c)) == address(0)) revert NoSuchToken(id);\n        return uint8(c >> 160);\n    }\n\n    /// @return holder current holder\n    /// @return usesLeft remaining free reaps (0 to 3)\n    /// @return expiresAt end of validity (exclusive)\n    /// @return usable holder could redeem it right now\n    function stubInfo(uint256 id) external view returns (address holder, uint256 usesLeft, uint256 expiresAt, bool usable) {\n        uint256 c = _tokenWord[id];\n        holder = address(uint160(c));\n        if (holder == address(0)) revert NoSuchToken(id);\n        if (uint8(c >> 160) != KIND_STUB) revert NotAStub(id);\n        usesLeft = uint8(c >> 200);\n        expiresAt = uint32(c >> 168);\n        usable = usesLeft != 0 && block.timestamp < expiresAt;\n    }\n\n    function cardSlot(uint256 id) external view returns (uint256) {\n        uint256 c = _tokenWord[id];\n        if (address(uint160(c)) == address(0)) revert NoSuchToken(id);\n        if (uint8(c >> 160) != KIND_CARD) revert NotACard(id);\n        return uint32(c >> 168);\n    }\n\n    function ripeAt(uint256 id) public view returns (uint256) {\n        uint256 c = _tokenWord[id];\n        if (address(uint160(c)) == address(0)) revert NoSuchToken(id);\n        if (uint8(c >> 160) != KIND_CARD) revert NotACard(id);\n        return (uint256(uint32(c >> 168)) + 1) * SLOT_SECS;\n    }\n\n    function reaped(uint256 id) public view returns (bool) {\n        return _reaped[id] != 0;\n    }\n\n    function _worth(uint256 id, uint32 slot) private view returns (bool known, uint8 grade, uint256 amount) {\n        (uint8 st, bytes32 seed) = _peekSlot(slot);\n        if (st < 2) return (false, NOT_READY, 0);\n        grade = _gradeFor(seed, id);\n        return (true, grade, tierAmount(grade));\n    }\n\n    /// @notice 0..3 grade (0 for a stale slot), NOT_READY until the card is ripe and its seed readable; the grade it got once reaped.\n    function gradeOfCard(uint256 id) external view returns (uint8) {\n        uint256 c = _tokenWord[id];\n        if (address(uint160(c)) == address(0)) revert NoSuchToken(id);\n        if (uint8(c >> 160) != KIND_CARD) revert NotACard(id);\n        uint256 r = _reaped[id];\n        if (r != 0) return uint8((r & 0xff) - 1);\n        uint32 slot = uint32(c >> 168);\n        if (block.timestamp < (uint256(slot) + 1) * SLOT_SECS) return NOT_READY;\n        (, uint8 grade,) = _worth(id, slot);\n        return grade;\n    }\n\n    /// @notice What reaping the card would give now (0 if it cannot be reaped yet or no longer fits); what it gave once reaped.\n    function worthOf(uint256 id) external view returns (uint256) {\n        uint256 c = _tokenWord[id];\n        if (address(uint160(c)) == address(0) || uint8(c >> 160) != KIND_CARD) return 0;\n        uint256 r = _reaped[id];\n        if (r != 0) return r >> 8;\n        uint32 slot = uint32(c >> 168);\n        if (block.timestamp < (uint256(slot) + 1) * SLOT_SECS) return 0;\n        (, , uint256 amount) = _worth(id, slot);\n        return amount <= _coinsRoom() ? amount : 0;\n    }\n\n    function reapable(uint256 id) external view returns (bool) {\n        uint256 c = _tokenWord[id];\n        if (address(uint160(c)) == address(0) || uint8(c >> 160) != KIND_CARD || _reaped[id] != 0) return false;\n        uint32 slot = uint32(c >> 168);\n        if (block.timestamp < (uint256(slot) + 1) * SLOT_SECS) return false;\n        (bool known,, uint256 amount) = _worth(id, slot);\n        return known && amount <= _coinsRoom();\n    }\n\n    // ===== ERC-721 =====\n    function ownerOf(uint256 id) public view returns (address holder) {\n        holder = address(uint160(_tokenWord[id]));\n        if (holder == address(0)) revert NoSuchToken(id);\n    }\n\n    function approve(address to, uint256 id) external {\n        address holder = ownerOf(id);\n        if (msg.sender != holder && !isApprovedForAll[holder][msg.sender]) revert NoPermission();\n        getApproved[id] = to;\n        emit Approval(holder, to, id);\n    }\n\n    function setApprovalForAll(address op, bool yes) external {\n        isApprovedForAll[msg.sender][op] = yes;\n        emit ApprovalForAll(msg.sender, op, yes);\n    }\n\n    function transferFrom(address from, address to, uint256 id) public {\n        address holder = ownerOf(id);\n        if (holder != from || to == address(0)) revert WrongHolder();\n        if (msg.sender != holder && !isApprovedForAll[holder][msg.sender] && getApproved[id] != msg.sender) {\n            revert NoPermission();\n        }\n        if (getApproved[id] != address(0)) delete getApproved[id];\n        unchecked {\n            balanceOf[from] -= 1;\n            balanceOf[to] += 1;\n        }\n        _tokenWord[id] = (_tokenWord[id] & ~uint256(type(uint160).max)) | uint256(uint160(to));\n        emit Transfer(from, to, id);\n    }\n\n    function safeTransferFrom(address from, address to, uint256 id) external {\n        safeTransferFrom(from, to, id, \"\");\n    }\n\n    function safeTransferFrom(address from, address to, uint256 id, bytes memory data) public {\n        transferFrom(from, to, id);\n        if (to.code.length != 0) {\n            try OstrenneReceiver(to).onERC721Received(msg.sender, from, id, data) returns (bytes4 r) {\n                if (r != OstrenneReceiver.onERC721Received.selector) revert ReceiverRefused();\n            } catch {\n                revert ReceiverRefused();\n            }\n        }\n    }\n\n    function supportsInterface(bytes4 i) external pure returns (bool) {\n        return i == 0x01ffc9a7 || i == 0x80ac58cd || i == 0x5b5e139f;\n    }\n\n    // ===== metadata =====\n    function tokenURI(uint256 id) external view returns (string memory) {\n        uint256 c = _tokenWord[id];\n        if (address(uint160(c)) == address(0)) revert NoSuchToken(id);\n        bool stub = uint8(c >> 160) == KIND_STUB;\n        string memory line;\n        string memory tint;\n        if (stub) {\n            uint256 left = uint8(c >> 200);\n            bool live = left != 0 && block.timestamp < uint32(c >> 168);\n            line = string.concat(\"Stub \", OstrenneText.numStr(id), \" | \", OstrenneText.numStr(left), \" of 3 left | \", live ? \"VALID\" : \"SPENT OR EXPIRED\");\n            tint = live ? \"#d9a441\" : \"#6b6b6b\";\n        } else {\n            uint256 slot = uint32(c >> 168);\n            bool ripe = block.timestamp / SLOT_SECS > slot;\n            line = string.concat(\"Card \", OstrenneText.numStr(id), \" | Slot \", OstrenneText.numStr(slot), \" | \", ripe ? \"RIPE\" : \"GROWING\");\n            tint = ripe ? \"#5bbf9a\" : \"#4a7fb5\";\n        }\n        string memory art = string.concat(\n            \"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400'><rect width='400' height='400' fill='#14110f'/>\",\n            \"<rect x='40' y='60' width='320' height='200' rx='22' fill='none' stroke='\",\n            tint,\n            \"' stroke-width='5'/><circle cx='200' cy='160' r='50' fill='\",\n            tint,\n            \"' fill-opacity='0.4'/><text x='200' y='330' text-anchor='middle' font-family='monospace' font-size='20' fill='#eee'>\",\n            line,\n            \"</text></svg>\"\n        );\n        string memory meta = string.concat(\n            '{\"image\":\"data:image/svg+xml;base64,',\n            OstrenneText.base64Of(bytes(art)),\n            '\",\"name\":\"Ostrenne #',\n            OstrenneText.numStr(id),\n            '\",\"description\":\"',\n            stub ? \"Three free reaps, valid for seven days from purchase.\" : \"Six-hour card, reaped for coins once the next slot starts.\",\n            '\",\"attributes\":[{\"trait_type\":\"Kind\",\"value\":\"',\n            stub ? \"Stub\" : \"Card\",\n            '\"}]}'\n        );\n        return string.concat(\"data:application/json;base64,\", OstrenneText.base64Of(bytes(meta)));\n    }\n}\n"},"src/OstrenneCoin.sol":{"content":"// SPDX-License-Identifier: Unlicense\npragma solidity 0.8.28;\n\n/// @notice The coin paid out by the Ostrenne contract that created it. The ceiling is a constant, only that contract\n///         can mint, and the coin has no tax, list, pause or pool.\ncontract OstrenneCoin {\n    string public constant name = \"Ostrenne Mote\";\n    string public constant symbol = \"OSTRM\";\n    uint8 public constant decimals = 18;\n    uint256 public constant MOTE_LIMIT = 6_000_000_000 ether;\n    address public immutable MINTER_HOUSE;\n\n    uint256 public totalSupply;\n    mapping(address => uint256) public balanceOf;\n    mapping(address => mapping(address => uint256)) public allowance;\n\n    event Transfer(address indexed from, address indexed to, uint256 value);\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    error HouseOnly();\n    error OverLimit(uint256 room, uint256 asked);\n    error NotEnough(uint256 have, uint256 need);\n    error AllowanceShort(uint256 have, uint256 need);\n    error NullTarget();\n\n    constructor(address house) {\n        MINTER_HOUSE = house;\n    }\n\n    function owner() external pure returns (address renounced) {\n        return address(0);\n    }\n\n    function mint(address who, uint256 motes) external {\n        if (msg.sender != MINTER_HOUSE) revert HouseOnly();\n        uint256 room = MOTE_LIMIT - totalSupply;\n        if (motes > room) revert OverLimit(room, motes);\n        totalSupply += motes;\n        unchecked {\n            balanceOf[who] += motes;\n        }\n        emit Transfer(address(0), who, motes);\n    }\n\n    function approve(address spender, uint256 value) external returns (bool) {\n        allowance[msg.sender][spender] = value;\n        emit Approval(msg.sender, spender, value);\n        return true;\n    }\n\n    function transfer(address to, uint256 value) external returns (bool) {\n        _carry(msg.sender, to, value);\n        return true;\n    }\n\n    function transferFrom(address from, address to, uint256 value) external returns (bool) {\n        uint256 cap = allowance[from][msg.sender];\n        if (cap != type(uint256).max) {\n            if (cap < value) revert AllowanceShort(cap, value);\n            unchecked {\n                allowance[from][msg.sender] = cap - value;\n            }\n        }\n        _carry(from, to, value);\n        return true;\n    }\n\n    function _carry(address from, address to, uint256 value) private {\n        if (to == address(0)) revert NullTarget();\n        uint256 have = balanceOf[from];\n        if (have < value) revert NotEnough(have, value);\n        unchecked {\n            balanceOf[from] = have - value;\n            balanceOf[to] += value;\n        }\n        emit Transfer(from, to, value);\n    }\n}\n"},"src/OstrenneText.sol":{"content":"// SPDX-License-Identifier: Unlicense\npragma solidity 0.8.28;\n\n/// @dev Text helpers for the on-chain token pictures.\nlibrary OstrenneText {\n    bytes private constant ALPHA64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\n    function numStr(uint256 v) internal pure returns (string memory) {\n        if (v == 0) return \"0\";\n        uint256 digits;\n        for (uint256 t = v; t != 0; t /= 10) digits++;\n        bytes memory buf = new bytes(digits);\n        while (v != 0) {\n            buf[--digits] = bytes1(uint8(48 + (v % 10)));\n            v /= 10;\n        }\n        return string(buf);\n    }\n\n    function base64Of(bytes memory raw) internal pure returns (string memory) {\n        uint256 n = raw.length;\n        if (n == 0) return \"\";\n        bytes memory out = new bytes(4 * ((n + 2) / 3));\n        bytes memory tbl = ALPHA64;\n        uint256 w;\n        for (uint256 i = 0; i < n; i += 3) {\n            uint256 x = uint8(raw[i]) << 16;\n            if (i + 1 < n) x |= uint8(raw[i + 1]) << 8;\n            if (i + 2 < n) x |= uint8(raw[i + 2]);\n            out[w++] = tbl[(x >> 18) & 63];\n            out[w++] = tbl[(x >> 12) & 63];\n            out[w++] = i + 1 < n ? tbl[(x >> 6) & 63] : bytes1(\"=\");\n            out[w++] = i + 2 < n ? tbl[x & 63] : bytes1(\"=\");\n        }\n        return string(out);\n    }\n}\n"}},"abi":[{"type":"constructor","inputs":[{"name":"ledger","type":"address","internalType":"address"},{"name":"till","type":"address","internalType":"address"},{"name":"delay","type":"uint256","internalType":"uint256"},{"name":"duration","type":"uint256","internalType":"uint256"},{"name":"toll","type":"uint256","internalType":"uint256"},{"name":"stubCost","type":"uint256","internalType":"uint256"}],"stateMutability":"nonpayable"},{"name":"AlreadyReaped","type":"error","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}]},{"name":"BareSendRefused","type":"error","inputs":[]},{"name":"CoinsShort","type":"error","inputs":[{"name":"need","type":"uint256","internalType":"uint256"},{"name":"left","type":"uint256","internalType":"uint256"}]},{"name":"ConfigRejected","type":"error","inputs":[]},{"name":"Locked","type":"error","inputs":[]},{"name":"NeedHandleOrFunds","type":"error","inputs":[{"name":"stubCost","type":"uint256","internalType":"uint256"},{"name":"sent","type":"uint256","internalType":"uint256"}]},{"name":"NoPermission","type":"error","inputs":[]},{"name":"NoSuchSelector","type":"error","inputs":[{"name":"selector","type":"bytes4","internalType":"bytes4"}]},{"name":"NoSuchTier","type":"error","inputs":[{"name":"tier","type":"uint8","internalType":"uint8"}]},{"name":"NoSuchToken","type":"error","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}]},{"name":"NoTokensGiven","type":"error","inputs":[]},{"name":"NotACard","type":"error","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}]},{"name":"NotAStub","type":"error","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}]},{"name":"NotRipeYet","type":"error","inputs":[{"name":"id","type":"uint256","internalType":"uint256"},{"name":"ripeAt","type":"uint256","internalType":"uint256"}]},{"name":"NotYourToken","type":"error","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}]},{"name":"OncePerSlot","type":"error","inputs":[{"name":"nextAt","type":"uint256","internalType":"uint256"}]},{"name":"PaymentBounced","type":"error","inputs":[{"name":"reason","type":"bytes","internalType":"bytes"}]},{"name":"ReceiverRefused","type":"error","inputs":[]},{"name":"RefundDenied","type":"error","inputs":[{"name":"reason","type":"bytes","internalType":"bytes"}]},{"name":"Shut","type":"error","inputs":[{"name":"closedAt","type":"uint256","internalType":"uint256"}]},{"name":"SlotNotOver","type":"error","inputs":[{"name":"slot","type":"uint256","internalType":"uint256"},{"name":"overAt","type":"uint256","internalType":"uint256"}]},{"name":"SlotNotReady","type":"error","inputs":[{"name":"slot","type":"uint256","internalType":"uint256"},{"name":"lookBlock","type":"uint256","internalType":"uint256"}]},{"name":"StubExpired","type":"error","inputs":[{"name":"id","type":"uint256","internalType":"uint256"},{"name":"at","type":"uint256","internalType":"uint256"}]},{"name":"StubSpent","type":"error","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}]},{"name":"StubsGone","type":"error","inputs":[{"name":"left","type":"uint256","internalType":"uint256"},{"name":"walletLeft","type":"uint256","internalType":"uint256"}]},{"name":"TollShort","type":"error","inputs":[{"name":"required","type":"uint256","internalType":"uint256"},{"name":"sent","type":"uint256","internalType":"uint256"}]},{"name":"TooEarly","type":"error","inputs":[{"name":"opensAt","type":"uint256","internalType":"uint256"}]},{"name":"WrongHolder","type":"error","inputs":[]},{"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":"BatchReaped","type":"event","inputs":[{"name":"holder","type":"address","indexed":true,"internalType":"address"},{"name":"asked","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"done","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"paid","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"CardIssued","type":"event","inputs":[{"name":"holder","type":"address","indexed":true,"internalType":"address"},{"name":"id","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"slot","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"LookRecorded","type":"event","inputs":[{"name":"slot","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"atBlock","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"Reaped","type":"event","inputs":[{"name":"holder","type":"address","indexed":true,"internalType":"address"},{"name":"id","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"grade","type":"uint8","indexed":false,"internalType":"uint8"},{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"SlotSeeded","type":"event","inputs":[{"name":"slot","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"seed","type":"bytes32","indexed":false,"internalType":"bytes32"}],"anonymous":false},{"name":"StubIssued","type":"event","inputs":[{"name":"holder","type":"address","indexed":true,"internalType":"address"},{"name":"id","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"expiresAt","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"StubUsed","type":"event","inputs":[{"name":"stubId","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"holder","type":"address","indexed":true,"internalType":"address"},{"name":"used","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"left","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},{"type":"fallback","stateMutability":"payable"},{"name":"BATCH_MAX","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"ENTRY_END","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"ENTRY_START","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"HANDLE_LEDGER","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract OstrenneRegistry"}],"stateMutability":"view"},{"name":"KIND_CARD","type":"function","inputs":[],"outputs":[{"name":"","type":"uint8","internalType":"uint8"}],"stateMutability":"view"},{"name":"KIND_STUB","type":"function","inputs":[],"outputs":[{"name":"","type":"uint8","internalType":"uint8"}],"stateMutability":"view"},{"name":"MAX_SUPPLY","type":"function","inputs":[],"outputs":[{"name":"cap","type":"uint256","internalType":"uint256"}],"stateMutability":"pure"},{"name":"MOTES","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract OstrenneCoin"}],"stateMutability":"view"},{"name":"NOT_READY","type":"function","inputs":[],"outputs":[{"name":"","type":"uint8","internalType":"uint8"}],"stateMutability":"view"},{"name":"SCAN_MAX","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"SLOT_SECS","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"STUBS_PER_WALLET","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"STUB_CAP","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"STUB_COST","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"STUB_LIFE","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"STUB_USES","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"TILL","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"TOLL","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"agentMint","type":"function","inputs":[],"outputs":[],"stateMutability":"payable"},{"name":"approve","type":"function","inputs":[{"name":"to","type":"address","internalType":"address"},{"name":"id","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"balanceOf","type":"function","inputs":[{"name":"","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"cardSlot","type":"function","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"cardsIn","type":"function","inputs":[{"name":"","type":"uint32","internalType":"uint32"}],"outputs":[{"name":"","type":"uint32","internalType":"uint32"}],"stateMutability":"view"},{"name":"claim","type":"function","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"payable"},{"name":"claim","type":"function","inputs":[],"outputs":[],"stateMutability":"payable"},{"name":"claim","type":"function","inputs":[{"name":"ids","type":"uint256[]","internalType":"uint256[]"}],"outputs":[],"stateMutability":"payable"},{"name":"claimFree","type":"function","inputs":[],"outputs":[],"stateMutability":"payable"},{"name":"claimReward","type":"function","inputs":[{"name":"ids","type":"uint256[]","internalType":"uint256[]"}],"outputs":[],"stateMutability":"payable"},{"name":"currentSlot","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"entryOpen","type":"function","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"entryQuote","type":"function","inputs":[{"name":"who","type":"address","internalType":"address"},{"name":"value","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"freeCard","type":"bool","internalType":"bool"},{"name":"sets","type":"uint256","internalType":"uint256"},{"name":"spent","type":"uint256","internalType":"uint256"},{"name":"refund","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"freeMint","type":"function","inputs":[],"outputs":[],"stateMutability":"payable"},{"name":"freeMint","type":"function","inputs":[{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"payable"},{"name":"getApproved","type":"function","inputs":[{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"gradeOfCard","type":"function","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint8","internalType":"uint8"}],"stateMutability":"view"},{"name":"handleHashOf","type":"function","inputs":[{"name":"who","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"name":"isApprovedForAll","type":"function","inputs":[{"name":"","type":"address","internalType":"address"},{"name":"","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"kick","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"lookAt","type":"function","inputs":[{"name":"","type":"uint32","internalType":"uint32"}],"outputs":[{"name":"","type":"uint64","internalType":"uint64"}],"stateMutability":"view"},{"name":"mint","type":"function","inputs":[],"outputs":[],"stateMutability":"payable"},{"name":"mint","type":"function","inputs":[{"name":"","type":"address","internalType":"address"},{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"payable"},{"name":"mint","type":"function","inputs":[{"name":"","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"payable"},{"name":"mint","type":"function","inputs":[{"name":"","type":"uint256","internalType":"uint256"},{"name":"","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"payable"},{"name":"mint","type":"function","inputs":[{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"payable"},{"name":"mintFree","type":"function","inputs":[],"outputs":[],"stateMutability":"payable"},{"name":"mintFree","type":"function","inputs":[{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"payable"},{"name":"motesLeft","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"name","type":"function","inputs":[],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"view"},{"name":"nextSlotAt","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"owner","type":"function","inputs":[],"outputs":[{"name":"renounced","type":"address","internalType":"address"}],"stateMutability":"pure"},{"name":"ownerOf","type":"function","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"holder","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"publicMint","type":"function","inputs":[],"outputs":[],"stateMutability":"payable"},{"name":"reapable","type":"function","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"reaped","type":"function","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"reapsFor","type":"function","inputs":[{"name":"value","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"redeemStub","type":"function","inputs":[{"name":"stubId","type":"uint256","internalType":"uint256"},{"name":"ids","type":"uint256[]","internalType":"uint256[]"}],"outputs":[],"stateMutability":"payable"},{"name":"ripeAt","type":"function","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"safeTransferFrom","type":"function","inputs":[{"name":"from","type":"address","internalType":"address"},{"name":"to","type":"address","internalType":"address"},{"name":"id","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":"id","type":"uint256","internalType":"uint256"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"setApprovalForAll","type":"function","inputs":[{"name":"op","type":"address","internalType":"address"},{"name":"yes","type":"bool","internalType":"bool"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"settleSlot","type":"function","inputs":[{"name":"slot","type":"uint32","internalType":"uint32"}],"outputs":[{"name":"st","type":"uint8","internalType":"uint8"},{"name":"seed","type":"bytes32","internalType":"bytes32"}],"stateMutability":"nonpayable"},{"name":"slotSeed","type":"function","inputs":[{"name":"","type":"uint32","internalType":"uint32"}],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"name":"slotState","type":"function","inputs":[{"name":"slot","type":"uint32","internalType":"uint32"}],"outputs":[{"name":"st","type":"uint8","internalType":"uint8"},{"name":"seed","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"name":"stubInfo","type":"function","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"holder","type":"address","internalType":"address"},{"name":"usesLeft","type":"uint256","internalType":"uint256"},{"name":"expiresAt","type":"uint256","internalType":"uint256"},{"name":"usable","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"stubsBoughtBy","type":"function","inputs":[{"name":"","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"stubsLeft","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"stubsSold","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"supportsInterface","type":"function","inputs":[{"name":"i","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":"tierAmount","type":"function","inputs":[{"name":"grade","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"pure"},{"name":"tierOfRoll","type":"function","inputs":[{"name":"roll","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint8","internalType":"uint8"}],"stateMutability":"pure"},{"name":"tokenURI","type":"function","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"view"},{"name":"tollFor","type":"function","inputs":[{"name":"n","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"totalSupply","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":"id","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"typeOf","type":"function","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint8","internalType":"uint8"}],"stateMutability":"view"},{"name":"worthOf","type":"function","inputs":[{"name":"id","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"receive","stateMutability":"payable"}],"matchId":"59644506","creationMatch":"exact_match","runtimeMatch":"exact_match","verifiedAt":"2026-11-21T05:00:35Z","match":"exact_match","chainId":"56","address":"0x9fEB50Ae2DBa712a3F121F65F07be8802AF39a5e"}