Skip to content
Verified contractPartialMIT

SectionsViews

Address0x026b80d8cee675de15f201b800320a890a73d36e
Balance

0 ETH

 

Transactions

304

 

Compiler

solc 0.8.35

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.35+commit.47b9dedd
Language
solidity
Optimization
Yes, 200 runs
EVM version
cancun
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,363,734
Creation transaction
0x36454015e2…b53eb4995f

src/SectionsViews.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import { Ownable } from "solady/auth/Ownable.sol";

interface IERC721Owner {
    function ownerOf(uint256 tokenId) external view returns (address);
}

/**
 * @title  SectionsViews
 * @notice How a Section or a Megacity opens, chosen by whoever holds it or by a wallet on the master
 *         list, and kept on chain, where the token's own metadata reads it (OperationsMetadata's
 *         `viewsContract`, MegacityViewsMetadata).
 *
 * @dev    OperationsViews with a price, a master list and a reset (Fred, 7 Nov 2026: "should be able
 *         to fix a price for it ? could be 0 and we should have a master list able to do it in
 *         addition to token holder ... also offer a reset function for all views"). The view, its
 *         packing and its read functions are OperationsViews' own, word for word, so
 *         OperationsMetadata.setViewsContract takes this contract and the site's storedView() reads
 *         it unchanged. What is new:
 *
 *         1. A collection takes views once it is listed, and each listed collection has its own
 *            price to save one, in wei, which can be 0. A holder pays it on every save; clearing a
 *            view is free.
 *         2. The master list: wallets that may save or clear the view of any token of a listed
 *            collection, paying nothing, and run the list itself, the prices and the reset. The
 *            owner can do all of that too, and alone sets the payout, forwards a call (`execute`)
 *            and hands the contract on.
 *         3. The reset. A view is stored with its collection's epoch at the time it was saved and
 *            counts only while that is still the collection's epoch, so `reset` drops every view of
 *            a collection by moving it to the next epoch: one write, however many views there are.
 *            `restore` (or `setEpoch` back to the old number) is the undo, and the views saved
 *            before the reset come back as they were.
 *
 *         Authority is `ownerOf` at call time, read live from the token contract, as in
 *         OperationsViews: a view belongs to the work and stays with it when it changes hands.
 *
 *         Reversibility (CLAUDE.md): `setView` is undone by `clearView` or by saving the old view
 *         again, `reset` by `restore` (or `setEpoch`), every setter by being called again with the
 *         old value.
 *         `execute` and `withdraw` are kept; ownership cannot be renounced.
 */
