ETH Price: $3,131.01 (-5.56%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Settle All Aucti...192011892024-02-11 0:13:35351 days ago1707610415IN
0x5892Cad5...0DcE21CE9
0 ETH0.0126199126.85243412
Place Bid191881712024-02-09 4:23:35353 days ago1707452615IN
0x5892Cad5...0DcE21CE9
0.09 ETH0.004601850.2188793
Place Bid191876082024-02-09 2:29:23353 days ago1707445763IN
0x5892Cad5...0DcE21CE9
0.15 ETH0.0042710446.60928612
Place Bid191876052024-02-09 2:28:47353 days ago1707445727IN
0x5892Cad5...0DcE21CE9
0.08 ETH0.0044254948.29480834
Place Bid191755572024-02-07 9:54:59355 days ago1707299699IN
0x5892Cad5...0DcE21CE9
0.14 ETH0.0027040329.50878922
Place Bid191733782024-02-07 2:33:59355 days ago1707273239IN
0x5892Cad5...0DcE21CE9
0.07 ETH0.0024205926.41563952
Place Bid191723472024-02-06 23:06:11355 days ago1707260771IN
0x5892Cad5...0DcE21CE9
0.13 ETH0.002192723.92867561
Place Bid191716222024-02-06 20:38:47355 days ago1707251927IN
0x5892Cad5...0DcE21CE9
0.12 ETH0.0029047131.69870627
Place Bid191714542024-02-06 20:04:59355 days ago1707249899IN
0x5892Cad5...0DcE21CE9
0.07 ETH0.0034064437.17408085
Place Bid191714512024-02-06 20:04:23355 days ago1707249863IN
0x5892Cad5...0DcE21CE9
0.07 ETH0.0035059438.25987412
Place Bid191675072024-02-06 6:46:11356 days ago1707201971IN
0x5892Cad5...0DcE21CE9
0.11 ETH0.0028441731.03811578
Place Bid191674792024-02-06 6:40:35356 days ago1707201635IN
0x5892Cad5...0DcE21CE9
0.1 ETH0.0026577629.00380595
Place Bid191674722024-02-06 6:39:11356 days ago1707201551IN
0x5892Cad5...0DcE21CE9
0.06 ETH0.0029486632.17839761
Place Bid191674692024-02-06 6:38:35356 days ago1707201515IN
0x5892Cad5...0DcE21CE9
0.09 ETH0.0028719531.34119586
Place Bid191674682024-02-06 6:38:23356 days ago1707201503IN
0x5892Cad5...0DcE21CE9
0.06 ETH0.0030145332.89719538
Place Bid191674672024-02-06 6:38:11356 days ago1707201491IN
0x5892Cad5...0DcE21CE9
0.08 ETH0.0029846432.57096206
Place Bid191668672024-02-06 4:37:35356 days ago1707194255IN
0x5892Cad5...0DcE21CE9
0.08 ETH0.0021415119.69481902
Place Bid191665082024-02-06 3:25:35356 days ago1707189935IN
0x5892Cad5...0DcE21CE9
0.07 ETH0.0017603219.21019082
Place Bid191665052024-02-06 3:24:59356 days ago1707189899IN
0x5892Cad5...0DcE21CE9
0.07 ETH0.0021462519.73840446
Place Bid191662222024-02-06 2:27:59356 days ago1707186479IN
0x5892Cad5...0DcE21CE9
0.05 ETH0.0022503519.3290993
Place Bid191650312024-02-05 22:28:11356 days ago1707172091IN
0x5892Cad5...0DcE21CE9
0.05 ETH0.0025360221.78287275
Place Bid191649722024-02-05 22:16:23356 days ago1707171383IN
0x5892Cad5...0DcE21CE9
0.05 ETH0.0024834825.00413607
Place Bid191649502024-02-05 22:11:59356 days ago1707171119IN
0x5892Cad5...0DcE21CE9
0.06 ETH0.0022650924.71870934
Place Bid191649482024-02-05 22:11:35356 days ago1707171095IN
0x5892Cad5...0DcE21CE9
0.05 ETH0.000634820.29997431
Place Bid191649482024-02-05 22:11:35356 days ago1707171095IN
0x5892Cad5...0DcE21CE9
0.05 ETH0.0023633820.29997431
View all transactions

Latest 21 internal transactions

Advanced mode:
Parent Transaction Hash Block
From
To
192011892024-02-11 0:13:35351 days ago1707610415
0x5892Cad5...0DcE21CE9
0.46 ETH
191881712024-02-09 4:23:35353 days ago1707452615
0x5892Cad5...0DcE21CE9
0.08 ETH
191876082024-02-09 2:29:23353 days ago1707445763
0x5892Cad5...0DcE21CE9
0.14 ETH
191876052024-02-09 2:28:47353 days ago1707445727
0x5892Cad5...0DcE21CE9
0.07 ETH
191755572024-02-07 9:54:59355 days ago1707299699
0x5892Cad5...0DcE21CE9
0.13 ETH
191733782024-02-07 2:33:59355 days ago1707273239
0x5892Cad5...0DcE21CE9
0.06 ETH
191723472024-02-06 23:06:11355 days ago1707260771
0x5892Cad5...0DcE21CE9
0.12 ETH
191716222024-02-06 20:38:47355 days ago1707251927
0x5892Cad5...0DcE21CE9
0.11 ETH
191714542024-02-06 20:04:59355 days ago1707249899
0x5892Cad5...0DcE21CE9
0.06 ETH
191714512024-02-06 20:04:23355 days ago1707249863
0x5892Cad5...0DcE21CE9
0.06 ETH
191675072024-02-06 6:46:11356 days ago1707201971
0x5892Cad5...0DcE21CE9
0.1 ETH
191674792024-02-06 6:40:35356 days ago1707201635
0x5892Cad5...0DcE21CE9
0.09 ETH
191674722024-02-06 6:39:11356 days ago1707201551
0x5892Cad5...0DcE21CE9
0.05 ETH
191674692024-02-06 6:38:35356 days ago1707201515
0x5892Cad5...0DcE21CE9
0.08 ETH
191674682024-02-06 6:38:23356 days ago1707201503
0x5892Cad5...0DcE21CE9
0.05 ETH
191674672024-02-06 6:38:11356 days ago1707201491
0x5892Cad5...0DcE21CE9
0.07 ETH
191668672024-02-06 4:37:35356 days ago1707194255
0x5892Cad5...0DcE21CE9
0.07 ETH
191665082024-02-06 3:25:35356 days ago1707189935
0x5892Cad5...0DcE21CE9
0.05 ETH
191665052024-02-06 3:24:59356 days ago1707189899
0x5892Cad5...0DcE21CE9
0.05 ETH
191649502024-02-05 22:11:59356 days ago1707171119
0x5892Cad5...0DcE21CE9
0.05 ETH
191635972024-02-05 17:38:23356 days ago1707154703
0x5892Cad5...0DcE21CE9
 Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MiyaAuction

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 12 : MiyaAuction.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import {Ownable} from "../lib/solady/src/auth/Ownable.sol";
import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import {MiyaAuctionNFT} from "./MiyaAuctionNFT.sol";
import {SafeCastLib} from "./libs/SafeCastLib.sol";
import {SafeTransferLib} from "./libs/SafeTransferLib.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";

contract MiyaAuction is Ownable, ERC721Holder {
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableSet for EnumerableSet.AddressSet;

    error EndedAuction();
    error ActiveAuction();
    error LockedAuction();
    error InvalidAuction();
    error SettledAuction();
    error InactiveAuction();
    error InsufficientBid();
    error InvalidTimestamp();

    /*//////////////////////////////////////////////////////////////
                            AUCTION PARAMS
    //////////////////////////////////////////////////////////////*/

    // Packed for max storage + gas efficiency (2 slots)
    struct AuctionData {
        address bidder;
        uint96 amount;
        uint96 minPrice;
        uint40 startTime;
        uint40 endTime;
        bool settled;
    }

    EnumerableSet.AddressSet internal _nfts;
    mapping(address nft => EnumerableSet.UintSet) internal _activeNftIds;
    mapping(address nft => EnumerableSet.UintSet) internal _settledNftIds;
    mapping(address nft => mapping(uint256 tokenId => AuctionData)) internal _auctionData;
    MiyaAuctionNFT public auctioncore;
    uint40 public auctionDuration = 120 hours;
    uint96 public bidIncrement = 0.01 ether;
    uint96 public auctionFunds;
    bool auctionLocked;

    /*//////////////////////////////////////////////////////////////
                                EVENTS
    //////////////////////////////////////////////////////////////*/

    event LockAuction();
    event BidPlaced(address indexed nft, uint256 indexed tokenId, uint256 indexed amount, address sender);
    event AuctionCreated(address indexed nft, uint256 indexed tokenId, uint40 indexed startTime, uint40 endTime);
    event AuctionSettled(address indexed nft, uint256 indexed tokenId, uint256 indexed amount, address winner);
    event AuctionDeleted(address indexed nft, uint256 indexed tokenId);
    event AuctionDurationUpdated(uint256 indexed amount);
    event AuctionBidIncrementUpdated(uint256 indexed amount);

    constructor(address _owner, string memory _name, string memory _symbol, string memory _baseUri) {
        _initializeOwner(_owner);
        auctioncore = new MiyaAuctionNFT(address(this), _name, _symbol, _baseUri);
    }

    /*//////////////////////////////////////////////////////////////
                    PUBLIC/EXTERNAL VIEW FUNCTIONS
    //////////////////////////////////////////////////////////////*/

    /*
     * @notice This returns the list of NFT collections that have been auctioned
     */
    function getNfts() external view returns (address[] memory) {
        return _nfts.values();
    }

    /*
     * @notice This returns the auction by address and tokenId
     */
    function getAuction(address _nft, uint256 _tokenId) external view returns (AuctionData memory) {
        return _auctionData[_nft][_tokenId];
    }

    /*
     * @notice This returns the list of actively auctioned tokenIds for a specific NFT
     */
    function getActiveAuctionsList(address _nft) external view returns (AuctionData[] memory) {
        uint256[] memory tokenIds = _activeNftIds[_nft].values();
        AuctionData[] memory data = new AuctionData[](tokenIds.length);
        for (uint256 i; i < tokenIds.length;) {
            data[i] = _auctionData[_nft][tokenIds[i]];
            unchecked {
                ++i;
            }
        }
        return data;
    }

    /*
     * @notice This returns the list of settled auctioned tokenIds for a specific NFT
     */
    function getSettledAuctionsList(address _nft) external view returns (AuctionData[] memory) {
        uint256[] memory tokenIds = _settledNftIds[_nft].values();
        AuctionData[] memory data = new AuctionData[](tokenIds.length);
        for (uint256 i; i < tokenIds.length;) {
            data[i] = _auctionData[_nft][tokenIds[i]];
            unchecked {
                ++i;
            }
        }
        return data;
    }

    /*
     * @notice This returns the list of active tokenIds auctioned for a specific NFT collection
     */
    function getActiveTokenIds(address _nft) external view returns (uint256[] memory) {
        return _activeNftIds[_nft].values();
    }

    /*
     * @notice This returns the list of settled tokenIds auctioned for a specific NFT collection
     */
    function getSettledTokenIds(address _nft) external view returns (uint256[] memory) {
        return _settledNftIds[_nft].values();
    }

    /*
     * @notice This returns the list of all auctions that are active or settled for a specific NFT collection
     * @dev WARNING: DO NOT USE THIS FUNCTION ONCHAIN, IT IS INTENDED TO BE VIEW ONLY
     */
    function getAllTokenIds(address _nft) external view returns (uint256[] memory) {
        uint256[] memory activeIds = _activeNftIds[_nft].values();
        uint256[] memory settledIds = _settledNftIds[_nft].values();
        uint256[] memory tokenIds = new uint256[](activeIds.length + settledIds.length);
        for (uint256 i; i < tokenIds.length;) {
            if (i < activeIds.length) tokenIds[i] = activeIds[i];
            else tokenIds[i] = settledIds[i - activeIds.length];
            unchecked {
                ++i;
            }
        }
        return tokenIds;
    }

    /*//////////////////////////////////////////////////////////////
                    PUBLIC/EXTERNAL WRITE FUNCTIONS
    //////////////////////////////////////////////////////////////*/

    /*
     * @notice This allow admin to auction an NFT
     */
    function createAuction(address _nft, uint256 _tokenId, uint96 _minPrice, uint40 _startTime)
        external
        onlyOwner
        returns (bool)
    {
        if (auctionLocked) revert LockedAuction();
        if (_activeNftIds[_nft].contains(_tokenId)) revert ActiveAuction();
        if (_startTime < block.timestamp) revert InvalidTimestamp();

        if (!_nfts.contains(_nft)) _nfts.add(_nft);
        if (_settledNftIds[_nft].contains(_tokenId)) _settledNftIds[_nft].remove(_tokenId);
        if (IERC721(_nft).ownerOf(_tokenId) != address(this)) {
            IERC721(_nft).transferFrom(owner(), address(this), _tokenId);
        }

        uint40 endTime = _startTime + auctionDuration;
        _activeNftIds[_nft].add(_tokenId);
        _auctionData[_nft][_tokenId] = AuctionData({
            bidder: address(0),
            amount: 0,
            minPrice: _minPrice,
            startTime: _startTime,
            endTime: endTime,
            settled: false
        });

        emit AuctionCreated(_nft, _tokenId, _startTime, endTime);
        return true;
    }

    /*
     * @notice This allows the admin to delete an auction that has no bids
     */
    function deleteAuction(address _nft, uint256 _tokenId) external onlyOwner {
        AuctionData storage auction = _auctionData[_nft][_tokenId];

        if (auctionLocked) revert LockedAuction();
        if (!_activeNftIds[_nft].contains(_tokenId)) revert InvalidAuction();
        if (auction.settled) revert SettledAuction();
        if (auction.bidder != address(0)) revert ActiveAuction();

        _activeNftIds[_nft].remove(_tokenId);
        if (_activeNftIds[_nft].length() == 0 && _settledNftIds[_nft].length() == 0) _nfts.remove(_nft);
        delete _auctionData[_nft][_tokenId];

        IERC721(_nft).transferFrom(address(this), owner(), _tokenId);

        emit AuctionDeleted(_nft, _tokenId);
    }

    /*
     * @notice This allows users to bid on auctions
     */
    function placeBid(address _nft, uint256 _tokenId) external payable {
        AuctionData storage auction = _auctionData[_nft][_tokenId];

        if (!_activeNftIds[_nft].contains(_tokenId)) revert InvalidAuction();
        if (block.timestamp < auction.startTime) revert InactiveAuction();
        if (block.timestamp > auction.endTime) revert EndedAuction();
        if (msg.value < auction.minPrice) revert InsufficientBid();
        if (msg.value < auction.amount + bidIncrement) revert InsufficientBid();

        // bidding logic
        address lastBidder = auction.bidder;
        uint96 lastBid = auction.amount;

        auction.bidder = msg.sender;
        auction.amount = SafeCastLib.toUint96(msg.value);
        unchecked {
            auctionFunds += uint96(msg.value) - lastBid;
        }

        if (lastBid > 0) {
            // refund last bidder
            SafeTransferLib.forceSafeTransferETH(lastBidder, lastBid);
        }

        auctioncore.mint(msg.sender);

        emit BidPlaced(_nft, _tokenId, msg.value, msg.sender);
    }

    /*
     * @notice This settles all concluded active auctions
     */
    function settleAllAuctions() external onlyOwner {
        address[] memory nfts = _nfts.values();
        for (uint256 i = _nfts.length(); i > 0;) {
            address nft = nfts[i - 1];
            for (uint256 j = _activeNftIds[nft].length(); j > 0;) {
                settleOneAuction(nft, _activeNftIds[nft].at(j - 1));
                unchecked {
                    --j;
                }
            }
            unchecked {
                --i;
            }
        }
        if (address(this).balance > 0) {
            SafeTransferLib.forceSafeTransferETH(owner(), address(this).balance - auctionFunds);
        }
    }

    /*
     * @notice This settles the auction, by sending out the nft associated with the auction
     * also setting its status to true
     */

    function settleOneAuction(address _nft, uint256 _tokenId) public onlyOwner {
        AuctionData storage data = _auctionData[_nft][_tokenId];
        address bidder = data.bidder;
        uint96 amount = data.amount;

        if (bidder == address(0)) return;
        else if (block.timestamp <= data.endTime) return;
        else {
            data.settled = true;
            _activeNftIds[_nft].remove(_tokenId);
            _settledNftIds[_nft].add(_tokenId);
            unchecked {
                auctionFunds -= amount;
            }
            IERC721(_nft).transferFrom(address(this), bidder, _tokenId);
            emit AuctionSettled(_nft, _tokenId, amount, bidder);
        }
    }

    /*//////////////////////////////////////////////////////////////
                        ADMIN WRITE FUNCTIONS
    //////////////////////////////////////////////////////////////*/

    /*
     * @notice This allows the admin to withdraw eth
     */
    function withdrawETH(address recipient) external onlyOwner {
        SafeTransferLib.forceSafeTransferETH(recipient, address(this).balance - auctionFunds);
    }

    /*
     * @notice This allows the admin to set the bid increment for the auction
     */
    function setBidIncrement(uint96 _bidIncrement) external onlyOwner {
        if (auctionLocked) revert LockedAuction();
        if (_bidIncrement == 0) revert();
        bidIncrement = _bidIncrement;
        emit AuctionBidIncrementUpdated(_bidIncrement);
    }

    /*
     * @notice This allows the admin to set the duration for the auction
     */
    function setDuration(uint32 _duration) external onlyOwner {
        if (auctionLocked) revert LockedAuction();
        auctionDuration = _duration;
        emit AuctionDurationUpdated(_duration);
    }

    /*
     * @notice This halts creation and deletion of auctions, but not bidding and settling
     */
    function lockAuction() external onlyOwner {
        if (auctionLocked) revert LockedAuction();
        auctionLocked = true;
        auctioncore.lockMint();
        emit LockAuction();
    }

    /*
     * @notice Update auctioncore NFT URI
     */
    function updateAuctioncoreURI(string memory baseUri_) external onlyOwner {
        auctioncore.updateBaseURI(baseUri_);
    }

    /*
     * @notice Lock auctioncore NFT URI
     */
    function lockAuctioncoreURI() external onlyOwner {
        auctioncore.lockURI();
    }

    /*
     * @notice Lock auctioncore NFT mint
     */
    function lockAuctioncoreMint() external onlyOwner {
        auctioncore.lockMint();
    }

    /*
     * @notice Renounce ownership of auctioncore NFT, which also locks URI but not mint
     */
    function renounceAuctioncore() external onlyOwner {
        auctioncore.renounceOwnership();
    }
}

File 2 of 12 : 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();
        _;
    }
}

File 3 of 12 : ERC721Holder.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.20;

import {IERC721Receiver} from "../IERC721Receiver.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or
 * {IERC721-setApprovalForAll}.
 */
abstract contract ERC721Holder is IERC721Receiver {
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {
        return this.onERC721Received.selector;
    }
}

File 4 of 12 : MiyaAuctionNFT.sol
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.23;

import {ERC721} from "../lib/solady/src/tokens/ERC721.sol";
import {Ownable} from "../lib/solady/src/auth/Ownable.sol";
import {LibString} from "../lib/solady/src/utils/LibString.sol";