contract SectionsViews is Ownable {
    /// @dev camera: 0 = elevation (the engine's own default), 1 = plan, 2 = isometric. The engines'
    ///      keys are "2", "1" and "q": not the same order (OperationsMetadata maps them).
    uint8 public constant CAMERA_DEFAULT = 0;
    uint8 public constant CAMERA_PLAN = 1;
    uint8 public constant CAMERA_ISO = 2;
    uint8 public constant CAMERA_MAX = 2;

    /// @dev Wheel ticks of 100 from the camera's own distance, the unit both engines zoom by.
    int8 public constant ZOOM_MIN = -8;
    int8 public constant ZOOM_MAX = 24;

    struct View {
        bool set;
        uint8 camera;
        bool night;
        bool traffic;
        bool line;
        int8 zoom;
    }

    /// @dev One slot: whether it takes views, the epoch its views count in, the price of a save.
    struct Collection {
        bool listed;
        uint32 epoch;
        uint128 price;
    }

    mapping(address => Collection) public collections;

    /// @dev nft => tokenId => packed view: bit 0 set, 8-15 camera, 16 night, 17 traffic, 18 line,
    ///      24-31 zoom (OperationsViews' word), 32-63 the epoch it was saved in.
    mapping(address => mapping(uint256 => uint256)) private _views;

    address[] private _masters;
    /// @dev position in `_masters` plus one; 0 is not on the list.
    mapping(address => uint256) private _masterAt;

    /// @notice Where `withdraw` sends what the saves have paid.
    address public payout;

    event ViewSet(
        address indexed nft,
        uint256 indexed tokenId,
        address indexed by,
        uint8 camera,
        bool night,
        bool traffic,
        bool line,
        int8 zoom,
        uint256 paid
    );
    event ViewCleared(address indexed nft, uint256 indexed tokenId, address indexed by);
    event ViewsReset(address indexed nft, uint32 epoch);
    event EpochSet(address indexed nft, uint32 epoch);
    event CollectionSet(address indexed nft, bool listed, uint256 price);
    event MasterSet(address indexed who, bool on);
    event PayoutSet(address indexed payout);
    event Withdrawn(address indexed to, uint256 amount);
    event Executed(address indexed target, uint256 value, bytes data);

    error NotTokenOwner();
    error NotMaster();
    error NotListed();
    error BadCamera();
    error BadZoom();
    error WrongPrice();
    error PriceTooHigh();
    error NotAContract();
    error ZeroAddress();
    error NothingToRestore();
    error WithdrawFailed();
    error ExecuteFailed();
    error OwnershipCannotBeRenounced();

    modifier onlyMasterOrOwner() {
        if (!_runs(msg.sender)) revert NotMaster();
        _;
    }

    constructor(address payout_) {
        _initializeOwner(msg.sender);
        _setPayout(payout_);
    }

    /// @dev Zeroing the owner would leave the payout and `execute` with no one to run them.
    function renounceOwnership() public payable override {
        revert OwnershipCannotBeRenounced();
    }

    // ============ Saving a view ============

    /// @notice Record how this piece should open. The holder pays the collection's price, exactly;
    ///         a wallet on the master list (or the owner) pays nothing and sends nothing.
    function setView(
        address nft,
        uint256 tokenId,
        uint8 camera,
        bool night,
        bool traffic,
        bool line,
        int8 zoom
    ) external payable {
        Collection memory c = collections[nft];
        if (!c.listed) revert NotListed();
        if (camera > CAMERA_MAX) revert BadCamera();
        if (zoom < ZOOM_MIN || zoom > ZOOM_MAX) revert BadZoom();
        // ownerOf also refuses a token that does not exist, for a master too
        address holder = IERC721Owner(nft).ownerOf(tokenId);
        if (_runs(msg.sender)) {
            if (msg.value != 0) revert WrongPrice();
        } else {
            if (holder != msg.sender) revert NotTokenOwner();
            if (msg.value != c.price) revert WrongPrice();
        }

        _views[nft][tokenId] =
            1 |
            (uint256(camera) << 8) |
            (night ? 1 << 16 : 0) |
            (traffic ? 1 << 17 : 0) |
            (line ? 1 << 18 : 0) |
            (uint256(uint8(zoom)) << 24) |
            (uint256(c.epoch) << 32);

        emit ViewSet(nft, tokenId, msg.sender, camera, night, traffic, line, zoom, msg.value);
    }

    /// @notice The undo: the piece opens however its engine opens it. Free, for the holder or a master.
    function clearView(address nft, uint256 tokenId) external {
        if (IERC721Owner(nft).ownerOf(tokenId) != msg.sender && !_runs(msg.sender)) revert NotTokenOwner();
        delete _views[nft][tokenId];
        emit ViewCleared(nft, tokenId, msg.sender);
    }

    // ============ Reading it (OperationsViews' functions) ============

    /// @notice The stored view. `set` is false when none counts (never saved, cleared, or saved
    ///         before the collection's last reset); every other field is then zero. Never reverts:
    ///         OperationsMetadata reads it inside `tokenURI`.
    function viewOf(address nft, uint256 tokenId) public view returns (View memory v) {
        uint256 p = _current(nft, tokenId);
        if (p == 0) return v;
        v.set = true;
        v.camera = uint8((p >> 8) & 0xFF);
        v.night = (p >> 16) & 1 == 1;
        v.traffic = (p >> 17) & 1 == 1;
        v.line = (p >> 18) & 1 == 1;
        v.zoom = int8(uint8((p >> 24) & 0xFF));
    }

    /// @notice OperationsViews' packed word for the view that counts, or 0.
    function packedView(address nft, uint256 tokenId) external view returns (uint256) {
        return _current(nft, tokenId);
    }

    /// @notice Views for a list of ids in one call.
    function viewsOf(address nft, uint256[] calldata tokenIds) external view returns (View[] memory out) {
        out = new View[](tokenIds.length);
        for (uint256 i; i < tokenIds.length; ++i) out[i] = viewOf(nft, tokenIds[i]);
    }

    /// @notice The query string a renderer appends to apply a stored view, or "" when none counts.
    function viewQuery(address nft, uint256 tokenId) external view returns (string memory) {
        View memory v = viewOf(nft, tokenId);
        if (!v.set) return "";
        bytes memory b = abi.encodePacked("?c=", _u(v.camera));
        if (v.night) b = abi.encodePacked(b, "&n=1");
        if (v.traffic) b = abi.encodePacked(b, "&t=1");
        if (v.line) b = abi.encodePacked(b, "&l=1");
        if (v.zoom != 0) {
            b = v.zoom < 0
                ? abi.encodePacked(b, "&z=-", _u(uint8(-v.zoom)))
                : abi.encodePacked(b, "&z=", _u(uint8(v.zoom)));
        }
        return string(b);
    }

    function _current(address nft, uint256 tokenId) internal view returns (uint256 p) {
        p = _views[nft][tokenId];
        if (p & 1 == 0 || uint32(p >> 32) != collections[nft].epoch) return 0;
        return p & 0xFFFFFFFF;
    }

    // ============ The master list ============

    function isMaster(address who) public view returns (bool) {
        return _masterAt[who] != 0;
    }

    function masters() external view returns (address[] memory) {
        return _masters;
    }

    /// @notice Put wallets on the master list (`on`) or take them off. Its own undo.
    function setMasters(address[] calldata who, bool on) external onlyMasterOrOwner {
        for (uint256 i; i < who.length; ++i) {
            address a = who[i];
            if (a == address(0)) revert ZeroAddress();
            uint256 at = _masterAt[a];
            if (on && at == 0) {
                _masters.push(a);
                _masterAt[a] = _masters.length;
                emit MasterSet(a, true);
            } else if (!on && at != 0) {
                address last = _masters[_masters.length - 1];
                _masters[at - 1] = last;
                _masterAt[last] = at;
                _masters.pop();
                delete _masterAt[a];
                emit MasterSet(a, false);
            }
        }
    }

    // ============ Collections, prices, the reset ============

    /// @notice List a collection (or stop it taking new views) and set its price in wei. Its views
    ///         and its epoch are kept either way. Its own undo.
    function setCollection(address nft, bool listed, uint256 price) external onlyMasterOrOwner {
        if (nft.code.length == 0) revert NotAContract();
        if (price > type(uint128).max) revert PriceTooHigh();
        Collection storage c = collections[nft];
        c.listed = listed;
        c.price = uint128(price);
        emit CollectionSet(nft, listed, price);
    }

    /// @notice Drop every view of these collections at once. `restore` is the undo.
    function reset(address[] calldata nfts) external onlyMasterOrOwner {
        for (uint256 i; i < nfts.length; ++i) {
            Collection storage c = collections[nfts[i]];
            c.epoch += 1;
            emit ViewsReset(nfts[i], c.epoch);
        }
    }

    /// @notice `reset`'s undo, in one call as the reset is: each collection back one epoch, so the
    ///         views from before its last reset count again (and any saved since wait).
    function restore(address[] calldata nfts) external onlyMasterOrOwner {
        for (uint256 i; i < nfts.length; ++i) {
            Collection storage c = collections[nfts[i]];
            if (c.epoch == 0) revert NothingToRestore();
            c.epoch -= 1;
            emit EpochSet(nfts[i], c.epoch);
        }
    }

    /// @notice Move a collection to any epoch; back to the one before a reset brings its views back.
    function setEpoch(address nft, uint32 epoch) external onlyMasterOrOwner {
        collections[nft].epoch = epoch;
        emit EpochSet(nft, epoch);
    }

    // ============ Money, and the owner's own ============

    /// @notice Send what the saves have paid to the payout.
    function withdraw() external onlyMasterOrOwner {
        uint256 amount = address(this).balance;
        address to = payout;
        (bool ok,) = to.call{ value: amount }("");
        if (!ok) revert WithdrawFailed();
        emit Withdrawn(to, amount);
    }

    function setPayout(address payout_) external onlyOwner {
        _setPayout(payout_);
    }

    /// @notice Forward a call, for whatever this contract turns out to need after deployment.
    function execute(address target, uint256 value, bytes calldata data)
        external
        payable
        onlyOwner
        returns (bytes memory result)
    {
        bool ok;
        (ok, result) = target.call{ value: value }(data);
        if (!ok) revert ExecuteFailed();
        emit Executed(target, value, data);
    }

    function _setPayout(address payout_) internal {
        if (payout_ == address(0)) revert ZeroAddress();
        payout = payout_;
        emit PayoutSet(payout_);
    }

    function _runs(address who) internal view returns (bool) {
        return _masterAt[who] != 0 || who == owner();
    }

    function _u(uint8 n) private pure returns (bytes memory) {
        if (n == 0) return "0";
        bytes memory r;
        while (n != 0) {
            r = abi.encodePacked(bytes1(uint8(48 + (n % 10))), r);
            n /= 10;
        }
        return r;
    }
}

lib/solady/src/auth/Ownable.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Simple single owner authorization mixin.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)
///
/// @dev Note:
/// This implementation does NOT auto-initialize the owner to `msg.sender`.
/// You MUST call the `_initializeOwner` in the constructor / initializer.
///
/// While the ownable portion follows
/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,
/// the nomenclature for the 2-step ownership handover may be unique to this codebase.
abstract contract Ownable {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The caller is not authorized to call the function.
    error Unauthorized();

    /// @dev The `newOwner` cannot be the zero address.
    error NewOwnerIsZeroAddress();

    /// @dev The `pendingOwner` does not have a valid handover request.
    error NoHandoverRequest();

    /// @dev Cannot double-initialize.
    error AlreadyInitialized();

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                           EVENTS                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The ownership is transferred from `oldOwner` to `newOwner`.
    /// This event is intentionally kept the same as OpenZeppelin's Ownable to be
    /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),
    /// despite it not being as lightweight as a single argument event.
    event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);

    /// @dev An ownership handover to `pendingOwner` has been requested.
    event OwnershipHandoverRequested(address indexed pendingOwner);

    /// @dev The ownership handover to `pendingOwner` has been canceled.
    event OwnershipHandoverCanceled(address indexed pendingOwner);

    /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`.
    uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =
        0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;

    /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`.
    uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =
        0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;

    /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`.
    uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =
        0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                          STORAGE                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The owner slot is given by:
    /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`.
    /// It is intentionally chosen to be a high value
    /// to avoid collision with lower slots.
    /// The choice of manual storage layout is to enable compatibility
    /// with both regular and upgradeable contracts.
    bytes32 internal constant _OWNER_SLOT =
        0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927;

    /// The ownership handover slot of `newOwner` is given by:
    /// ```
    ///     mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))
    ///     let handoverSlot := keccak256(0x00, 0x20)
    /// ```
    /// It stores the expiry timestamp of the two-step ownership handover.
    uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                     INTERNAL FUNCTIONS                     */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Override to return true to make `_initializeOwner` prevent double-initialization.
    function _guardInitializeOwner() internal pure virtual returns (bool guard) {}

    /// @dev Initializes the owner directly without authorization guard.
    /// This function must be called upon initialization,
    /// regardless of whether the contract is upgradeable or not.
    /// This is to enable generalization to both regular and upgradeable contracts,
    /// and to save gas in case the initial owner is not the caller.
    /// For performance reasons, this function will not check if there
    /// is an existing owner.
    function _initializeOwner(address newOwner) internal virtual {
        if (_guardInitializeOwner()) {
            /// @solidity memory-safe-assembly
            assembly {
                let ownerSlot := _OWNER_SLOT
                if sload(ownerSlot) {
                    mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`.
                    revert(0x1c, 0x04)
                }
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Store the new value.
                sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
            }
        } else {
            /// @solidity memory-safe-assembly
            assembly {
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Store the new value.
                sstore(_OWNER_SLOT, newOwner)
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
            }
        }
    }

    /// @dev Sets the owner directly without authorization guard.
    function _setOwner(address newOwner) internal virtual {
        if (_guardInitializeOwner()) {
            /// @solidity memory-safe-assembly
            assembly {
                let ownerSlot := _OWNER_SLOT
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
                // Store the new value.
                sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
            }
        } else {
            /// @solidity memory-safe-assembly
            assembly {
                let ownerSlot := _OWNER_SLOT
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
                // Store the new value.
                sstore(ownerSlot, newOwner)
            }
        }
    }

    /// @dev Throws if the sender is not the owner.
    function _checkOwner() internal view virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // If the caller is not the stored owner, revert.
            if iszero(eq(caller(), sload(_OWNER_SLOT))) {
                mstore(0x00, 0x82b42900) // `Unauthorized()`.
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Returns how long a two-step ownership handover is valid for in seconds.
    /// Override to return a different value if needed.
    /// Made internal to conserve bytecode. Wrap it in a public function if needed.
    function _ownershipHandoverValidFor() internal view virtual returns (uint64) {
        return 48 * 3600;
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                  PUBLIC UPDATE FUNCTIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Allows the owner to transfer the ownership to `newOwner`.
    function transferOwnership(address newOwner) public payable virtual onlyOwner {
        /// @solidity memory-safe-assembly
        assembly {
            if iszero(shl(96, newOwner)) {
                mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.
                revert(0x1c, 0x04)
            }
        }
        _setOwner(newOwner);
    }

    /// @dev Allows the owner to renounce their ownership.
    function renounceOwnership() public payable virtual onlyOwner {
        _setOwner(address(0));
    }

    /// @dev Request a two-step ownership handover to the caller.
    /// The request will automatically expire in 48 hours (172800 seconds) by default.
    function requestOwnershipHandover() public payable virtual {
        unchecked {
            uint256 expires = block.timestamp + _ownershipHandoverValidFor();
            /// @solidity memory-safe-assembly
            assembly {
                // Compute and set the handover slot to `expires`.
                mstore(0x0c, _HANDOVER_SLOT_SEED)
                mstore(0x00, caller())
                sstore(keccak256(0x0c, 0x20), expires)
                // Emit the {OwnershipHandoverRequested} event.
                log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())
            }
        }
    }

    /// @dev Cancels the two-step ownership handover to the caller, if any.
    function cancelOwnershipHandover() public payable virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute and set the handover slot to 0.
            mstore(0x0c, _HANDOVER_SLOT_SEED)
            mstore(0x00, caller())
            sstore(keccak256(0x0c, 0x20), 0)
            // Emit the {OwnershipHandoverCanceled} event.
            log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())
        }
    }

    /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.
    /// Reverts if there is no existing ownership handover requested by `pendingOwner`.
    function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute and set the handover slot to 0.
            mstore(0x0c, _HANDOVER_SLOT_SEED)
            mstore(0x00, pendingOwner)
            let handoverSlot := keccak256(0x0c, 0x20)
            // If the handover does not exist, or has expired.
            if gt(timestamp(), sload(handoverSlot)) {
                mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.
                revert(0x1c, 0x04)
            }
            // Set the handover slot to 0.
            sstore(handoverSlot, 0)
        }
        _setOwner(pendingOwner);
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   PUBLIC READ FUNCTIONS                    */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the owner of the contract.
    function owner() public view virtual returns (address result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := sload(_OWNER_SLOT)
        }
    }

    /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.
    function ownershipHandoverExpiresAt(address pendingOwner)
        public
        view
        virtual
        returns (uint256 result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute the handover slot.
            mstore(0x0c, _HANDOVER_SLOT_SEED)
            mstore(0x00, pendingOwner)
            // Load the handover slot.
            result := sload(keccak256(0x0c, 0x20))
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         MODIFIERS                          */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Marks a function as only callable by the owner.
    modifier onlyOwner() virtual {
        _checkOwner();
        _;
    }
}
Compiler settingsShow
{
  "viaIR": false,
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "none",
    "useLiteralContent": false
  },
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "cancun",
  "remappings": [
    "seadrop/=lib/seadrop/src/",
    "ERC721A/=lib/seadrop/lib/ERC721A/contracts/",
    "openzeppelin-contracts/=lib/seadrop/lib/openzeppelin-contracts/contracts/",
    "operator-filter-registry/=lib/seadrop/lib/operator-filter-registry/src/",
    "solmate/=lib/seadrop/lib/solmate/src/",
    "utility-contracts/=lib/seadrop/lib/utility-contracts/src/",
    "solady/=lib/solady/src/",
    "forge-std/=lib/forge-std/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "ERC721A-Upgradeable/=lib/seadrop/lib/ERC721A-Upgradeable/contracts/",
    "create2-helpers/=lib/seadrop/lib/create2-helpers/",
    "create2-scripts/=lib/seadrop/lib/create2-helpers/script/",
    "murky/=lib/seadrop/lib/murky/src/",
    "openzeppelin-contracts-upgradeable/=lib/seadrop/lib/openzeppelin-contracts-upgradeable/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.