contract MiyaAuctionNFT is ERC721, Ownable {
    using LibString for uint256;
    using LibString for string;

    error Locked();

    event URILocked();
    event MintLocked();
    event UpdateBaseURI(string indexed baseURI_);

    string internal _name;
    string internal _symbol;
    string internal _baseUri;
    uint128 totalSupply;
    bool mintLocked;
    bool uriLocked;

    constructor(address owner_, string memory name_, string memory symbol_, string memory baseUri_) {
        _initializeOwner(owner_);
        _name = name_;
        _symbol = symbol_;
        _baseUri = baseUri_;
        emit UpdateBaseURI(baseUri_);
    }

    function name() public view override returns (string memory) {
        return _name;
    }

    function symbol() public view override returns (string memory) {
        return _symbol;
    }

    function contractURI() external view returns (string memory) {
        return _baseUri.concat("contract.json");
    }

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        if (!_exists(tokenId)) return "";
        else return _baseUri.concat(tokenId.toString());
    }

    function burn(uint256 tokenId) external {
        if (!_isApprovedOrOwner(msg.sender, tokenId)) revert Unauthorized();
        _burn(tokenId);
    }

    function mint(address to) external onlyOwner {
        if (mintLocked) return;
        uint256 tokenId = ++totalSupply;
        _mint(to, tokenId);
    }

    function mint(address to, uint128 num) external onlyOwner {
        if (mintLocked) return;
        uint128 tokenId = totalSupply;
        for (uint256 i; i < num;) {
            unchecked {
                _mint(to, ++tokenId);
                ++i;
            }
        }
        unchecked {
            totalSupply += num;
        }
    }

    function updateBaseURI(string memory baseUri_) external onlyOwner {
        if (uriLocked) revert Locked();
        _baseUri = baseUri_;
        emit UpdateBaseURI(baseUri_);
    }

    function lockURI() public onlyOwner {
        uriLocked = true;
        emit URILocked();
    }

    function lockMint() public onlyOwner {
        mintLocked = true;
        emit MintLocked();
    }

    function renounceOwnership() public override payable onlyOwner {
        lockURI();
        super.renounceOwnership();
    }
}

File 5 of 12 : SafeCastLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Safe integer casting library that reverts on overflow.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeCastLib.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeCast.sol)
library SafeCastLib {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    error Overflow();

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*          UNSIGNED INTEGER SAFE CASTING OPERATIONS          */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    function toUint8(uint256 x) internal pure returns (uint8) {
        if (x >= 1 << 8) _revertOverflow();
        return uint8(x);
    }

    function toUint16(uint256 x) internal pure returns (uint16) {
        if (x >= 1 << 16) _revertOverflow();
        return uint16(x);
    }

    function toUint24(uint256 x) internal pure returns (uint24) {
        if (x >= 1 << 24) _revertOverflow();
        return uint24(x);
    }

    function toUint32(uint256 x) internal pure returns (uint32) {
        if (x >= 1 << 32) _revertOverflow();
        return uint32(x);
    }

    function toUint40(uint256 x) internal pure returns (uint40) {
        if (x >= 1 << 40) _revertOverflow();
        return uint40(x);
    }

    function toUint48(uint256 x) internal pure returns (uint48) {
        if (x >= 1 << 48) _revertOverflow();
        return uint48(x);
    }

    function toUint56(uint256 x) internal pure returns (uint56) {
        if (x >= 1 << 56) _revertOverflow();
        return uint56(x);
    }

    function toUint64(uint256 x) internal pure returns (uint64) {
        if (x >= 1 << 64) _revertOverflow();
        return uint64(x);
    }

    function toUint72(uint256 x) internal pure returns (uint72) {
        if (x >= 1 << 72) _revertOverflow();
        return uint72(x);
    }

    function toUint80(uint256 x) internal pure returns (uint80) {
        if (x >= 1 << 80) _revertOverflow();
        return uint80(x);
    }

    function toUint88(uint256 x) internal pure returns (uint88) {
        if (x >= 1 << 88) _revertOverflow();
        return uint88(x);
    }

    function toUint96(uint256 x) internal pure returns (uint96) {
        if (x >= 1 << 96) _revertOverflow();
        return uint96(x);
    }

    function toUint104(uint256 x) internal pure returns (uint104) {
        if (x >= 1 << 104) _revertOverflow();
        return uint104(x);
    }

    function toUint112(uint256 x) internal pure returns (uint112) {
        if (x >= 1 << 112) _revertOverflow();
        return uint112(x);
    }

    function toUint120(uint256 x) internal pure returns (uint120) {
        if (x >= 1 << 120) _revertOverflow();
        return uint120(x);
    }

    function toUint128(uint256 x) internal pure returns (uint128) {
        if (x >= 1 << 128) _revertOverflow();
        return uint128(x);
    }

    function toUint136(uint256 x) internal pure returns (uint136) {
        if (x >= 1 << 136) _revertOverflow();
        return uint136(x);
    }

    function toUint144(uint256 x) internal pure returns (uint144) {
        if (x >= 1 << 144) _revertOverflow();
        return uint144(x);
    }

    function toUint152(uint256 x) internal pure returns (uint152) {
        if (x >= 1 << 152) _revertOverflow();
        return uint152(x);
    }

    function toUint160(uint256 x) internal pure returns (uint160) {
        if (x >= 1 << 160) _revertOverflow();
        return uint160(x);
    }

    function toUint168(uint256 x) internal pure returns (uint168) {
        if (x >= 1 << 168) _revertOverflow();
        return uint168(x);
    }

    function toUint176(uint256 x) internal pure returns (uint176) {
        if (x >= 1 << 176) _revertOverflow();
        return uint176(x);
    }

    function toUint184(uint256 x) internal pure returns (uint184) {
        if (x >= 1 << 184) _revertOverflow();
        return uint184(x);
    }

    function toUint192(uint256 x) internal pure returns (uint192) {
        if (x >= 1 << 192) _revertOverflow();
        return uint192(x);
    }

    function toUint200(uint256 x) internal pure returns (uint200) {
        if (x >= 1 << 200) _revertOverflow();
        return uint200(x);
    }

    function toUint208(uint256 x) internal pure returns (uint208) {
        if (x >= 1 << 208) _revertOverflow();
        return uint208(x);
    }

    function toUint216(uint256 x) internal pure returns (uint216) {
        if (x >= 1 << 216) _revertOverflow();
        return uint216(x);
    }

    function toUint224(uint256 x) internal pure returns (uint224) {
        if (x >= 1 << 224) _revertOverflow();
        return uint224(x);
    }

    function toUint232(uint256 x) internal pure returns (uint232) {
        if (x >= 1 << 232) _revertOverflow();
        return uint232(x);
    }

    function toUint240(uint256 x) internal pure returns (uint240) {
        if (x >= 1 << 240) _revertOverflow();
        return uint240(x);
    }

    function toUint248(uint256 x) internal pure returns (uint248) {
        if (x >= 1 << 248) _revertOverflow();
        return uint248(x);
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*           SIGNED INTEGER SAFE CASTING OPERATIONS           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    function toInt8(int256 x) internal pure returns (int8) {
        int8 y = int8(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt16(int256 x) internal pure returns (int16) {
        int16 y = int16(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt24(int256 x) internal pure returns (int24) {
        int24 y = int24(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt32(int256 x) internal pure returns (int32) {
        int32 y = int32(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt40(int256 x) internal pure returns (int40) {
        int40 y = int40(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt48(int256 x) internal pure returns (int48) {
        int48 y = int48(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt56(int256 x) internal pure returns (int56) {
        int56 y = int56(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt64(int256 x) internal pure returns (int64) {
        int64 y = int64(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt72(int256 x) internal pure returns (int72) {
        int72 y = int72(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt80(int256 x) internal pure returns (int80) {
        int80 y = int80(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt88(int256 x) internal pure returns (int88) {
        int88 y = int88(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt96(int256 x) internal pure returns (int96) {
        int96 y = int96(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt104(int256 x) internal pure returns (int104) {
        int104 y = int104(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt112(int256 x) internal pure returns (int112) {
        int112 y = int112(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt120(int256 x) internal pure returns (int120) {
        int120 y = int120(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt128(int256 x) internal pure returns (int128) {
        int128 y = int128(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt136(int256 x) internal pure returns (int136) {
        int136 y = int136(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt144(int256 x) internal pure returns (int144) {
        int144 y = int144(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt152(int256 x) internal pure returns (int152) {
        int152 y = int152(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt160(int256 x) internal pure returns (int160) {
        int160 y = int160(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt168(int256 x) internal pure returns (int168) {
        int168 y = int168(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt176(int256 x) internal pure returns (int176) {
        int176 y = int176(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt184(int256 x) internal pure returns (int184) {
        int184 y = int184(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt192(int256 x) internal pure returns (int192) {
        int192 y = int192(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt200(int256 x) internal pure returns (int200) {
        int200 y = int200(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt208(int256 x) internal pure returns (int208) {
        int208 y = int208(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt216(int256 x) internal pure returns (int216) {
        int216 y = int216(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt224(int256 x) internal pure returns (int224) {
        int224 y = int224(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt232(int256 x) internal pure returns (int232) {
        int232 y = int232(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt240(int256 x) internal pure returns (int240) {
        int240 y = int240(x);
        if (x != y) _revertOverflow();
        return y;
    }

    function toInt248(int256 x) internal pure returns (int248) {
        int248 y = int248(x);
        if (x != y) _revertOverflow();
        return y;
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*               OTHER SAFE CASTING OPERATIONS                */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    function toInt256(uint256 x) internal pure returns (int256) {
        if (x >= 1 << 255) _revertOverflow();
        return int256(x);
    }

    function toUint256(int256 x) internal pure returns (uint256) {
        if (x < 0) _revertOverflow();
        return uint256(x);
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      PRIVATE HELPERS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    function _revertOverflow() private pure {
        /// @solidity memory-safe-assembly
        assembly {
            // Store the function selector of `Overflow()`.
            mstore(0x00, 0x35278d12)
            // Revert with (offset, size).
            revert(0x1c, 0x04)
        }
    }
}

File 6 of 12 : SafeTransferLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
///
/// @dev Note:
/// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection.
/// - For ERC20s, this implementation won't check that a token has code,
///   responsibility is delegated to the caller.
library SafeTransferLib {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The ETH transfer has failed.
    error ETHTransferFailed();

    /// @dev The ERC20 `transferFrom` has failed.
    error TransferFromFailed();

    /// @dev The ERC20 `transfer` has failed.
    error TransferFailed();

    /// @dev The ERC20 `approve` has failed.
    error ApproveFailed();

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

    /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes.
    uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300;

    /// @dev Suggested gas stipend for contract receiving ETH to perform a few
    /// storage reads and writes, but low enough to prevent griefing.
    uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       ETH OPERATIONS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants.
    //
    // The regular variants:
    // - Forwards all remaining gas to the target.
    // - Reverts if the target reverts.
    // - Reverts if the current contract has insufficient balance.
    //
    // The force variants:
    // - Forwards with an optional gas stipend
    //   (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases).
    // - If the target reverts, or if the gas stipend is exhausted,
    //   creates a temporary contract to force send the ETH via `SELFDESTRUCT`.
    //   Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758.
    // - Reverts if the current contract has insufficient balance.
    //
    // The try variants:
    // - Forwards with a mandatory gas stipend.
    // - Instead of reverting, returns whether the transfer succeeded.

    /// @dev Sends `amount` (in wei) ETH to `to`.
    function safeTransferETH(address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Sends all the ETH in the current contract to `to`.
    function safeTransferAllETH(address to) internal {
        /// @solidity memory-safe-assembly
        assembly {
            // Transfer all the ETH and check if it succeeded or not.
            if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
    function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {
        /// @solidity memory-safe-assembly
        assembly {
            if lt(selfbalance(), amount) {
                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                revert(0x1c, 0x04)
            }
            if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
            }
        }
    }

    /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`.
    function forceSafeTransferAllETH(address to, uint256 gasStipend) internal {
        /// @solidity memory-safe-assembly
        assembly {
            if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
            }
        }
    }

    /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`.
    function forceSafeTransferETH(address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            if lt(selfbalance(), amount) {
                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                revert(0x1c, 0x04)
            }
            if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
            }
        }
    }

    /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`.
    function forceSafeTransferAllETH(address to) internal {
        /// @solidity memory-safe-assembly
        assembly {
            // forgefmt: disable-next-item
            if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
            }
        }
    }

    /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
    function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal returns (bool success) {
        /// @solidity memory-safe-assembly
        assembly {
            success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)
        }
    }

    /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`.
    function trySafeTransferAllETH(address to, uint256 gasStipend) internal returns (bool success) {
        /// @solidity memory-safe-assembly
        assembly {
            success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      ERC20 OPERATIONS                      */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
    /// Reverts upon failure.
    ///
    /// The `from` account must have at least `amount` approved for
    /// the current contract to manage.
    function safeTransferFrom(address token, address from, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40) // Cache the free memory pointer.
            mstore(0x60, amount) // Store the `amount` argument.
            mstore(0x40, to) // Store the `to` argument.
            mstore(0x2c, shl(96, from)) // Store the `from` argument.
            mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`.
            // Perform the transfer, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x60, 0) // Restore the zero slot to zero.
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /// @dev Sends all of ERC20 `token` from `from` to `to`.
    /// Reverts upon failure.
    ///
    /// The `from` account must have their entire balance approved for
    /// the current contract to manage.
    function safeTransferAllFrom(address token, address from, address to) internal returns (uint256 amount) {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40) // Cache the free memory pointer.
            mstore(0x40, to) // Store the `to` argument.
            mstore(0x2c, shl(96, from)) // Store the `from` argument.
            mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
            // Read the balance, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    gt(returndatasize(), 0x1f), // At least 32 bytes returned.
                    staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20)
                )
            ) {
                mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`.
            amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it.
            // Perform the transfer, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x60, 0) // Restore the zero slot to zero.
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`.
    /// Reverts upon failure.
    function safeTransfer(address token, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x14, to) // Store the `to` argument.
            mstore(0x34, amount) // Store the `amount` argument.
            mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
            // Perform the transfer, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
        }
    }

    /// @dev Sends all of ERC20 `token` from the current contract to `to`.
    /// Reverts upon failure.
    function safeTransferAll(address token, address to) internal returns (uint256 amount) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`.
            mstore(0x20, address()) // Store the address of the current contract.
            // Read the balance, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    gt(returndatasize(), 0x1f), // At least 32 bytes returned.
                    staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20)
                )
            ) {
                mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x14, to) // Store the `to` argument.
            amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it.
            mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
            // Perform the transfer, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
        }
    }

    /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
    /// Reverts upon failure.
    function safeApprove(address token, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x14, to) // Store the `to` argument.
            mstore(0x34, amount) // Store the `amount` argument.
            mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
            // Perform the approval, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
        }
    }

    /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
    /// If the initial attempt to approve fails, attempts to reset the approved amount to zero,
    /// then retries the approval again (some tokens, e.g. USDT, requires this).
    /// Reverts upon failure.
    function safeApproveWithRetry(address token, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x14, to) // Store the `to` argument.
            mstore(0x34, amount) // Store the `amount` argument.
            mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
            // Perform the approval, retrying upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                )
            ) {
                mstore(0x34, 0) // Store 0 for the `amount`.
                mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
                pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval.
                mstore(0x34, amount) // Store back the original `amount`.
                // Retry the approval, reverting upon failure.
                if iszero(
                    and(
                        or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                        call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                    )
                ) {
                    mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
                    revert(0x1c, 0x04)
                }
            }
            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
        }
    }

    /// @dev Returns the amount of ERC20 `token` owned by `account`.
    /// Returns zero if the `token` does not exist.
    function balanceOf(address token, address account) internal view returns (uint256 amount) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x14, account) // Store the `account` argument.
            mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
            amount :=
                mul(
                    mload(0x20),
                    and( // The arguments of `and` are evaluated from right to left.
                        gt(returndatasize(), 0x1f), // At least 32 bytes returned.
                        staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20)
                    )
                )
        }
    }
}

File 7 of 12 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position is the index of the value in the `values` array plus 1.
        // Position 0 is used to mean a value is not in the set.
        mapping(bytes32 value => uint256) _positions;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._positions[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We cache the value's position to prevent multiple reads from the same storage slot
        uint256 position = set._positions[value];

        if (position != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 valueIndex = position - 1;
            uint256 lastIndex = set._values.length - 1;

            if (valueIndex != lastIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the lastValue to the index where the value to delete is
                set._values[valueIndex] = lastValue;
                // Update the tracked position of the lastValue (that was just moved)
                set._positions[lastValue] = position;
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the tracked position for the deleted slot
            delete set._positions[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._positions[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 8 of 12 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
     *   a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or
     *   {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
     *   a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the address zero.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

File 9 of 12 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.20;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be
     * reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 10 of 12 : ERC721.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Simple ERC721 implementation with storage hitchhiking.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC721.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC721/ERC721.sol)
///
/// @dev Note:
/// - The ERC721 standard allows for self-approvals.
///   For performance, this implementation WILL NOT revert for such actions.
///   Please add any checks with overrides if desired.
/// - For performance, methods are made payable where permitted by the ERC721 standard.
/// - The `safeTransfer` functions use the identity precompile (0x4)
///   to copy memory internally.
///
/// If you are overriding:
/// - NEVER violate the ERC721 invariant:
///   the balance of an owner MUST always be equal to their number of ownership slots.
///   The transfer functions do not have an underflow guard for user token balances.
/// - Make sure all variables written to storage are properly cleaned
//    (e.g. the bool value for `isApprovedForAll` MUST be either 1 or 0 under the hood).
/// - Check that the overridden function is actually used in the function you want to
///   change the behavior of. Much of the code has been manually inlined for performance.
abstract contract ERC721 {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         CONSTANTS                          */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev An account can hold up to 4294967295 tokens.
    uint256 internal constant _MAX_ACCOUNT_BALANCE = 0xffffffff;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Only the token owner or an approved account can manage the token.
    error NotOwnerNorApproved();

    /// @dev The token does not exist.
    error TokenDoesNotExist();

    /// @dev The token already exists.
    error TokenAlreadyExists();

    /// @dev Cannot query the balance for the zero address.
    error BalanceQueryForZeroAddress();

    /// @dev Cannot mint or transfer to the zero address.
    error TransferToZeroAddress();

    /// @dev The token must be owned by `from`.
    error TransferFromIncorrectOwner();

    /// @dev The recipient's balance has overflowed.
    error AccountBalanceOverflow();

    /// @dev Cannot safely transfer to a contract that does not implement
    /// the ERC721Receiver interface.
    error TransferToNonERC721ReceiverImplementer();

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

    /// @dev Emitted when token `id` is transferred from `from` to `to`.
    event Transfer(address indexed from, address indexed to, uint256 indexed id);

    /// @dev Emitted when `owner` enables `account` to manage the `id` token.
    event Approval(address indexed owner, address indexed account, uint256 indexed id);

    /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens.
    event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved);

    /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`.
    uint256 private constant _TRANSFER_EVENT_SIGNATURE =
        0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;

    /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`.
    uint256 private constant _APPROVAL_EVENT_SIGNATURE =
        0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925;

    /// @dev `keccak256(bytes("ApprovalForAll(address,address,bool)"))`.
    uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE =
        0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31;

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

    /// @dev The ownership data slot of `id` is given by:
    /// ```
    ///     mstore(0x00, id)
    ///     mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
    ///     let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
    /// ```
    /// Bits Layout:
    /// - [0..159]   `addr`
    /// - [160..255] `extraData`
    ///
    /// The approved address slot is given by: `add(1, ownershipSlot)`.
    ///
    /// See: https://notes.ethereum.org/%40vbuterin/verkle_tree_eip
    ///
    /// The balance slot of `owner` is given by:
    /// ```
    ///     mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
    ///     mstore(0x00, owner)
    ///     let balanceSlot := keccak256(0x0c, 0x1c)
    /// ```
    /// Bits Layout:
    /// - [0..31]   `balance`
    /// - [32..255] `aux`
    ///
    /// The `operator` approval slot of `owner` is given by:
    /// ```
    ///     mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, operator))
    ///     mstore(0x00, owner)
    ///     let operatorApprovalSlot := keccak256(0x0c, 0x30)
    /// ```
    uint256 private constant _ERC721_MASTER_SLOT_SEED = 0x7d8825530a5a2e7a << 192;

    /// @dev Pre-shifted and pre-masked constant.
    uint256 private constant _ERC721_MASTER_SLOT_SEED_MASKED = 0x0a5a2e7a00000000;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      ERC721 METADATA                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the token collection name.
    function name() public view virtual returns (string memory);

    /// @dev Returns the token collection symbol.
    function symbol() public view virtual returns (string memory);

    /// @dev Returns the Uniform Resource Identifier (URI) for token `id`.
    function tokenURI(uint256 id) public view virtual returns (string memory);

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

    /// @dev Returns the owner of token `id`.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    function ownerOf(uint256 id) public view virtual returns (address result) {
        result = _ownerOf(id);
        /// @solidity memory-safe-assembly
        assembly {
            if iszero(result) {
                mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`.
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Returns the number of tokens owned by `owner`.
    ///
    /// Requirements:
    /// - `owner` must not be the zero address.
    function balanceOf(address owner) public view virtual returns (uint256 result) {
        /// @solidity memory-safe-assembly
        assembly {
            // Revert if the `owner` is the zero address.
            if iszero(owner) {
                mstore(0x00, 0x8f4eb604) // `BalanceQueryForZeroAddress()`.
                revert(0x1c, 0x04)
            }
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            mstore(0x00, owner)
            result := and(sload(keccak256(0x0c, 0x1c)), _MAX_ACCOUNT_BALANCE)
        }
    }

    /// @dev Returns the account approved to manage token `id`.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    function getApproved(uint256 id) public view virtual returns (address result) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, id)
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            if iszero(shl(96, sload(ownershipSlot))) {
                mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`.
                revert(0x1c, 0x04)
            }
            result := sload(add(1, ownershipSlot))
        }
    }

    /// @dev Sets `account` as the approved account to manage token `id`.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    /// - The caller must be the owner of the token,
    ///   or an approved operator for the token owner.
    ///
    /// Emits an {Approval} event.
    function approve(address account, uint256 id) public payable virtual {
        _approve(msg.sender, account, id);
    }

    /// @dev Returns whether `operator` is approved to manage the tokens of `owner`.
    function isApprovedForAll(address owner, address operator)
        public
        view
        virtual
        returns (bool result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x1c, operator)
            mstore(0x08, _ERC721_MASTER_SLOT_SEED_MASKED)
            mstore(0x00, owner)
            result := sload(keccak256(0x0c, 0x30))
        }
    }

    /// @dev Sets whether `operator` is approved to manage the tokens of the caller.
    ///
    /// Emits an {ApprovalForAll} event.
    function setApprovalForAll(address operator, bool isApproved) public virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // Convert to 0 or 1.
            isApproved := iszero(iszero(isApproved))
            // Update the `isApproved` for (`msg.sender`, `operator`).
            mstore(0x1c, operator)
            mstore(0x08, _ERC721_MASTER_SLOT_SEED_MASKED)
            mstore(0x00, caller())
            sstore(keccak256(0x0c, 0x30), isApproved)
            // Emit the {ApprovalForAll} event.
            mstore(0x00, isApproved)
            // forgefmt: disable-next-item
            log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)))
        }
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    /// - The caller must be the owner of the token, or be approved to manage the token.
    ///
    /// Emits a {Transfer} event.
    function transferFrom(address from, address to, uint256 id) public payable virtual {
        _beforeTokenTransfer(from, to, id);
        /// @solidity memory-safe-assembly
        assembly {
            // Clear the upper 96 bits.
            let bitmaskAddress := shr(96, not(0))
            from := and(bitmaskAddress, from)
            to := and(bitmaskAddress, to)
            // Load the ownership data.
            mstore(0x00, id)
            mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, caller()))
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            let ownershipPacked := sload(ownershipSlot)
            let owner := and(bitmaskAddress, ownershipPacked)
            // Revert if the token does not exist, or if `from` is not the owner.
            if iszero(mul(owner, eq(owner, from))) {
                // `TokenDoesNotExist()`, `TransferFromIncorrectOwner()`.
                mstore(shl(2, iszero(owner)), 0xceea21b6a1148100)
                revert(0x1c, 0x04)
            }
            // Load, check, and update the token approval.
            {
                mstore(0x00, from)
                let approvedAddress := sload(add(1, ownershipSlot))
                // Revert if the caller is not the owner, nor approved.
                if iszero(or(eq(caller(), from), eq(caller(), approvedAddress))) {
                    if iszero(sload(keccak256(0x0c, 0x30))) {
                        mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.
                        revert(0x1c, 0x04)
                    }
                }
                // Delete the approved address if any.
                if approvedAddress { sstore(add(1, ownershipSlot), 0) }
            }
            // Update with the new owner.
            sstore(ownershipSlot, xor(ownershipPacked, xor(from, to)))
            // Decrement the balance of `from`.
            {
                let fromBalanceSlot := keccak256(0x0c, 0x1c)
                sstore(fromBalanceSlot, sub(sload(fromBalanceSlot), 1))
            }
            // Increment the balance of `to`.
            {
                mstore(0x00, to)
                let toBalanceSlot := keccak256(0x0c, 0x1c)
                let toBalanceSlotPacked := add(sload(toBalanceSlot), 1)
                // Revert if `to` is the zero address, or if the account balance overflows.
                if iszero(mul(to, and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE))) {
                    // `TransferToZeroAddress()`, `AccountBalanceOverflow()`.
                    mstore(shl(2, iszero(to)), 0xea553b3401336cea)
                    revert(0x1c, 0x04)
                }
                sstore(toBalanceSlot, toBalanceSlotPacked)
            }
            // Emit the {Transfer} event.
            log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id)
        }
        _afterTokenTransfer(from, to, id);
    }

    /// @dev Equivalent to `safeTransferFrom(from, to, id, "")`.
    function safeTransferFrom(address from, address to, uint256 id) public payable virtual {
        transferFrom(from, to, id);
        if (_hasCode(to)) _checkOnERC721Received(from, to, id, "");
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    /// - The caller must be the owner of the token, or be approved to manage the token.
    /// - If `to` refers to a smart contract, it must implement
    ///   {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
    ///
    /// Emits a {Transfer} event.
    function safeTransferFrom(address from, address to, uint256 id, bytes calldata data)
        public
        payable
        virtual
    {
        transferFrom(from, to, id);
        if (_hasCode(to)) _checkOnERC721Received(from, to, id, data);
    }

    /// @dev Returns true if this contract implements the interface defined by `interfaceId`.
    /// See: https://eips.ethereum.org/EIPS/eip-165
    /// This function call must use less than 30000 gas.
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            let s := shr(224, interfaceId)
            // ERC165: 0x01ffc9a7, ERC721: 0x80ac58cd, ERC721Metadata: 0x5b5e139f.
            result := or(or(eq(s, 0x01ffc9a7), eq(s, 0x80ac58cd)), eq(s, 0x5b5e139f))
        }
    }

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

    /// @dev Returns if token `id` exists.
    function _exists(uint256 id) internal view virtual returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, id)
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            result := iszero(iszero(shl(96, sload(add(id, add(id, keccak256(0x00, 0x20)))))))
        }
    }

    /// @dev Returns the owner of token `id`.
    /// Returns the zero address instead of reverting if the token does not exist.
    function _ownerOf(uint256 id) internal view virtual returns (address result) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, id)
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            result := shr(96, shl(96, sload(add(id, add(id, keccak256(0x00, 0x20))))))
        }
    }

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

    // For performance, no events are emitted for the hitchhiking setters.
    // Please emit your own events if required.

    /// @dev Returns the auxiliary data for `owner`.
    /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data.
    /// Auxiliary data can be set for any address, even if it does not have any tokens.
    function _getAux(address owner) internal view virtual returns (uint224 result) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            mstore(0x00, owner)
            result := shr(32, sload(keccak256(0x0c, 0x1c)))
        }
    }

    /// @dev Set the auxiliary data for `owner` to `value`.
    /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data.
    /// Auxiliary data can be set for any address, even if it does not have any tokens.
    function _setAux(address owner, uint224 value) internal virtual {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            mstore(0x00, owner)
            let balanceSlot := keccak256(0x0c, 0x1c)
            let packed := sload(balanceSlot)
            sstore(balanceSlot, xor(packed, shl(32, xor(value, shr(32, packed)))))
        }
    }

    /// @dev Returns the extra data for token `id`.
    /// Minting, transferring, burning a token will not change the extra data.
    /// The extra data can be set on a non-existent token.
    function _getExtraData(uint256 id) internal view virtual returns (uint96 result) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, id)
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            result := shr(160, sload(add(id, add(id, keccak256(0x00, 0x20)))))
        }
    }

    /// @dev Sets the extra data for token `id` to `value`.
    /// Minting, transferring, burning a token will not change the extra data.
    /// The extra data can be set on a non-existent token.
    function _setExtraData(uint256 id, uint96 value) internal virtual {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, id)
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            let packed := sload(ownershipSlot)
            sstore(ownershipSlot, xor(packed, shl(160, xor(value, shr(160, packed)))))
        }
    }

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

    /// @dev Mints token `id` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must not exist.
    /// - `to` cannot be the zero address.
    ///
    /// Emits a {Transfer} event.
    function _mint(address to, uint256 id) internal virtual {
        _beforeTokenTransfer(address(0), to, id);
        /// @solidity memory-safe-assembly
        assembly {
            // Clear the upper 96 bits.
            to := shr(96, shl(96, to))
            // Load the ownership data.
            mstore(0x00, id)
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            let ownershipPacked := sload(ownershipSlot)
            // Revert if the token already exists.
            if shl(96, ownershipPacked) {
                mstore(0x00, 0xc991cbb1) // `TokenAlreadyExists()`.
                revert(0x1c, 0x04)
            }
            // Update with the owner.
            sstore(ownershipSlot, or(ownershipPacked, to))
            // Increment the balance of the owner.
            {
                mstore(0x00, to)
                let balanceSlot := keccak256(0x0c, 0x1c)
                let balanceSlotPacked := add(sload(balanceSlot), 1)
                // Revert if `to` is the zero address, or if the account balance overflows.
                if iszero(mul(to, and(balanceSlotPacked, _MAX_ACCOUNT_BALANCE))) {
                    // `TransferToZeroAddress()`, `AccountBalanceOverflow()`.
                    mstore(shl(2, iszero(to)), 0xea553b3401336cea)
                    revert(0x1c, 0x04)
                }
                sstore(balanceSlot, balanceSlotPacked)
            }
            // Emit the {Transfer} event.
            log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, 0, to, id)
        }
        _afterTokenTransfer(address(0), to, id);
    }

    /// @dev Mints token `id` to `to`, and updates the extra data for token `id` to `value`.
    /// Does NOT check if token `id` already exists (assumes `id` is auto-incrementing).
    ///
    /// Requirements:
    ///
    /// - `to` cannot be the zero address.
    ///
    /// Emits a {Transfer} event.
    function _mintAndSetExtraDataUnchecked(address to, uint256 id, uint96 value) internal virtual {
        _beforeTokenTransfer(address(0), to, id);
        /// @solidity memory-safe-assembly
        assembly {
            // Clear the upper 96 bits.
            to := shr(96, shl(96, to))
            // Update with the owner and extra data.
            mstore(0x00, id)
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            sstore(add(id, add(id, keccak256(0x00, 0x20))), or(shl(160, value), to))
            // Increment the balance of the owner.
            {
                mstore(0x00, to)
                let balanceSlot := keccak256(0x0c, 0x1c)
                let balanceSlotPacked := add(sload(balanceSlot), 1)
                // Revert if `to` is the zero address, or if the account balance overflows.
                if iszero(mul(to, and(balanceSlotPacked, _MAX_ACCOUNT_BALANCE))) {
                    // `TransferToZeroAddress()`, `AccountBalanceOverflow()`.
                    mstore(shl(2, iszero(to)), 0xea553b3401336cea)
                    revert(0x1c, 0x04)
                }
                sstore(balanceSlot, balanceSlotPacked)
            }
            // Emit the {Transfer} event.
            log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, 0, to, id)
        }
        _afterTokenTransfer(address(0), to, id);
    }

    /// @dev Equivalent to `_safeMint(to, id, "")`.
    function _safeMint(address to, uint256 id) internal virtual {
        _safeMint(to, id, "");
    }

    /// @dev Mints token `id` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must not exist.
    /// - `to` cannot be the zero address.
    /// - If `to` refers to a smart contract, it must implement
    ///   {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
    ///
    /// Emits a {Transfer} event.
    function _safeMint(address to, uint256 id, bytes memory data) internal virtual {
        _mint(to, id);
        if (_hasCode(to)) _checkOnERC721Received(address(0), to, id, data);
    }

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

    /// @dev Equivalent to `_burn(address(0), id)`.
    function _burn(uint256 id) internal virtual {
        _burn(address(0), id);
    }

    /// @dev Destroys token `id`, using `by`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - If `by` is not the zero address,
    ///   it must be the owner of the token, or be approved to manage the token.
    ///
    /// Emits a {Transfer} event.
    function _burn(address by, uint256 id) internal virtual {
        address owner = ownerOf(id);
        _beforeTokenTransfer(owner, address(0), id);
        /// @solidity memory-safe-assembly
        assembly {
            // Clear the upper 96 bits.
            by := shr(96, shl(96, by))
            // Load the ownership data.
            mstore(0x00, id)
            mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by))
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            let ownershipPacked := sload(ownershipSlot)
            // Reload the owner in case it is changed in `_beforeTokenTransfer`.
            owner := shr(96, shl(96, ownershipPacked))
            // Revert if the token does not exist.
            if iszero(owner) {
                mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`.
                revert(0x1c, 0x04)
            }
            // Load and check the token approval.
            {
                mstore(0x00, owner)
                let approvedAddress := sload(add(1, ownershipSlot))
                // If `by` is not the zero address, do the authorization check.
                // Revert if the `by` is not the owner, nor approved.
                if iszero(or(iszero(by), or(eq(by, owner), eq(by, approvedAddress)))) {
                    if iszero(sload(keccak256(0x0c, 0x30))) {
                        mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.
                        revert(0x1c, 0x04)
                    }
                }
                // Delete the approved address if any.
                if approvedAddress { sstore(add(1, ownershipSlot), 0) }
            }
            // Clear the owner.
            sstore(ownershipSlot, xor(ownershipPacked, owner))
            // Decrement the balance of `owner`.
            {
                let balanceSlot := keccak256(0x0c, 0x1c)
                sstore(balanceSlot, sub(sload(balanceSlot), 1))
            }
            // Emit the {Transfer} event.
            log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, owner, 0, id)
        }
        _afterTokenTransfer(owner, address(0), id);
    }

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

    /// @dev Returns whether `account` is the owner of token `id`, or is approved to manage it.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    function _isApprovedOrOwner(address account, uint256 id)
        internal
        view
        virtual
        returns (bool result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            result := 1
            // Clear the upper 96 bits.
            account := shr(96, shl(96, account))
            // Load the ownership data.
            mstore(0x00, id)
            mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, account))
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            let owner := shr(96, shl(96, sload(ownershipSlot)))
            // Revert if the token does not exist.
            if iszero(owner) {
                mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`.
                revert(0x1c, 0x04)
            }
            // Check if `account` is the `owner`.
            if iszero(eq(account, owner)) {
                mstore(0x00, owner)
                // Check if `account` is approved to manage the token.
                if iszero(sload(keccak256(0x0c, 0x30))) {
                    result := eq(account, sload(add(1, ownershipSlot)))
                }
            }
        }
    }

    /// @dev Returns the account approved to manage token `id`.
    /// Returns the zero address instead of reverting if the token does not exist.
    function _getApproved(uint256 id) internal view virtual returns (address result) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, id)
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            result := sload(add(1, add(id, add(id, keccak256(0x00, 0x20)))))
        }
    }

    /// @dev Equivalent to `_approve(address(0), account, id)`.
    function _approve(address account, uint256 id) internal virtual {
        _approve(address(0), account, id);
    }

    /// @dev Sets `account` as the approved account to manage token `id`, using `by`.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    /// - If `by` is not the zero address, `by` must be the owner
    ///   or an approved operator for the token owner.
    ///
    /// Emits a {Transfer} event.
    function _approve(address by, address account, uint256 id) internal virtual {
        assembly {
            // Clear the upper 96 bits.
            let bitmaskAddress := shr(96, not(0))
            account := and(bitmaskAddress, account)
            by := and(bitmaskAddress, by)
            // Load the owner of the token.
            mstore(0x00, id)
            mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by))
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            let owner := and(bitmaskAddress, sload(ownershipSlot))
            // Revert if the token does not exist.
            if iszero(owner) {
                mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`.
                revert(0x1c, 0x04)
            }
            // If `by` is not the zero address, do the authorization check.
            // Revert if `by` is not the owner, nor approved.
            if iszero(or(iszero(by), eq(by, owner))) {
                mstore(0x00, owner)
                if iszero(sload(keccak256(0x0c, 0x30))) {
                    mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.
                    revert(0x1c, 0x04)
                }
            }
            // Sets `account` as the approved account to manage `id`.
            sstore(add(1, ownershipSlot), account)
            // Emit the {Approval} event.
            log4(codesize(), 0x00, _APPROVAL_EVENT_SIGNATURE, owner, account, id)
        }
    }

    /// @dev Approve or remove the `operator` as an operator for `by`,
    /// without authorization checks.
    ///
    /// Emits an {ApprovalForAll} event.
    function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // Clear the upper 96 bits.
            by := shr(96, shl(96, by))
            operator := shr(96, shl(96, operator))
            // Convert to 0 or 1.
            isApproved := iszero(iszero(isApproved))
            // Update the `isApproved` for (`by`, `operator`).
            mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, operator))
            mstore(0x00, by)
            sstore(keccak256(0x0c, 0x30), isApproved)
            // Emit the {ApprovalForAll} event.
            mstore(0x00, isApproved)
            log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, by, operator)
        }
    }

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

    /// @dev Equivalent to `_transfer(address(0), from, to, id)`.
    function _transfer(address from, address to, uint256 id) internal virtual {
        _transfer(address(0), from, to, id);
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    /// - If `by` is not the zero address,
    ///   it must be the owner of the token, or be approved to manage the token.
    ///
    /// Emits a {Transfer} event.
    function _transfer(address by, address from, address to, uint256 id) internal virtual {
        _beforeTokenTransfer(from, to, id);
        /// @solidity memory-safe-assembly
        assembly {
            // Clear the upper 96 bits.
            let bitmaskAddress := shr(96, not(0))
            from := and(bitmaskAddress, from)
            to := and(bitmaskAddress, to)
            by := and(bitmaskAddress, by)
            // Load the ownership data.
            mstore(0x00, id)
            mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by))
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            let ownershipPacked := sload(ownershipSlot)
            let owner := and(bitmaskAddress, ownershipPacked)
            // Revert if the token does not exist, or if `from` is not the owner.
            if iszero(mul(owner, eq(owner, from))) {
                // `TokenDoesNotExist()`, `TransferFromIncorrectOwner()`.
                mstore(shl(2, iszero(owner)), 0xceea21b6a1148100)
                revert(0x1c, 0x04)
            }
            // Load, check, and update the token approval.
            {
                mstore(0x00, from)
                let approvedAddress := sload(add(1, ownershipSlot))
                // If `by` is not the zero address, do the authorization check.
                // Revert if the `by` is not the owner, nor approved.
                if iszero(or(iszero(by), or(eq(by, from), eq(by, approvedAddress)))) {
                    if iszero(sload(keccak256(0x0c, 0x30))) {
                        mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.
                        revert(0x1c, 0x04)
                    }
                }
                // Delete the approved address if any.
                if approvedAddress { sstore(add(1, ownershipSlot), 0) }
            }
            // Update with the new owner.
            sstore(ownershipSlot, xor(ownershipPacked, xor(from, to)))
            // Decrement the balance of `from`.
            {
                let fromBalanceSlot := keccak256(0x0c, 0x1c)
                sstore(fromBalanceSlot, sub(sload(fromBalanceSlot), 1))
            }
            // Increment the balance of `to`.
            {
                mstore(0x00, to)
                let toBalanceSlot := keccak256(0x0c, 0x1c)
                let toBalanceSlotPacked := add(sload(toBalanceSlot), 1)
                // Revert if `to` is the zero address, or if the account balance overflows.
                if iszero(mul(to, and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE))) {
                    // `TransferToZeroAddress()`, `AccountBalanceOverflow()`.
                    mstore(shl(2, iszero(to)), 0xea553b3401336cea)
                    revert(0x1c, 0x04)
                }
                sstore(toBalanceSlot, toBalanceSlotPacked)
            }
            // Emit the {Transfer} event.
            log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id)
        }
        _afterTokenTransfer(from, to, id);
    }

    /// @dev Equivalent to `_safeTransfer(from, to, id, "")`.
    function _safeTransfer(address from, address to, uint256 id) internal virtual {
        _safeTransfer(from, to, id, "");
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    /// - The caller must be the owner of the token, or be approved to manage the token.
    /// - If `to` refers to a smart contract, it must implement
    ///   {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
    ///
    /// Emits a {Transfer} event.
    function _safeTransfer(address from, address to, uint256 id, bytes memory data)
        internal
        virtual
    {
        _transfer(address(0), from, to, id);
        if (_hasCode(to)) _checkOnERC721Received(from, to, id, data);
    }

    /// @dev Equivalent to `_safeTransfer(by, from, to, id, "")`.
    function _safeTransfer(address by, address from, address to, uint256 id) internal virtual {
        _safeTransfer(by, from, to, id, "");
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    /// - If `by` is not the zero address,
    ///   it must be the owner of the token, or be approved to manage the token.
    /// - If `to` refers to a smart contract, it must implement
    ///   {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
    ///
    /// Emits a {Transfer} event.
    function _safeTransfer(address by, address from, address to, uint256 id, bytes memory data)
        internal
        virtual
    {
        _transfer(by, from, to, id);
        if (_hasCode(to)) _checkOnERC721Received(from, to, id, data);
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                    HOOKS FOR OVERRIDING                    */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Hook that is called before any token transfers, including minting and burning.
    function _beforeTokenTransfer(address from, address to, uint256 id) internal virtual {}

    /// @dev Hook that is called after any token transfers, including minting and burning.
    function _afterTokenTransfer(address from, address to, uint256 id) internal virtual {}

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      PRIVATE HELPERS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns if `a` has bytecode of non-zero length.
    function _hasCode(address a) private view returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := extcodesize(a) // Can handle dirty upper bits.
        }
    }

    /// @dev Perform a call to invoke {IERC721Receiver-onERC721Received} on `to`.
    /// Reverts if the target does not support the function correctly.
    function _checkOnERC721Received(address from, address to, uint256 id, bytes memory data)
        private
    {
        /// @solidity memory-safe-assembly
        assembly {
            // Prepare the calldata.
            let m := mload(0x40)
            let onERC721ReceivedSelector := 0x150b7a02
            mstore(m, onERC721ReceivedSelector)
            mstore(add(m, 0x20), caller()) // The `operator`, which is always `msg.sender`.
            mstore(add(m, 0x40), shr(96, shl(96, from)))
            mstore(add(m, 0x60), id)
            mstore(add(m, 0x80), 0x80)
            let n := mload(data)
            mstore(add(m, 0xa0), n)
            if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xc0), n)) }
            // Revert if the call reverts.
            if iszero(call(gas(), to, 0, add(m, 0x1c), add(n, 0xa4), m, 0x20)) {
                if returndatasize() {
                    // Bubble up the revert if the call reverts.
                    returndatacopy(m, 0x00, returndatasize())
                    revert(m, returndatasize())
                }
            }
            // Load the returndata and compare it.
            if iszero(eq(mload(m), shl(224, onERC721ReceivedSelector))) {
                mstore(0x00, 0xd1a57ed6) // `TransferToNonERC721ReceiverImplementer()`.
                revert(0x1c, 0x04)
            }
        }
    }
}

File 11 of 12 : LibString.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Library for converting numbers into strings and other string operations.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibString.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibString.sol)
///
/// Note:
/// For performance and bytecode compactness, most of the string operations are restricted to
/// byte strings (7-bit ASCII), except where otherwise specified.
/// Usage of byte string operations on charsets with runes spanning two or more bytes
/// can lead to undefined behavior.
library LibString {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                        CUSTOM ERRORS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The length of the output is too small to contain all the hex digits.
    error HexLengthInsufficient();

    /// @dev The length of the string is more than 32 bytes.
    error TooBigForSmallString();

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

    /// @dev The constant returned when the `search` is not found in the string.
    uint256 internal constant NOT_FOUND = type(uint256).max;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                     DECIMAL OPERATIONS                     */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the base 10 decimal representation of `value`.
    function toString(uint256 value) internal pure returns (string memory str) {
        /// @solidity memory-safe-assembly
        assembly {
            // The maximum value of a uint256 contains 78 digits (1 byte per digit), but
            // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
            // We will need 1 word for the trailing zeros padding, 1 word for the length,
            // and 3 words for a maximum of 78 digits.
            str := add(mload(0x40), 0x80)
            // Update the free memory pointer to allocate.
            mstore(0x40, add(str, 0x20))
            // Zeroize the slot after the string.
            mstore(str, 0)

            // Cache the end of the memory to calculate the length later.
            let end := str

            let w := not(0) // Tsk.
            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            for { let temp := value } 1 {} {
                str := add(str, w) // `sub(str, 1)`.
                // Write the character to the pointer.
                // The ASCII index of the '0' character is 48.
                mstore8(str, add(48, mod(temp, 10)))
                // Keep dividing `temp` until zero.
                temp := div(temp, 10)
                if iszero(temp) { break }
            }

            let length := sub(end, str)
            // Move the pointer 32 bytes leftwards to make room for the length.
            str := sub(str, 0x20)
            // Store the length.
            mstore(str, length)
        }
    }

    /// @dev Returns the base 10 decimal representation of `value`.
    function toString(int256 value) internal pure returns (string memory str) {
        if (value >= 0) {
            return toString(uint256(value));
        }
        unchecked {
            str = toString(~uint256(value) + 1);
        }
        /// @solidity memory-safe-assembly
        assembly {
            // We still have some spare memory space on the left,
            // as we have allocated 3 words (96 bytes) for up to 78 digits.
            let length := mload(str) // Load the string length.
            mstore(str, 0x2d) // Store the '-' character.
            str := sub(str, 1) // Move back the string pointer by a byte.
            mstore(str, add(length, 1)) // Update the string length.
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   HEXADECIMAL OPERATIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the hexadecimal representation of `value`,
    /// left-padded to an input length of `length` bytes.
    /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte,
    /// giving a total length of `length * 2 + 2` bytes.
    /// Reverts if `length` is too small for the output to contain all the digits.
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value, length);
        /// @solidity memory-safe-assembly
        assembly {
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(str, 0x3078) // Write the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Write the length.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`,
    /// left-padded to an input length of `length` bytes.
    /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte,
    /// giving a total length of `length * 2` bytes.
    /// Reverts if `length` is too small for the output to contain all the digits.
    function toHexStringNoPrefix(uint256 value, uint256 length)
        internal
        pure
        returns (string memory str)
    {
        /// @solidity memory-safe-assembly
        assembly {
            // We need 0x20 bytes for the trailing zeros padding, `length * 2` bytes
            // for the digits, 0x02 bytes for the prefix, and 0x20 bytes for the length.
            // We add 0x20 to the total and round down to a multiple of 0x20.
            // (0x20 + 0x20 + 0x02 + 0x20) = 0x62.
            str := add(mload(0x40), and(add(shl(1, length), 0x42), not(0x1f)))
            // Allocate the memory.
            mstore(0x40, add(str, 0x20))
            // Zeroize the slot after the string.
            mstore(str, 0)

            // Cache the end to calculate the length later.
            let end := str
            // Store "0123456789abcdef" in scratch space.
            mstore(0x0f, 0x30313233343536373839616263646566)

            let start := sub(str, add(length, length))
            let w := not(1) // Tsk.
            let temp := value
            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            for {} 1 {} {
                str := add(str, w) // `sub(str, 2)`.
                mstore8(add(str, 1), mload(and(temp, 15)))
                mstore8(str, mload(and(shr(4, temp), 15)))
                temp := shr(8, temp)
                if iszero(xor(str, start)) { break }
            }

            if temp {
                mstore(0x00, 0x2194895a) // `HexLengthInsufficient()`.
                revert(0x1c, 0x04)
            }

            // Compute the string's length.
            let strLength := sub(end, str)
            // Move the pointer and write the length.
            str := sub(str, 0x20)
            mstore(str, strLength)
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte.
    /// As address are 20 bytes long, the output will left-padded to have
    /// a length of `20 * 2 + 2` bytes.
    function toHexString(uint256 value) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value);
        /// @solidity memory-safe-assembly
        assembly {
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(str, 0x3078) // Write the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Write the length.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is prefixed with "0x".
    /// The output excludes leading "0" from the `toHexString` output.
    /// `0x00: "0x0", 0x01: "0x1", 0x12: "0x12", 0x123: "0x123"`.
    function toMinimalHexString(uint256 value) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value);
        /// @solidity memory-safe-assembly
        assembly {
            let o := eq(byte(0, mload(add(str, 0x20))), 0x30) // Whether leading zero is present.
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(add(str, o), 0x3078) // Write the "0x" prefix, accounting for leading zero.
            str := sub(add(str, o), 2) // Move the pointer, accounting for leading zero.
            mstore(str, sub(strLength, o)) // Write the length, accounting for leading zero.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output excludes leading "0" from the `toHexStringNoPrefix` output.
    /// `0x00: "0", 0x01: "1", 0x12: "12", 0x123: "123"`.
    function toMinimalHexStringNoPrefix(uint256 value) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value);
        /// @solidity memory-safe-assembly
        assembly {
            let o := eq(byte(0, mload(add(str, 0x20))), 0x30) // Whether leading zero is present.
            let strLength := mload(str) // Get the length.
            str := add(str, o) // Move the pointer, accounting for leading zero.
            mstore(str, sub(strLength, o)) // Write the length, accounting for leading zero.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is encoded using 2 hexadecimal digits per byte.
    /// As address are 20 bytes long, the output will left-padded to have
    /// a length of `20 * 2` bytes.
    function toHexStringNoPrefix(uint256 value) internal pure returns (string memory str) {
        /// @solidity memory-safe-assembly
        assembly {
            // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length,
            // 0x02 bytes for the prefix, and 0x40 bytes for the digits.
            // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x40) is 0xa0.
            str := add(mload(0x40), 0x80)
            // Allocate the memory.
            mstore(0x40, add(str, 0x20))
            // Zeroize the slot after the string.
            mstore(str, 0)

            // Cache the end to calculate the length later.
            let end := str
            // Store "0123456789abcdef" in scratch space.
            mstore(0x0f, 0x30313233343536373839616263646566)

            let w := not(1) // Tsk.
            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            for { let temp := value } 1 {} {
                str := add(str, w) // `sub(str, 2)`.
                mstore8(add(str, 1), mload(and(temp, 15)))
                mstore8(str, mload(and(shr(4, temp), 15)))
                temp := shr(8, temp)
                if iszero(temp) { break }
            }

            // Compute the string's length.
            let strLength := sub(end, str)
            // Move the pointer and write the length.
            str := sub(str, 0x20)
            mstore(str, strLength)
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is prefixed with "0x", encoded using 2 hexadecimal digits per byte,
    /// and the alphabets are capitalized conditionally according to
    /// https://eips.ethereum.org/EIPS/eip-55
    function toHexStringChecksummed(address value) internal pure returns (string memory str) {
        str = toHexString(value);
        /// @solidity memory-safe-assembly
        assembly {
            let mask := shl(6, div(not(0), 255)) // `0b010000000100000000 ...`
            let o := add(str, 0x22)
            let hashed := and(keccak256(o, 40), mul(34, mask)) // `0b10001000 ... `
            let t := shl(240, 136) // `0b10001000 << 240`
            for { let i := 0 } 1 {} {
                mstore(add(i, i), mul(t, byte(i, hashed)))
                i := add(i, 1)
                if eq(i, 20) { break }
            }
            mstore(o, xor(mload(o), shr(1, and(mload(0x00), and(mload(o), mask)))))
            o := add(o, 0x20)
            mstore(o, xor(mload(o), shr(1, and(mload(0x20), and(mload(o), mask)))))
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte.
    function toHexString(address value) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value);
        /// @solidity memory-safe-assembly
        assembly {
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(str, 0x3078) // Write the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Write the length.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is encoded using 2 hexadecimal digits per byte.
    function toHexStringNoPrefix(address value) internal pure returns (string memory str) {
        /// @solidity memory-safe-assembly
        assembly {
            str := mload(0x40)

            // Allocate the memory.
            // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length,
            // 0x02 bytes for the prefix, and 0x28 bytes for the digits.
            // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x28) is 0x80.
            mstore(0x40, add(str, 0x80))

            // Store "0123456789abcdef" in scratch space.
            mstore(0x0f, 0x30313233343536373839616263646566)

            str := add(str, 2)
            mstore(str, 40)

            let o := add(str, 0x20)
            mstore(add(o, 40), 0)

            value := shl(96, value)

            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            for { let i := 0 } 1 {} {
                let p := add(o, add(i, i))
                let temp := byte(i, value)
                mstore8(add(p, 1), mload(and(temp, 15)))
                mstore8(p, mload(shr(4, temp)))
                i := add(i, 1)
                if eq(i, 20) { break }
            }
        }
    }

    /// @dev Returns the hex encoded string from the raw bytes.
    /// The output is encoded using 2 hexadecimal digits per byte.
    function toHexString(bytes memory raw) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(raw);
        /// @solidity memory-safe-assembly
        assembly {
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(str, 0x3078) // Write the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Write the length.
        }
    }

    /// @dev Returns the hex encoded string from the raw bytes.
    /// The output is encoded using 2 hexadecimal digits per byte.
    function toHexStringNoPrefix(bytes memory raw) internal pure returns (string memory str) {
        /// @solidity memory-safe-assembly
        assembly {
            let length := mload(raw)
            str := add(mload(0x40), 2) // Skip 2 bytes for the optional prefix.
            mstore(str, add(length, length)) // Store the length of the output.

            // Store "0123456789abcdef" in scratch space.
            mstore(0x0f, 0x30313233343536373839616263646566)

            let o := add(str, 0x20)
            let end := add(raw, length)

            for {} iszero(eq(raw, end)) {} {
                raw := add(raw, 1)
                mstore8(add(o, 1), mload(and(mload(raw), 15)))
                mstore8(o, mload(and(shr(4, mload(raw)), 15)))
                o := add(o, 2)
            }
            mstore(o, 0) // Zeroize the slot after the string.
            mstore(0x40, add(o, 0x20)) // Allocate the memory.
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   RUNE STRING OPERATIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the number of UTF characters in the string.
    function runeCount(string memory s) internal pure returns (uint256 result) {
        /// @solidity memory-safe-assembly
        assembly {
            if mload(s) {
                mstore(0x00, div(not(0), 255))
                mstore(0x20, 0x0202020202020202020202020202020202020202020202020303030304040506)
                let o := add(s, 0x20)
                let end := add(o, mload(s))
                for { result := 1 } 1 { result := add(result, 1) } {
                    o := add(o, byte(0, mload(shr(250, mload(o)))))
                    if iszero(lt(o, end)) { break }
                }
            }
        }
    }

    /// @dev Returns if this string is a 7-bit ASCII string.
    /// (i.e. all characters codes are in [0..127])
    function is7BitASCII(string memory s) internal pure returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            let mask := shl(7, div(not(0), 255))
            result := 1
            let n := mload(s)
            if n {
                let o := add(s, 0x20)
                let end := add(o, n)
                let last := mload(end)
                mstore(end, 0)
                for {} 1 {} {
                    if and(mask, mload(o)) {
                        result := 0
                        break
                    }
                    o := add(o, 0x20)
                    if iszero(lt(o, end)) { break }
                }
                mstore(end, last)
            }
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   BYTE STRING OPERATIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    // For performance and bytecode compactness, byte string operations are restricted
    // to 7-bit ASCII strings. All offsets are byte offsets, not UTF character offsets.
    // Usage of byte string operations on charsets with runes spanning two or more bytes
    // can lead to undefined behavior.

    /// @dev Returns `subject` all occurrences of `search` replaced with `replacement`.
    function replace(string memory subject, string memory search, string memory replacement)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let subjectLength := mload(subject)
            let searchLength := mload(search)
            let replacementLength := mload(replacement)

            subject := add(subject, 0x20)
            search := add(search, 0x20)
            replacement := add(replacement, 0x20)
            result := add(mload(0x40), 0x20)

            let subjectEnd := add(subject, subjectLength)
            if iszero(gt(searchLength, subjectLength)) {
                let subjectSearchEnd := add(sub(subjectEnd, searchLength), 1)
                let h := 0
                if iszero(lt(searchLength, 0x20)) { h := keccak256(search, searchLength) }
                let m := shl(3, sub(0x20, and(searchLength, 0x1f)))
                let s := mload(search)
                for {} 1 {} {
                    let t := mload(subject)
                    // Whether the first `searchLength % 32` bytes of
                    // `subject` and `search` matches.
                    if iszero(shr(m, xor(t, s))) {
                        if h {
                            if iszero(eq(keccak256(subject, searchLength), h)) {
                                mstore(result, t)
                                result := add(result, 1)
                                subject := add(subject, 1)
                                if iszero(lt(subject, subjectSearchEnd)) { break }
                                continue
                            }
                        }
                        // Copy the `replacement` one word at a time.
                        for { let o := 0 } 1 {} {
                            mstore(add(result, o), mload(add(replacement, o)))
                            o := add(o, 0x20)
                            if iszero(lt(o, replacementLength)) { break }
                        }
                        result := add(result, replacementLength)
                        subject := add(subject, searchLength)
                        if searchLength {
                            if iszero(lt(subject, subjectSearchEnd)) { break }
                            continue
                        }
                    }
                    mstore(result, t)
                    result := add(result, 1)
                    subject := add(subject, 1)
                    if iszero(lt(subject, subjectSearchEnd)) { break }
                }
            }

            let resultRemainder := result
            result := add(mload(0x40), 0x20)
            let k := add(sub(resultRemainder, result), sub(subjectEnd, subject))
            // Copy the rest of the string one word at a time.
            for {} lt(subject, subjectEnd) {} {
                mstore(resultRemainder, mload(subject))
                resultRemainder := add(resultRemainder, 0x20)
                subject := add(subject, 0x20)
            }
            result := sub(result, 0x20)
            let last := add(add(result, 0x20), k) // Zeroize the slot after the string.
            mstore(last, 0)
            mstore(0x40, add(last, 0x20)) // Allocate the memory.
            mstore(result, k) // Store the length.
        }
    }

    /// @dev Returns the byte index of the first location of `search` in `subject`,
    /// searching from left to right, starting from `from`.
    /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
    function indexOf(string memory subject, string memory search, uint256 from)
        internal
        pure
        returns (uint256 result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            for { let subjectLength := mload(subject) } 1 {} {
                if iszero(mload(search)) {
                    if iszero(gt(from, subjectLength)) {
                        result := from
                        break
                    }
                    result := subjectLength
                    break
                }
                let searchLength := mload(search)
                let subjectStart := add(subject, 0x20)

                result := not(0) // Initialize to `NOT_FOUND`.

                subject := add(subjectStart, from)
                let end := add(sub(add(subjectStart, subjectLength), searchLength), 1)

                let m := shl(3, sub(0x20, and(searchLength, 0x1f)))
                let s := mload(add(search, 0x20))

                if iszero(and(lt(subject, end), lt(from, subjectLength))) { break }

                if iszero(lt(searchLength, 0x20)) {
                    for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} {
                        if iszero(shr(m, xor(mload(subject), s))) {
                            if eq(keccak256(subject, searchLength), h) {
                                result := sub(subject, subjectStart)
                                break
                            }
                        }
                        subject := add(subject, 1)
                        if iszero(lt(subject, end)) { break }
                    }
                    break
                }
                for {} 1 {} {
                    if iszero(shr(m, xor(mload(subject), s))) {
                        result := sub(subject, subjectStart)
                        break
                    }
                    subject := add(subject, 1)
                    if iszero(lt(subject, end)) { break }
                }
                break
            }
        }
    }

    /// @dev Returns the byte index of the first location of `search` in `subject`,
    /// searching from left to right.
    /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
    function indexOf(string memory subject, string memory search)
        internal
        pure
        returns (uint256 result)
    {
        result = indexOf(subject, search, 0);
    }

    /// @dev Returns the byte index of the first location of `search` in `subject`,
    /// searching from right to left, starting from `from`.
    /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
    function lastIndexOf(string memory subject, string memory search, uint256 from)
        internal
        pure
        returns (uint256 result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            for {} 1 {} {
                result := not(0) // Initialize to `NOT_FOUND`.
                let searchLength := mload(search)
                if gt(searchLength, mload(subject)) { break }
                let w := result

                let fromMax := sub(mload(subject), searchLength)
                if iszero(gt(fromMax, from)) { from := fromMax }

                let end := add(add(subject, 0x20), w)
                subject := add(add(subject, 0x20), from)
                if iszero(gt(subject, end)) { break }
                // As this function is not too often used,
                // we shall simply use keccak256 for smaller bytecode size.
                for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} {
                    if eq(keccak256(subject, searchLength), h) {
                        result := sub(subject, add(end, 1))
                        break
                    }
                    subject := add(subject, w) // `sub(subject, 1)`.
                    if iszero(gt(subject, end)) { break }
                }
                break
            }
        }
    }

    /// @dev Returns the byte index of the first location of `search` in `subject`,
    /// searching from right to left.
    /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
    function lastIndexOf(string memory subject, string memory search)
        internal
        pure
        returns (uint256 result)
    {
        result = lastIndexOf(subject, search, uint256(int256(-1)));
    }

    /// @dev Returns true if `search` is found in `subject`, false otherwise.
    function contains(string memory subject, string memory search) internal pure returns (bool) {
        return indexOf(subject, search) != NOT_FOUND;
    }

    /// @dev Returns whether `subject` starts with `search`.
    function startsWith(string memory subject, string memory search)
        internal
        pure
        returns (bool result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let searchLength := mload(search)
            // Just using keccak256 directly is actually cheaper.
            // forgefmt: disable-next-item
            result := and(
                iszero(gt(searchLength, mload(subject))),
                eq(
                    keccak256(add(subject, 0x20), searchLength),
                    keccak256(add(search, 0x20), searchLength)
                )
            )
        }
    }

    /// @dev Returns whether `subject` ends with `search`.
    function endsWith(string memory subject, string memory search)
        internal
        pure
        returns (bool result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let searchLength := mload(search)
            let subjectLength := mload(subject)
            // Whether `search` is not longer than `subject`.
            let withinRange := iszero(gt(searchLength, subjectLength))
            // Just using keccak256 directly is actually cheaper.
            // forgefmt: disable-next-item
            result := and(
                withinRange,
                eq(
                    keccak256(
                        // `subject + 0x20 + max(subjectLength - searchLength, 0)`.
                        add(add(subject, 0x20), mul(withinRange, sub(subjectLength, searchLength))),
                        searchLength
                    ),
                    keccak256(add(search, 0x20), searchLength)
                )
            )
        }
    }

    /// @dev Returns `subject` repeated `times`.
    function repeat(string memory subject, uint256 times)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let subjectLength := mload(subject)
            if iszero(or(iszero(times), iszero(subjectLength))) {
                subject := add(subject, 0x20)
                result := mload(0x40)
                let output := add(result, 0x20)
                for {} 1 {} {
                    // Copy the `subject` one word at a time.
                    for { let o := 0 } 1 {} {
                        mstore(add(output, o), mload(add(subject, o)))
                        o := add(o, 0x20)
                        if iszero(lt(o, subjectLength)) { break }
                    }
                    output := add(output, subjectLength)
                    times := sub(times, 1)
                    if iszero(times) { break }
                }
                mstore(output, 0) // Zeroize the slot after the string.
                let resultLength := sub(output, add(result, 0x20))
                mstore(result, resultLength) // Store the length.
                // Allocate the memory.
                mstore(0x40, add(result, add(resultLength, 0x20)))
            }
        }
    }

    /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive).
    /// `start` and `end` are byte offsets.
    function slice(string memory subject, uint256 start, uint256 end)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let subjectLength := mload(subject)
            if iszero(gt(subjectLength, end)) { end := subjectLength }
            if iszero(gt(subjectLength, start)) { start := subjectLength }
            if lt(start, end) {
                result := mload(0x40)
                let resultLength := sub(end, start)
                mstore(result, resultLength)
                subject := add(subject, start)
                let w := not(0x1f)
                // Copy the `subject` one word at a time, backwards.
                for { let o := and(add(resultLength, 0x1f), w) } 1 {} {
                    mstore(add(result, o), mload(add(subject, o)))
                    o := add(o, w) // `sub(o, 0x20)`.
                    if iszero(o) { break }
                }
                // Zeroize the slot after the string.
                mstore(add(add(result, 0x20), resultLength), 0)
                // Allocate memory for the length and the bytes,
                // rounded up to a multiple of 32.
                mstore(0x40, add(result, and(add(resultLength, 0x3f), w)))
            }
        }
    }

    /// @dev Returns a copy of `subject` sliced from `start` to the end of the string.
    /// `start` is a byte offset.
    function slice(string memory subject, uint256 start)
        internal
        pure
        returns (string memory result)
    {
        result = slice(subject, start, uint256(int256(-1)));
    }

    /// @dev Returns all the indices of `search` in `subject`.
    /// The indices are byte offsets.
    function indicesOf(string memory subject, string memory search)
        internal
        pure
        returns (uint256[] memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let subjectLength := mload(subject)
            let searchLength := mload(search)

            if iszero(gt(searchLength, subjectLength)) {
                subject := add(subject, 0x20)
                search := add(search, 0x20)
                result := add(mload(0x40), 0x20)

                let subjectStart := subject
                let subjectSearchEnd := add(sub(add(subject, subjectLength), searchLength), 1)
                let h := 0
                if iszero(lt(searchLength, 0x20)) { h := keccak256(search, searchLength) }
                let m := shl(3, sub(0x20, and(searchLength, 0x1f)))
                let s := mload(search)
                for {} 1 {} {
                    let t := mload(subject)
                    // Whether the first `searchLength % 32` bytes of
                    // `subject` and `search` matches.
                    if iszero(shr(m, xor(t, s))) {
                        if h {
                            if iszero(eq(keccak256(subject, searchLength), h)) {
                                subject := add(subject, 1)
                                if iszero(lt(subject, subjectSearchEnd)) { break }
                                continue
                            }
                        }
                        // Append to `result`.
                        mstore(result, sub(subject, subjectStart))
                        result := add(result, 0x20)
                        // Advance `subject` by `searchLength`.
                        subject := add(subject, searchLength)
                        if searchLength {
                            if iszero(lt(subject, subjectSearchEnd)) { break }
                            continue
                        }
                    }
                    subject := add(subject, 1)
                    if iszero(lt(subject, subjectSearchEnd)) { break }
                }
                let resultEnd := result
                // Assign `result` to the free memory pointer.
                result := mload(0x40)
                // Store the length of `result`.
                mstore(result, shr(5, sub(resultEnd, add(result, 0x20))))
                // Allocate memory for result.
                // We allocate one more word, so this array can be recycled for {split}.
                mstore(0x40, add(resultEnd, 0x20))
            }
        }
    }

    /// @dev Returns a arrays of strings based on the `delimiter` inside of the `subject` string.
    function split(string memory subject, string memory delimiter)
        internal
        pure
        returns (string[] memory result)
    {
        uint256[] memory indices = indicesOf(subject, delimiter);
        /// @solidity memory-safe-assembly
        assembly {
            let w := not(0x1f)
            let indexPtr := add(indices, 0x20)
            let indicesEnd := add(indexPtr, shl(5, add(mload(indices), 1)))
            mstore(add(indicesEnd, w), mload(subject))
            mstore(indices, add(mload(indices), 1))
            let prevIndex := 0
            for {} 1 {} {
                let index := mload(indexPtr)
                mstore(indexPtr, 0x60)
                if iszero(eq(index, prevIndex)) {
                    let element := mload(0x40)
                    let elementLength := sub(index, prevIndex)
                    mstore(element, elementLength)
                    // Copy the `subject` one word at a time, backwards.
                    for { let o := and(add(elementLength, 0x1f), w) } 1 {} {
                        mstore(add(element, o), mload(add(add(subject, prevIndex), o)))
                        o := add(o, w) // `sub(o, 0x20)`.
                        if iszero(o) { break }
                    }
                    // Zeroize the slot after the string.
                    mstore(add(add(element, 0x20), elementLength), 0)
                    // Allocate memory for the length and the bytes,
                    // rounded up to a multiple of 32.
                    mstore(0x40, add(element, and(add(elementLength, 0x3f), w)))
                    // Store the `element` into the array.
                    mstore(indexPtr, element)
                }
                prevIndex := add(index, mload(delimiter))
                indexPtr := add(indexPtr, 0x20)
                if iszero(lt(indexPtr, indicesEnd)) { break }
            }
            result := indices
            if iszero(mload(delimiter)) {
                result := add(indices, 0x20)
                mstore(result, sub(mload(indices), 2))
            }
        }
    }

    /// @dev Returns a concatenated string of `a` and `b`.
    /// Cheaper than `string.concat()` and does not de-align the free memory pointer.
    function concat(string memory a, string memory b)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let w := not(0x1f)
            result := mload(0x40)
            let aLength := mload(a)
            // Copy `a` one word at a time, backwards.
            for { let o := and(add(aLength, 0x20), w) } 1 {} {
                mstore(add(result, o), mload(add(a, o)))
                o := add(o, w) // `sub(o, 0x20)`.
                if iszero(o) { break }
            }
            let bLength := mload(b)
            let output := add(result, aLength)
            // Copy `b` one word at a time, backwards.
            for { let o := and(add(bLength, 0x20), w) } 1 {} {
                mstore(add(output, o), mload(add(b, o)))
                o := add(o, w) // `sub(o, 0x20)`.
                if iszero(o) { break }
            }
            let totalLength := add(aLength, bLength)
            let last := add(add(result, 0x20), totalLength)
            // Zeroize the slot after the string.
            mstore(last, 0)
            // Stores the length.
            mstore(result, totalLength)
            // Allocate memory for the length and the bytes,
            // rounded up to a multiple of 32.
            mstore(0x40, and(add(last, 0x1f), w))
        }
    }

    /// @dev Returns a copy of the string in either lowercase or UPPERCASE.
    /// WARNING! This function is only compatible with 7-bit ASCII strings.
    function toCase(string memory subject, bool toUpper)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let length := mload(subject)
            if length {
                result := add(mload(0x40), 0x20)
                subject := add(subject, 1)
                let flags := shl(add(70, shl(5, toUpper)), 0x3ffffff)
                let w := not(0)
                for { let o := length } 1 {} {
                    o := add(o, w)
                    let b := and(0xff, mload(add(subject, o)))
                    mstore8(add(result, o), xor(b, and(shr(b, flags), 0x20)))
                    if iszero(o) { break }
                }
                result := mload(0x40)
                mstore(result, length) // Store the length.
                let last := add(add(result, 0x20), length)
                mstore(last, 0) // Zeroize the slot after the string.
                mstore(0x40, add(last, 0x20)) // Allocate the memory.
            }
        }
    }

    /// @dev Returns a string from a small bytes32 string.
    /// `s` must be null-terminated, or behavior will be undefined.
    function fromSmallString(bytes32 s) internal pure returns (string memory result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := mload(0x40)
            let n := 0
            for {} byte(n, s) { n := add(n, 1) } {} // Scan for '\0'.
            mstore(result, n)
            let o := add(result, 0x20)
            mstore(o, s)
            mstore(add(o, n), 0)
            mstore(0x40, add(result, 0x40))
        }
    }

    /// @dev Returns the small string, with all bytes after the first null byte zeroized.
    function normalizeSmallString(bytes32 s) internal pure returns (bytes32 result) {
        /// @solidity memory-safe-assembly
        assembly {
            for {} byte(result, s) { result := add(result, 1) } {} // Scan for '\0'.
            mstore(0x00, s)
            mstore(result, 0x00)
            result := mload(0x00)
        }
    }

    /// @dev Returns the string as a normalized null-terminated small string.
    function toSmallString(string memory s) internal pure returns (bytes32 result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := mload(s)
            if iszero(lt(result, 33)) {
                mstore(0x00, 0xec92f9a3) // `TooBigForSmallString()`.
                revert(0x1c, 0x04)
            }
            result := shl(shl(3, sub(32, result)), mload(add(s, result)))
        }
    }

    /// @dev Returns a lowercased copy of the string.
    /// WARNING! This function is only compatible with 7-bit ASCII strings.
    function lower(string memory subject) internal pure returns (string memory result) {
        result = toCase(subject, false);
    }

    /// @dev Returns an UPPERCASED copy of the string.
    /// WARNING! This function is only compatible with 7-bit ASCII strings.
    function upper(string memory subject) internal pure returns (string memory result) {
        result = toCase(subject, true);
    }

    /// @dev Escapes the string to be used within HTML tags.
    function escapeHTML(string memory s) internal pure returns (string memory result) {
        /// @solidity memory-safe-assembly
        assembly {
            let end := add(s, mload(s))
            result := add(mload(0x40), 0x20)
            // Store the bytes of the packed offsets and strides into the scratch space.
            // `packed = (stride << 5) | offset`. Max offset is 20. Max stride is 6.
            mstore(0x1f, 0x900094)
            mstore(0x08, 0xc0000000a6ab)
            // Store "&quot;&amp;&#39;&lt;&gt;" into the scratch space.
            mstore(0x00, shl(64, 0x2671756f743b26616d703b262333393b266c743b2667743b))
            for {} iszero(eq(s, end)) {} {
                s := add(s, 1)
                let c := and(mload(s), 0xff)
                // Not in `["\"","'","&","<",">"]`.
                if iszero(and(shl(c, 1), 0x500000c400000000)) {
                    mstore8(result, c)
                    result := add(result, 1)
                    continue
                }
                let t := shr(248, mload(c))
                mstore(result, mload(and(t, 0x1f)))
                result := add(result, shr(5, t))
            }
            let last := result
            mstore(last, 0) // Zeroize the slot after the string.
            result := mload(0x40)
            mstore(result, sub(last, add(result, 0x20))) // Store the length.
            mstore(0x40, add(last, 0x20)) // Allocate the memory.
        }
    }

    /// @dev Escapes the string to be used within double-quotes in a JSON.
    /// If `addDoubleQuotes` is true, the result will be enclosed in double-quotes.
    function escapeJSON(string memory s, bool addDoubleQuotes)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let end := add(s, mload(s))
            result := add(mload(0x40), 0x20)
            if addDoubleQuotes {
                mstore8(result, 34)
                result := add(1, result)
            }
            // Store "\\u0000" in scratch space.
            // Store "0123456789abcdef" in scratch space.
            // Also, store `{0x08:"b", 0x09:"t", 0x0a:"n", 0x0c:"f", 0x0d:"r"}`.
            // into the scratch space.
            mstore(0x15, 0x5c75303030303031323334353637383961626364656662746e006672)
            // Bitmask for detecting `["\"","\\"]`.
            let e := or(shl(0x22, 1), shl(0x5c, 1))
            for {} iszero(eq(s, end)) {} {
                s := add(s, 1)
                let c := and(mload(s), 0xff)
                if iszero(lt(c, 0x20)) {
                    if iszero(and(shl(c, 1), e)) {
                        // Not in `["\"","\\"]`.
                        mstore8(result, c)
                        result := add(result, 1)
                        continue
                    }
                    mstore8(result, 0x5c) // "\\".
                    mstore8(add(result, 1), c)
                    result := add(result, 2)
                    continue
                }
                if iszero(and(shl(c, 1), 0x3700)) {
                    // Not in `["\b","\t","\n","\f","\d"]`.
                    mstore8(0x1d, mload(shr(4, c))) // Hex value.
                    mstore8(0x1e, mload(and(c, 15))) // Hex value.
                    mstore(result, mload(0x19)) // "\\u00XX".
                    result := add(result, 6)
                    continue
                }
                mstore8(result, 0x5c) // "\\".
                mstore8(add(result, 1), mload(add(c, 8)))
                result := add(result, 2)
            }
            if addDoubleQuotes {
                mstore8(result, 34)
                result := add(1, result)
            }
            let last := result
            mstore(last, 0) // Zeroize the slot after the string.
            result := mload(0x40)
            mstore(result, sub(last, add(result, 0x20))) // Store the length.
            mstore(0x40, add(last, 0x20)) // Allocate the memory.
        }
    }

    /// @dev Escapes the string to be used within double-quotes in a JSON.
    function escapeJSON(string memory s) internal pure returns (string memory result) {
        result = escapeJSON(s, false);
    }

    /// @dev Returns whether `a` equals `b`.
    function eq(string memory a, string memory b) internal pure returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := eq(keccak256(add(a, 0x20), mload(a)), keccak256(add(b, 0x20), mload(b)))
        }
    }

    /// @dev Returns whether `a` equals `b`, where `b` is a null-terminated small string.
    function eqs(string memory a, bytes32 b) internal pure returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            // These should be evaluated on compile time, as far as possible.
            let m := not(shl(7, div(not(iszero(b)), 255))) // `0x7f7f ...`.
            let x := not(or(m, or(b, add(m, and(b, m)))))
            let r := shl(7, iszero(iszero(shr(128, x))))
            r := or(r, shl(6, iszero(iszero(shr(64, shr(r, x))))))
            r := or(r, shl(5, lt(0xffffffff, shr(r, x))))
            r := or(r, shl(4, lt(0xffff, shr(r, x))))
            r := or(r, shl(3, lt(0xff, shr(r, x))))
            // forgefmt: disable-next-item
            result := gt(eq(mload(a), add(iszero(x), xor(31, shr(3, r)))),
                xor(shr(add(8, r), b), shr(add(8, r), mload(add(a, 0x20)))))
        }
    }

    /// @dev Packs a single string with its length into a single word.
    /// Returns `bytes32(0)` if the length is zero or greater than 31.
    function packOne(string memory a) internal pure returns (bytes32 result) {
        /// @solidity memory-safe-assembly
        assembly {
            // We don't need to zero right pad the string,
            // since this is our own custom non-standard packing scheme.
            result :=
                mul(
                    // Load the length and the bytes.
                    mload(add(a, 0x1f)),
                    // `length != 0 && length < 32`. Abuses underflow.
                    // Assumes that the length is valid and within the block gas limit.
                    lt(sub(mload(a), 1), 0x1f)
                )
        }
    }

    /// @dev Unpacks a string packed using {packOne}.
    /// Returns the empty string if `packed` is `bytes32(0)`.
    /// If `packed` is not an output of {packOne}, the output behavior is undefined.
    function unpackOne(bytes32 packed) internal pure returns (string memory result) {
        /// @solidity memory-safe-assembly
        assembly {
            // Grab the free memory pointer.
            result := mload(0x40)
            // Allocate 2 words (1 for the length, 1 for the bytes).
            mstore(0x40, add(result, 0x40))
            // Zeroize the length slot.
            mstore(result, 0)
            // Store the length and bytes.
            mstore(add(result, 0x1f), packed)
            // Right pad with zeroes.
            mstore(add(add(result, 0x20), mload(result)), 0)
        }
    }

    /// @dev Packs two strings with their lengths into a single word.
    /// Returns `bytes32(0)` if combined length is zero or greater than 30.
    function packTwo(string memory a, string memory b) internal pure returns (bytes32 result) {
        /// @solidity memory-safe-assembly
        assembly {
            let aLength := mload(a)
            // We don't need to zero right pad the strings,
            // since this is our own custom non-standard packing scheme.
            result :=
                mul(
                    // Load the length and the bytes of `a` and `b`.
                    or(
                        shl(shl(3, sub(0x1f, aLength)), mload(add(a, aLength))),
                        mload(sub(add(b, 0x1e), aLength))
                    ),
                    // `totalLength != 0 && totalLength < 31`. Abuses underflow.
                    // Assumes that the lengths are valid and within the block gas limit.
                    lt(sub(add(aLength, mload(b)), 1), 0x1e)
                )
        }
    }

    /// @dev Unpacks strings packed using {packTwo}.
    /// Returns the empty strings if `packed` is `bytes32(0)`.
    /// If `packed` is not an output of {packTwo}, the output behavior is undefined.
    function unpackTwo(bytes32 packed)
        internal
        pure
        returns (string memory resultA, string memory resultB)
    {
        /// @solidity memory-safe-assembly
        assembly {
            // Grab the free memory pointer.
            resultA := mload(0x40)
            resultB := add(resultA, 0x40)
            // Allocate 2 words for each string (1 for the length, 1 for the byte). Total 4 words.
            mstore(0x40, add(resultB, 0x40))
            // Zeroize the length slots.
            mstore(resultA, 0)
            mstore(resultB, 0)
            // Store the lengths and bytes.
            mstore(add(resultA, 0x1f), packed)
            mstore(add(resultB, 0x1f), mload(add(add(resultA, 0x20), mload(resultA))))
            // Right pad with zeroes.
            mstore(add(add(resultA, 0x20), mload(resultA)), 0)
            mstore(add(add(resultB, 0x20), mload(resultB)), 0)
        }
    }

    /// @dev Directly returns `a` without copying.
    function directReturn(string memory a) internal pure {
        assembly {
            // Assumes that the string does not start from the scratch space.
            let retStart := sub(a, 0x20)
            let retSize := add(mload(a), 0x40)
            // Right pad with zeroes. Just in case the string is produced
            // by a method that doesn't zero right pad.
            mstore(add(retStart, retSize), 0)
            // Store the return offset.
            mstore(retStart, 0x20)
            // End the transaction, returning the string.
            return(retStart, retSize)
        }
    }
}

File 12 of 12 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "solady/=lib/solady/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_baseUri","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ActiveAuction","type":"error"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"EndedAuction","type":"error"},{"inputs":[],"name":"InactiveAuction","type":"error"},{"inputs":[],"name":"InsufficientBid","type":"error"},{"inputs":[],"name":"InvalidAuction","type":"error"},{"inputs":[],"name":"InvalidTimestamp","type":"error"},{"inputs":[],"name":"LockedAuction","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"SettledAuction","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AuctionBidIncrementUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nft","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint40","name":"startTime","type":"uint40"},{"indexed":false,"internalType":"uint40","name":"endTime","type":"uint40"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nft","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"AuctionDeleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AuctionDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nft","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"winner","type":"address"}],"name":"AuctionSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nft","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"BidPlaced","type":"event"},{"anonymous":false,"inputs":[],"name":"LockAuction","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"auctionDuration","outputs":[{"internalType":"uint40","name":"","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionFunds","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctioncore","outputs":[{"internalType":"contract MiyaAuctionNFT","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bidIncrement","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint96","name":"_minPrice","type":"uint96"},{"internalType":"uint40","name":"_startTime","type":"uint40"}],"name":"createAuction","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"deleteAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"}],"name":"getActiveAuctionsList","outputs":[{"components":[{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint96","name":"amount","type":"uint96"},{"internalType":"uint96","name":"minPrice","type":"uint96"},{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"},{"internalType":"bool","name":"settled","type":"bool"}],"internalType":"struct MiyaAuction.AuctionData[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"}],"name":"getActiveTokenIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"}],"name":"getAllTokenIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getAuction","outputs":[{"components":[{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint96","name":"amount","type":"uint96"},{"internalType":"uint96","name":"minPrice","type":"uint96"},{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"},{"internalType":"bool","name":"settled","type":"bool"}],"internalType":"struct MiyaAuction.AuctionData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNfts","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"}],"name":"getSettledAuctionsList","outputs":[{"components":[{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint96","name":"amount","type":"uint96"},{"internalType":"uint96","name":"minPrice","type":"uint96"},{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"},{"internalType":"bool","name":"settled","type":"bool"}],"internalType":"struct MiyaAuction.AuctionData[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"}],"name":"getSettledTokenIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockAuctioncoreMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockAuctioncoreURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"placeBid","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceAuctioncore","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint96","name":"_bidIncrement","type":"uint96"}],"name":"setBidIncrement","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_duration","type":"uint32"}],"name":"setDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settleAllAuctions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"settleOneAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"baseUri_","type":"string"}],"name":"updateAuctioncoreURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405260058054610d2f60a71b64ffffffffff60a01b19909116179055600680546001600160601b031916662386f26fc100001790553480156200004457600080fd5b50604051620040ce380380620040ce8339810160408190526200006791620001f3565b6200007284620000dc565b30838383604051620000849062000118565b620000939493929190620002d3565b604051809103906000f080158015620000b0573d6000803e3d6000fd5b50600580546001600160a01b0319166001600160a01b0392909216919091179055506200032e92505050565b6001600160a01b0316638b78c6d8198190558060007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b611991806200273d83390190565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620001595781810151838201526020016200013f565b50506000910152565b600082601f8301126200017457600080fd5b81516001600160401b038082111562000191576200019162000126565b604051601f8301601f19908116603f01168101908282118183101715620001bc57620001bc62000126565b81604052838152866020858801011115620001d657600080fd5b620001e98460208301602089016200013c565b9695505050505050565b600080600080608085870312156200020a57600080fd5b84516001600160a01b03811681146200022257600080fd5b60208601519094506001600160401b03808211156200024057600080fd5b6200024e8883890162000162565b945060408701519150808211156200026557600080fd5b620002738883890162000162565b935060608701519150808211156200028a57600080fd5b50620002998782880162000162565b91505092959194509250565b60008151808452620002bf8160208601602086016200013c565b601f01601f19169290920160200192915050565b6001600160a01b0385168152608060208201819052600090620002f990830186620002a5565b82810360408401526200030d8186620002a5565b90508281036060840152620003238185620002a5565b979650505050505050565b6123ff806200033e6000396000f3fe6080604052600436106101e35760003560e01c8063a522793f11610102578063d98b9bb511610095578063f0d03af711610064578063f0d03af71461057e578063f2fde38b1461059e578063f762a234146105b1578063fee81cf4146105d157600080fd5b8063d98b9bb514610523578063dba969ff14610536578063dfe5ada21461054b578063f04e283e1461056b57600080fd5b8063b4d78ecc116100d1578063b4d78ecc146104b7578063be40e409146104cc578063cc20b334146104ec578063d8cb55e31461050157600080fd5b8063a522793f14610423578063ae33c7fc14610438578063b0d8ccdd14610458578063b3cc167a1461049757600080fd5b806354d1f13d1161017a578063762a66a211610149578063762a66a2146103855780637f2f6336146103b25780638da5cb5b146103ea5780639732e7201461040357600080fd5b806354d1f13d146103405780635c10b5e414610348578063690d83201461035d578063715018a61461037d57600080fd5b806329c2cbbc116101b657806329c2cbbc146102a65780632b76feda146102c657806342b14996146102f3578063542a53151461032057600080fd5b80630cbf54c8146101e857806314350c1014610228578063150b7a0214610258578063256929621461029c575b600080fd5b3480156101f457600080fd5b5060055461020d90600160a01b900464ffffffffff1681565b60405164ffffffffff90911681526020015b60405180910390f35b34801561023457600080fd5b50610248610243366004611f40565b610612565b604051901515815260200161021f565b34801561026457600080fd5b50610283610273366004612027565b630a85bd0160e11b949350505050565b6040516001600160e01b0319909116815260200161021f565b6102a4610a46565b005b3480156102b257600080fd5b506102a46102c13660046120a7565b610a96565b3480156102d257600080fd5b506102e66102e13660046120d3565b610cee565b60405161021f9190612150565b3480156102ff57600080fd5b5061031361030e3660046120d3565b610e67565b60405161021f919061219e565b34801561032c57600080fd5b506102a461033b3660046121d6565b610faf565b6102a4611047565b34801561035457600080fd5b506102a4611083565b34801561036957600080fd5b506102a46103783660046120d3565b611152565b6102a4611185565b34801561039157600080fd5b506103a56103a03660046120a7565b611199565b60405161021f91906121f1565b3480156103be57600080fd5b506005546103d2906001600160a01b031681565b6040516001600160a01b03909116815260200161021f565b3480156103f657600080fd5b50638b78c6d819546103d2565b34801561040f57600080fd5b506102a461041e3660046121ff565b611238565b34801561042f57600080fd5b506102a46112bb565b34801561044457600080fd5b506103136104533660046120d3565b6113be565b34801561046457600080fd5b5060065461047f90600160601b90046001600160601b031681565b6040516001600160601b03909116815260200161021f565b3480156104a357600080fd5b5060065461047f906001600160601b031681565b3480156104c357600080fd5b506102a46113e2565b3480156104d857600080fd5b506102a46104e7366004612225565b611454565b3480156104f857600080fd5b506102a46114c1565b34801561050d57600080fd5b50610516611519565b60405161021f9190612276565b6102a46105313660046120a7565b61152a565b34801561054257600080fd5b506102a46117a1565b34801561055757600080fd5b506103136105663660046120d3565b6117f9565b6102a46105793660046120d3565b61181d565b34801561058a57600080fd5b506102a46105993660046120a7565b61185a565b6102a46105ac3660046120d3565b611a0e565b3480156105bd57600080fd5b506102e66105cc3660046120d3565b611a35565b3480156105dd57600080fd5b506106046105ec3660046120d3565b63389a75e1600c908152600091909152602090205490565b60405190815260200161021f565b600061061c611ba6565b600654600160c01b900460ff16156106475760405163a077a2b160e01b815260040160405180910390fd5b6001600160a01b03851660009081526002602052604090206106699085611bc1565b15610687576040516355220de960e01b815260040160405180910390fd5b428264ffffffffff1610156106af5760405163b7d0949760e01b815260040160405180910390fd5b6106ba600086611bdc565b6106cb576106c9600086611bfe565b505b6001600160a01b03851660009081526003602052604090206106ed9085611bc1565b15610716576001600160a01b03851660009081526003602052604090206107149085611c13565b505b6040516331a9108f60e11b81526004810185905230906001600160a01b03871690636352211e90602401602060405180830381865afa15801561075d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078191906122b7565b6001600160a01b03161461081257846001600160a01b03166323b872dd6107ab638b78c6d8195490565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015230602482015260448101879052606401600060405180830381600087803b1580156107f957600080fd5b505af115801561080d573d6000803e3d6000fd5b505050505b60055460009061083090600160a01b900464ffffffffff16846122ea565b6001600160a01b03871660009081526002602052604090209091506108559086611c1f565b506040518060c0016040528060006001600160a01b0316815260200160006001600160601b03168152602001856001600160601b031681526020018464ffffffffff1681526020018264ffffffffff1681526020016000151581525060046000886001600160a01b03166001600160a01b03168152602001908152602001600020600087815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160000160146101000a8154816001600160601b0302191690836001600160601b0316021790555060408201518160010160006101000a8154816001600160601b0302191690836001600160601b03160217905550606082015181600101600c6101000a81548164ffffffffff021916908364ffffffffff16021790555060808201518160010160116101000a81548164ffffffffff021916908364ffffffffff16021790555060a08201518160010160166101000a81548160ff0219169083151502179055509050508264ffffffffff1685876001600160a01b03167f1ef4a6664b40950b0e98a5e36404f04c9042b462509b458d5c1298cf7837206f84604051610a32919064ffffffffff91909116815260200190565b60405180910390a450600195945050505050565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b610a9e611ba6565b6001600160a01b03821660009081526004602090815260408083208484529091529020600654600160c01b900460ff1615610aec5760405163a077a2b160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600260205260409020610b0e9083611bc1565b610b2b5760405163010ab10b60e51b815260040160405180910390fd5b6001810154600160b01b900460ff1615610b5857604051639b2b92e160e01b815260040160405180910390fd5b80546001600160a01b031615610b81576040516355220de960e01b815260040160405180910390fd5b6001600160a01b0383166000908152600260205260409020610ba39083611c13565b506001600160a01b0383166000908152600260205260409020610bc590611c2b565b158015610bf057506001600160a01b0383166000908152600360205260409020610bee90611c2b565b155b15610c0257610c00600084611c35565b505b6001600160a01b0383166000818152600460209081526040808320868452909152812090815560010180546001600160b81b03191690556323b872dd30610c4c638b78c6d8195490565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260448101859052606401600060405180830381600087803b158015610c9b57600080fd5b505af1158015610caf573d6000803e3d6000fd5b50506040518492506001600160a01b03861691507f1a85ec288d9cf9ade2cd1b97e705311e36adcb26b91163a89d6cbfbb27b8232790600090a3505050565b6001600160a01b038116600090815260026020526040812060609190610d1390611c4a565b90506000815167ffffffffffffffff811115610d3157610d31611f9b565b604051908082528060200260200182016040528015610d6a57816020015b610d57611eda565b815260200190600190039081610d4f5790505b50905060005b8251811015610e5f576001600160a01b03851660009081526004602052604081208451909190859084908110610da857610da8612308565b6020908102919091018101518252818101929092526040908101600020815160c08101835281546001600160a01b0381168252600160a01b90046001600160601b039081169482019490945260019091015492831691810191909152600160601b820464ffffffffff9081166060830152600160881b8304166080820152600160b01b90910460ff16151560a08201528251839083908110610e4c57610e4c612308565b6020908102919091010152600101610d70565b509392505050565b6001600160a01b038116600090815260026020526040812060609190610e8c90611c4a565b6001600160a01b038416600090815260036020526040812091925090610eb190611c4a565b9050600081518351610ec3919061231e565b67ffffffffffffffff811115610edb57610edb611f9b565b604051908082528060200260200182016040528015610f04578160200160208202803683370190505b50905060005b8151811015610fa6578351811015610f5957838181518110610f2e57610f2e612308565b6020026020010151828281518110610f4857610f48612308565b602002602001018181525050610f9e565b82845182610f679190612331565b81518110610f7757610f77612308565b6020026020010151828281518110610f9157610f91612308565b6020026020010181815250505b600101610f0a565b50949350505050565b610fb7611ba6565b600654600160c01b900460ff1615610fe25760405163a077a2b160e01b815260040160405180910390fd5b806001600160601b0316600003610ff857600080fd5b600680546bffffffffffffffffffffffff19166001600160601b0383169081179091556040517fb83a187395954522b39c23a14b9652b8e8905ccf0acb84f8b239c1597fc8a0aa90600090a250565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b61108b611ba6565b600654600160c01b900460ff16156110b65760405163a077a2b160e01b815260040160405180910390fd5b6006805460ff60c01b1916600160c01b1790556005546040805163e0b6bb6760e01b815290516001600160a01b039092169163e0b6bb679160048082019260009290919082900301818387803b15801561110f57600080fd5b505af1158015611123573d6000803e3d6000fd5b50506040517fc92a3cf209e095e5ad7ce8d95b47d8d90876622386894215952620888b4f724d925060009150a1565b61115a611ba6565b60065461118290829061117d90600160601b90046001600160601b031647612331565b611c57565b50565b61118d611ba6565b6111976000611c9a565b565b6111a1611eda565b506001600160a01b038281166000908152600460209081526040808320858452825291829020825160c08101845281549485168152600160a01b9094046001600160601b03908116928501929092526001015490811691830191909152600160601b810464ffffffffff9081166060840152600160881b8204166080830152600160b01b900460ff16151560a08201525b92915050565b611240611ba6565b600654600160c01b900460ff161561126b5760405163a077a2b160e01b815260040160405180910390fd5b6005805464ffffffffff60a01b191663ffffffff8316600160a01b8102919091179091556040517faab6389d8f1c16ba1deb6e9831f5c5442cf4fcf99bf5bfa867460be408a9111890600090a250565b6112c3611ba6565b60006112cf6000611c4a565b905060006112dd6000611c2b565b90505b801561138a576000826112f4600184612331565b8151811061130457611304612308565b60200260200101519050600061133d60026000846001600160a01b03166001600160a01b03168152602001908152602001600020611c2b565b90505b801561137f5761137682610599611358600185612331565b6001600160a01b038616600090815260026020526040902090611cd8565b60001901611340565b5050600019016112e0565b504715611182576111826113a1638b78c6d8195490565b60065461117d90600160601b90046001600160601b031647612331565b6001600160a01b038116600090815260026020526040902060609061123290611c4a565b6113ea611ba6565b600560009054906101000a90046001600160a01b03166001600160a01b0316638e021c066040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561143a57600080fd5b505af115801561144e573d6000803e3d6000fd5b50505050565b61145c611ba6565b60055460405163931688cb60e01b81526001600160a01b039091169063931688cb9061148c908490600401612344565b600060405180830381600087803b1580156114a657600080fd5b505af11580156114ba573d6000803e3d6000fd5b5050505050565b6114c9611ba6565b600560009054906101000a90046001600160a01b03166001600160a01b031663e0b6bb676040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561143a57600080fd5b60606115256000611c4a565b905090565b6001600160a01b03821660008181526004602090815260408083208584528252808320938352600290915290206115619083611bc1565b61157e5760405163010ab10b60e51b815260040160405180910390fd5b6001810154600160601b900464ffffffffff164210156115b1576040516306b6209160e51b815260040160405180910390fd5b6001810154600160881b900464ffffffffff164211156115e457604051636bed8ced60e11b815260040160405180910390fd5b60018101546001600160601b03163410156116125760405163918678cb60e01b815260040160405180910390fd5b6006548154611634916001600160601b0390811691600160a01b900416612393565b6001600160601b031634101561165d5760405163918678cb60e01b815260040160405180910390fd5b8054336001600160a01b031982161782556001600160a01b03811690600160a01b90046001600160601b031661169234611ce4565b83546001600160601b03918216600160a01b026001600160a01b0390911617845560068054600160601b808204841634869003018416026bffffffffffffffffffffffff60601b199091161790558116156116fa576116fa82826001600160601b0316611c57565b6005546040516335313c2160e11b81523360048201526001600160a01b0390911690636a62784290602401600060405180830381600087803b15801561173f57600080fd5b505af1158015611753573d6000803e3d6000fd5b50506040513381523492508691506001600160a01b038816907f5485cf82060404805b51f48c0c4afa3cec4a9e5755c0131e1243553f0eebb9a3906020015b60405180910390a45050505050565b6117a9611ba6565b600560009054906101000a90046001600160a01b03166001600160a01b031663715018a66040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561143a57600080fd5b6001600160a01b038116600090815260036020526040902060609061123290611c4a565b611825611ba6565b63389a75e1600c52806000526020600c20805442111561184d57636f5e88186000526004601cfd5b6000905561118281611c9a565b611862611ba6565b6001600160a01b038281166000908152600460209081526040808320858452909152902080549091811690600160a01b90046001600160601b0316816118a9575050505050565b6001830154600160881b900464ffffffffff1642116118c9575050505050565b60018301805460ff60b01b1916600160b01b1790556001600160a01b03851660009081526002602052604090206119009085611c13565b506001600160a01b03851660009081526003602052604090206119239085611c1f565b50600680546001600160601b03600160601b8083048216859003909116026bffffffffffffffffffffffff60601b199091161790556040516323b872dd60e01b81523060048201526001600160a01b038381166024830152604482018690528616906323b872dd90606401600060405180830381600087803b1580156119a857600080fd5b505af11580156119bc573d6000803e3d6000fd5b50506040516001600160a01b0385811682526001600160601b03851693508792508816907ffd7ce28213bbc2fc23c21e3e9179a76f7ad9aecfa290c1b78193228e81f3327490602001611792565b5050565b611a16611ba6565b8060601b611a2c57637448fbae6000526004601cfd5b61118281611c9a565b6001600160a01b038116600090815260036020526040812060609190611a5a90611c4a565b90506000815167ffffffffffffffff811115611a7857611a78611f9b565b604051908082528060200260200182016040528015611ab157816020015b611a9e611eda565b815260200190600190039081611a965790505b50905060005b8251811015610e5f576001600160a01b03851660009081526004602052604081208451909190859084908110611aef57611aef612308565b6020908102919091018101518252818101929092526040908101600020815160c08101835281546001600160a01b0381168252600160a01b90046001600160601b039081169482019490945260019091015492831691810191909152600160601b820464ffffffffff9081166060830152600160881b8304166080820152600160b01b90910460ff16151560a08201528251839083908110611b9357611b93612308565b6020908102919091010152600101611ab7565b638b78c6d819543314611197576382b429006000526004601cfd5b600081815260018301602052604081205415155b9392505050565b6001600160a01b03811660009081526001830160205260408120541515611bd5565b6000611bd5836001600160a01b038416611cfd565b6000611bd58383611d4c565b6000611bd58383611cfd565b6000611232825490565b6000611bd5836001600160a01b038416611d4c565b60606000611bd583611e46565b80471015611c6d5763b12d13eb6000526004601cfd5b6000386000388486620186a0f1611a0a57816000526073600b5360ff6020536016600b82f0611a0a573838fd5b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b6000611bd58383611ea2565b6000600160601b8210611cf957611cf9611ecc565b5090565b6000818152600183016020526040812054611d4457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611232565b506000611232565b60008181526001830160205260408120548015611e35576000611d70600183612331565b8554909150600090611d8490600190612331565b9050808214611de9576000866000018281548110611da457611da4612308565b9060005260206000200154905080876000018481548110611dc757611dc7612308565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611dfa57611dfa6123b3565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611232565b6000915050611232565b5092915050565b606081600001805480602002602001604051908101604052809291908181526020018280548015611e9657602002820191906000526020600020905b815481526020019060010190808311611e82575b50505050509050919050565b6000826000018281548110611eb957611eb9612308565b9060005260206000200154905092915050565b6335278d126000526004601cfd5b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b6001600160a01b038116811461118257600080fd5b80356001600160601b0381168114611f3b57600080fd5b919050565b60008060008060808587031215611f5657600080fd5b8435611f6181611f0f565b935060208501359250611f7660408601611f24565b9150606085013564ffffffffff81168114611f9057600080fd5b939692955090935050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115611fcc57611fcc611f9b565b604051601f8501601f19908116603f01168101908282118183101715611ff457611ff4611f9b565b8160405280935085815286868601111561200d57600080fd5b858560208301376000602087830101525050509392505050565b6000806000806080858703121561203d57600080fd5b843561204881611f0f565b9350602085013561205881611f0f565b925060408501359150606085013567ffffffffffffffff81111561207b57600080fd5b8501601f8101871361208c57600080fd5b61209b87823560208401611fb1565b91505092959194509250565b600080604083850312156120ba57600080fd5b82356120c581611f0f565b946020939093013593505050565b6000602082840312156120e557600080fd5b8135611bd581611f0f565b60018060a01b03815116825260208101516001600160601b0380821660208501528060408401511660408501525050606081015164ffffffffff8082166060850152806080840151166080850152505060a0810151151560a08301525050565b6020808252825182820181905260009190848201906040850190845b818110156121925761217f8385516120f0565b9284019260c0929092019160010161216c565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612192578351835292840192918401916001016121ba565b6000602082840312156121e857600080fd5b611bd582611f24565b60c0810161123282846120f0565b60006020828403121561221157600080fd5b813563ffffffff81168114611bd557600080fd5b60006020828403121561223757600080fd5b813567ffffffffffffffff81111561224e57600080fd5b8201601f8101841361225f57600080fd5b61226e84823560208401611fb1565b949350505050565b6020808252825182820181905260009190848201906040850190845b818110156121925783516001600160a01b031683529284019291840191600101612292565b6000602082840312156122c957600080fd5b8151611bd581611f0f565b634e487b7160e01b600052601160045260246000fd5b64ffffffffff818116838216019080821115611e3f57611e3f6122d4565b634e487b7160e01b600052603260045260246000fd5b80820180821115611232576112326122d4565b81810381811115611232576112326122d4565b60006020808352835180602085015260005b8181101561237257858101830151858201604001528201612356565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160601b03818116838216019080821115611e3f57611e3f6122d4565b634e487b7160e01b600052603160045260246000fdfea264697066735822122071cee4f54e616d6c9f4a6a2f336be0952f342f241dfa2d74dae586aa713f4c3464736f6c6343000818003360806040523480156200001157600080fd5b5060405162001991380380620019918339810160408190526200003491620001bf565b6200003f84620000b6565b60006200004d848262000302565b5060016200005c838262000302565b5060026200006b828262000302565b50806040516200007c9190620003ce565b604051908190038120907f157d450c8fb1377294d9db75af1de2753efc52d8e5578551d70d2c7d9cd74df990600090a250505050620003ec565b6001600160a01b0316638b78c6d8198190558060007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620001255781810151838201526020016200010b565b50506000910152565b600082601f8301126200014057600080fd5b81516001600160401b03808211156200015d576200015d620000f2565b604051601f8301601f19908116603f01168101908282118183101715620001885762000188620000f2565b81604052838152866020858801011115620001a257600080fd5b620001b584602083016020890162000108565b9695505050505050565b60008060008060808587031215620001d657600080fd5b84516001600160a01b0381168114620001ee57600080fd5b60208601519094506001600160401b03808211156200020c57600080fd5b6200021a888389016200012e565b945060408701519150808211156200023157600080fd5b6200023f888389016200012e565b935060608701519150808211156200025657600080fd5b5062000265878288016200012e565b91505092959194509250565b600181811c908216806200028657607f821691505b602082108103620002a757634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002fd576000816000526020600020601f850160051c81016020861015620002d85750805b601f850160051c820191505b81811015620002f957828155600101620002e4565b5050505b505050565b81516001600160401b038111156200031e576200031e620000f2565b62000336816200032f845462000271565b84620002ad565b602080601f8311600181146200036e5760008415620003555750858301515b600019600386901b1c1916600185901b178555620002f9565b600085815260208120601f198616915b828110156200039f578886015182559484019460019091019084016200037e565b5085821015620003be5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008251620003e281846020870162000108565b9190910192915050565b61159580620003fc6000396000f3fe60806040526004361061019c5760003560e01c80638da5cb5b116100ec578063c87b56dd1161008a578063e985e9c511610064578063e985e9c51461042e578063f04e283e14610464578063f2fde38b14610477578063fee81cf41461048a57600080fd5b8063c87b56dd146103e4578063e0b6bb6714610404578063e8a3d4851461041957600080fd5b806395d89b41116100c657806395d89b411461037c578063a22cb46514610391578063b88d4fde146103b1578063be29184f146103c457600080fd5b80638da5cb5b1461032e5780638e021c0614610347578063931688cb1461035c57600080fd5b806342842e0e116101595780636352211e116101335780636352211e146102b85780636a627842146102d857806370a08231146102f8578063715018a61461032657600080fd5b806342842e0e1461027d57806342966c681461029057806354d1f13d146102b057600080fd5b806301ffc9a7146101a157806306fdde03146101f3578063081812fc14610215578063095ea7b31461024d57806323b872dd146102625780632569296214610275575b600080fd5b3480156101ad57600080fd5b506101de6101bc36600461108b565b6301ffc9a760e09190911c9081146380ac58cd821417635b5e139f9091141790565b60405190151581526020015b60405180910390f35b3480156101ff57600080fd5b506102086104bd565b6040516101ea91906110e0565b34801561022157600080fd5b50610235610230366004611113565b61054f565b6040516001600160a01b0390911681526020016101ea565b61026061025b366004611143565b61058e565b005b61026061027036600461116d565b61059d565b61026061069e565b61026061028b36600461116d565b6106ee565b34801561029c57600080fd5b506102606102ab366004611113565b61071b565b61026061074d565b3480156102c457600080fd5b506102356102d3366004611113565b610789565b3480156102e457600080fd5b506102606102f33660046111a9565b6107c7565b34801561030457600080fd5b506103186103133660046111a9565b610834565b6040519081526020016101ea565b61026061086f565b34801561033a57600080fd5b50638b78c6d81954610235565b34801561035357600080fd5b50610260610889565b34801561036857600080fd5b506102606103773660046111da565b6108cf565b34801561038857600080fd5b50610208610950565b34801561039d57600080fd5b506102606103ac36600461128b565b61095f565b6102606103bf3660046112c7565b6109b5565b3480156103d057600080fd5b506102606103df366004611362565b610a10565b3480156103f057600080fd5b506102086103ff366004611113565b610a9a565b34801561041057600080fd5b50610260610b87565b34801561042557600080fd5b50610208610bcd565b34801561043a57600080fd5b506101de61044936600461139a565b601c52670a5a2e7a000000006008526000526030600c205490565b6102606104723660046111a9565b610c0a565b6102606104853660046111a9565b610c47565b34801561049657600080fd5b506103186104a53660046111a9565b63389a75e1600c908152600091909152602090205490565b6060600080546104cc906113cd565b80601f01602080910402602001604051908101604052809291908181526020018280546104f8906113cd565b80156105455780601f1061051a57610100808354040283529160200191610545565b820191906000526020600020905b81548152906001019060200180831161052857829003601f168201915b5050505050905090565b600081600052673ec412a9852d173d60c11b601c52602060002082018201805460601b6105845763ceea21b66000526004601cfd5b6001015492915050565b610599338383610c6e565b5050565b6000818152673ec412a9852d173d60c11b3317601c52602090208101810180546001600160a01b0394851694938416938116919082861483026105ef5767ceea21b6a1148100831560021b526004601cfd5b85600052816001015492508233148633141761061d576030600c205461061d57634b6e7f186000526004601cfd5b821561062b57600082600101555b85851818905550601c600c8181208054600019019055600084905220805460010163ffffffff8116840261066e5767ea553b3401336cea841560021b526004601cfd5b90558082847fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600038a45b505050565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b6106f983838361059d565b813b156106995761069983838360405180602001604052806000815250610d0f565b6107253382610d9b565b610741576040516282b42960e81b815260040160405180910390fd5b61074a81610e07565b50565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b6000818152673ec412a9852d173d60c11b601c526020902081018101546001600160a01b0316806107c25763ceea21b66000526004601cfd5b919050565b6107cf610e12565b600354600160801b900460ff1661074a57600380546000919082906107fc906001600160801b0316611407565b91906101000a8154816001600160801b0302191690836001600160801b0316021790556001600160801b031690506105998282610e2d565b60008161084957638f4eb6046000526004601cfd5b673ec412a9852d173d60c11b601c528160005263ffffffff601c600c2054169050919050565b610877610e12565b61087f610889565b610887610ece565b565b610891610e12565b6003805460ff60881b1916600160881b1790556040517f31d1c0a3af6e15844ff9c1bf6201a5cf123137eb2fb3eeb96861a436d49cd25f90600090a1565b6108d7610e12565b600354600160881b900460ff1615610902576040516303cb96db60e21b815260040160405180910390fd5b600261090e8282611483565b508060405161091d9190611543565b604051908190038120907f157d450c8fb1377294d9db75af1de2753efc52d8e5578551d70d2c7d9cd74df990600090a250565b6060600180546104cc906113cd565b801515905081601c52670a5a2e7a0000000060085233600052806030600c2055806000528160601b60601c337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160206000a35050565b6109c085858561059d565b833b15610a0957610a0985858585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610d0f92505050565b5050505050565b610a18610e12565b600354600160801b900460ff16610599576003546001600160801b031660005b826001600160801b0316811015610a6a57610a6284836001019350836001600160801b0316610e2d565b600101610a38565b5050600380546001600160801b038082168401166fffffffffffffffffffffffffffffffff199091161790555050565b6060610ac4826000818152673ec412a9852d173d60c11b601c52602090208101015460601b151590565b610adc57505060408051602081019091526000815290565b610b81610ae883610ee0565b60028054610af5906113cd565b80601f0160208091040260200160405190810160405280929190818152602001828054610b21906113cd565b8015610b6e5780601f10610b4357610100808354040283529160200191610b6e565b820191906000526020600020905b815481529060010190602001808311610b5157829003601f168201915b5050505050610f2490919063ffffffff16565b92915050565b610b8f610e12565b6003805460ff60801b1916600160801b1790556040517faa71a6e005bc4e0ea53d6184338a28d3f4737f18bed30c92d93a239ad5a7174790600090a1565b6060610c056040518060400160405280600d81526020016c31b7b73a3930b1ba173539b7b760991b81525060028054610af5906113cd565b905090565b610c12610e12565b63389a75e1600c52806000526020600c208054421115610c3a57636f5e88186000526004601cfd5b6000905561074a81610f7f565b610c4f610e12565b8060601b610c6557637448fbae6000526004601cfd5b61074a81610f7f565b60001960601c828116925083811693508160005283673ec412a9852d173d60c11b17601c5260206000208201820180548216915081610cb55763ceea21b66000526004601cfd5b818514851517610cdb57816000526030600c2054610cdb57634b6e7f186000526004601cfd5b6001018390558183827f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600038a450505050565b60405163150b7a028082523360208301528560601b60601c604083015283606083015260808083015282518060a08401528015610d56578060c08401826020870160045afa505b60208360a48301601c860160008a5af1610d79573d15610d79573d6000843e3d83fd5b508060e01b825114610d935763d1a57ed66000526004601cfd5b505050505050565b60008181526001600160a01b03928316673ec412a9852d173d60c11b8117601c52602090912082018201805491936001921680610de05763ceea21b66000526004601cfd5b808514610dff57806000526030600c2054610dff578160010154851492505b505092915050565b61074a600082610fbd565b638b78c6d819543314610887576382b429006000526004601cfd5b8160601b60601c915080600052673ec412a9852d173d60c11b601c5260206000208101810180548060601b15610e6b5763c991cbb16000526004601cfd5b831790556000829052601c600c20805460010163ffffffff81168402610ea05767ea553b3401336cea841560021b526004601cfd5b9055808260007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8138a45050565b610ed6610e12565b6108876000610f7f565b60606080604051019050602081016040526000815280600019835b928101926030600a8206018453600a900480610efb575050819003601f19909101908152919050565b6040518251601f19906020810182165b8581015184820152820180610f34575083518184018360208301165b8681015182820152840180610f505750506000910183810160208101929092528352603f011660405292915050565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b6000610fc882610789565b90505060008181526001600160a01b03928316673ec412a9852d173d60c11b8117601c52602090912082018201805491938216918261100f5763ceea21b66000526004601cfd5b8260005281600101548086148487141786151761103e576030600c205461103e57634b6e7f186000526004601cfd5b801561104c57600083600101555b5082189055601c600c208054600019019055816000827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8238a4505050565b60006020828403121561109d57600080fd5b81356001600160e01b0319811681146110b557600080fd5b9392505050565b60005b838110156110d75781810151838201526020016110bf565b50506000910152565b60208152600082518060208401526110ff8160408501602087016110bc565b601f01601f19169190910160400192915050565b60006020828403121561112557600080fd5b5035919050565b80356001600160a01b03811681146107c257600080fd5b6000806040838503121561115657600080fd5b61115f8361112c565b946020939093013593505050565b60008060006060848603121561118257600080fd5b61118b8461112c565b92506111996020850161112c565b9150604084013590509250925092565b6000602082840312156111bb57600080fd5b6110b58261112c565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156111ec57600080fd5b813567ffffffffffffffff8082111561120457600080fd5b818401915084601f83011261121857600080fd5b81358181111561122a5761122a6111c4565b604051601f8201601f19908116603f01168101908382118183101715611252576112526111c4565b8160405282815287602084870101111561126b57600080fd5b826020860160208301376000928101602001929092525095945050505050565b6000806040838503121561129e57600080fd5b6112a78361112c565b9150602083013580151581146112bc57600080fd5b809150509250929050565b6000806000806000608086880312156112df57600080fd5b6112e88661112c565b94506112f66020870161112c565b935060408601359250606086013567ffffffffffffffff8082111561131a57600080fd5b818801915088601f83011261132e57600080fd5b81358181111561133d57600080fd5b89602082850101111561134f57600080fd5b9699959850939650602001949392505050565b6000806040838503121561137557600080fd5b61137e8361112c565b915060208301356001600160801b03811681146112bc57600080fd5b600080604083850312156113ad57600080fd5b6113b68361112c565b91506113c46020840161112c565b90509250929050565b600181811c908216806113e157607f821691505b60208210810361140157634e487b7160e01b600052602260045260246000fd5b50919050565b60006001600160801b0380831681810361143157634e487b7160e01b600052601160045260246000fd5b6001019392505050565b601f821115610699576000816000526020600020601f850160051c810160208610156114645750805b601f850160051c820191505b81811015610d9357828155600101611470565b815167ffffffffffffffff81111561149d5761149d6111c4565b6114b1816114ab84546113cd565b8461143b565b602080601f8311600181146114e657600084156114ce5750858301515b600019600386901b1c1916600185901b178555610d93565b600085815260208120601f198616915b82811015611515578886015182559484019460019091019084016114f6565b50858210156115335787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082516115558184602087016110bc565b919091019291505056fea2646970667358221220dce0bdf8732b09537e0f12c70e4f4c72e54fcb75db30e9f1a0da7a85f155580064736f6c63430008180033000000000000000000000000a779fc675db318dab004ab8d538cb320d0013f42000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000073430344d6979610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054552524f520000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106101e35760003560e01c8063a522793f11610102578063d98b9bb511610095578063f0d03af711610064578063f0d03af71461057e578063f2fde38b1461059e578063f762a234146105b1578063fee81cf4146105d157600080fd5b8063d98b9bb514610523578063dba969ff14610536578063dfe5ada21461054b578063f04e283e1461056b57600080fd5b8063b4d78ecc116100d1578063b4d78ecc146104b7578063be40e409146104cc578063cc20b334146104ec578063d8cb55e31461050157600080fd5b8063a522793f14610423578063ae33c7fc14610438578063b0d8ccdd14610458578063b3cc167a1461049757600080fd5b806354d1f13d1161017a578063762a66a211610149578063762a66a2146103855780637f2f6336146103b25780638da5cb5b146103ea5780639732e7201461040357600080fd5b806354d1f13d146103405780635c10b5e414610348578063690d83201461035d578063715018a61461037d57600080fd5b806329c2cbbc116101b657806329c2cbbc146102a65780632b76feda146102c657806342b14996146102f3578063542a53151461032057600080fd5b80630cbf54c8146101e857806314350c1014610228578063150b7a0214610258578063256929621461029c575b600080fd5b3480156101f457600080fd5b5060055461020d90600160a01b900464ffffffffff1681565b60405164ffffffffff90911681526020015b60405180910390f35b34801561023457600080fd5b50610248610243366004611f40565b610612565b604051901515815260200161021f565b34801561026457600080fd5b50610283610273366004612027565b630a85bd0160e11b949350505050565b6040516001600160e01b0319909116815260200161021f565b6102a4610a46565b005b3480156102b257600080fd5b506102a46102c13660046120a7565b610a96565b3480156102d257600080fd5b506102e66102e13660046120d3565b610cee565b60405161021f9190612150565b3480156102ff57600080fd5b5061031361030e3660046120d3565b610e67565b60405161021f919061219e565b34801561032c57600080fd5b506102a461033b3660046121d6565b610faf565b6102a4611047565b34801561035457600080fd5b506102a4611083565b34801561036957600080fd5b506102a46103783660046120d3565b611152565b6102a4611185565b34801561039157600080fd5b506103a56103a03660046120a7565b611199565b60405161021f91906121f1565b3480156103be57600080fd5b506005546103d2906001600160a01b031681565b6040516001600160a01b03909116815260200161021f565b3480156103f657600080fd5b50638b78c6d819546103d2565b34801561040f57600080fd5b506102a461041e3660046121ff565b611238565b34801561042f57600080fd5b506102a46112bb565b34801561044457600080fd5b506103136104533660046120d3565b6113be565b34801561046457600080fd5b5060065461047f90600160601b90046001600160601b031681565b6040516001600160601b03909116815260200161021f565b3480156104a357600080fd5b5060065461047f906001600160601b031681565b3480156104c357600080fd5b506102a46113e2565b3480156104d857600080fd5b506102a46104e7366004612225565b611454565b3480156104f857600080fd5b506102a46114c1565b34801561050d57600080fd5b50610516611519565b60405161021f9190612276565b6102a46105313660046120a7565b61152a565b34801561054257600080fd5b506102a46117a1565b34801561055757600080fd5b506103136105663660046120d3565b6117f9565b6102a46105793660046120d3565b61181d565b34801561058a57600080fd5b506102a46105993660046120a7565b61185a565b6102a46105ac3660046120d3565b611a0e565b3480156105bd57600080fd5b506102e66105cc3660046120d3565b611a35565b3480156105dd57600080fd5b506106046105ec3660046120d3565b63389a75e1600c908152600091909152602090205490565b60405190815260200161021f565b600061061c611ba6565b600654600160c01b900460ff16156106475760405163a077a2b160e01b815260040160405180910390fd5b6001600160a01b03851660009081526002602052604090206106699085611bc1565b15610687576040516355220de960e01b815260040160405180910390fd5b428264ffffffffff1610156106af5760405163b7d0949760e01b815260040160405180910390fd5b6106ba600086611bdc565b6106cb576106c9600086611bfe565b505b6001600160a01b03851660009081526003602052604090206106ed9085611bc1565b15610716576001600160a01b03851660009081526003602052604090206107149085611c13565b505b6040516331a9108f60e11b81526004810185905230906001600160a01b03871690636352211e90602401602060405180830381865afa15801561075d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078191906122b7565b6001600160a01b03161461081257846001600160a01b03166323b872dd6107ab638b78c6d8195490565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015230602482015260448101879052606401600060405180830381600087803b1580156107f957600080fd5b505af115801561080d573d6000803e3d6000fd5b505050505b60055460009061083090600160a01b900464ffffffffff16846122ea565b6001600160a01b03871660009081526002602052604090209091506108559086611c1f565b506040518060c0016040528060006001600160a01b0316815260200160006001600160601b03168152602001856001600160601b031681526020018464ffffffffff1681526020018264ffffffffff1681526020016000151581525060046000886001600160a01b03166001600160a01b03168152602001908152602001600020600087815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160000160146101000a8154816001600160601b0302191690836001600160601b0316021790555060408201518160010160006101000a8154816001600160601b0302191690836001600160601b03160217905550606082015181600101600c6101000a81548164ffffffffff021916908364ffffffffff16021790555060808201518160010160116101000a81548164ffffffffff021916908364ffffffffff16021790555060a08201518160010160166101000a81548160ff0219169083151502179055509050508264ffffffffff1685876001600160a01b03167f1ef4a6664b40950b0e98a5e36404f04c9042b462509b458d5c1298cf7837206f84604051610a32919064ffffffffff91909116815260200190565b60405180910390a450600195945050505050565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b610a9e611ba6565b6001600160a01b03821660009081526004602090815260408083208484529091529020600654600160c01b900460ff1615610aec5760405163a077a2b160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600260205260409020610b0e9083611bc1565b610b2b5760405163010ab10b60e51b815260040160405180910390fd5b6001810154600160b01b900460ff1615610b5857604051639b2b92e160e01b815260040160405180910390fd5b80546001600160a01b031615610b81576040516355220de960e01b815260040160405180910390fd5b6001600160a01b0383166000908152600260205260409020610ba39083611c13565b506001600160a01b0383166000908152600260205260409020610bc590611c2b565b158015610bf057506001600160a01b0383166000908152600360205260409020610bee90611c2b565b155b15610c0257610c00600084611c35565b505b6001600160a01b0383166000818152600460209081526040808320868452909152812090815560010180546001600160b81b03191690556323b872dd30610c4c638b78c6d8195490565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260448101859052606401600060405180830381600087803b158015610c9b57600080fd5b505af1158015610caf573d6000803e3d6000fd5b50506040518492506001600160a01b03861691507f1a85ec288d9cf9ade2cd1b97e705311e36adcb26b91163a89d6cbfbb27b8232790600090a3505050565b6001600160a01b038116600090815260026020526040812060609190610d1390611c4a565b90506000815167ffffffffffffffff811115610d3157610d31611f9b565b604051908082528060200260200182016040528015610d6a57816020015b610d57611eda565b815260200190600190039081610d4f5790505b50905060005b8251811015610e5f576001600160a01b03851660009081526004602052604081208451909190859084908110610da857610da8612308565b6020908102919091018101518252818101929092526040908101600020815160c08101835281546001600160a01b0381168252600160a01b90046001600160601b039081169482019490945260019091015492831691810191909152600160601b820464ffffffffff9081166060830152600160881b8304166080820152600160b01b90910460ff16151560a08201528251839083908110610e4c57610e4c612308565b6020908102919091010152600101610d70565b509392505050565b6001600160a01b038116600090815260026020526040812060609190610e8c90611c4a565b6001600160a01b038416600090815260036020526040812091925090610eb190611c4a565b9050600081518351610ec3919061231e565b67ffffffffffffffff811115610edb57610edb611f9b565b604051908082528060200260200182016040528015610f04578160200160208202803683370190505b50905060005b8151811015610fa6578351811015610f5957838181518110610f2e57610f2e612308565b6020026020010151828281518110610f4857610f48612308565b602002602001018181525050610f9e565b82845182610f679190612331565b81518110610f7757610f77612308565b6020026020010151828281518110610f9157610f91612308565b6020026020010181815250505b600101610f0a565b50949350505050565b610fb7611ba6565b600654600160c01b900460ff1615610fe25760405163a077a2b160e01b815260040160405180910390fd5b806001600160601b0316600003610ff857600080fd5b600680546bffffffffffffffffffffffff19166001600160601b0383169081179091556040517fb83a187395954522b39c23a14b9652b8e8905ccf0acb84f8b239c1597fc8a0aa90600090a250565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b61108b611ba6565b600654600160c01b900460ff16156110b65760405163a077a2b160e01b815260040160405180910390fd5b6006805460ff60c01b1916600160c01b1790556005546040805163e0b6bb6760e01b815290516001600160a01b039092169163e0b6bb679160048082019260009290919082900301818387803b15801561110f57600080fd5b505af1158015611123573d6000803e3d6000fd5b50506040517fc92a3cf209e095e5ad7ce8d95b47d8d90876622386894215952620888b4f724d925060009150a1565b61115a611ba6565b60065461118290829061117d90600160601b90046001600160601b031647612331565b611c57565b50565b61118d611ba6565b6111976000611c9a565b565b6111a1611eda565b506001600160a01b038281166000908152600460209081526040808320858452825291829020825160c08101845281549485168152600160a01b9094046001600160601b03908116928501929092526001015490811691830191909152600160601b810464ffffffffff9081166060840152600160881b8204166080830152600160b01b900460ff16151560a08201525b92915050565b611240611ba6565b600654600160c01b900460ff161561126b5760405163a077a2b160e01b815260040160405180910390fd5b6005805464ffffffffff60a01b191663ffffffff8316600160a01b8102919091179091556040517faab6389d8f1c16ba1deb6e9831f5c5442cf4fcf99bf5bfa867460be408a9111890600090a250565b6112c3611ba6565b60006112cf6000611c4a565b905060006112dd6000611c2b565b90505b801561138a576000826112f4600184612331565b8151811061130457611304612308565b60200260200101519050600061133d60026000846001600160a01b03166001600160a01b03168152602001908152602001600020611c2b565b90505b801561137f5761137682610599611358600185612331565b6001600160a01b038616600090815260026020526040902090611cd8565b60001901611340565b5050600019016112e0565b504715611182576111826113a1638b78c6d8195490565b60065461117d90600160601b90046001600160601b031647612331565b6001600160a01b038116600090815260026020526040902060609061123290611c4a565b6113ea611ba6565b600560009054906101000a90046001600160a01b03166001600160a01b0316638e021c066040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561143a57600080fd5b505af115801561144e573d6000803e3d6000fd5b50505050565b61145c611ba6565b60055460405163931688cb60e01b81526001600160a01b039091169063931688cb9061148c908490600401612344565b600060405180830381600087803b1580156114a657600080fd5b505af11580156114ba573d6000803e3d6000fd5b5050505050565b6114c9611ba6565b600560009054906101000a90046001600160a01b03166001600160a01b031663e0b6bb676040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561143a57600080fd5b60606115256000611c4a565b905090565b6001600160a01b03821660008181526004602090815260408083208584528252808320938352600290915290206115619083611bc1565b61157e5760405163010ab10b60e51b815260040160405180910390fd5b6001810154600160601b900464ffffffffff164210156115b1576040516306b6209160e51b815260040160405180910390fd5b6001810154600160881b900464ffffffffff164211156115e457604051636bed8ced60e11b815260040160405180910390fd5b60018101546001600160601b03163410156116125760405163918678cb60e01b815260040160405180910390fd5b6006548154611634916001600160601b0390811691600160a01b900416612393565b6001600160601b031634101561165d5760405163918678cb60e01b815260040160405180910390fd5b8054336001600160a01b031982161782556001600160a01b03811690600160a01b90046001600160601b031661169234611ce4565b83546001600160601b03918216600160a01b026001600160a01b0390911617845560068054600160601b808204841634869003018416026bffffffffffffffffffffffff60601b199091161790558116156116fa576116fa82826001600160601b0316611c57565b6005546040516335313c2160e11b81523360048201526001600160a01b0390911690636a62784290602401600060405180830381600087803b15801561173f57600080fd5b505af1158015611753573d6000803e3d6000fd5b50506040513381523492508691506001600160a01b038816907f5485cf82060404805b51f48c0c4afa3cec4a9e5755c0131e1243553f0eebb9a3906020015b60405180910390a45050505050565b6117a9611ba6565b600560009054906101000a90046001600160a01b03166001600160a01b031663715018a66040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561143a57600080fd5b6001600160a01b038116600090815260036020526040902060609061123290611c4a565b611825611ba6565b63389a75e1600c52806000526020600c20805442111561184d57636f5e88186000526004601cfd5b6000905561118281611c9a565b611862611ba6565b6001600160a01b038281166000908152600460209081526040808320858452909152902080549091811690600160a01b90046001600160601b0316816118a9575050505050565b6001830154600160881b900464ffffffffff1642116118c9575050505050565b60018301805460ff60b01b1916600160b01b1790556001600160a01b03851660009081526002602052604090206119009085611c13565b506001600160a01b03851660009081526003602052604090206119239085611c1f565b50600680546001600160601b03600160601b8083048216859003909116026bffffffffffffffffffffffff60601b199091161790556040516323b872dd60e01b81523060048201526001600160a01b038381166024830152604482018690528616906323b872dd90606401600060405180830381600087803b1580156119a857600080fd5b505af11580156119bc573d6000803e3d6000fd5b50506040516001600160a01b0385811682526001600160601b03851693508792508816907ffd7ce28213bbc2fc23c21e3e9179a76f7ad9aecfa290c1b78193228e81f3327490602001611792565b5050565b611a16611ba6565b8060601b611a2c57637448fbae6000526004601cfd5b61118281611c9a565b6001600160a01b038116600090815260036020526040812060609190611a5a90611c4a565b90506000815167ffffffffffffffff811115611a7857611a78611f9b565b604051908082528060200260200182016040528015611ab157816020015b611a9e611eda565b815260200190600190039081611a965790505b50905060005b8251811015610e5f576001600160a01b03851660009081526004602052604081208451909190859084908110611aef57611aef612308565b6020908102919091018101518252818101929092526040908101600020815160c08101835281546001600160a01b0381168252600160a01b90046001600160601b039081169482019490945260019091015492831691810191909152600160601b820464ffffffffff9081166060830152600160881b8304166080820152600160b01b90910460ff16151560a08201528251839083908110611b9357611b93612308565b6020908102919091010152600101611ab7565b638b78c6d819543314611197576382b429006000526004601cfd5b600081815260018301602052604081205415155b9392505050565b6001600160a01b03811660009081526001830160205260408120541515611bd5565b6000611bd5836001600160a01b038416611cfd565b6000611bd58383611d4c565b6000611bd58383611cfd565b6000611232825490565b6000611bd5836001600160a01b038416611d4c565b60606000611bd583611e46565b80471015611c6d5763b12d13eb6000526004601cfd5b6000386000388486620186a0f1611a0a57816000526073600b5360ff6020536016600b82f0611a0a573838fd5b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b6000611bd58383611ea2565b6000600160601b8210611cf957611cf9611ecc565b5090565b6000818152600183016020526040812054611d4457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611232565b506000611232565b60008181526001830160205260408120548015611e35576000611d70600183612331565b8554909150600090611d8490600190612331565b9050808214611de9576000866000018281548110611da457611da4612308565b9060005260206000200154905080876000018481548110611dc757611dc7612308565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611dfa57611dfa6123b3565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611232565b6000915050611232565b5092915050565b606081600001805480602002602001604051908101604052809291908181526020018280548015611e9657602002820191906000526020600020905b815481526020019060010190808311611e82575b50505050509050919050565b6000826000018281548110611eb957611eb9612308565b9060005260206000200154905092915050565b6335278d126000526004601cfd5b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b6001600160a01b038116811461118257600080fd5b80356001600160601b0381168114611f3b57600080fd5b919050565b60008060008060808587031215611f5657600080fd5b8435611f6181611f0f565b935060208501359250611f7660408601611f24565b9150606085013564ffffffffff81168114611f9057600080fd5b939692955090935050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115611fcc57611fcc611f9b565b604051601f8501601f19908116603f01168101908282118183101715611ff457611ff4611f9b565b8160405280935085815286868601111561200d57600080fd5b858560208301376000602087830101525050509392505050565b6000806000806080858703121561203d57600080fd5b843561204881611f0f565b9350602085013561205881611f0f565b925060408501359150606085013567ffffffffffffffff81111561207b57600080fd5b8501601f8101871361208c57600080fd5b61209b87823560208401611fb1565b91505092959194509250565b600080604083850312156120ba57600080fd5b82356120c581611f0f565b946020939093013593505050565b6000602082840312156120e557600080fd5b8135611bd581611f0f565b60018060a01b03815116825260208101516001600160601b0380821660208501528060408401511660408501525050606081015164ffffffffff8082166060850152806080840151166080850152505060a0810151151560a08301525050565b6020808252825182820181905260009190848201906040850190845b818110156121925761217f8385516120f0565b9284019260c0929092019160010161216c565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612192578351835292840192918401916001016121ba565b6000602082840312156121e857600080fd5b611bd582611f24565b60c0810161123282846120f0565b60006020828403121561221157600080fd5b813563ffffffff81168114611bd557600080fd5b60006020828403121561223757600080fd5b813567ffffffffffffffff81111561224e57600080fd5b8201601f8101841361225f57600080fd5b61226e84823560208401611fb1565b949350505050565b6020808252825182820181905260009190848201906040850190845b818110156121925783516001600160a01b031683529284019291840191600101612292565b6000602082840312156122c957600080fd5b8151611bd581611f0f565b634e487b7160e01b600052601160045260246000fd5b64ffffffffff818116838216019080821115611e3f57611e3f6122d4565b634e487b7160e01b600052603260045260246000fd5b80820180821115611232576112326122d4565b81810381811115611232576112326122d4565b60006020808352835180602085015260005b8181101561237257858101830151858201604001528201612356565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160601b03818116838216019080821115611e3f57611e3f6122d4565b634e487b7160e01b600052603160045260246000fdfea264697066735822122071cee4f54e616d6c9f4a6a2f336be0952f342f241dfa2d74dae586aa713f4c3464736f6c63430008180033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000a779fc675db318dab004ab8d538cb320d0013f42000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000073430344d6979610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054552524f520000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _owner (address): 0xA779fC675Db318dab004Ab8D538CB320D0013F42
Arg [1] : _name (string): 404Miya
Arg [2] : _symbol (string): ERROR
Arg [3] : _baseUri (string):

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 000000000000000000000000a779fc675db318dab004ab8d538cb320d0013f42
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [5] : 3430344d69796100000000000000000000000000000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [7] : 4552524f52000000000000000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.