ETH Price: $3,460.50 (+1.82%)

Contract

0x2fB65031a2269dE88Ca6109Cfce61b3Cc58B7012
 

Overview

ETH Balance

0.6216 ETH

Eth Value

$2,151.05 (@ $3,460.50/ETH)

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Approval For...208502502024-09-28 16:12:2387 days ago1727539943IN
0x2fB65031...Cc58B7012
0 ETH0.00033137.20250637
Set Approval For...207443932024-09-13 21:31:35101 days ago1726263095IN
0x2fB65031...Cc58B7012
0 ETH0.0004943410.74679685
Set Approval For...207436562024-09-13 19:03:23102 days ago1726254203IN
0x2fB65031...Cc58B7012
0 ETH0.0001312.84799303
Safe Transfer Fr...207431562024-09-13 17:22:59102 days ago1726248179IN
0x2fB65031...Cc58B7012
0 ETH0.000327975.31627776
Safe Transfer Fr...207431472024-09-13 17:21:11102 days ago1726248071IN
0x2fB65031...Cc58B7012
0 ETH0.000296284.80259706
Safe Transfer Fr...207431412024-09-13 17:19:59102 days ago1726247999IN
0x2fB65031...Cc58B7012
0 ETH0.00031135.04608328
Safe Transfer Fr...207431242024-09-13 17:16:35102 days ago1726247795IN
0x2fB65031...Cc58B7012
0 ETH0.000263754.27542287
Safe Transfer Fr...207431212024-09-13 17:15:59102 days ago1726247759IN
0x2fB65031...Cc58B7012
0 ETH0.000276854.48775088
Safe Transfer Fr...207431192024-09-13 17:15:35102 days ago1726247735IN
0x2fB65031...Cc58B7012
0 ETH0.000272694.42026974
Safe Transfer Fr...207430892024-09-13 17:09:23102 days ago1726247363IN
0x2fB65031...Cc58B7012
0 ETH0.000279254.52743522
Safe Transfer Fr...207430422024-09-13 16:59:59102 days ago1726246799IN
0x2fB65031...Cc58B7012
0 ETH0.000301314.88421657
Safe Transfer Fr...207430372024-09-13 16:58:59102 days ago1726246739IN
0x2fB65031...Cc58B7012
0 ETH0.000331395.37181315
Safe Transfer Fr...207430332024-09-13 16:58:11102 days ago1726246691IN
0x2fB65031...Cc58B7012
0 ETH0.000353415.72871005
Safe Transfer Fr...207430292024-09-13 16:57:23102 days ago1726246643IN
0x2fB65031...Cc58B7012
0 ETH0.00034685.62147819
Safe Transfer Fr...207430222024-09-13 16:55:59102 days ago1726246559IN
0x2fB65031...Cc58B7012
0 ETH0.000353685.73301867
Safe Transfer Fr...207430182024-09-13 16:55:11102 days ago1726246511IN
0x2fB65031...Cc58B7012
0 ETH0.000391956.35337851
Safe Transfer Fr...207430112024-09-13 16:53:47102 days ago1726246427IN
0x2fB65031...Cc58B7012
0 ETH0.000439377.12208401
Safe Transfer Fr...207418992024-09-13 13:09:11102 days ago1726232951IN
0x2fB65031...Cc58B7012
0 ETH0.000181212.93739867
Safe Transfer Fr...207418952024-09-13 13:08:23102 days ago1726232903IN
0x2fB65031...Cc58B7012
0 ETH0.000187693.04243152
Safe Transfer Fr...207418912024-09-13 13:07:35102 days ago1726232855IN
0x2fB65031...Cc58B7012
0 ETH0.000187993.04724061
Safe Transfer Fr...207418872024-09-13 13:06:47102 days ago1726232807IN
0x2fB65031...Cc58B7012
0 ETH0.000177982.88509208
Safe Transfer Fr...207418832024-09-13 13:05:59102 days ago1726232759IN
0x2fB65031...Cc58B7012
0 ETH0.000190743.09189829
Safe Transfer Fr...207418802024-09-13 13:05:23102 days ago1726232723IN
0x2fB65031...Cc58B7012
0 ETH0.000187323.03646396
Safe Transfer Fr...207418752024-09-13 13:04:23102 days ago1726232663IN
0x2fB65031...Cc58B7012
0 ETH0.000204513.31516079
Set Approval For...207233372024-09-10 22:57:23104 days ago1726009043IN
0x2fB65031...Cc58B7012
0 ETH0.000224274.87574297
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BauhausSignet

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 200 runs

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

import {ERC721} from "solady/tokens/ERC721.sol";
import {ERC2981} from "solady/tokens/ERC2981.sol";
import {Ownable} from "solady/auth/Ownable.sol";
import {MerkleProofLib} from "solady/utils/MerkleProofLib.sol";
import {LibString} from "solady/utils/LibString.sol";
import {SafeTransferLib} from "solady/utils/SafeTransferLib.sol";

import {BauhausMetadata} from "./BauhausMetadata.sol";
import {CommitRevealRand} from "./CommitRevealRand.sol";

/**
 * @title BauhausSignet
 * @author akuti.eth
 * @notice The "Bauhaus Signet” NFT, originally created in 1923 by Oskar Schlemmer, is an
 * authorized collaboration with The Oskar Schlemmer Theatre Archives that brings a seminal
 * work of 20th-century design into the blockchain era. The iconic Bauhaus signet will persist
 * on Ethereum forever, as fully onchain SVG generative renditions.
 */
contract BauhausSignet is ERC721, Ownable, CommitRevealRand, BauhausMetadata, ERC2981 {
    using MerkleProofLib for bytes32[];
    using LibString for uint256;

    enum SaleType {
        FREE,
        HALFPRICE,
        PUBLIC
    }

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                                constants                                 │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    uint256 private constant _START_TOKEN_ID = 1;
    uint256 private constant _MAX_SUPPLY = 1888;
    uint256 private constant _MAX_MINT_FREE = 1;
    uint256 private constant _MAX_MINT_HALF = 3;
    uint256 private constant _MAX_MINT_PUBLIC = 10;
    uint256 private constant _MINT_PRICE = 0.0888 ether;
    uint96 private constant _ROYALTY_BPS = 800;

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                                 storage                                  │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    bytes32 private _merkleRootFreeMint;
    bytes32 private _merkleRootHalfMint;
    uint256 private _currentIndex = _START_TOKEN_ID;

    bool public publicSaleActive;

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                                  errors                                  │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    error InvalidProof();
    error InvalidValue();
    error MintLimitReached();
    error MintEnded();
    error SaleNotActive();

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                               constructor                                │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */
    constructor() CommitRevealRand(32) ERC2981() {
        _initializeOwner(msg.sender);
        _setDefaultRoyalty(msg.sender, _ROYALTY_BPS);
    }

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                          public view functions                           │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    /**
     * @notice Returns the total number of tokens in existence.
     */
    function totalSupply() public view returns (uint256) {
        return _currentIndex - _START_TOKEN_ID;
    }

    /**
     * @dev Returns true if this contract implements the interface defined by `interfaceId`.
     * See: https://eips.ethereum.org/EIPS/eip-165
     */
    function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC2981) returns (bool result) {
        return super.supportsInterface(interfaceId);
    }

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                            external functions                            │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    /**
     * @notice Allows whitelisted addresses to mint one token for free.
     *
     * @param _merkleProof The proof for the msg sender.
     */
    function mintFree(bytes32[] calldata _merkleProof) external {
        if (_getMintedCount(msg.sender, SaleType.FREE) + 1 > _MAX_MINT_FREE) revert MintLimitReached();
        if (_currentIndex + 1 - _START_TOKEN_ID > _MAX_SUPPLY) revert MintEnded();

        bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
        if (!_merkleProof.verifyCalldata(_merkleRootFreeMint, leaf)) revert InvalidProof();

        processCommitReveal();

        _setMintCount(msg.sender, 1, SaleType.FREE);
        _mintAndSetExtraDataUnchecked(msg.sender, _currentIndex++, uint96(getCurrentEpochIndex()));
    }

    /**
     * @notice Allows whitelisted addresses to mint up to three tokens for half the price.
     *
     * @param amount The amount of tokens to mint, limited to three per address.
     * @param _merkleProof The proof for the msg sender.
     */
    function mintHalfPrice(uint256 amount, bytes32[] calldata _merkleProof) external payable {
        uint256 mintCount = _getMintedCount(msg.sender, SaleType.HALFPRICE);
        uint256 currentIndex = _currentIndex;

        if (mintCount + amount > _MAX_MINT_HALF) revert MintLimitReached();
        if (currentIndex + amount - _START_TOKEN_ID > _MAX_SUPPLY) revert MintEnded();
        if (msg.value != _MINT_PRICE * amount / 2) revert InvalidValue();

        bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
        if (!_merkleProof.verifyCalldata(_merkleRootHalfMint, leaf)) revert InvalidProof();

        processCommitReveal();

        _setMintCount(msg.sender, uint224(mintCount + amount), SaleType.HALFPRICE);
        _currentIndex += amount;
        for (uint256 index = 0; index < amount;) {
            _mintAndSetExtraDataUnchecked(msg.sender, currentIndex + index, uint96(getCurrentEpochIndex()));
            unchecked {
                index++;
            }
        }
    }

    /**
     * @notice Allows whitelisted addresses to mint up to ten tokens.
     *
     * @param amount The amount of tokens to mint, limited to ten per address.
     */
    function mintPublic(uint256 amount) external payable {
        uint256 mintCount = _getMintedCount(msg.sender, SaleType.PUBLIC);
        uint256 currentIndex = _currentIndex;

        if (!publicSaleActive) revert SaleNotActive();
        if (mintCount + amount > _MAX_MINT_PUBLIC) revert MintLimitReached();
        if (currentIndex + amount - _START_TOKEN_ID > _MAX_SUPPLY) revert MintEnded();
        if (msg.value != _MINT_PRICE * amount) revert InvalidValue();

        processCommitReveal();

        _setMintCount(msg.sender, uint224(mintCount + amount), SaleType.PUBLIC);
        _currentIndex += amount;
        for (uint256 index = 0; index < amount;) {
            _mintAndSetExtraDataUnchecked(msg.sender, currentIndex + index, uint96(getCurrentEpochIndex()));
            unchecked {
                index++;
            }
        }
    }

    /**
     * @notice Allows the contract owner to mint for free.
     *
     * @param amount The amount of tokens to mint.
     * @param target The receiver of the minted tokens.
     */
    function mintAdmin(uint256 amount, address target) external onlyOwner {
        uint256 currentIndex = _currentIndex;

        if (currentIndex + amount - _START_TOKEN_ID > _MAX_SUPPLY) revert MintEnded();
        processCommitReveal();

        _currentIndex += amount;
        for (uint256 index = 0; index < amount;) {
            _mintAndSetExtraDataUnchecked(target, currentIndex + index, uint96(getCurrentEpochIndex()));
            unchecked {
                index++;
            }
        }
    }

    /**
     * @notice Set the merkle root for the free mint whitelist. Only callable by the contract owner.
     *
     * @param _root The merkle tree root hash.
     */
    function setFreeMerkleRoot(bytes32 _root) external onlyOwner {
        _merkleRootFreeMint = _root;
    }

    /**
     * @notice Set the merkle root for the half price mint whitelist. Only callable by the contract owner.
     *
     * @param _root The merkle tree root hash.
     */
    function setHalfPriceMerkleRoot(bytes32 _root) external onlyOwner {
        _merkleRootHalfMint = _root;
    }

    /**
     * @notice Set the state of the public sale. Only callable by the contract owner.
     *
     * @param active Whether the public sale should be active.
     */
    function setPublicSale(bool active) external onlyOwner {
        publicSaleActive = active;
    }

    /**
     * @notice Withdraw the contract funds to the owner address. Only callable by the contract owner.
     */
    function withdraw() external onlyOwner {
        SafeTransferLib.safeTransferAllETH(owner());
    }

    /**
     * @notice Withdraw the contract funds to the owner address. Only callable by the contract owner.
     */
    function setRoyaltyReceiver(address receiver) external onlyOwner {
        _setDefaultRoyalty(receiver, _ROYALTY_BPS);
    }

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                         external view functions                          │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    /**
     * @notice Returns amount of tokens minted using mintFree.
     */
    function getMintCountFree(address user) external view returns (uint256) {
        return _getMintedCount(user, SaleType.FREE);
    }

    /**
     * @notice Returns amount of tokens minted using mintHalfPrice.
     */
    function getMintCountHalfPrice(address user) external view returns (uint256) {
        return _getMintedCount(user, SaleType.HALFPRICE);
    }

    /**
     * @notice Returns amount of tokens minted using mintPublic.
     */
    function getMintCountPublic(address user) external view returns (uint256) {
        return _getMintedCount(user, SaleType.PUBLIC);
    }

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                         internal view functions                          │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    /**
     * @dev Returns how many tokens a user minted in the given `SaleType`.
     *
     * @param user The address of a user.
     * @param saleType The type of sale (free, half price, paid).
     */
    function _getMintedCount(address user, SaleType saleType) internal view returns (uint256) {
        // Amount minted per sale type is stored in the aux owner data in uint224
        // [0] free mint 0-1
        // [1..2] half price mint 0-3
        // [3..6] public mint 0-15
        uint224 auxData = _getAux(user);
        if (saleType == SaleType.FREE) return uint256(auxData & 0x1);
        else if (saleType == SaleType.HALFPRICE) return uint256((auxData >> 1) & 0x3);
        else if (saleType == SaleType.PUBLIC) return uint256((auxData >> 3) & 0xF);
        return 0;
    }

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                            private functions                             │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    /**
     * @dev Sets how many tokens a user minted in the given `SaleType`.
     *
     * @param user The address of a user.
     * @param count The amount of tokens minted in total by the user for the this `SaleType`.
     * @param saleType The type of sale (free, half price, paid).
     */
    function _setMintCount(address user, uint224 count, SaleType saleType) private {
        uint224 auxData = _getAux(user);
        if (saleType == SaleType.FREE) auxData = (auxData & ~uint224(0x1)) | count;
        else if (saleType == SaleType.HALFPRICE) auxData = (auxData & ~uint224(0x6)) | (count << 1);
        else if (saleType == SaleType.PUBLIC) auxData = (auxData & ~uint224(0x78)) | (count << 3);
        _setAux(user, auxData);
    }
}

File 2 of 10 : 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 {Approval} 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 3 of 10 : ERC2981.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Simple ERC2981 NFT Royalty Standard implementation.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC2981.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol)
abstract contract ERC2981 {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The royalty fee numerator exceeds the fee denominator.
    error RoyaltyOverflow();

    /// @dev The royalty receiver cannot be the zero address.
    error RoyaltyReceiverIsZeroAddress();

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

    /// @dev The default royalty info is given by:
    /// ```
    ///     let packed := sload(_ERC2981_MASTER_SLOT_SEED)
    ///     let receiver := shr(96, packed)
    ///     let royaltyFraction := xor(packed, shl(96, receiver))
    /// ```
    ///
    /// The per token royalty info is given by.
    /// ```
    ///     mstore(0x00, tokenId)
    ///     mstore(0x20, _ERC2981_MASTER_SLOT_SEED)
    ///     let packed := sload(keccak256(0x00, 0x40))
    ///     let receiver := shr(96, packed)
    ///     let royaltyFraction := xor(packed, shl(96, receiver))
    /// ```
    uint256 private constant _ERC2981_MASTER_SLOT_SEED = 0xaa4ec00224afccfdb7;

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

    /// @dev Checks that `_feeDenominator` is non-zero.
    constructor() {
        require(_feeDenominator() != 0, "Fee denominator cannot be zero.");
    }

    /// @dev Returns the denominator for the royalty amount.
    /// Defaults to 10000, which represents fees in basis points.
    /// Override this function to return a custom amount if needed.
    function _feeDenominator() internal pure virtual returns (uint96) {
        return 10000;
    }

    /// @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, ERC2981: 0x2a55205a.
            result := or(eq(s, 0x01ffc9a7), eq(s, 0x2a55205a))
        }
    }

    /// @dev Returns the `receiver` and `royaltyAmount` for `tokenId` sold at `salePrice`.
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        public
        view
        virtual
        returns (address receiver, uint256 royaltyAmount)
    {
        uint256 feeDenominator = _feeDenominator();
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, tokenId)
            mstore(0x20, _ERC2981_MASTER_SLOT_SEED)
            let packed := sload(keccak256(0x00, 0x40))
            receiver := shr(96, packed)
            if iszero(receiver) {
                packed := sload(mload(0x20))
                receiver := shr(96, packed)
            }
            let x := salePrice
            let y := xor(packed, shl(96, receiver)) // `feeNumerator`.
            // Overflow check, equivalent to `require(y == 0 || x <= type(uint256).max / y)`.
            // Out-of-gas revert. Should not be triggered in practice, but included for safety.
            returndatacopy(returndatasize(), returndatasize(), mul(y, gt(x, div(not(0), y))))
            royaltyAmount := div(mul(x, y), feeDenominator)
        }
    }

    /// @dev Sets the default royalty `receiver` and `feeNumerator`.
    ///
    /// Requirements:
    /// - `receiver` must not be the zero address.
    /// - `feeNumerator` must not be greater than the fee denominator.
    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
        uint256 feeDenominator = _feeDenominator();
        /// @solidity memory-safe-assembly
        assembly {
            feeNumerator := shr(160, shl(160, feeNumerator))
            if gt(feeNumerator, feeDenominator) {
                mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.
                revert(0x1c, 0x04)
            }
            let packed := shl(96, receiver)
            if iszero(packed) {
                mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.
                revert(0x1c, 0x04)
            }
            sstore(_ERC2981_MASTER_SLOT_SEED, or(packed, feeNumerator))
        }
    }

    /// @dev Sets the default royalty `receiver` and `feeNumerator` to zero.
    function _deleteDefaultRoyalty() internal virtual {
        /// @solidity memory-safe-assembly
        assembly {
            sstore(_ERC2981_MASTER_SLOT_SEED, 0)
        }
    }

    /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId`.
    ///
    /// Requirements:
    /// - `receiver` must not be the zero address.
    /// - `feeNumerator` must not be greater than the fee denominator.
    function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator)
        internal
        virtual
    {
        uint256 feeDenominator = _feeDenominator();
        /// @solidity memory-safe-assembly
        assembly {
            feeNumerator := shr(160, shl(160, feeNumerator))
            if gt(feeNumerator, feeDenominator) {
                mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.
                revert(0x1c, 0x04)
            }
            let packed := shl(96, receiver)
            if iszero(packed) {
                mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.
                revert(0x1c, 0x04)
            }
            mstore(0x00, tokenId)
            mstore(0x20, _ERC2981_MASTER_SLOT_SEED)
            sstore(keccak256(0x00, 0x40), or(packed, feeNumerator))
        }
    }

    /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId` to zero.
    function _resetTokenRoyalty(uint256 tokenId) internal virtual {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, tokenId)
            mstore(0x20, _ERC2981_MASTER_SLOT_SEED)
            sstore(keccak256(0x00, 0x40), 0)
        }
    }
}

File 4 of 10 : 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 5 of 10 : MerkleProofLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Gas optimized verification of proof of inclusion for a leaf in a Merkle tree.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/MerkleProofLib.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol)
library MerkleProofLib {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*            MERKLE PROOF VERIFICATION OPERATIONS            */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns whether `leaf` exists in the Merkle tree with `root`, given `proof`.
    function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf)
        internal
        pure
        returns (bool isValid)
    {
        /// @solidity memory-safe-assembly
        assembly {
            if mload(proof) {
                // Initialize `offset` to the offset of `proof` elements in memory.
                let offset := add(proof, 0x20)
                // Left shift by 5 is equivalent to multiplying by 0x20.
                let end := add(offset, shl(5, mload(proof)))
                // Iterate over proof elements to compute root hash.
                for {} 1 {} {
                    // Slot of `leaf` in scratch space.
                    // If the condition is true: 0x20, otherwise: 0x00.
                    let scratch := shl(5, gt(leaf, mload(offset)))
                    // Store elements to hash contiguously in scratch space.
                    // Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes.
                    mstore(scratch, leaf)
                    mstore(xor(scratch, 0x20), mload(offset))
                    // Reuse `leaf` to store the hash to reduce stack operations.
                    leaf := keccak256(0x00, 0x40)
                    offset := add(offset, 0x20)
                    if iszero(lt(offset, end)) { break }
                }
            }
            isValid := eq(leaf, root)
        }
    }

    /// @dev Returns whether `leaf` exists in the Merkle tree with `root`, given `proof`.
    function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf)
        internal
        pure
        returns (bool isValid)
    {
        /// @solidity memory-safe-assembly
        assembly {
            if proof.length {
                // Left shift by 5 is equivalent to multiplying by 0x20.
                let end := add(proof.offset, shl(5, proof.length))
                // Initialize `offset` to the offset of `proof` in the calldata.
                let offset := proof.offset
                // Iterate over proof elements to compute root hash.
                for {} 1 {} {
                    // Slot of `leaf` in scratch space.
                    // If the condition is true: 0x20, otherwise: 0x00.
                    let scratch := shl(5, gt(leaf, calldataload(offset)))
                    // Store elements to hash contiguously in scratch space.
                    // Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes.
                    mstore(scratch, leaf)
                    mstore(xor(scratch, 0x20), calldataload(offset))
                    // Reuse `leaf` to store the hash to reduce stack operations.
                    leaf := keccak256(0x00, 0x40)
                    offset := add(offset, 0x20)
                    if iszero(lt(offset, end)) { break }
                }
            }
            isValid := eq(leaf, root)
        }
    }

    /// @dev Returns whether all `leaves` exist in the Merkle tree with `root`,
    /// given `proof` and `flags`.
    ///
    /// Note:
    /// - Breaking the invariant `flags.length == (leaves.length - 1) + proof.length`
    ///   will always return false.
    /// - The sum of the lengths of `proof` and `leaves` must never overflow.
    /// - Any non-zero word in the `flags` array is treated as true.
    /// - The memory offset of `proof` must be non-zero
    ///   (i.e. `proof` is not pointing to the scratch space).
    function verifyMultiProof(
        bytes32[] memory proof,
        bytes32 root,
        bytes32[] memory leaves,
        bool[] memory flags
    ) internal pure returns (bool isValid) {
        // Rebuilds the root by consuming and producing values on a queue.
        // The queue starts with the `leaves` array, and goes into a `hashes` array.
        // After the process, the last element on the queue is verified
        // to be equal to the `root`.
        //
        // The `flags` array denotes whether the sibling
        // should be popped from the queue (`flag == true`), or
        // should be popped from the `proof` (`flag == false`).
        /// @solidity memory-safe-assembly
        assembly {
            // Cache the lengths of the arrays.
            let leavesLength := mload(leaves)
            let proofLength := mload(proof)
            let flagsLength := mload(flags)

            // Advance the pointers of the arrays to point to the data.
            leaves := add(0x20, leaves)
            proof := add(0x20, proof)
            flags := add(0x20, flags)

            // If the number of flags is correct.
            for {} eq(add(leavesLength, proofLength), add(flagsLength, 1)) {} {
                // For the case where `proof.length + leaves.length == 1`.
                if iszero(flagsLength) {
                    // `isValid = (proof.length == 1 ? proof[0] : leaves[0]) == root`.
                    isValid := eq(mload(xor(leaves, mul(xor(proof, leaves), proofLength))), root)
                    break
                }

                // The required final proof offset if `flagsLength` is not zero, otherwise zero.
                let proofEnd := add(proof, shl(5, proofLength))
                // We can use the free memory space for the queue.
                // We don't need to allocate, since the queue is temporary.
                let hashesFront := mload(0x40)
                // Copy the leaves into the hashes.
                // Sometimes, a little memory expansion costs less than branching.
                // Should cost less, even with a high free memory offset of 0x7d00.
                leavesLength := shl(5, leavesLength)
                for { let i := 0 } iszero(eq(i, leavesLength)) { i := add(i, 0x20) } {
                    mstore(add(hashesFront, i), mload(add(leaves, i)))
                }
                // Compute the back of the hashes.
                let hashesBack := add(hashesFront, leavesLength)
                // This is the end of the memory for the queue.
                // We recycle `flagsLength` to save on stack variables (sometimes save gas).
                flagsLength := add(hashesBack, shl(5, flagsLength))

                for {} 1 {} {
                    // Pop from `hashes`.
                    let a := mload(hashesFront)
                    // Pop from `hashes`.
                    let b := mload(add(hashesFront, 0x20))
                    hashesFront := add(hashesFront, 0x40)

                    // If the flag is false, load the next proof,
                    // else, pops from the queue.
                    if iszero(mload(flags)) {
                        // Loads the next proof.
                        b := mload(proof)
                        proof := add(proof, 0x20)
                        // Unpop from `hashes`.
                        hashesFront := sub(hashesFront, 0x20)
                    }

                    // Advance to the next flag.
                    flags := add(flags, 0x20)

                    // Slot of `a` in scratch space.
                    // If the condition is true: 0x20, otherwise: 0x00.
                    let scratch := shl(5, gt(a, b))
                    // Hash the scratch space and push the result onto the queue.
                    mstore(scratch, a)
                    mstore(xor(scratch, 0x20), b)
                    mstore(hashesBack, keccak256(0x00, 0x40))
                    hashesBack := add(hashesBack, 0x20)
                    if iszero(lt(hashesBack, flagsLength)) { break }
                }
                isValid :=
                    and(
                        // Checks if the last value in the queue is same as the root.
                        eq(mload(sub(hashesBack, 0x20)), root),
                        // And whether all the proofs are used, if required.
                        eq(proofEnd, proof)
                    )
                break
            }
        }
    }

    /// @dev Returns whether all `leaves` exist in the Merkle tree with `root`,
    /// given `proof` and `flags`.
    ///
    /// Note:
    /// - Breaking the invariant `flags.length == (leaves.length - 1) + proof.length`
    ///   will always return false.
    /// - Any non-zero word in the `flags` array is treated as true.
    /// - The calldata offset of `proof` must be non-zero
    ///   (i.e. `proof` is from a regular Solidity function with a 4-byte selector).
    function verifyMultiProofCalldata(
        bytes32[] calldata proof,
        bytes32 root,
        bytes32[] calldata leaves,
        bool[] calldata flags
    ) internal pure returns (bool isValid) {
        // Rebuilds the root by consuming and producing values on a queue.
        // The queue starts with the `leaves` array, and goes into a `hashes` array.
        // After the process, the last element on the queue is verified
        // to be equal to the `root`.
        //
        // The `flags` array denotes whether the sibling
        // should be popped from the queue (`flag == true`), or
        // should be popped from the `proof` (`flag == false`).
        /// @solidity memory-safe-assembly
        assembly {
            // If the number of flags is correct.
            for {} eq(add(leaves.length, proof.length), add(flags.length, 1)) {} {
                // For the case where `proof.length + leaves.length == 1`.
                if iszero(flags.length) {
                    // `isValid = (proof.length == 1 ? proof[0] : leaves[0]) == root`.
                    // forgefmt: disable-next-item
                    isValid := eq(
                        calldataload(
                            xor(leaves.offset, mul(xor(proof.offset, leaves.offset), proof.length))
                        ),
                        root
                    )
                    break
                }

                // The required final proof offset if `flagsLength` is not zero, otherwise zero.
                let proofEnd := add(proof.offset, shl(5, proof.length))
                // We can use the free memory space for the queue.
                // We don't need to allocate, since the queue is temporary.
                let hashesFront := mload(0x40)
                // Copy the leaves into the hashes.
                // Sometimes, a little memory expansion costs less than branching.
                // Should cost less, even with a high free memory offset of 0x7d00.
                calldatacopy(hashesFront, leaves.offset, shl(5, leaves.length))
                // Compute the back of the hashes.
                let hashesBack := add(hashesFront, shl(5, leaves.length))
                // This is the end of the memory for the queue.
                // We recycle `flagsLength` to save on stack variables (sometimes save gas).
                flags.length := add(hashesBack, shl(5, flags.length))

                // We don't need to make a copy of `proof.offset` or `flags.offset`,
                // as they are pass-by-value (this trick may not always save gas).

                for {} 1 {} {
                    // Pop from `hashes`.
                    let a := mload(hashesFront)
                    // Pop from `hashes`.
                    let b := mload(add(hashesFront, 0x20))
                    hashesFront := add(hashesFront, 0x40)

                    // If the flag is false, load the next proof,
                    // else, pops from the queue.
                    if iszero(calldataload(flags.offset)) {
                        // Loads the next proof.
                        b := calldataload(proof.offset)
                        proof.offset := add(proof.offset, 0x20)
                        // Unpop from `hashes`.
                        hashesFront := sub(hashesFront, 0x20)
                    }

                    // Advance to the next flag offset.
                    flags.offset := add(flags.offset, 0x20)

                    // Slot of `a` in scratch space.
                    // If the condition is true: 0x20, otherwise: 0x00.
                    let scratch := shl(5, gt(a, b))
                    // Hash the scratch space and push the result onto the queue.
                    mstore(scratch, a)
                    mstore(xor(scratch, 0x20), b)
                    mstore(hashesBack, keccak256(0x00, 0x40))
                    hashesBack := add(hashesBack, 0x20)
                    if iszero(lt(hashesBack, flags.length)) { break }
                }
                isValid :=
                    and(
                        // Checks if the last value in the queue is same as the root.
                        eq(mload(sub(hashesBack, 0x20)), root),
                        // And whether all the proofs are used, if required.
                        eq(proofEnd, proof.offset)
                    )
                break
            }
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   EMPTY CALLDATA HELPERS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns an empty calldata bytes32 array.
    function emptyProof() internal pure returns (bytes32[] calldata proof) {
        /// @solidity memory-safe-assembly
        assembly {
            proof.length := 0
        }
    }

    /// @dev Returns an empty calldata bytes32 array.
    function emptyLeaves() internal pure returns (bytes32[] calldata leaves) {
        /// @solidity memory-safe-assembly
        assembly {
            leaves.length := 0
        }
    }

    /// @dev Returns an empty calldata bool array.
    function emptyFlags() internal pure returns (bool[] calldata flags) {
        /// @solidity memory-safe-assembly
        assembly {
            flags.length := 0
        }
    }
}

File 6 of 10 : 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)
///
/// @dev 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();

    /// @dev The input string must be a 7-bit ASCII.
    error StringNot7BitASCII();

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

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

    /// @dev Lookup for '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.
    uint128 internal constant ALPHANUMERIC_7_BIT_ASCII = 0x7fffffe07fffffe03ff000000000000;

    /// @dev Lookup for 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.
    uint128 internal constant LETTERS_7_BIT_ASCII = 0x7fffffe07fffffe0000000000000000;

    /// @dev Lookup for 'abcdefghijklmnopqrstuvwxyz'.
    uint128 internal constant LOWERCASE_7_BIT_ASCII = 0x7fffffe000000000000000000000000;

    /// @dev Lookup for 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
    uint128 internal constant UPPERCASE_7_BIT_ASCII = 0x7fffffe0000000000000000;

    /// @dev Lookup for '0123456789'.
    uint128 internal constant DIGITS_7_BIT_ASCII = 0x3ff000000000000;

    /// @dev Lookup for '0123456789abcdefABCDEF'.
    uint128 internal constant HEXDIGITS_7_BIT_ASCII = 0x7e0000007e03ff000000000000;

    /// @dev Lookup for '01234567'.
    uint128 internal constant OCTDIGITS_7_BIT_ASCII = 0xff000000000000;

    /// @dev Lookup for '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'.
    uint128 internal constant PRINTABLE_7_BIT_ASCII = 0x7fffffffffffffffffffffff00003e00;

    /// @dev Lookup for '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'.
    uint128 internal constant PUNCTUATION_7_BIT_ASCII = 0x78000001f8000001fc00fffe00000000;

    /// @dev Lookup for ' \t\n\r\x0b\x0c'.
    uint128 internal constant WHITESPACE_7_BIT_ASCII = 0x100003e00;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                     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)
            mstore(0x40, add(str, 0x20)) // Allocate the memory.
            mstore(str, 0) // Zeroize the slot after the string.

            let end := str // Cache the end of the memory to calculate the length later.
            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)`.
                // Store the character to the pointer.
                // The ASCII index of the '0' character is 48.
                mstore8(str, add(48, mod(temp, 10)))
                temp := div(temp, 10) // Keep dividing `temp` until zero.
                if iszero(temp) { break }
            }
            let length := sub(end, str)
            str := sub(str, 0x20) // Move the pointer 32 bytes back to make room for the length.
            mstore(str, length) // Store the 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) // Store the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Store 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)))
            mstore(0x40, add(str, 0x20)) // Allocate the memory.
            mstore(str, 0) // Zeroize the slot after the string.

            let end := str // Cache the end to calculate the length later.
            // 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)
            }
            let strLength := sub(end, str)
            str := sub(str, 0x20)
            mstore(str, strLength) // Store the length.
        }
    }

    /// @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) // Store the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Store 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) // Store 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)) // Store 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)) // Store 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)
            mstore(0x40, add(str, 0x20)) // Allocate the memory.
            mstore(str, 0) // Zeroize the slot after the string.

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

            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 }
            }
            let strLength := sub(end, str)
            str := sub(str, 0x20)
            mstore(str, strLength) // Store the length.
        }
    }

    /// @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) // Store the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Store 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))
            mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup.

            str := add(str, 2)
            mstore(str, 40) // Store the length.
            let o := add(str, 0x20)
            mstore(add(o, 40), 0) // Zeroize the slot after the string.
            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) // Store the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Store 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.

            mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup.
            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)
            }
        }
    }

    /// @dev Returns if this string is a 7-bit ASCII string,
    /// AND all characters are in the `allowed` lookup.
    /// Note: If `s` is empty, returns true regardless of `allowed`.
    function is7BitASCII(string memory s, uint128 allowed) internal pure returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := 1
            if mload(s) {
                let allowed_ := shr(128, shl(128, allowed))
                let o := add(s, 0x20)
                let end := add(o, mload(s))
                for {} 1 {} {
                    result := and(result, shr(byte(0, mload(o)), allowed_))
                    o := add(o, 1)
                    if iszero(and(result, lt(o, end))) { break }
                }
            }
        }
    }

    /// @dev Converts the bytes in the 7-bit ASCII string `s` to
    /// an allowed lookup for use in `is7BitASCII(s, allowed)`.
    /// To save runtime gas, you can cache the result in an immutable variable.
    function to7BitASCIIAllowedLookup(string memory s) internal pure returns (uint128 result) {
        /// @solidity memory-safe-assembly
        assembly {
            if mload(s) {
                let o := add(s, 0x20)
                let end := add(o, mload(s))
                for {} 1 {} {
                    result := or(result, shl(byte(0, mload(o)), 1))
                    o := add(o, 1)
                    if iszero(lt(o, end)) { break }
                }
                if shr(128, result) {
                    mstore(0x00, 0xc9807e0d) // `StringNot7BitASCII()`.
                    revert(0x1c, 0x04)
                }
            }
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   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.
                mstore(0x40, add(result, add(resultLength, 0x40))) // Allocate the memory.
            }
        }
    }

    /// @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)
                mstore(0x40, add(result, add(resultLength, 0x40))) // Allocate the memory.
            }
        }
    }

    /// @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)
            mstore(last, 0) // Zeroize the slot after the string.
            mstore(result, totalLength) // Store the length.
            mstore(0x40, add(last, 0x20)) // Allocate the memory.
        }
    }

    /// @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) // Store the length.
            let o := add(result, 0x20)
            mstore(o, s) // Store the bytes of the string.
            mstore(add(o, n), 0) // Zeroize the slot after the string.
            mstore(0x40, add(result, 0x40)) // Allocate the memory.
        }
    }

    /// @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 {
            result := mload(0x40) // Grab the free memory pointer.
            mstore(0x40, add(result, 0x40)) // Allocate 2 words (1 for the length, 1 for the bytes).
            mstore(result, 0) // Zeroize the length slot.
            mstore(add(result, 0x1f), packed) // Store the length and bytes.
            mstore(add(add(result, 0x20), mload(result)), 0) // Right pad with zeroes.
        }
    }

    /// @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(
                    or( // Load the length and the bytes of `a` and `b`.
                        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 {
            resultA := mload(0x40) // Grab the free memory pointer.
            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 retUnpaddedSize := 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, retUnpaddedSize), 0)
            mstore(retStart, 0x20) // Store the return offset.
            // End the transaction, returning the string.
            return(retStart, and(not(0x1f), add(0x1f, retUnpaddedSize)))
        }
    }
}

File 7 of 10 : 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)
/// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.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();

    /// @dev The Permit2 operation has failed.
    error Permit2Failed();

    /// @dev The Permit2 amount must be less than `2**160 - 1`.
    error Permit2AmountOverflow();

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         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;

    /// @dev The unique EIP-712 domain domain separator for the DAI token contract.
    bytes32 internal constant DAI_DOMAIN_SEPARATOR =
        0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7;

    /// @dev The address for the WETH9 contract on Ethereum mainnet.
    address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;

    /// @dev The canonical Permit2 address.
    /// [Github](https://github.com/Uniswap/permit2)
    /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3)
    address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       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 `amount` of ERC20 `token` from `from` to `to`.
    ///
    /// The `from` account must have at least `amount` approved for the current contract to manage.
    function trySafeTransferFrom(address token, address from, address to, uint256 amount)
        internal
        returns (bool success)
    {
        /// @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)`.
            success :=
                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(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( // The arguments of `mul` are evaluated from right to left.
                    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)
                    )
                )
        }
    }

    /// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
    /// If the initial attempt fails, try to use Permit2 to transfer the token.
    /// Reverts upon failure.
    ///
    /// The `from` account must have at least `amount` approved for the current contract to manage.
    function safeTransferFrom2(address token, address from, address to, uint256 amount) internal {
        if (!trySafeTransferFrom(token, from, to, amount)) {
            permit2TransferFrom(token, from, to, amount);
        }
    }

    /// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2.
    /// Reverts upon failure.
    function permit2TransferFrom(address token, address from, address to, uint256 amount)
        internal
    {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40)
            mstore(add(m, 0x74), shr(96, shl(96, token)))
            mstore(add(m, 0x54), amount)
            mstore(add(m, 0x34), to)
            mstore(add(m, 0x20), shl(96, from))
            // `transferFrom(address,address,uint160,address)`.
            mstore(m, 0x36c78516000000000000000000000000)
            let p := PERMIT2
            let exists := eq(chainid(), 1)
            if iszero(exists) { exists := iszero(iszero(extcodesize(p))) }
            if iszero(and(call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00), exists)) {
                mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`.
                revert(add(0x18, shl(2, iszero(iszero(shr(160, amount))))), 0x04)
            }
        }
    }

    /// @dev Permit a user to spend a given amount of
    /// another user's tokens via native EIP-2612 permit if possible, falling
    /// back to Permit2 if native permit fails or is not implemented on the token.
    function permit2(
        address token,
        address owner,
        address spender,
        uint256 amount,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        bool success;
        /// @solidity memory-safe-assembly
        assembly {
            for {} shl(96, xor(token, WETH9)) {} {
                mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`.
                if iszero(
                    and( // The arguments of `and` are evaluated from right to left.
                        lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word.
                        // Gas stipend to limit gas burn for tokens that don't refund gas when
                        // an non-existing function is called. 5K should be enough for a SLOAD.
                        staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20)
                    )
                ) { break }
                // After here, we can be sure that token is a contract.
                let m := mload(0x40)
                mstore(add(m, 0x34), spender)
                mstore(add(m, 0x20), shl(96, owner))
                mstore(add(m, 0x74), deadline)
                if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) {
                    mstore(0x14, owner)
                    mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`.
                    mstore(add(m, 0x94), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20))
                    mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`.
                    // `nonces` is already at `add(m, 0x54)`.
                    // `1` is already stored at `add(m, 0x94)`.
                    mstore(add(m, 0xb4), and(0xff, v))
                    mstore(add(m, 0xd4), r)
                    mstore(add(m, 0xf4), s)
                    success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00)
                    break
                }
                mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`.
                mstore(add(m, 0x54), amount)
                mstore(add(m, 0x94), and(0xff, v))
                mstore(add(m, 0xb4), r)
                mstore(add(m, 0xd4), s)
                success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00)
                break
            }
        }
        if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s);
    }

    /// @dev Simple permit on the Permit2 contract.
    function simplePermit2(
        address token,
        address owner,
        address spender,
        uint256 amount,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40)
            mstore(m, 0x927da105) // `allowance(address,address,address)`.
            {
                let addressMask := shr(96, not(0))
                mstore(add(m, 0x20), and(addressMask, owner))
                mstore(add(m, 0x40), and(addressMask, token))
                mstore(add(m, 0x60), and(addressMask, spender))
                mstore(add(m, 0xc0), and(addressMask, spender))
            }
            let p := mul(PERMIT2, iszero(shr(160, amount)))
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`.
                    staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60)
                )
            ) {
                mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`.
                revert(add(0x18, shl(2, iszero(p))), 0x04)
            }
            mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant).
            // `owner` is already `add(m, 0x20)`.
            // `token` is already at `add(m, 0x40)`.
            mstore(add(m, 0x60), amount)
            mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`.
            // `nonce` is already at `add(m, 0xa0)`.
            // `spender` is already at `add(m, 0xc0)`.
            mstore(add(m, 0xe0), deadline)
            mstore(add(m, 0x100), 0x100) // `signature` offset.
            mstore(add(m, 0x120), 0x41) // `signature` length.
            mstore(add(m, 0x140), r)
            mstore(add(m, 0x160), s)
            mstore(add(m, 0x180), shl(248, v))
            if iszero(call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00)) {
                mstore(0x00, 0x6b836e6b) // `Permit2Failed()`.
                revert(0x1c, 0x04)
            }
        }
    }
}

File 8 of 10 : BauhausMetadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

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

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

/**
 * @title BauhausMetadata
 * @author akuti.eth
 * @notice The "Bauhaus Signet” NFT, originally created in 1923 by Oskar Schlemmer, is an
 * authorized collaboration with The Oskar Schlemmer Theatre Archives that brings a seminal
 * work of 20th-century design into the blockchain era. The iconic Bauhaus signet will persist
 * on Ethereum forever, as fully onchain SVG generative renditions.
 */
abstract contract BauhausMetadata is ERC721, Ownable, CommitRevealRand {
    using LibString for uint256;

    enum ArtStyle {
        ORIGINAL,
        ORIGINAL_INVERSE,
        GOLD_SILVER,
        PRIMARY,
        DANCE,
        TRIADIC_BALLET,
        HOMAGE_DE_STIJL,
        GRADIENT_RADIAL,
        GRADIENT_ANGLED,
        PUNKISM,
        UNREVEALED
    }

    string[] private _artStyleNames = [
        "Bauhaus Original",
        "Bauhaus Original Inverse",
        "Gold Silver",
        "Bauhaus Primary",
        "Bauhaus Dance",
        "Triadic Ballet",
        "Homage De Stijl",
        "Gradient Radial",
        "Gradient Angled",
        "Punkism",
        "Unrevealed"
    ];

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                                  colors                                  │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    string[] private _colorsBauhaus = [
        "F50101",
        "0200f1",
        "F9FF4C",
        "FF0000",
        "0000FF",
        "FFFF00",
        "00FF00",
        "FFA500",
        "800080",
        "808080",
        "1A1A1A",
        "E6E6E6",
        "B3B3B3",
        "F5F5DC",
        "A52A2A",
        "CC7722"
    ];

    string[] private _colorsBauhausNames = [
        "Bright Red",
        "Cobalt Blue",
        "Lemon Yellow",
        "Pure Red",
        "Pure Blue",
        "Pure Yellow",
        "Lime Green",
        "Orange",
        "Purple",
        "Gray",
        "Near Black",
        "Off-White",
        "Light Gray",
        "Beige",
        "Brown",
        "Ochre"
    ];

    string[] private _colorsBauhausDance = [
        "303F9F",
        "D32F2F",
        "FFEB3B",
        "BDBDBD",
        "78909C",
        "D84315",
        "66BB6A",
        "3F51B5",
        "3433FF",
        "FF9800",
        "4CAF50",
        "9C27B0",
        "009688",
        "FFC107",
        "E91E63",
        "607D8B"
    ];

    string[] private _colorsBauhausDanceNames = [
        "Deep Indigo",
        "Crimson",
        "Lemon Yellow",
        "Light Gray",
        "Slate Gray",
        "Burnt Orange",
        "Lime Green",
        "Royal Blue",
        "Ultramarine",
        "Orange",
        "Kelly Green",
        "Purple",
        "Teal",
        "Amber",
        "Hot Pink",
        "Blue Gray"
    ];

    string[] private _colorsTriadicBallet = [
        "F57C00",
        "FFEE58",
        "FFCA28",
        "FF7043",
        "FFC107",
        "FF5722",
        "5E35B1",
        "673AB7",
        "3949AB",
        "42A5F5",
        "00BCD4",
        "F8BBD0",
        "CE93D8",
        "AB47BC",
        "E91E63",
        "9C27B0",
        "388E3C",
        "66BB6A",
        "4CAF50",
        "BDBDBD",
        "78909C",
        "607D8B"
    ];

    string[] private _colorsTriadicBalletNames = [
        "Deep Orange",
        "Pale Yellow",
        "Amber",
        "Coral",
        "Marigold",
        "Vermilion",
        "Deep Purple",
        "Royal Purple",
        "Indigo",
        "Sky Blue",
        "Turquoise",
        "Pale Pink",
        "Lilac",
        "Medium Purple",
        "Cerise",
        "Magenta",
        "Forest Green",
        "Light Green",
        "Kelly Green",
        "Light Gray",
        "Slate Gray",
        "Blue Gray"
    ];

    string[] private _colorsDeStijlColors = [
        "F50101",
        "0200F1",
        "F9FF4C",
        "FF0000",
        "0000FF",
        "FFFF00",
        "808080",
        "D3D3D3",
        "404040",
        "FFA500",
        "008000",
        "800080",
        "CD5C5C",
        "4682B4",
        "DAA520"
    ];

    string[] private _colorsDeStijlColorsNames = [
        "Bright Red",
        "Cobalt Blue",
        "Lemon Yellow",
        "Pure Red",
        "Pure Blue",
        "Pure Yellow",
        "Medium Gray",
        "Light Gray",
        "Dark Gray",
        "Orange",
        "Green",
        "Purple",
        "Indian Red",
        "Steel Blue",
        "Goldenrod"
    ];

    string[] private _colorsPunk = [
        "DCF9FB", // Alien
        "7C7059", // Ape Skin
        "302616", // Ape Fur
        "365FB4", // Beanie Blue
        "E7EB6C", // Beanie Yellow
        "B4392A", // Beanie Red
        "7DBF50", // Beanie Green
        "496962", // Pilot Helmet
        "EBBF59", // Tiara
        "C76837", // Orange Side
        "514B1E", // Welding Goggles
        "8BA177", // Zombie Skin
        "F6DB6B", // Pigtails
        "E299B8", // Pink with Hat
        "000000", // Top Hat
        "FFFFFF", // Wild White Hair
        "6D4F28", // Cowboy Hat
        "967040", // Big Beard
        "C1483D", // Red Mohawk
        "6EAD5C", // Clown Hair Green
        "E0DFE4", // Silver Chain
        "5E1EB7", // Purple Hair
        "F2CE65", // Gold Chain
        "C9C9C9", // Medical Mask
        "598D36", // Tassle Hat
        "3A3022", // Fedora
        "2C3145", // Police Cap
        "B63829", // Clown Nose
        "515151", // Cap Forward
        "565656", // Hoodie
        "5E492C", // Front Beard Dark
        "973E77", // Purple Eye Shadow
        "687D8D", // Blue Eye Shadow
        "708E67", // Green Eye Shadow
        "223EED", // Vape
        "F0F0F0", // 3D Glasses
        "5C8BEE", // 3D Glasses Blue
        "D65446", // 3D Glasses Red
        "4C4C4C", // Do Rag
        "77572B", // Pipe
        "B4B4B4", // VR
        "6C2AAB", // Cap
        "5E7F33", // Feels Good Man
        "44643D", // Clown Eyes Green
        "323D5F", // Clown Eyes Blue
        "446CCA", // Headband
        "C1483D", // Crazy Hair
        "AF5E34", // Knitted Cap
        "967040", // Mohawk
        "565656", // Mohawk Thin
        "2C42B8", // Bandana
        "B27D3E", // Classic Shades
        "93385E", // Big Shades
        "FDF7AA", // Blonde Hair
        "A5D5D6", // Nerd Glasses
        "AC34BD", // Purple Lipstick
        "A73D2A", // Hot Lipstick
        "000000", // Black Shades
        "C56A42", // Cigarette
        "E6DAD9", // Punk Skin
        "967040", // Facial Hair Brown
        "F7DB6B", // Earring
        "CEB48B", // Punk Skin 2
        "A28D6C", // Punk Skin 3
        "64432A", // Punk Skin 4
        "000000", // Black Hair
        "6F8490", // Not For Sale
        "875A56", // For Sale
        "91BA8A", // Transferred
        "8470AB" // New Bid
    ];

    string[] private _colorsPunkNames = [
        "Alien",
        "Ape Skin",
        "Ape Fur",
        "Beanie Blue",
        "Beanie Yellow",
        "Beanie Red",
        "Beanie Green",
        "Pilot Helmet",
        "Tiara",
        "Orange Side",
        "Welding Goggles",
        "Zombie Skin",
        "Pigtails",
        "Pink with Hat",
        "Top Hat",
        "Wild White Hair",
        "Cowboy Hat",
        "Big Beard",
        "Red Mohawk",
        "Clown Hair Green",
        "Silver Chain",
        "Purple Hair",
        "Gold Chain",
        "Medical Mask",
        "Tassle Hat",
        "Fedora",
        "Police Cap",
        "Clown Nose",
        "Cap Forward",
        "Hoodie",
        "Front Beard Dark",
        "Purple Eye Shadow",
        "Blue Eye Shadow",
        "Green Eye Shadow",
        "Vape",
        "3D Glasses",
        "3D Glasses Blue",
        "3D Glasses Red",
        "Do Rag",
        "Pipe",
        "VR",
        "Cap",
        "Feels Good Man",
        "Clown Eyes Green",
        "Clown Eyes Blue",
        "Headband",
        "Crazy Hair",
        "Knitted Cap",
        "Mohawk",
        "Mohawk Thin",
        "Bandana",
        "Classic Shades",
        "Big Shades",
        "Blonde Hair",
        "Nerd Glasses",
        "Purple Lipstick",
        "Hot Lipstick",
        "Black Shades",
        "Cigarette",
        "Punk Skin",
        "Facial Hair Brown",
        "Earring",
        "Punk Skin 2",
        "Punk Skin 3",
        "Punk Skin 4",
        "Black Hair",
        "Not For Sale",
        "For Sale",
        "Transferred",
        "New Bid"
    ];

    string[] private _linearGradientDirections = [
        'x1="3%" y1="50%" x2="97%" y2="50%"', //Left to Right
        'x1="3%" y1="3%" x2="97%" y2="97%"', //Top-Left to Bottom-Right
        'x1="50%" y1="3%" x2="50%" y2="97%"', //Top to Bottom
        'x1="97%" y1="3%" x2="3%" y2="97%"', //Top-Right to Bottom-Left
        'x1="97%" y1="50%" x2="3%" y2="50%"', //Right to Left
        'x1="97%" y1="97%" x2="3%" y2="3%"', //Bottom-Right to Top-Left
        'x1="50%" y1="97%" x2="50%" y2="3%"', //Bottom to Top
        'x1="3%" y1="97%" x2="97%" y2="3%"' //Bottom-Left to Top-Right
    ];

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                                constants                                 │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    string private constant _NAME = "Bauhaus Signet";
    string private constant _SYMBOL = "BAU";

    string private constant _SVG_MAIN =
        '<g id="headGroup"><path d="M592.85 1147.5h146.83v147.25H592.85z" class="head" id="Neck" /><path d="M792.68 810.36v345.25H502.1v-15.24h234.64V964.74h-58.31v-25.59h58.31V810.36z" class="head" id="Mouth" /><path d="M819.52 807.07v8.53H680.53v-8.53h105.43l.28-753.56 33 7z" class="head" id="Nose" /><path d="M647.25 255.71v317.7h-10.63v-119.7H445.89V266.34H330.22v-10.63z" class="head" id="Eye" /></g>';

    string private constant _DESCRIPTION =
        unicode"The “Bauhaus Signet” NFT, originally created in 1923 by Oskar Schlemmer, is an authorized collaboration with The Oskar Schlemmer Theatre Archives that brings a seminal work of 20th-century design into the blockchain era. The iconic Bauhaus signet will persist on Ethereum forever, as fully onchain SVG generative renditions.";

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                          public view functions                           │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    /**
     * @dev Returns the token collection name.
     */
    function name() public view virtual override returns (string memory) {
        return _NAME;
    }

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() public view virtual override returns (string memory) {
        return _SYMBOL;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _exists(tokenId);

        string memory tokenIdStr = tokenId.toString();
        string memory tokenURI_ = string.concat(
            '{"name":"Bauhaus Signet #',
            tokenIdStr,
            '","description":"',
            _DESCRIPTION,
            '","image":"',
            _getImage(tokenId),
            '","attributes":',
            _getAttributeJson(tokenId),
            "}"
        );
        return string.concat("data:application/json;base64,", Base64.encode(bytes(tokenURI_)));
    }

    /**
     * @notice Returns the base64 encoded SVG for the given token id.
     */
    function getImage(uint256 tokenId) public view returns (string memory) {
        _exists(tokenId);
        return _getImage(tokenId);
    }

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                         internal view functions                          │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    function _getSeed(uint256 tokenId) internal view returns (uint256) {
        uint256 randomness = getRand(_getExtraData(tokenId));
        return (randomness == 0) ? 0 : uint256(keccak256(abi.encodePacked(randomness, tokenId)));
    }

    function _getArtStyle(uint256 tokenId) internal view returns (ArtStyle) {
        uint256 seed = _getSeed(tokenId);
        if (seed == 0) return ArtStyle.UNREVEALED;

        uint256 randomValue = seed % 10000;
        if (randomValue < 20) return ArtStyle.ORIGINAL; // 0.2%
        if (randomValue < 45) return ArtStyle.ORIGINAL_INVERSE; // 0.25%
        if (randomValue < 114) return ArtStyle.GOLD_SILVER; // 0.69%
        if (randomValue < 414) return ArtStyle.PRIMARY; // 3%
        if (randomValue < 714) return ArtStyle.DANCE; // 3%
        if (randomValue < 1014) return ArtStyle.TRIADIC_BALLET; // 3%
        if (randomValue < 1314) return ArtStyle.HOMAGE_DE_STIJL; // 3%
        if (randomValue < 1914) return ArtStyle.GRADIENT_RADIAL; // 6%
        if (randomValue < 3414) return ArtStyle.GRADIENT_ANGLED; // 15%
        return ArtStyle.PUNKISM;
    }

    // random functions using seed

    function _isGlitch(uint256 seed) internal pure returns (bool) {
        return (uint256(keccak256(abi.encodePacked(seed, "Glitch"))) % 100) == 0;
    }

    function _getRandomBool(uint256 seed, string memory name_) internal pure returns (bool) {
        return (uint256(keccak256(abi.encodePacked(seed, name_))) % 2) == 1;
    }

    function _getRandomColor(uint256 seed, string memory name_) internal view returns (string memory) {
        uint256 randomIndex = uint256(keccak256(abi.encodePacked(seed, name_))) % _colorsPunk.length;
        return _colorsPunk[randomIndex];
    }

    function _getRandomColor(uint256 seed, string memory name_, string[] storage colors)
        internal
        view
        returns (string memory)
    {
        uint256 randomIndex = uint256(keccak256(abi.encodePacked(seed, name_))) % colors.length;
        return colors[randomIndex];
    }

    function _getRandomColor(uint256 seed, string memory name_, string[] storage colors, string memory excludeColor)
        internal
        view
        returns (string memory)
    {
        uint256 randomIndex = uint256(keccak256(abi.encodePacked(seed, name_))) % colors.length;
        string memory selectedColor = colors[randomIndex];
        if (keccak256(bytes(selectedColor)) == keccak256(bytes(excludeColor))) {
            return colors[(randomIndex + 1) % colors.length];
        }
        return selectedColor;
    }

    // generate functions

    function _getImage(uint256 tokenId) internal view returns (string memory out) {
        ArtStyle style = _getArtStyle(tokenId);
        uint256 seed = _getSeed(tokenId);
        string memory defs;
        if (style == ArtStyle.UNREVEALED) {
            defs = _generateDefsSingleColor("EAEAEA");
        } else if (style == ArtStyle.ORIGINAL) {
            defs = _generateDefsSingleColor("FFF");
        } else if (style == ArtStyle.ORIGINAL_INVERSE) {
            defs = "<defs><style>.head{fill:#000}circle{stroke:#000;fill:#FFF}";
        } else if (style == ArtStyle.GOLD_SILVER) {
            if (_getRandomBool(seed, "isGold")) {
                defs =
                    '<defs><linearGradient id="GoldGradient" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" stop-color="gold"/><stop offset="45%" stop-color="#fffec1"/><stop offset="55%" stop-color="#fffec1"/><stop offset="100%" stop-color="#e4c200"/></linearGradient><style>.head{fill:var(--color,url(#GoldGradient))}circle{stroke:url(#GoldGradient)}';
            } else {
                defs =
                    '<defs><linearGradient id="SilverGradient" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" stop-color="silver"/><stop offset="45%" stop-color="#FFF"/><stop offset="55%" stop-color="#FFF"/><stop offset="100%" stop-color="silver"/></linearGradient><style>.head{fill:var(--color,url(#SilverGradient))}circle{stroke:url(#SilverGradient)}';
            }
        } else if (style == ArtStyle.PRIMARY) {
            defs = _generateDefsMixed(seed, _colorsBauhaus, false);
        } else if (style == ArtStyle.DANCE) {
            defs = _generateDefsMixed(seed, _colorsBauhausDance, false);
        } else if (style == ArtStyle.TRIADIC_BALLET) {
            defs = _generateDefsMixed(seed, _colorsTriadicBallet, false);
        } else if (style == ArtStyle.HOMAGE_DE_STIJL) {
            defs = _generateDefsMixed(seed, _colorsDeStijlColors, false);
        } else if (style == ArtStyle.GRADIENT_RADIAL) {
            defs = _generateDefsGradientRadial(seed);
        } else if (style == ArtStyle.GRADIENT_ANGLED) {
            defs = _generateDefsGradientAngled(seed);
        } else {
            //ArtStyle.PUNKISM
            defs = _generateDefsMixed(seed, _colorsPunk, true);
        }

        if (_isGlitch(seed)) {
            defs = string.concat(
                defs,
                "@keyframes glitch{0%,to{transform:translate(0,0)}20%{transform:translate(-5px,-5px)}40%{transform:translate(5px,5px)}60%{transform:translate(-15px,0)}80%{transform:translate(15px,0)}}"
            );
        }

        out = string.concat(
            '<svg xmlns="http://www.w3.org/2000/svg" data-name="Bauhaus Signet" id="Bauhaus_Signet" style="background-color:transparent" viewBox="0 0 1337 1337">',
            defs,
            "</style></defs>",
            _SVG_MAIN,
            '<circle cx="50%" cy="50%" r="628" fill="black" />'
        );
        if (_isGlitch(seed)) {
            out = string.concat(
                out,
                '<use href="#headGroup" transform="translate(-10, -1)" style="animation:glitch 20s infinite;--color: #F00;" /><use href="#headGroup" transform="translate(10, 1)" style="animation:glitch 20s infinite;animation-delay:-10s;--color: #00CCF5;" />'
            );
        }
        out = string.concat(
            out,
            '<use href="#headGroup" /><circle cx="50%" cy="50%" r="628" stroke-width="10px" style="fill:transparent" />'
            "</svg>"
        );
        out = string.concat("data:image/svg+xml;base64,", Base64.encode(bytes(out)));
    }

    function _getAttributeJson(uint256 tokenId) internal view returns (string memory out) {
        ArtStyle style = _getArtStyle(tokenId);
        uint256 seed = _getSeed(tokenId);
        out = "[";
        out = _traitJson(out, "Art Style", _artStyleNames[uint256(style)], false);
        string memory colorAttributes;
        if (style != ArtStyle.UNREVEALED) {
            out = string.concat(out, ",");
            if (_isGlitch(seed)) {
                out = _traitJson(out, "Glitch", "True", true);
            }
            if (style == ArtStyle.PUNKISM || style == ArtStyle.GRADIENT_RADIAL || style == ArtStyle.GRADIENT_ANGLED) {
                colorAttributes = _generateColorAttributesMixed(seed, style, _colorsPunkNames);
            } else if (style == ArtStyle.ORIGINAL) {
                colorAttributes = _generateColorAttributesSingle("White", "Black");
            } else if (style == ArtStyle.ORIGINAL_INVERSE) {
                colorAttributes = _generateColorAttributesSingle("Black", "White");
            } else if (style == ArtStyle.GOLD_SILVER) {
                if (_getRandomBool(seed, "isGold")) {
                    colorAttributes = _generateColorAttributesSingle("Gold", "Black");
                } else {
                    colorAttributes = _generateColorAttributesSingle("Silver", "Black");
                }
            } else if (style == ArtStyle.PRIMARY) {
                colorAttributes = _generateColorAttributesMixed(seed, style, _colorsBauhausNames);
            } else if (style == ArtStyle.DANCE) {
                colorAttributes = _generateColorAttributesMixed(seed, style, _colorsBauhausDanceNames);
            } else if (style == ArtStyle.TRIADIC_BALLET) {
                colorAttributes = _generateColorAttributesMixed(seed, style, _colorsTriadicBalletNames);
            } else if (style == ArtStyle.HOMAGE_DE_STIJL) {
                colorAttributes = _generateColorAttributesMixed(seed, style, _colorsDeStijlColorsNames);
            }
        }

        out = string.concat(out, colorAttributes, "]");
    }

    function _traitJson(string memory s, string memory category, string memory trait, bool useSeperator)
        internal
        pure
        returns (string memory)
    {
        string memory seperator = (useSeperator) ? "," : "";
        return string.concat(s, '{"trait_type":"', category, '","value":"', trait, '"}', seperator);
    }

    function _generateColorAttributesSingle(string memory colorName, string memory bgColorName)
        internal
        pure
        returns (string memory out)
    {
        out = _traitJson(out, "Neck", colorName, true);
        out = _traitJson(out, "Mouth", colorName, true);
        out = _traitJson(out, "Nose", colorName, true);
        out = _traitJson(out, "Eye", colorName, true);
        out = _traitJson(out, "Circle", colorName, true);
        out = _traitJson(out, "Background", bgColorName, false);
    }

    function _generateColorAttributesMixed(uint256 seed, ArtStyle style, string[] storage colorNames)
        internal
        view
        returns (string memory out)
    {
        if (style == ArtStyle.UNREVEALED) return out;
        if (style == ArtStyle.GRADIENT_RADIAL || style == ArtStyle.GRADIENT_ANGLED) {
            out = _traitJson(out, "Color I", _getRandomColor(seed, "Color I", colorNames), true);
            out = _traitJson(out, "Color II", _getRandomColor(seed, "Color II", colorNames), true);
            out = _traitJson(out, "Color III", _getRandomColor(seed, "Color III", colorNames), true);
            out = _traitJson(out, "Background", _getRandomColor(seed, "Background", colorNames), false);
            return out;
        }

        string memory bgColorName =
            (style == ArtStyle.PUNKISM) ? _getRandomColor(seed, "Background", colorNames) : "Black";
        out = _traitJson(out, "Neck", _getRandomColor(seed, "Neck", colorNames, bgColorName), true);
        out = _traitJson(out, "Mouth", _getRandomColor(seed, "Mouth", colorNames, bgColorName), true);
        out = _traitJson(out, "Nose", _getRandomColor(seed, "Nose", colorNames, bgColorName), true);
        out = _traitJson(out, "Eye", _getRandomColor(seed, "Eye", colorNames, bgColorName), true);
        out = _traitJson(out, "Circle", _getRandomColor(seed, "Circle", colorNames, bgColorName), true);
        if (style == ArtStyle.PUNKISM) {
            out = _traitJson(out, "Background", bgColorName, false);
        } else {
            out = _traitJson(out, "Background", "Black", false);
        }
    }

    function _generateDefsMixed(uint256 seed, string[] storage colors, bool coloredBg)
        internal
        view
        returns (string memory out)
    {
        string memory bgColor;
        if (coloredBg) {
            bgColor = _getRandomColor(seed, "Background", colors);
        }

        out = string.concat(
            "<defs><style>",
            _cssFillId(seed, "Neck", colors, bgColor),
            _cssFillId(seed, "Mouth", colors, bgColor),
            _cssFillId(seed, "Nose", colors, bgColor),
            _cssFillId(seed, "Eye", colors, bgColor),
            "circle { stroke: #",
            _getRandomColor(seed, "Circle", colors, bgColor)
        );
        if (coloredBg) {
            out = string.concat(out, ";fill: #", bgColor);
        }
        out = string.concat(out, ";}");
    }

    function _generateDefsSingleColor(string memory color) internal pure returns (string memory) {
        return string.concat("<defs><style>.head{fill:var(--color, #", color, ")}circle{stroke:#", color, "}");
    }

    function _generateDefsGradientAngled(uint256 seed) internal view returns (string memory) {
        uint256 directionIndex = uint256(keccak256(abi.encodePacked(seed, "Direction"))) % 8;
        return string.concat(
            '<defs><linearGradient id="LinearGradient" ',
            _linearGradientDirections[directionIndex],
            ' gradientUnits="userSpaceOnUse"><stop offset="0%" stop-color="#',
            _getRandomColor(seed, "Color I", _colorsPunk),
            '"/>' '<stop offset="50%" stop-color="#',
            _getRandomColor(seed, "Color II", _colorsPunk),
            '"/>' '<stop offset="100%" stop-color="#',
            _getRandomColor(seed, "Color III", _colorsPunk),
            '"/></linearGradient><style>.head{fill:var(--color,url(#LinearGradient))}circle{stroke:url(#LinearGradient);fill: #',
            _getRandomColor(seed, "Background", _colorsPunk),
            ";}"
        );
    }

    function _generateDefsGradientRadial(uint256 seed) internal view returns (string memory) {
        return string.concat(
            '<defs><radialGradient id="RadialGradient" cx="50%" cy="50%" r="47%" fx="50%" fy="50%" gradientUnits="userSpaceOnUse">'
            '<stop offset="0%" stop-color="#',
            _getRandomColor(seed, "Color I", _colorsPunk),
            '"/>' '<stop offset="50%" stop-color="#',
            _getRandomColor(seed, "Color II", _colorsPunk),
            '"/>' '<stop offset="100%" stop-color="#',
            _getRandomColor(seed, "Color III", _colorsPunk),
            '"/></radialGradient><style>.head{fill:var(--color,url(#RadialGradient))}circle{stroke:url(#RadialGradient);fill: #',
            _getRandomColor(seed, "Background", _colorsPunk),
            ";}"
        );
    }

    function _cssFillId(uint256 seed, string memory name_, string[] storage colors, string memory excludeColor)
        internal
        view
        returns (string memory)
    {
        return string.concat(
            "#", name_, " { fill: var(--color, #", _getRandomColor(seed, name_, colors, excludeColor), "); }"
        );
    }
}

File 9 of 10 : CommitRevealRand.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

/**
 * @title CommitRevealRand
 * @author akuti.eth
 * @notice Commit-Reveal Scheme for on-chain randomness.
 * @dev To use just call `processCommitReveal()` and get the random value later when needed via `getEpoch(n)`
 */
contract CommitRevealRand {
    struct Epoch {
        uint256 randomness; // random value for revealed blocks, 255 bit
        uint128 revealBlock; // block number at which it can be revealed, will be cleared after revealing
        bool committed; // whether this epoch has been instantiated
        bool revealed; // whether this epoch has been revealed
    }

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                                constants                                 │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    uint256 private constant _HISTORY_LIMIT = 256;
    uint256 private constant _BITMASK_REAVEALED = 1 << 255;

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                                 storage                                  │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    uint256 private _currentEpochIndex = 1;
    uint256 private _nrConfirmations;

    // epochData stores a flag whether it's revealed in the HSB
    // if unset epochData stores the revealBlockNr
    // if unset and revealBlockNr is zero, the block is not commited yet
    // if set epochData stores the randomness with 255 bit
    mapping(uint256 epochIndex => uint256 epochData) private _epochs;

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                               constructor                                │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */
    /**
     * @param nrConfirmations The number of blocks before a commited epoch can be revealed. Must within the block history limit.
     */
    constructor(uint256 nrConfirmations) {
        _nrConfirmations = nrConfirmations;
    }

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                             public functions                             │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    /**
     * @notice Reveals the current epoch if possible and commits the next one.
     *
     * Based on the commit-reveal scheme proposed by MouseDev and implemented by jalil for Checks.
     *
     * @return bool whether an epoch was revealed
     */
    function processCommitReveal() public returns (bool) {
        uint256 d = _epochs[_currentEpochIndex];

        if (d == 0 || (d & _BITMASK_REAVEALED) == 0 && d < block.number - _HISTORY_LIMIT) {
            // reveal block blockhash no longer available (256 block history)
            _epochs[_currentEpochIndex] = block.number + _nrConfirmations;
            return false;
        }
        if (block.number > d) {
            _epochs[_currentEpochIndex] =
                uint256(keccak256(abi.encodePacked(blockhash(d), block.prevrandao))) | _BITMASK_REAVEALED;
            _currentEpochIndex++;
            _epochs[_currentEpochIndex] = block.number + _nrConfirmations;
            return true;
        }
        return false;
    }

    /*  
    ┌──────────────────────────────────────────────────────────────────────────╮
    │                          public view functions                           │
    ╰──────────────────────────────────────────────────────────────────────────┘
    */

    /**
     * @notice Returns the requested epoch.
     * @dev The reaveal block number will not be provided for revealed epochs.
     *
     * @param epochIndex The index of the requested epoch.
     * @return epoch Epoch containing data of the requested epoch for easy use.
     */
    function getEpoch(uint256 epochIndex) public view returns (Epoch memory epoch) {
        uint256 d = _epochs[epochIndex];
        if ((d & (1 << 255)) == 0) epoch.revealBlock = uint128(d);
        else epoch.randomness = d;
        epoch.committed = d != 0; // every existing epoch is commited
        epoch.revealed = epoch.randomness != 0;
    }

    /**
     * @notice Get the randomness of the requested epoch.
     *
     * @param epochIndex The index of the requested epoch.
     * @return uint256 Randomness of requested epoch, returns zero if epoch is not commited or reavealed.
     */
    function getRand(uint256 epochIndex) public view returns (uint256) {
        uint256 d = _epochs[epochIndex];
        return ((d & (1 << 255)) == 0) ? 0 : d;
    }

    /**
     * @notice Returns the index of the currently comitted epoch.
     *
     * @return uint256 The index of the currently comitted epoch.
     */
    function getCurrentEpochIndex() public view returns (uint256) {
        return _currentEpochIndex;
    }

    /**
     * @notice Returns the the currently comitted epoch.
     * @dev The current epoch will always be unrevealed and contain the reveal block number.
     *
     * @return epoch Epoch containing data of the current epoch for easy use.
     */
    function getCurrentEpoch() public view returns (Epoch memory epoch) {
        return getEpoch(_currentEpochIndex);
    }
}

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

/// @notice Library to encode strings in Base64.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/Base64.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/Base64.sol)
/// @author Modified from (https://github.com/Brechtpd/base64/blob/main/base64.sol) by Brecht Devos - <[email protected]>.
library Base64 {
    /// @dev Encodes `data` using the base64 encoding described in RFC 4648.
    /// See: https://datatracker.ietf.org/doc/html/rfc4648
    /// @param fileSafe  Whether to replace '+' with '-' and '/' with '_'.
    /// @param noPadding Whether to strip away the padding.
    function encode(bytes memory data, bool fileSafe, bool noPadding)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let dataLength := mload(data)

            if dataLength {
                // Multiply by 4/3 rounded up.
                // The `shl(2, ...)` is equivalent to multiplying by 4.
                let encodedLength := shl(2, div(add(dataLength, 2), 3))

                // Set `result` to point to the start of the free memory.
                result := mload(0x40)

                // Store the table into the scratch space.
                // Offsetted by -1 byte so that the `mload` will load the character.
                // We will rewrite the free memory pointer at `0x40` later with
                // the allocated size.
                // The magic constant 0x0670 will turn "-_" into "+/".
                mstore(0x1f, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef")
                mstore(0x3f, xor("ghijklmnopqrstuvwxyz0123456789-_", mul(iszero(fileSafe), 0x0670)))

                // Skip the first slot, which stores the length.
                let ptr := add(result, 0x20)
                let end := add(ptr, encodedLength)

                let dataEnd := add(add(0x20, data), dataLength)
                let dataEndValue := mload(dataEnd) // Cache the value at the `dataEnd` slot.
                mstore(dataEnd, 0x00) // Zeroize the `dataEnd` slot to clear dirty bits.

                // Run over the input, 3 bytes at a time.
                for {} 1 {} {
                    data := add(data, 3) // Advance 3 bytes.
                    let input := mload(data)

                    // Write 4 bytes. Optimized for fewer stack operations.
                    mstore8(0, mload(and(shr(18, input), 0x3F)))
                    mstore8(1, mload(and(shr(12, input), 0x3F)))
                    mstore8(2, mload(and(shr(6, input), 0x3F)))
                    mstore8(3, mload(and(input, 0x3F)))
                    mstore(ptr, mload(0x00))

                    ptr := add(ptr, 4) // Advance 4 bytes.
                    if iszero(lt(ptr, end)) { break }
                }
                mstore(dataEnd, dataEndValue) // Restore the cached value at `dataEnd`.
                mstore(0x40, add(end, 0x20)) // Allocate the memory.
                // Equivalent to `o = [0, 2, 1][dataLength % 3]`.
                let o := div(2, mod(dataLength, 3))
                // Offset `ptr` and pad with '='. We can simply write over the end.
                mstore(sub(ptr, o), shl(240, 0x3d3d))
                // Set `o` to zero if there is padding.
                o := mul(iszero(iszero(noPadding)), o)
                mstore(sub(ptr, o), 0) // Zeroize the slot after the string.
                mstore(result, sub(encodedLength, o)) // Store the length.
            }
        }
    }

    /// @dev Encodes `data` using the base64 encoding described in RFC 4648.
    /// Equivalent to `encode(data, false, false)`.
    function encode(bytes memory data) internal pure returns (string memory result) {
        result = encode(data, false, false);
    }

    /// @dev Encodes `data` using the base64 encoding described in RFC 4648.
    /// Equivalent to `encode(data, fileSafe, false)`.
    function encode(bytes memory data, bool fileSafe)
        internal
        pure
        returns (string memory result)
    {
        result = encode(data, fileSafe, false);
    }

    /// @dev Decodes base64 encoded `data`.
    ///
    /// Supports:
    /// - RFC 4648 (both standard and file-safe mode).
    /// - RFC 3501 (63: ',').
    ///
    /// Does not support:
    /// - Line breaks.
    ///
    /// Note: For performance reasons,
    /// this function will NOT revert on invalid `data` inputs.
    /// Outputs for invalid inputs will simply be undefined behaviour.
    /// It is the user's responsibility to ensure that the `data`
    /// is a valid base64 encoded string.
    function decode(string memory data) internal pure returns (bytes memory result) {
        /// @solidity memory-safe-assembly
        assembly {
            let dataLength := mload(data)

            if dataLength {
                let decodedLength := mul(shr(2, dataLength), 3)

                for {} 1 {} {
                    // If padded.
                    if iszero(and(dataLength, 3)) {
                        let t := xor(mload(add(data, dataLength)), 0x3d3d)
                        // forgefmt: disable-next-item
                        decodedLength := sub(
                            decodedLength,
                            add(iszero(byte(30, t)), iszero(byte(31, t)))
                        )
                        break
                    }
                    // If non-padded.
                    decodedLength := add(decodedLength, sub(and(dataLength, 3), 1))
                    break
                }
                result := mload(0x40)

                // Write the length of the bytes.
                mstore(result, decodedLength)

                // Skip the first slot, which stores the length.
                let ptr := add(result, 0x20)
                let end := add(ptr, decodedLength)

                // Load the table into the scratch space.
                // Constants are optimized for smaller bytecode with zero gas overhead.
                // `m` also doubles as the mask of the upper 6 bits.
                let m := 0xfc000000fc00686c7074787c8084888c9094989ca0a4a8acb0b4b8bcc0c4c8cc
                mstore(0x5b, m)
                mstore(0x3b, 0x04080c1014181c2024282c3034383c4044484c5054585c6064)
                mstore(0x1a, 0xf8fcf800fcd0d4d8dce0e4e8ecf0f4)

                for {} 1 {} {
                    // Read 4 bytes.
                    data := add(data, 4)
                    let input := mload(data)

                    // Write 3 bytes.
                    // forgefmt: disable-next-item
                    mstore(ptr, or(
                        and(m, mload(byte(28, input))),
                        shr(6, or(
                            and(m, mload(byte(29, input))),
                            shr(6, or(
                                and(m, mload(byte(30, input))),
                                shr(6, mload(byte(31, input)))
                            ))
                        ))
                    ))
                    ptr := add(ptr, 3)
                    if iszero(lt(ptr, end)) { break }
                }
                mstore(0x40, add(end, 0x20)) // Allocate the memory.
                mstore(end, 0) // Zeroize the slot after the bytes.
                mstore(0x60, 0) // Restore the zero slot.
            }
        }
    }
}

Settings
{
  "remappings": [
    "chainlink/=lib/chainlink-brownie-contracts/contracts/src/v0.8/",
    "forge-std/=lib/forge-std/src/",
    "solady/=lib/solady/src/",
    "chainlink-brownie-contracts/=lib/chainlink-brownie-contracts/contracts/src/v0.6/vendor/@arbitrum/nitro-contracts/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccountBalanceOverflow","type":"error"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[],"name":"InvalidValue","type":"error"},{"inputs":[],"name":"MintEnded","type":"error"},{"inputs":[],"name":"MintLimitReached","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"NotOwnerNorApproved","type":"error"},{"inputs":[],"name":"RoyaltyOverflow","type":"error"},{"inputs":[],"name":"RoyaltyReceiverIsZeroAddress","type":"error"},{"inputs":[],"name":"SaleNotActive","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"isApproved","type":"bool"}],"name":"ApprovalForAll","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"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":"uint256","name":"id","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentEpoch","outputs":[{"components":[{"internalType":"uint256","name":"randomness","type":"uint256"},{"internalType":"uint128","name":"revealBlock","type":"uint128"},{"internalType":"bool","name":"committed","type":"bool"},{"internalType":"bool","name":"revealed","type":"bool"}],"internalType":"struct CommitRevealRand.Epoch","name":"epoch","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentEpochIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epochIndex","type":"uint256"}],"name":"getEpoch","outputs":[{"components":[{"internalType":"uint256","name":"randomness","type":"uint256"},{"internalType":"uint128","name":"revealBlock","type":"uint128"},{"internalType":"bool","name":"committed","type":"bool"},{"internalType":"bool","name":"revealed","type":"bool"}],"internalType":"struct CommitRevealRand.Epoch","name":"epoch","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getImage","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getMintCountFree","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getMintCountHalfPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getMintCountPublic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epochIndex","type":"uint256"}],"name":"getRand","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"target","type":"address"}],"name":"mintAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"mintFree","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"mintHalfPrice","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintPublic","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"ownerOf","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":[],"name":"processCommitReveal","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"publicSaleActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"isApproved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_root","type":"bytes32"}],"name":"setFreeMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_root","type":"bytes32"}],"name":"setHalfPriceMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"active","type":"bool"}],"name":"setPublicSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"setRoyaltyReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

600160005560106101e09081526f10985d5a185d5cc813dc9a59da5b985b60821b61020052608090815260186102209081527f42617568617573204f726967696e616c20496e766572736500000000000000006102405260a052600b6102608181526a23b7b6321029b4b63b32b960a91b6102805260c052600f6102a08181526e42617568617573205072696d61727960881b6102c05260e052600d6102e09081526c426175686175732044616e636560981b6103005261010052600e6103209081526d151c9a58591a58c810985b1b195d60921b61034052610120526103608181526e121bdb5859d94811194814dd1a5a9b608a1b61038052610140526103a08181526e11dc98591a595b9d081498591a585b608a1b6103c052610160526103e09081526e11dc98591a595b9d08105b99db1959608a1b610400526101805260076104209081526650756e6b69736d60c81b610440526101a0526104a0604052600a61046090815269155b9c995d99585b195960b21b610480526101c0526200018c9160039162002910565b506040805161024081018252600661020082018181526546353031303160d01b6102208401528252825180840184528181526530323030663160d01b60208281019190915280840191909152835180850185528281526546394646344360d01b8183015283850152835180850185528281526504646303030360d41b818301526060840152835180850185528281526518181818232360d11b818301526080840152835180850185528281526504646464630360d41b8183015260a0840152835180850185528281526503030464630360d41b8183015260c0840152835180850185528281526504646413530360d41b8183015260e0840152835180850185528281526503830303038360d41b81830152610100840152835180850185528281526503830383038360d41b81830152610120840152835180850185528281526531413141314160d01b818301526101408401528351808501855282815265229b229b229b60d11b81830152610160840152835180850185528281526542334233423360d01b81830152610180840152835180850185528281526546354635444360d01b818301526101a0840152835180850185528281526541353241324160d01b818301526101c084015283518085019094529083526521a19b9b991960d11b908301526101e0810191909152620003899060049060106200296d565b506040805161024081018252600a610200820181815269109c9a59da1d0814995960b21b610220840152825282518084018452600b8082526a436f62616c7420426c756560a81b6020838101919091528085019290925284518086018652600c81526b4c656d6f6e2059656c6c6f7760a01b8184015284860152845180860186526008815267141d5c994814995960c21b818401526060850152845180860186526009808252685075726520426c756560b81b828501526080860191909152855180870187529182526a507572652059656c6c6f7760a81b8284015260a085019190915284518086018652838152692634b6b29023b932b2b760b11b8184015260c0850152845180860186526006808252654f72616e676560d01b8285015260e08601919091528551808701875290815265507572706c6560d01b818401526101008501528451808601865260048152634772617960e01b8184015261012085015284518086018652838152694e65617220426c61636b60b01b8184015261014085015284518086018652908152684f66662d576869746560b81b8183015261016084015283518085018552918252694c69676874204772617960b01b8282015261018083019190915282518084018452600580825264426569676560d81b828401526101a08401919091528351808501855281815264213937bbb760d91b818401526101c08401528351808501909452808452644f6368726560d81b918401919091526101e0820192909252620005c4919060106200296d565b5060408051610240810182526006610200820181815265199819a31ca360d11b6102208401528252825180840184528181526522199923192360d11b602082810191909152808401919091528351808501855282815265232322a119a160d11b8183015283850152835180850185528281526510911091109160d21b818301526060840152835180850185528281526537383930394360d01b818301526080840152835180850185528281526544383433313560d01b8183015260a0840152835180850185528281526536364242364160d01b8183015260c0840152835180850185528281526533463531423560d01b8183015260e08401528351808501855282815265199a1999a32360d11b81830152610100840152835180850185528281526504646393830360d41b81830152610120840152835180850185528281526503443414635360d41b81830152610140840152835180850185528281526503943323742360d41b81830152610160840152835180850185528281526506060726c70760d31b81830152610180840152835180850185528281526546464331303760d01b818301526101a0840152835180850185528281526545393145363360d01b818301526101c08401528351808501909452818452651b181ba21c2160d11b908401526101e0820192909252620007bf919060106200296d565b506040805161024081018252600b61020082018181526a4465657020496e6469676f60a81b61022084015282528251808401845260078082526621b934b6b9b7b760c91b6020838101919091528085019290925284518086018652600c8082526b4c656d6f6e2059656c6c6f7760a01b828501528587019190915285518087018752600a808252694c69676874204772617960b01b8286015260608701919091528651808801885281815269536c617465204772617960b01b818601526080870152865180880188529182526b4275726e74204f72616e676560a01b8285015260a086019190915285518087018752818152692634b6b29023b932b2b760b11b8185015260c08601528551808701875290815269526f79616c20426c756560b01b8184015260e0850152845180860186528381526a556c7472616d6172696e6560a81b81840152610100850152845180860186526006808252654f72616e676560d01b82850152610120860191909152855180870187529384526a25b2b6363c9023b932b2b760a91b848401526101408501939093528451808601865292835265507572706c6560d01b838301526101608401929092528351808501855260048152631519585b60e21b8183015261018084015283518085018552600581526420b6b132b960d91b818301526101a0840152835180850185526008815267486f742050696e6b60c01b818301526101c084015283518085019094526009845268426c7565204772617960b81b908401526101e082019290925262000a06919060106200296d565b50604080516103008101825260066102c082018181526504635374330360d41b6102e08401528252825180840184528181526508c8c8a8a6a760d31b60208281019190915280840191909152835180850185528281526508c8c868264760d31b8183015283850152835180850185528281526546463730343360d01b818301526060840152835180850185528281526546464331303760d01b818301526080840152835180850185528281526523231a9b991960d11b8183015260a0840152835180850185528281526535453335423160d01b8183015260c0840152835180850185528281526536373341423760d01b8183015260e08401528351808501855282815265199c9a1ca0a160d11b81830152610100840152835180850185528281526534324135463560d01b8183015261012084015283518085018552828152650c0c1090d10d60d21b81830152610140840152835180850185528281526504638424244360d41b8183015261016084015283518085018552828152650868a726688760d31b81830152610180840152835180850185528281526541423437424360d01b818301526101a0840152835180850185528281526545393145363360d01b818301526101c0840152835180850185528281526503943323742360d41b818301526101e0840152835180850185528281526533383845334360d01b81830152610200840152835180850185528281526536364242364160d01b81830152610220840152835180850185528281526503443414635360d41b81830152610240840152835180850185528281526510911091109160d21b81830152610260840152835180850185528281526537383930394360d01b818301526102808401528351808501909452908352651b181ba21c2160d11b908301526102a081019190915262000cb7906008906016620029b8565b506040805161030081018252600b6102c082018181526a44656570204f72616e676560a81b6102e08401528252825180840184528181526a50616c652059656c6c6f7760a81b602082810191909152808401919091528351808501855260058082526420b6b132b960d91b8284015284860191909152845180860186528181526410dbdc985b60da1b8184015260608501528451808601865260088082526713585c9a59dbdb1960c21b828501526080860191909152855180870187526009808252682b32b936b4b634b7b760b91b8286015260a0870191909152865180880188528581526a4465657020507572706c6560a81b8186015260c087015286518088018852600c8082526b526f79616c20507572706c6560a01b8287015260e088019190915287518089018952600680825265496e6469676f60d01b828801526101008901919091528851808a018a5293845267536b7920426c756560c01b84870152610120880193909352875180890189528281526854757271756f69736560b81b81870152610140880152875180890189528281526850616c652050696e6b60b81b8187015261016088015287518089018952938452644c696c616360d81b8486015261018087019390935286518088018852600d81526c4d656469756d20507572706c6560981b818601526101a0870152865180880188529182526543657269736560d01b828501526101c08601919091528551808701875260078152664d6167656e746160c81b818501526101e0860152855180870187529182526b2337b932b9ba1023b932b2b760a11b82840152610200850191909152845180860186528381526a2634b3b43a1023b932b2b760a91b81840152610220850152845180860186529283526a25b2b6363c9023b932b2b760a91b8383015261024084019290925283518085018552600a808252694c69676874204772617960b01b828401526102608501919091528451808601865290815269536c617465204772617960b01b81830152610280840152835180850190945281845268426c7565204772617960b81b908401526102a082019290925262000fd791906016620029b8565b50604080516102208101825260066101e082018181526546353031303160d01b6102008401528252825180840184528181526530323030463160d01b60208281019190915280840191909152835180850185528281526546394646344360d01b8183015283850152835180850185528281526504646303030360d41b818301526060840152835180850185528281526518181818232360d11b818301526080840152835180850185528281526504646464630360d41b8183015260a0840152835180850185528281526503830383038360d41b8183015260c0840152835180850185528281526544334433443360d01b8183015260e0840152835180850185528281526503430343034360d41b81830152610100840152835180850185528281526504646413530360d41b81830152610120840152835180850185528281526503030383030360d41b81830152610140840152835180850185528281526503830303038360d41b81830152610160840152835180850185528281526543443543354360d01b8183015261018084015283518085018552828152650d0d8e0c908d60d21b818301526101a084015283518085019094529083526504441413532360d41b908301526101c0810191909152620011b690600a90600f62002a03565b506040805161022081018252600a6101e0820181815269109c9a59da1d0814995960b21b610200840152825282518084018452600b8082526a436f62616c7420426c756560a81b6020838101919091528085019290925284518086018652600c81526b4c656d6f6e2059656c6c6f7760a01b8184015284860152845180860186526008815267141d5c994814995960c21b818401526060850152845180860186526009808252685075726520426c756560b81b828501526080860191909152855180870187528281526a507572652059656c6c6f7760a81b8185015260a0860152855180870187528281526a4d656469756d204772617960a81b8185015260c086015285518087018752848152694c69676874204772617960b01b8185015260e086015285518087018752818152684461726b204772617960b81b81850152610100860152855180870187526006808252654f72616e676560d01b8286015261012087019190915286518088018852600581526423b932b2b760d91b818601526101408701528651808801885290815265507572706c6560d01b818501526101608601528551808701875284815269125b991a585b8814995960b21b818501526101808601528551808701875293845269537465656c20426c756560b01b848401526101a085019390935284518086019095529184526811dbdb19195b9c9bd960ba1b908401526101c0820192909252620013d49190600f62002a03565b50604080516109008101825260066108c08201818152652221a31ca32160d11b6108e08401528252825180840184528181526537433730353960d01b6020828101919091528084019190915283518085018552828152651998191b189b60d11b818301528385015283518085018552828152650ccd8d51908d60d21b818301526060840152835180850185528281526545374542364360d01b818301526080840152835180850185528281526542343339324160d01b8183015260a0840152835180850185528281526503744424635360d41b8183015260c084015283518085018552828152651a1c9b1c9b1960d11b8183015260e0840152835180850185528281526545424246353960d01b81830152610100840152835180850185528281526543373638333760d01b81830152610120840152835180850185528281526535313442314560d01b81830152610140840152835180850185528281526538424131373760d01b818301526101608401528351808501855282815265231b22211b2160d11b81830152610180840152835180850185528281526508a64727284760d31b818301526101a0840152835180850185528281526503030303030360d41b8183018190526101c0850191909152845180860186528381526523232323232360d11b818401526101e0850152845180860186528381526506c88688c64760d31b81840152610200850152845180860186528381526503936373034360d41b818401819052610220860191909152855180870187528481526510cc4d0e0cd160d21b818501819052610240870191909152865180880188528581526536454144354360d01b818601526102608701528651808801885285815265114c1111914d60d21b81860152610280870152865180880188528581526535453145423760d01b818601526102a0870152865180880188528581526546324345363560d01b818601526102c0870152865180880188528581526543394339433960d01b818601526102e087015286518088018852858152651a9c9c22199b60d11b81860152610300870152865180880188528581526519a09998191960d11b81860152610320870152865180880188528581526532433331343560d01b81860152610340870152865180880188528581526542363338323960d01b81860152610360870152865180880188528581526535313531353160d01b8186015261038087015286518088018852858152651a9b1a9b1a9b60d11b8186018190526103a0880191909152875180890189528681526535453439324360d01b818701526103c0880152875180890189528681526539373345373760d01b818701526103e088015287518089018952868152650d8e0dd10e1160d21b81870152610400880152875180890189528681526537303845363760d01b8187015261042088015287518089018952868152650c8c8cd1515160d21b81870152610440880152875180890189528681526504630463046360d41b81870152610460880152875180890189528681526535433842454560d01b818701526104808801528751808901895286815265221b1a9a1a1b60d11b818701526104a0880152875180890189528681526534433443344360d01b818701526104c088015287518089018952868152651b9b9a9b992160d11b818701526104e08801528751808901895286815265108d108d108d60d21b8187015261050088015287518089018952868152651b219920a0a160d11b81870152610520880152875180890189528681526535453746333360d01b8187015261054088015287518089018952868152650d0d0d8d0cd160d21b818701526105608801528751808901895286815265199919a21aa360d11b81870152610580880152875180890189528681526534343643434160d01b818701526105a088015287518089018952868152808601929092526105c0870191909152865180880188528581526510518d514ccd60d21b818601526105e0870152865180880188528581528085018390526106008701528651808801885285815280850191909152610620860152855180870187528481526506486686484760d31b81850152610640860152855180870187528481526542323744334560d01b81850152610660860152855180870187528481526539333338354560d01b81850152610680860152855180870187528481526546444637414160d01b818501526106a08601528551808701875284815265209aa21aa21b60d11b818501526106c086015285518087018752848152651050cccd109160d21b818501526106e0860152855180870187528481526541373344324160d01b81850152610700860152855180870187528481528084018390526107208601528551808701875284815265219a9b209a1960d11b81850152610740860152855180870187528481526545364441443960d01b8185015261076086015285518087018752848152808401919091526107808501528451808601865283815265231ba2211b2160d11b818401526107a0850152845180860186528381526521a2a11a1c2160d11b818401526107c0850152845180860186528381526541323844364360d01b818401526107e0850152845180860186528381526536343433324160d01b818401526108008501528451808601865283815280830191909152610820840152835180850185528281526503646383439360d41b8183015261084084015283518085018552828152651c1b9aa09a9b60d11b81830152610860840152835180850185528281526539314241384160d01b818301526108808401528351808501909452908352651c1a1b9820a160d11b908301526108a081019190915262001c1090600c90604662002a4e565b50604051806108c001604052806040518060400160405280600581526020016420b634b2b760d91b81525081526020016040518060400160405280600881526020016720b8329029b5b4b760c11b81525081526020016040518060400160405280600781526020016620b83290233ab960c91b81525081526020016040518060400160405280600b81526020016a4265616e696520426c756560a81b81525081526020016040518060400160405280600d81526020016c4265616e69652059656c6c6f7760981b81525081526020016040518060400160405280600a8152602001691099585b9a594814995960b21b81525081526020016040518060400160405280600c81526020016b2132b0b734b29023b932b2b760a11b81525081526020016040518060400160405280600c81526020016b141a5b1bdd0812195b1b595d60a21b815250815260200160405180604001604052806005815260200164546961726160d81b81525081526020016040518060400160405280600b81526020016a4f72616e6765205369646560a81b81525081526020016040518060400160405280600f81526020016e57656c64696e6720476f67676c657360881b81525081526020016040518060400160405280600b81526020016a2d37b6b134b29029b5b4b760a91b8152508152602001604051806040016040528060088152602001675069677461696c7360c01b81525081526020016040518060400160405280600d81526020016c141a5b9ac81dda5d1a0812185d609a1b815250815260200160405180604001604052806007815260200166151bdc0812185d60ca1b81525081526020016040518060400160405280600f81526020016e2bb4b632102bb434ba32902430b4b960891b81525081526020016040518060400160405280600a81526020016910dbddd89bde4812185d60b21b815250815260200160405180604001604052806009815260200168109a59c81099585c9960ba1b81525081526020016040518060400160405280600a815260200169526564204d6f6861776b60b01b81525081526020016040518060400160405280601081526020016f21b637bbb7102430b4b91023b932b2b760811b81525081526020016040518060400160405280600c81526020016b29b4b63b32b91021b430b4b760a11b81525081526020016040518060400160405280600b81526020016a283ab9383632902430b4b960a91b81525081526020016040518060400160405280600a81526020016923b7b6321021b430b4b760b11b81525081526020016040518060400160405280600c81526020016b4d65646963616c204d61736b60a01b81525081526020016040518060400160405280600a81526020016915185cdcdb194812185d60b21b8152508152602001604051806040016040528060068152602001654665646f726160d01b81525081526020016040518060400160405280600a8152602001690506f6c696365204361760b41b81525081526020016040518060400160405280600a815260200169436c6f776e204e6f736560b01b81525081526020016040518060400160405280600b81526020016a10d85c08119bdc9dd85c9960aa1b815250815260200160405180604001604052806006815260200165486f6f64696560d01b81525081526020016040518060400160405280601081526020016f46726f6e74204265617264204461726b60801b815250815260200160405180604001604052806011815260200170507572706c652045796520536861646f7760781b81525081526020016040518060400160405280600f81526020016e426c75652045796520536861646f7760881b81525081526020016040518060400160405280601081526020016f477265656e2045796520536861646f7760801b8152508152602001604051806040016040528060048152602001635661706560e01b81525081526020016040518060400160405280600a815260200169334420476c617373657360b01b81525081526020016040518060400160405280600f81526020016e334420476c617373657320426c756560881b81525081526020016040518060400160405280600e81526020016d0cd10811db185cdcd95cc814995960921b815250815260200160405180604001604052806006815260200165446f2052616760d01b8152508152602001604051806040016040528060048152602001635069706560e01b8152508152602001604051806040016040528060028152602001612b2960f11b81525081526020016040518060400160405280600381526020016204361760ec1b81525081526020016040518060400160405280600e81526020016d2332b2b6399023b7b7b21026b0b760911b81525081526020016040518060400160405280601081526020016f21b637bbb71022bcb2b99023b932b2b760811b81525081526020016040518060400160405280600f81526020016e436c6f776e204579657320426c756560881b8152508152602001604051806040016040528060088152602001671219585918985b9960c21b81525081526020016040518060400160405280600a81526020016921b930bd3c902430b4b960b11b81525081526020016040518060400160405280600b81526020016a04b6e6974746564204361760ac1b8152508152602001604051806040016040528060068152602001654d6f6861776b60d01b81525081526020016040518060400160405280600b81526020016a26b7b430bbb5902a3434b760a91b81525081526020016040518060400160405280600781526020016642616e64616e6160c81b81525081526020016040518060400160405280600e81526020016d436c61737369632053686164657360901b81525081526020016040518060400160405280600a8152602001694269672053686164657360b01b81525081526020016040518060400160405280600b81526020016a213637b73232902430b4b960a91b81525081526020016040518060400160405280600c81526020016b4e65726420476c617373657360a01b81525081526020016040518060400160405280600f81526020016e507572706c65204c6970737469636b60881b81525081526020016040518060400160405280600c81526020016b486f74204c6970737469636b60a01b81525081526020016040518060400160405280600c81526020016b426c61636b2053686164657360a01b81525081526020016040518060400160405280600981526020016843696761726574746560b81b815250815260200160405180604001604052806009815260200168283ab7359029b5b4b760b91b8152508152602001604051806040016040528060118152602001702330b1b4b0b6102430b4b910213937bbb760791b81525081526020016040518060400160405280600781526020016645617272696e6760c81b81525081526020016040518060400160405280600b81526020016a283ab7359029b5b4b7101960a91b81525081526020016040518060400160405280600b81526020016a50756e6b20536b696e203360a81b81525081526020016040518060400160405280600b81526020016a141d5b9ac814dada5b880d60aa1b81525081526020016040518060400160405280600a815260200169213630b1b5902430b4b960b11b81525081526020016040518060400160405280600c81526020016b4e6f7420466f722053616c6560a01b815250815260200160405180604001604052806008815260200167466f722053616c6560c01b81525081526020016040518060400160405280600b81526020016a151c985b9cd9995c9c995960aa1b81525081526020016040518060400160405280600781526020016613995dc8109a5960ca1b815250815250600d9060466200274092919062002a4e565b506040805161016081019091526022610100820181815282916200733961012084013981526020016040518060600160405280602181526020016200737c6021913981526020016040518060600160405280602281526020016200739d602291398152602001604051806060016040528060218152602001620073bf602191398152602001604051806060016040528060228152602001620072f5602291398152602001604051806060016040528060218152602001620072d4602191398152602001604051806060016040528060228152602001620073176022913981526020016040518060600160405280602181526020016200735b6021913990526200284e90600e90600862002a99565b5060016011553480156200286157600080fd5b506020600155620028723362002886565b6200288033610320620028c3565b62002cc8565b6001600160a01b0316638b78c6d8198190558060007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a35b50565b6001600160601b031661271080821115620028e65763350a88b36000526004601cfd5b8260601b80620028fe5763b4457eaa6000526004601cfd5b90911768aa4ec00224afccfdb7555050565b8280548282559060005260206000209081019282156200295b579160200282015b828111156200295b57825182906200294a908262002bfc565b509160200191906001019062002931565b506200296992915062002ae4565b5090565b8280548282559060005260206000209081019282156200295b579160200282015b828111156200295b5782518290620029a7908262002bfc565b50916020019190600101906200298e565b8280548282559060005260206000209081019282156200295b579160200282015b828111156200295b5782518290620029f2908262002bfc565b5091602001919060010190620029d9565b8280548282559060005260206000209081019282156200295b579160200282015b828111156200295b578251829062002a3d908262002bfc565b509160200191906001019062002a24565b8280548282559060005260206000209081019282156200295b579160200282015b828111156200295b578251829062002a88908262002bfc565b509160200191906001019062002a6f565b8280548282559060005260206000209081019282156200295b579160200282015b828111156200295b578251829062002ad3908262002bfc565b509160200191906001019062002aba565b808211156200296957600062002afb828262002b05565b5060010162002ae4565b50805462002b139062002b6b565b6000825580601f1062002b24575050565b601f016020900490600052602060002090810190620028c091905b8082111562002969576000815560010162002b3f565b634e487b7160e01b600052604160045260246000fd5b600181811c9082168062002b8057607f821691505b60208210810362002ba157634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562002bf7576000816000526020600020601f850160051c8101602086101562002bd25750805b601f850160051c820191505b8181101562002bf35782815560010162002bde565b5050505b505050565b81516001600160401b0381111562002c185762002c1862002b55565b62002c308162002c29845462002b6b565b8462002ba7565b602080601f83116001811462002c68576000841562002c4f5750858301515b600019600386901b1c1916600185901b17855562002bf3565b600085815260208120601f198616915b8281101562002c995788860151825594840194600190910190840162002c78565b508582101562002cb85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6145fc8062002cd86000396000f3fe6080604052600436106102465760003560e01c8063638df30b11610139578063b88d4fde116100b6578063d46ba0e71161007a578063d46ba0e7146106a6578063e985e9c5146106c6578063efd0cbf9146106fc578063f04e283e1461070f578063f2fde38b14610722578063fee81cf41461073557600080fd5b8063b88d4fde146105e4578063b97dd9e2146105f7578063bc0bc6ba1461064c578063bc8893b41461066c578063c87b56dd1461068657600080fd5b80638da5cb5b116100fd5780638da5cb5b1461053f5780638dc251e31461055857806395d89b41146105785780639d034fe9146105a4578063a22cb465146105c457600080fd5b8063638df30b146104b757806370a08231146104d7578063715018a6146104f7578063733eb311146104ff57806376c7d8ca1461051f57600080fd5b80632607aafa116101c757806352b47bcc1161018b57806352b47bcc1461042f57806354d1f13d1461044f5780635aca1bb6146104575780635e5201b7146104775780636352211e1461049757600080fd5b80632607aafa146103935780632a55205a146103b35780633ccfd60b146103f257806342842e0e146104075780634e42d2471461041a57600080fd5b806318160ddd1161020e57806318160ddd1461033b5780631dc49fe91461035057806323381bd21461036357806323b872dd14610378578063256929621461038b57600080fd5b806301daeb511461024b57806301ffc9a71461027e57806306fdde03146102ae578063081812fc146102ee578063095ea7b314610326575b600080fd5b34801561025757600080fd5b5061026b610266366004612e8b565b610768565b6040519081526020015b60405180910390f35b34801561028a57600080fd5b5061029e610299366004612ea6565b61077b565b6040519015158152602001610275565b3480156102ba57600080fd5b5060408051808201909152600e81526d10985d5a185d5cc814da59db995d60921b60208201525b6040516102759190612ef4565b3480156102fa57600080fd5b5061030e610309366004612f27565b610799565b6040516001600160a01b039091168152602001610275565b610339610334366004612f40565b6107d8565b005b34801561034757600080fd5b5061026b6107e7565b61033961035e366004612fb6565b6107fd565b34801561036f57600080fd5b5060005461026b565b610339610386366004613002565b61097d565b610339610a7e565b34801561039f57600080fd5b506102e16103ae366004612f27565b610ace565b3480156103bf57600080fd5b506103d36103ce36600461303e565b610b02565b604080516001600160a01b039093168352602083019190915201610275565b3480156103fe57600080fd5b50610339610b57565b610339610415366004613002565b610b76565b34801561042657600080fd5b5061029e610ba3565b34801561043b57600080fd5b5061026b61044a366004612e8b565b610c98565b610339610ca5565b34801561046357600080fd5b50610339610472366004613070565b610ce1565b34801561048357600080fd5b5061026b610492366004612f27565b610cfc565b3480156104a357600080fd5b5061030e6104b2366004612f27565b610d27565b3480156104c357600080fd5b506103396104d2366004612f27565b610d65565b3480156104e357600080fd5b5061026b6104f2366004612e8b565b610d72565b610339610dad565b34801561050b57600080fd5b5061033961051a366004612f27565b610dbf565b34801561052b57600080fd5b5061033961053a36600461308b565b610dcc565b34801561054b57600080fd5b50638b78c6d8195461030e565b34801561056457600080fd5b50610339610573366004612e8b565b610edd565b34801561058457600080fd5b5060408051808201909152600381526242415560e81b60208201526102e1565b3480156105b057600080fd5b506103396105bf3660046130cd565b610ef4565b3480156105d057600080fd5b506103396105df3660046130f9565b610f7f565b6103396105f2366004613123565b610fd5565b34801561060357600080fd5b5061060c611030565b6040516102759190815181526020808301516001600160801b03169082015260408083015115159082015260609182015115159181019190915260800190565b34801561065857600080fd5b5061060c610667366004612f27565b61105b565b34801561067857600080fd5b5060125461029e9060ff1681565b34801561069257600080fd5b506102e16106a1366004612f27565b6110c9565b3480156106b257600080fd5b5061026b6106c1366004612e8b565b611187565b3480156106d257600080fd5b5061029e6106e13660046131be565b601c52670a5a2e7a000000006008526000526030600c205490565b61033961070a366004612f27565b611194565b61033961071d366004612e8b565b6112b6565b610339610730366004612e8b565b6112f3565b34801561074157600080fd5b5061026b610750366004612e8b565b63389a75e1600c908152600091909152602090205490565b600061077582600161131a565b92915050565b6000632a55205a60e083901c9081146301ffc9a79190911417610775565b600081600052673ec412a9852d173d60c11b601c52602060002082018201805460601b6107ce5763ceea21b66000526004601cfd5b6001015492915050565b6107e33383836113bd565b5050565b600060016011546107f891906131fe565b905090565b600061080a33600161131a565b601154909150600361081c8684613211565b111561083b5760405163303b682f60e01b815260040160405180910390fd5b610760600161084a8784613211565b61085491906131fe565b11156108735760405163124212e560e21b815260040160405180910390fd5b60026108878667013b7b21280e0000613224565b6108919190613251565b34146108b057604051632a9ffab760e21b815260040160405180910390fd5b604080513360601b6bffffffffffffffffffffffff191660208083019190915282516014818403018152603490920190925280519101206010546108f890869086908461145e565b610915576040516309bde33960e01b815260040160405180910390fd5b61091d610ba3565b506109333361092c8886613211565b6001611498565b85601160008282546109459190613211565b90915550600090505b868110156109745761096c336109648386613211565b600054611565565b60010161094e565b50505050505050565b6000818152673ec412a9852d173d60c11b3317601c52602090208101810180546001600160a01b0394851694938416938116919082861483026109cf5767ceea21b6a1148100831560021b526004601cfd5b8560005281600101549250823314863314176109fd576030600c20546109fd57634b6e7f186000526004601cfd5b8215610a0b57600082600101555b85851818905550601c600c8181208054600019019055600084905220805460010163ffffffff81168402610a4e5767ea553b3401336cea841560021b526004601cfd5b90558082847fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600038a45b505050565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b6060610af8826000818152673ec412a9852d173d60c11b601c52602090208101015460601b151590565b50610775826115f0565b600082815268aa4ec00224afccfdb76020526040812054606081901c91906127109083610b36576020515490508060601c93505b606084901b1884600019829004811182023d3d3e9396930204935090915050565b610b5f611938565b610b74610b6f638b78c6d8195490565b611953565b565b610b8183838361097d565b813b15610a7957610a798383836040518060200160405280600081525061196f565b60008054815260026020526040812054801580610bd95750600160ff1b8116158015610bd95750610bd6610100436131fe565b81105b15610c0457600154610beb9043613211565b6000805481526002602052604081209190915592915050565b80431115610c9057600160ff1b814044604051602001610c2e929190918252602082015260400190565b60408051601f1981840301815291815281516020928301206000805481526002909352908220921790915580549080610c6683613265565b9091555050600154610c789043613211565b60008054815260026020526040902055506001919050565b600091505090565b600061077582600261131a565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b610ce9611938565b6012805460ff1916911515919091179055565b600081815260026020526040812054600160ff1b811615610d1d5780610d20565b60005b9392505050565b6000818152673ec412a9852d173d60c11b601c526020902081018101546001600160a01b031680610d605763ceea21b66000526004601cfd5b919050565b610d6d611938565b600f55565b600081610d8757638f4eb6046000526004601cfd5b673ec412a9852d173d60c11b601c528160005263ffffffff601c600c2054169050919050565b610db5611938565b610b7460006119fb565b610dc7611938565b601055565b6001610dd933600061131a565b610de4906001613211565b1115610e035760405163303b682f60e01b815260040160405180910390fd5b61076060016011546001610e179190613211565b610e2191906131fe565b1115610e405760405163124212e560e21b815260040160405180910390fd5b604080513360601b6bffffffffffffffffffffffff19166020808301919091528251601481840301815260349092019092528051910120600f54610e8890849084908461145e565b610ea5576040516309bde33960e01b815260040160405180910390fd5b610ead610ba3565b50610ebb3360016000611498565b60118054610a79913391906000610ed183613265565b90915550600054611565565b610ee5611938565b610ef181610320611a39565b50565b610efc611938565b6011546107606001610f0e8584613211565b610f1891906131fe565b1115610f375760405163124212e560e21b815260040160405180910390fd5b610f3f610ba3565b508260116000828254610f529190613211565b90915550600090505b83811015610f7957610f71836109648385613211565b600101610f5b565b50505050565b801515905081601c52670a5a2e7a0000000060085233600052806030600c2055806000528160601b60601c337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160206000a35050565b610fe085858561097d565b833b156110295761102985858585858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061196f92505050565b5050505050565b6040805160808101825260008082526020820181905291810182905260608101919091526107f86000545b60408051608081018252600080825260208201819052918101829052606081019190915260008281526002602052604081205490600160ff1b821690036110b0576001600160801b03811660208301526110b4565b8082525b15156040820152805115156060820152919050565b60606110f3826000818152673ec412a9852d173d60c11b601c52602090208101015460601b151590565b5060006110ff83611a89565b905060008160405180610180016040528061014881526020016141676101489139611129866115f0565b61113287611acd565b604051602001611145949392919061329a565b604051602081830303815290604052905061115f81611f17565b60405160200161116f919061337b565b60405160208183030381529060405292505050919050565b600061077582600061131a565b60006111a133600261131a565b6011546012549192509060ff166111cb5760405163b7b2409760e01b815260040160405180910390fd5b600a6111d78484613211565b11156111f65760405163303b682f60e01b815260040160405180910390fd5b61076060016112058584613211565b61120f91906131fe565b111561122e5760405163124212e560e21b815260040160405180910390fd5b6112408367013b7b21280e0000613224565b341461125f57604051632a9ffab760e21b815260040160405180910390fd5b611267610ba3565b5061127d336112768585613211565b6002611498565b826011600082825461128f9190613211565b90915550600090505b83811015610f79576112ae336109648385613211565b600101611298565b6112be611938565b63389a75e1600c52806000526020600c2080544211156112e657636f5e88186000526004601cfd5b60009055610ef1816119fb565b6112fb611938565b8060601b61131157637448fbae6000526004601cfd5b610ef1816119fb565b60008061134284673ec412a9852d173d60c11b601c908152600091909152600c205460201c90565b90506000836002811115611358576113586133c0565b03611367576001169050610775565b600183600281111561137b5761137b6133c0565b0361138d5760011c6003169050610775565b60028360028111156113a1576113a16133c0565b036113b35760031c600f169050610775565b5060009392505050565b60001960601c828116925083811693508160005283673ec412a9852d173d60c11b17601c52602060002082018201805482169150816114045763ceea21b66000526004601cfd5b81851485151761142a57816000526030600c205461142a57634b6e7f186000526004601cfd5b6001018390558183827f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600038a450505050565b60008315611490578360051b8501855b803580851160051b9485526020948518526040600020930181811061146e5750505b501492915050565b673ec412a9852d173d60c11b601c9081526000848152600c919091205460201c908260028111156114cb576114cb6133c0565b036114db57600119168217611539565b60018260028111156114ef576114ef6133c0565b0361150c57600619166002600160e11b03600184901b1617611539565b6002826002811115611520576115206133c0565b0361153957607819166008600160e31b03600384901b16175b673ec412a9852d173d60c11b601c9081526000859052600c208054602081811c8418901b189055610f79565b8260601b60601c925081600052673ec412a9852d173d60c11b601c52828160a01b176020600020830183015582600052601c600c20600181540163ffffffff811685026115c15767ea553b3401336cea851560021b526004601cfd5b9055818360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8138a4505050565b606060006115fd83611f25565b9050600061160a8461200f565b90506060600a83600a811115611622576116226133c0565b036116555761164e6040518060400160405280600681526020016545414541454160d01b815250612088565b9050611843565b600083600a811115611669576116696133c0565b036116925761164e6040518060400160405280600381526020016223232360e91b815250612088565b600183600a8111156116a6576116a66133c0565b036116cb576040518060600160405280603a8152602001614400603a91399050611843565b600283600a8111156116df576116df6133c0565b036117575761170c82604051806040016040528060068152602001651a5cd1dbdb1960d21b8152506120b3565b156117345760405180610180016040528061015181526020016142af61015191399050611843565b604051806101800160405280610152815260200161401561015291399050611843565b600383600a81111561176b5761176b6133c0565b0361177d5761164e82600460006120f7565b600483600a811115611791576117916133c0565b036117a35761164e82600660006120f7565b600583600a8111156117b7576117b76133c0565b036117c95761164e82600860006120f7565b600683600a8111156117dd576117dd6133c0565b036117ef5761164e82600a60006120f7565b600783600a811115611803576118036133c0565b036118115761164e82612274565b600883600a811115611825576118256133c0565b036118335761164e8261233b565b61184082600c60016120f7565b90505b61184c82612485565b15611874578060405160200161186291906133d6565b60405160208183030381529060405290505b80604051806101c0016040528061018d815260200161443a61018d91396040516020016118a29291906134d5565b60405160208183030381529060405293506118bc82612485565b156118e457836040516020016118d2919061361b565b60405160208183030381529060405293505b836040516020016118f59190613759565b604051602081830303815290604052935061190f84611f17565b60405160200161191f91906137ff565b6040516020818303038152906040529350505050919050565b638b78c6d819543314610b74576382b429006000526004601cfd5b60003860003847855af1610ef15763b12d13eb6000526004601cfd5b60405163150b7a028082523360208301528560601b60601c604083015283606083015260808083015282518060a084015280156119b6578060c08401826020870160045afa505b60208360a48301601c860160008a5af16119d9573d156119d9573d6000843e3d83fd5b508060e01b8251146119f35763d1a57ed66000526004601cfd5b505050505050565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b6bffffffffffffffffffffffff1661271080821115611a605763350a88b36000526004601cfd5b8260601b80611a775763b4457eaa6000526004601cfd5b90911768aa4ec00224afccfdb7555050565b60606080604051019050602081016040526000815280600019835b928101926030600a8206018453600a900480611aa4575050819003601f19909101908152919050565b60606000611ada83611f25565b90506000611ae78461200f565b9050604051806040016040528060018152602001605b60f81b8152509250611be98360405180604001604052806009815260200168417274205374796c6560b81b815250600385600a811115611b3f57611b3f6133c0565b81548110611b4f57611b4f613844565b906000526020600020018054611b649061385a565b80601f0160208091040260200160405190810160405280929190818152602001828054611b909061385a565b8015611bdd5780601f10611bb257610100808354040283529160200191611bdd565b820191906000526020600020905b815481529060010190602001808311611bc057829003601f168201915b505050505060006124d5565b92506060600a83600a811115611c0157611c016133c0565b14611f045783604051602001611c179190613894565b6040516020818303038152906040529350611c3182612485565b15611c8057611c7d846040518060400160405280600681526020016508ed8d2e8c6d60d31b815250604051806040016040528060048152602001635472756560e01b81525060016124d5565b93505b600983600a811115611c9457611c946133c0565b1480611cb15750600783600a811115611caf57611caf6133c0565b145b80611ccd5750600883600a811115611ccb57611ccb6133c0565b145b15611ce557611cde8284600d612542565b9050611f04565b600083600a811115611cf957611cf96133c0565b03611d4257611cde60405180604001604052806005815260200164576869746560d81b81525060405180604001604052806005815260200164426c61636b60d81b815250612980565b600183600a811115611d5657611d566133c0565b03611d9f57611cde60405180604001604052806005815260200164426c61636b60d81b81525060405180604001604052806005815260200164576869746560d81b815250612980565b600283600a811115611db357611db36133c0565b03611e6d57611de082604051806040016040528060068152602001651a5cd1dbdb1960d21b8152506120b3565b15611e2857611cde6040518060400160405280600481526020016311dbdb1960e21b81525060405180604001604052806005815260200164426c61636b60d81b815250612980565b611cde6040518060400160405280600681526020016529b4b63b32b960d11b81525060405180604001604052806005815260200164426c61636b60d81b815250612980565b600383600a811115611e8157611e816133c0565b03611e9257611cde82846005612542565b600483600a811115611ea657611ea66133c0565b03611eb757611cde82846007612542565b600583600a811115611ecb57611ecb6133c0565b03611edc57611cde82846009612542565b600683600a811115611ef057611ef06133c0565b03611f0457611f018284600b612542565b90505b838160405160200161191f9291906138b9565b606061077582600080612a8a565b600080611f318361200f565b905080600003611f445750600a92915050565b6000611f52612710836138f4565b90506014811015611f67575060009392505050565b602d811015611f7a575060019392505050565b6072811015611f8d575060029392505050565b61019e811015611fa1575060039392505050565b6102ca811015611fb5575060049392505050565b6103f6811015611fc9575060059392505050565b610522811015611fdd575060069392505050565b61077a811015611ff1575060079392505050565b610d56811015612005575060089392505050565b5060099392505050565b60008061204e61203b846000818152673ec412a9852d173d60c11b601c52602090208101015460a01c90565b6bffffffffffffffffffffffff16610cfc565b90508015610d1d5760408051602081018390529081018490526060016040516020818303038152906040528051906020012060001c610d20565b6060818260405160200161209d929190613908565b6040516020818303038152906040529050919050565b6000600283836040516020016120ca92919061399a565b6040516020818303038152906040528051906020012060001c6120ed91906138f4565b6001149392505050565b60608082156121305761212d856040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b81525086612b7f565b90505b61215885604051806040016040528060048152602001634e65636b60e01b8152508684612c6e565b612181866040518060400160405280600581526020016409adeeae8d60db1b8152508785612c6e565b6121a987604051806040016040528060048152602001634e6f736560e01b8152508886612c6e565b6121d0886040518060400160405280600381526020016245796560e81b8152508987612c6e565b6121fa8960405180604001604052806006815260200165436972636c6560d01b8152508a88612ca7565b60405160200161220e9594939291906139c0565b6040516020818303038152906040529150821561224a578181604051602001612238929190613a6d565b60405160208183030381529060405291505b8160405160200161225b9190613ab0565b6040516020818303038152906040529150509392505050565b60606122a18260405180604001604052806007815260200166436f6c6f72204960c81b815250600c612b7f565b6122cd8360405180604001604052806008815260200167436f6c6f7220494960c01b815250600c612b7f565b6122fa8460405180604001604052806009815260200168436f6c6f722049494960b81b815250600c612b7f565b612328856040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b815250600c612b7f565b60405160200161209d9493929190613b41565b60606000600883604051602001612366918152682234b932b1ba34b7b760b91b602082015260290190565b6040516020818303038152906040528051906020012060001c61238991906138f4565b9050600e818154811061239e5761239e613844565b906000526020600020016123d38460405180604001604052806007815260200166436f6c6f72204960c81b815250600c612b7f565b6123ff8560405180604001604052806008815260200167436f6c6f7220494960c01b815250600c612b7f565b61242c8660405180604001604052806009815260200168436f6c6f722049494960b81b815250600c612b7f565b61245a876040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b815250600c612b7f565b60405160200161246e959493929190613cf6565b604051602081830303815290604052915050919050565b60006064826040516020016124ab9181526508ed8d2e8c6d60d31b602082015260260190565b6040516020818303038152906040528051906020012060001c6124ce91906138f4565b1592915050565b60606000826124f3576040518060200160405280600081525061250e565b604051806040016040528060018152602001600b60fa1b8152505b9050858585836040516020016125279493929190613f03565b6040516020818303038152906040529150505b949350505050565b6060600a83600a811115612558576125586133c0565b14610d2057600783600a811115612571576125716133c0565b148061258e5750600883600a81111561258c5761258c6133c0565b145b156126f2576125e88160405180604001604052806007815260200166436f6c6f72204960c81b8152506125e18760405180604001604052806007815260200166436f6c6f72204960c81b81525087612b7f565b60016124d5565b905061263a8160405180604001604052806008815260200167436f6c6f7220494960c01b8152506125e18760405180604001604052806008815260200167436f6c6f7220494960c01b81525087612b7f565b905061268e8160405180604001604052806009815260200168436f6c6f722049494960b81b8152506125e18760405180604001604052806009815260200168436f6c6f722049494960b81b81525087612b7f565b90506126eb816040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b8152506126e4876040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b81525087612b7f565b60006124d5565b9050610d20565b6000600984600a811115612708576127086133c0565b146127305760405180604001604052806005815260200164426c61636b60d81b81525061275d565b61275d856040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b81525085612b7f565b90506127a882604051806040016040528060048152602001634e65636b60e01b8152506125e188604051806040016040528060048152602001634e65636b60e01b8152508887612ca7565b91506127f5826040518060400160405280600581526020016409adeeae8d60db1b8152506125e1886040518060400160405280600581526020016409adeeae8d60db1b8152508887612ca7565b915061284082604051806040016040528060048152602001634e6f736560e01b8152506125e188604051806040016040528060048152602001634e6f736560e01b8152508887612ca7565b9150612889826040518060400160405280600381526020016245796560e81b8152506125e1886040518060400160405280600381526020016245796560e81b8152508887612ca7565b91506128d88260405180604001604052806006815260200165436972636c6560d01b8152506125e18860405180604001604052806006815260200165436972636c6560d01b8152508887612ca7565b9150600984600a8111156128ee576128ee6133c0565b0361292957612922826040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b8152508360006124d5565b9150612978565b612975826040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b81525060405180604001604052806005815260200164426c61636b60d81b81525060006124d5565b91505b509392505050565b60606129ab81604051806040016040528060048152602001634e65636b60e01b8152508560016124d5565b90506129d7816040518060400160405280600581526020016409adeeae8d60db1b8152508560016124d5565b9050612a0281604051806040016040528060048152602001634e6f736560e01b8152508560016124d5565b9050612a2c816040518060400160405280600381526020016245796560e81b8152508560016124d5565b9050612a598160405180604001604052806006815260200165436972636c6560d01b8152508560016124d5565b9050610d20816040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b8152508460006124d5565b606083518015612978576003600282010460021b60405192507f4142434445464748494a4b4c4d4e4f505152535455565758595a616263646566601f526106708515027f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392d5f18603f52602083018181018388602001018051600082525b60038a0199508951603f8160121c1651600053603f81600c1c1651600153603f8160061c1651600253603f811651600353506000518452600484019350828410612b06579052602001604052613d3d60f01b60038406600204808303919091526000861515909102918290035290038252509392505050565b8054604051606091600091612b9a908790879060200161399a565b6040516020818303038152906040528051906020012060001c612bbd91906138f4565b9050828181548110612bd157612bd1613844565b906000526020600020018054612be69061385a565b80601f0160208091040260200160405190810160405280929190818152602001828054612c129061385a565b8015612c5f5780601f10612c3457610100808354040283529160200191612c5f565b820191906000526020600020905b815481529060010190602001808311612c4257829003601f168201915b50505050509150509392505050565b606083612c7d86868686612ca7565b604051602001612c8e929190613f9e565b6040516020818303038152906040529050949350505050565b8154604051606091600091612cc2908890889060200161399a565b6040516020818303038152906040528051906020012060001c612ce591906138f4565b90506000848281548110612cfb57612cfb613844565b906000526020600020018054612d109061385a565b80601f0160208091040260200160405190810160405280929190818152602001828054612d3c9061385a565b8015612d895780601f10612d5e57610100808354040283529160200191612d89565b820191906000526020600020905b815481529060010190602001808311612d6c57829003601f168201915b505050505090508380519060200120818051906020012003612e6a5784548590612db4846001613211565b612dbe91906138f4565b81548110612dce57612dce613844565b906000526020600020018054612de39061385a565b80601f0160208091040260200160405190810160405280929190818152602001828054612e0f9061385a565b8015612e5c5780601f10612e3157610100808354040283529160200191612e5c565b820191906000526020600020905b815481529060010190602001808311612e3f57829003601f168201915b50505050509250505061253a565b9695505050505050565b80356001600160a01b0381168114610d6057600080fd5b600060208284031215612e9d57600080fd5b610d2082612e74565b600060208284031215612eb857600080fd5b81356001600160e01b031981168114610d2057600080fd5b60005b83811015612eeb578181015183820152602001612ed3565b50506000910152565b6020815260008251806020840152612f13816040850160208701612ed0565b601f01601f19169190910160400192915050565b600060208284031215612f3957600080fd5b5035919050565b60008060408385031215612f5357600080fd5b612f5c83612e74565b946020939093013593505050565b60008083601f840112612f7c57600080fd5b50813567ffffffffffffffff811115612f9457600080fd5b6020830191508360208260051b8501011115612faf57600080fd5b9250929050565b600080600060408486031215612fcb57600080fd5b83359250602084013567ffffffffffffffff811115612fe957600080fd5b612ff586828701612f6a565b9497909650939450505050565b60008060006060848603121561301757600080fd5b61302084612e74565b925061302e60208501612e74565b9150604084013590509250925092565b6000806040838503121561305157600080fd5b50508035926020909101359150565b80358015158114610d6057600080fd5b60006020828403121561308257600080fd5b610d2082613060565b6000806020838503121561309e57600080fd5b823567ffffffffffffffff8111156130b557600080fd5b6130c185828601612f6a565b90969095509350505050565b600080604083850312156130e057600080fd5b823591506130f060208401612e74565b90509250929050565b6000806040838503121561310c57600080fd5b61311583612e74565b91506130f060208401613060565b60008060008060006080868803121561313b57600080fd5b61314486612e74565b945061315260208701612e74565b935060408601359250606086013567ffffffffffffffff8082111561317657600080fd5b818801915088601f83011261318a57600080fd5b81358181111561319957600080fd5b8960208285010111156131ab57600080fd5b9699959850939650602001949392505050565b600080604083850312156131d157600080fd5b6131da83612e74565b91506130f060208401612e74565b634e487b7160e01b600052601160045260246000fd5b81810381811115610775576107756131e8565b80820180821115610775576107756131e8565b8082028115828204841417610775576107756131e8565b634e487b7160e01b600052601260045260246000fd5b6000826132605761326061323b565b500490565b600060018201613277576132776131e8565b5060010190565b60008151613290818560208601612ed0565b9290920192915050565b7f7b226e616d65223a2242617568617573205369676e65742023000000000000008152600085516132d2816019850160208a01612ed0565b701116113232b9b1b934b83a34b7b7111d1160791b601991840191820152855161330381602a840160208a01612ed0565b6a11161134b6b0b3b2911d1160a91b602a9290910191820152845161332f816035840160208901612ed0565b6e11161130ba3a3934b13aba32b9911d60891b60359290910191820152835161335f816044840160208801612ed0565b607d60f81b604492909101918201526045019695505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516133b381601d850160208701612ed0565b91909101601d0192915050565b634e487b7160e01b600052602160045260246000fd5b600082516133e8818460208701612ed0565b7f406b65796672616d657320676c697463687b30252c746f7b7472616e73666f729201918252507f6d3a7472616e736c61746528302c30297d3230257b7472616e73666f726d3a7460208201527f72616e736c617465282d3570782c2d357078297d3430257b7472616e73666f7260408201527f6d3a7472616e736c617465283570782c357078297d3630257b7472616e73666f60608201527f726d3a7472616e736c617465282d313570782c30297d3830257b7472616e736660808201527f6f726d3a7472616e736c61746528313570782c30297d7d00000000000000000060a082015260b701919050565b7f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323081527f30302f7376672220646174612d6e616d653d2242617568617573205369676e6560208201527f74222069643d22426175686175735f5369676e657422207374796c653d22626160408201527f636b67726f756e642d636f6c6f723a7472616e73706172656e742220766965776060820152732137bc1e91181018101899999b901899999b911f60611b60808201526000835161359c816094850160208801612ed0565b6e1e17b9ba3cb6329f1e17b232b3399f60891b60949184019182015283516135cb8160a3840160208801612ed0565b7f3c636972636c652063783d22353025222063793d223530252220723d2236323860a392909101918201527011103334b6361e91313630b1b59110179f60791b60c382015260d401949350505050565b6000825161362d818460208701612ed0565b7f3c75736520687265663d22236865616447726f757022207472616e73666f726d9201918252507f3d227472616e736c617465282d31302c202d312922207374796c653d22616e6960208201527f6d6174696f6e3a676c697463682032307320696e66696e6974653b2d2d636f6c60408201527f6f723a20234630303b22202f3e3c75736520687265663d22236865616447726f60608201527f757022207472616e73666f726d3d227472616e736c6174652831302c2031292260808201527f207374796c653d22616e696d6174696f6e3a676c697463682032307320696e6660a08201527f696e6974653b616e696d6174696f6e2d64656c61793a2d3130733b2d2d636f6c60c08201526f37b91d1011981821a1a31a9d9110179f60811b60e082015260f001919050565b6000825161376b818460208701612ed0565b7f3c75736520687265663d22236865616447726f757022202f3e3c636972636c659201918252507f2063783d22353025222063793d223530252220723d2236323822207374726f6b60208201527f652d77696474683d223130707822207374796c653d2266696c6c3a7472616e7360408201526f3830b932b73a1110179f1e17b9bb339f60811b6060820152607001919050565b7f646174613a696d6167652f7376672b786d6c3b6261736536342c00000000000081526000825161383781601a850160208701612ed0565b91909101601a0192915050565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061386e57607f821691505b60208210810361388e57634e487b7160e01b600052602260045260246000fd5b50919050565b600082516138a6818460208701612ed0565b600b60fa1b920191825250600101919050565b600083516138cb818460208801612ed0565b8351908301906138df818360208801612ed0565b605d60f81b9101908152600101949350505050565b6000826139035761390361323b565b500690565b7f3c646566733e3c7374796c653e2e686561647b66696c6c3a766172282d2d636f8152656c6f722c202360d01b60208201526000835161394f816026850160208801612ed0565b70297d636972636c657b7374726f6b653a2360781b6026918401918201528351613980816037840160208801612ed0565b607d60f81b60379290910191820152603801949350505050565b828152600082516139b2816020850160208701612ed0565b919091016020019392505050565b6c1e3232b3399f1e39ba3cb6329f60991b8152600086516139e881600d850160208b01612ed0565b8651908301906139ff81600d840160208b01612ed0565b8651910190613a1581600d840160208a01612ed0565b8551910190613a2b81600d840160208901612ed0565b71636972636c65207b207374726f6b653a202360701b600d92909101918201528351613a5e81601f840160208801612ed0565b01601f01979650505050505050565b60008351613a7f818460208801612ed0565b673b66696c6c3a202360c01b9083019081528351613aa4816008840160208801612ed0565b01600801949350505050565b60008251613ac2818460208701612ed0565b613b7d60f01b920191825250600201919050565b7f222f3e3c73746f70206f66667365743d22353025222073746f702d636f6c6f728152623d222360e81b602082015260230190565b7f222f3e3c73746f70206f66667365743d2231303025222073746f702d636f6c6f815263723d222360e01b602082015260240190565b7f3c646566733e3c72616469616c4772616469656e742069643d2252616469616c81527f4772616469656e74222063783d22353025222063793d223530252220723d223460208201527f3725222066783d22353025222066793d2235302522206772616469656e74556e60408201527f6974733d227573657253706163654f6e557365223e3c73746f70206f66667365606082015273743d223025222073746f702d636f6c6f723d222360601b608082015260008551613c08816094850160208a01612ed0565b613c16609482850101613ad6565b90508551613c28818360208a01612ed0565b613c33818301613b0b565b9150508451613c46818360208901612ed0565b7f222f3e3c2f72616469616c4772616469656e743e3c7374796c653e2e6865616491019081527f7b66696c6c3a766172282d2d636f6c6f722c75726c282352616469616c47726160208201527f6469656e7429297d636972636c657b7374726f6b653a75726c282352616469616040820152716c4772616469656e74293b66696c6c3a202360701b6060820152613ce0607282018561327e565b613b7d60f01b8152600201979650505050505050565b7f3c646566733e3c6c696e6561724772616469656e742069643d224c696e656172815269023b930b234b2b73a11160b51b60208201528554600090602a908290600181811c9080831680613d4b57607f831692505b602083108103613d6957634e487b7160e01b85526022600452602485fd5b808015613d7d5760018114613d9857613dcb565b60ff198516602a8a0152602a84151585028a01019550613dcb565b60008e81526020902060005b85811015613dc05781548b82018a015290840190602001613da4565b5050602a848a010195505b50507f206772616469656e74556e6974733d227573657253706163654f6e557365223e845250507f3c73746f70206f66667365743d223025222073746f702d636f6c6f723d222300602083015250613ee4613ede613e4e613e48613e43613e3d613e38603f88018f61327e565b613ad6565b8c61327e565b613b0b565b8961327e565b7f222f3e3c2f6c696e6561724772616469656e743e3c7374796c653e2e6865616481527f7b66696c6c3a766172282d2d636f6c6f722c75726c28234c696e65617247726160208201527f6469656e7429297d636972636c657b7374726f6b653a75726c28234c696e6561604082015271724772616469656e74293b66696c6c3a202360701b606082015260720190565b8661327e565b915050613ef581613b7d60f01b9052565b600201979650505050505050565b60008551613f15818460208a01612ed0565b6e3d913a3930b4ba2fba3cb832911d1160891b9083019081528551613f4181600f840160208a01612ed0565b6a1116113b30b63ab2911d1160a91b600f92909101918201528451613f6d81601a840160208901612ed0565b61227d60f01b601a92909101918201528351613f9081601c840160208801612ed0565b01601c019695505050505050565b602360f81b815260008351613fba816001850160208801612ed0565b7f207b2066696c6c3a20766172282d2d636f6c6f722c20230000000000000000006001918401918201528351613ff7816018840160208801612ed0565b63293b207d60e01b60189290910191820152601c0194935050505056fe3c646566733e3c6c696e6561724772616469656e742069643d2253696c7665724772616469656e74222078313d223025222079313d223025222078323d2231303025222079323d2231303025223e3c73746f70206f66667365743d223025222073746f702d636f6c6f723d2273696c766572222f3e3c73746f70206f66667365743d22343525222073746f702d636f6c6f723d2223464646222f3e3c73746f70206f66667365743d22353525222073746f702d636f6c6f723d2223464646222f3e3c73746f70206f66667365743d2231303025222073746f702d636f6c6f723d2273696c766572222f3e3c2f6c696e6561724772616469656e743e3c7374796c653e2e686561647b66696c6c3a766172282d2d636f6c6f722c75726c282353696c7665724772616469656e7429297d636972636c657b7374726f6b653a75726c282353696c7665724772616469656e74297d54686520e2809c42617568617573205369676e6574e2809d204e46542c206f726967696e616c6c79206372656174656420696e2031393233206279204f736b6172205363686c656d6d65722c20697320616e20617574686f72697a656420636f6c6c61626f726174696f6e207769746820546865204f736b6172205363686c656d6d657220546865617472652041726368697665732074686174206272696e677320612073656d696e616c20776f726b206f6620323074682d63656e747572792064657369676e20696e746f2074686520626c6f636b636861696e206572612e205468652069636f6e69632042617568617573207369676e65742077696c6c2070657273697374206f6e20457468657265756d20666f72657665722c2061732066756c6c79206f6e636861696e205356472067656e657261746976652072656e646974696f6e732e3c646566733e3c6c696e6561724772616469656e742069643d22476f6c644772616469656e74222078313d223025222079313d223025222078323d2231303025222079323d2231303025223e3c73746f70206f66667365743d223025222073746f702d636f6c6f723d22676f6c64222f3e3c73746f70206f66667365743d22343525222073746f702d636f6c6f723d2223666666656331222f3e3c73746f70206f66667365743d22353525222073746f702d636f6c6f723d2223666666656331222f3e3c73746f70206f66667365743d2231303025222073746f702d636f6c6f723d2223653463323030222f3e3c2f6c696e6561724772616469656e743e3c7374796c653e2e686561647b66696c6c3a766172282d2d636f6c6f722c75726c2823476f6c644772616469656e7429297d636972636c657b7374726f6b653a75726c2823476f6c644772616469656e74297d3c646566733e3c7374796c653e2e686561647b66696c6c3a233030307d636972636c657b7374726f6b653a233030303b66696c6c3a234646467d3c672069643d226865616447726f7570223e3c7061746820643d224d3539322e383520313134372e35683134362e3833763134372e3235483539322e38357a2220636c6173733d2268656164222069643d224e65636b22202f3e3c7061746820643d224d3739322e3638203831302e3336763334352e3235483530322e31762d31352e3234683233342e3634563936342e3734682d35382e3331762d32352e35396835382e3331563831302e33367a2220636c6173733d2268656164222069643d224d6f75746822202f3e3c7061746820643d224d3831392e3532203830372e303776382e3533483638302e3533762d382e3533683130352e34336c2e32382d3735332e353620333320377a2220636c6173733d2268656164222069643d224e6f736522202f3e3c7061746820643d224d3634372e3235203235352e3731763331372e37682d31302e3633762d3131392e37483434352e3839563236362e3334483333302e3232762d31302e36337a2220636c6173733d2268656164222069643d2245796522202f3e3c2f673ea26469706673582212205e048e289624563b256452fe664a79af8d562f4a2231f35538b10bb0f905c88b64736f6c6343000817003378313d22393725222079313d22393725222078323d223325222079323d2233252278313d22393725222079313d22353025222078323d223325222079323d223530252278313d22353025222079313d22393725222078323d22353025222079323d2233252278313d223325222079313d22353025222078323d22393725222079323d223530252278313d223325222079313d22393725222078323d22393725222079323d2233252278313d223325222079313d223325222078323d22393725222079323d223937252278313d22353025222079313d223325222078323d22353025222079323d223937252278313d22393725222079313d223325222078323d223325222079323d2239372522

Deployed Bytecode

0x6080604052600436106102465760003560e01c8063638df30b11610139578063b88d4fde116100b6578063d46ba0e71161007a578063d46ba0e7146106a6578063e985e9c5146106c6578063efd0cbf9146106fc578063f04e283e1461070f578063f2fde38b14610722578063fee81cf41461073557600080fd5b8063b88d4fde146105e4578063b97dd9e2146105f7578063bc0bc6ba1461064c578063bc8893b41461066c578063c87b56dd1461068657600080fd5b80638da5cb5b116100fd5780638da5cb5b1461053f5780638dc251e31461055857806395d89b41146105785780639d034fe9146105a4578063a22cb465146105c457600080fd5b8063638df30b146104b757806370a08231146104d7578063715018a6146104f7578063733eb311146104ff57806376c7d8ca1461051f57600080fd5b80632607aafa116101c757806352b47bcc1161018b57806352b47bcc1461042f57806354d1f13d1461044f5780635aca1bb6146104575780635e5201b7146104775780636352211e1461049757600080fd5b80632607aafa146103935780632a55205a146103b35780633ccfd60b146103f257806342842e0e146104075780634e42d2471461041a57600080fd5b806318160ddd1161020e57806318160ddd1461033b5780631dc49fe91461035057806323381bd21461036357806323b872dd14610378578063256929621461038b57600080fd5b806301daeb511461024b57806301ffc9a71461027e57806306fdde03146102ae578063081812fc146102ee578063095ea7b314610326575b600080fd5b34801561025757600080fd5b5061026b610266366004612e8b565b610768565b6040519081526020015b60405180910390f35b34801561028a57600080fd5b5061029e610299366004612ea6565b61077b565b6040519015158152602001610275565b3480156102ba57600080fd5b5060408051808201909152600e81526d10985d5a185d5cc814da59db995d60921b60208201525b6040516102759190612ef4565b3480156102fa57600080fd5b5061030e610309366004612f27565b610799565b6040516001600160a01b039091168152602001610275565b610339610334366004612f40565b6107d8565b005b34801561034757600080fd5b5061026b6107e7565b61033961035e366004612fb6565b6107fd565b34801561036f57600080fd5b5060005461026b565b610339610386366004613002565b61097d565b610339610a7e565b34801561039f57600080fd5b506102e16103ae366004612f27565b610ace565b3480156103bf57600080fd5b506103d36103ce36600461303e565b610b02565b604080516001600160a01b039093168352602083019190915201610275565b3480156103fe57600080fd5b50610339610b57565b610339610415366004613002565b610b76565b34801561042657600080fd5b5061029e610ba3565b34801561043b57600080fd5b5061026b61044a366004612e8b565b610c98565b610339610ca5565b34801561046357600080fd5b50610339610472366004613070565b610ce1565b34801561048357600080fd5b5061026b610492366004612f27565b610cfc565b3480156104a357600080fd5b5061030e6104b2366004612f27565b610d27565b3480156104c357600080fd5b506103396104d2366004612f27565b610d65565b3480156104e357600080fd5b5061026b6104f2366004612e8b565b610d72565b610339610dad565b34801561050b57600080fd5b5061033961051a366004612f27565b610dbf565b34801561052b57600080fd5b5061033961053a36600461308b565b610dcc565b34801561054b57600080fd5b50638b78c6d8195461030e565b34801561056457600080fd5b50610339610573366004612e8b565b610edd565b34801561058457600080fd5b5060408051808201909152600381526242415560e81b60208201526102e1565b3480156105b057600080fd5b506103396105bf3660046130cd565b610ef4565b3480156105d057600080fd5b506103396105df3660046130f9565b610f7f565b6103396105f2366004613123565b610fd5565b34801561060357600080fd5b5061060c611030565b6040516102759190815181526020808301516001600160801b03169082015260408083015115159082015260609182015115159181019190915260800190565b34801561065857600080fd5b5061060c610667366004612f27565b61105b565b34801561067857600080fd5b5060125461029e9060ff1681565b34801561069257600080fd5b506102e16106a1366004612f27565b6110c9565b3480156106b257600080fd5b5061026b6106c1366004612e8b565b611187565b3480156106d257600080fd5b5061029e6106e13660046131be565b601c52670a5a2e7a000000006008526000526030600c205490565b61033961070a366004612f27565b611194565b61033961071d366004612e8b565b6112b6565b610339610730366004612e8b565b6112f3565b34801561074157600080fd5b5061026b610750366004612e8b565b63389a75e1600c908152600091909152602090205490565b600061077582600161131a565b92915050565b6000632a55205a60e083901c9081146301ffc9a79190911417610775565b600081600052673ec412a9852d173d60c11b601c52602060002082018201805460601b6107ce5763ceea21b66000526004601cfd5b6001015492915050565b6107e33383836113bd565b5050565b600060016011546107f891906131fe565b905090565b600061080a33600161131a565b601154909150600361081c8684613211565b111561083b5760405163303b682f60e01b815260040160405180910390fd5b610760600161084a8784613211565b61085491906131fe565b11156108735760405163124212e560e21b815260040160405180910390fd5b60026108878667013b7b21280e0000613224565b6108919190613251565b34146108b057604051632a9ffab760e21b815260040160405180910390fd5b604080513360601b6bffffffffffffffffffffffff191660208083019190915282516014818403018152603490920190925280519101206010546108f890869086908461145e565b610915576040516309bde33960e01b815260040160405180910390fd5b61091d610ba3565b506109333361092c8886613211565b6001611498565b85601160008282546109459190613211565b90915550600090505b868110156109745761096c336109648386613211565b600054611565565b60010161094e565b50505050505050565b6000818152673ec412a9852d173d60c11b3317601c52602090208101810180546001600160a01b0394851694938416938116919082861483026109cf5767ceea21b6a1148100831560021b526004601cfd5b8560005281600101549250823314863314176109fd576030600c20546109fd57634b6e7f186000526004601cfd5b8215610a0b57600082600101555b85851818905550601c600c8181208054600019019055600084905220805460010163ffffffff81168402610a4e5767ea553b3401336cea841560021b526004601cfd5b90558082847fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600038a45b505050565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b6060610af8826000818152673ec412a9852d173d60c11b601c52602090208101015460601b151590565b50610775826115f0565b600082815268aa4ec00224afccfdb76020526040812054606081901c91906127109083610b36576020515490508060601c93505b606084901b1884600019829004811182023d3d3e9396930204935090915050565b610b5f611938565b610b74610b6f638b78c6d8195490565b611953565b565b610b8183838361097d565b813b15610a7957610a798383836040518060200160405280600081525061196f565b60008054815260026020526040812054801580610bd95750600160ff1b8116158015610bd95750610bd6610100436131fe565b81105b15610c0457600154610beb9043613211565b6000805481526002602052604081209190915592915050565b80431115610c9057600160ff1b814044604051602001610c2e929190918252602082015260400190565b60408051601f1981840301815291815281516020928301206000805481526002909352908220921790915580549080610c6683613265565b9091555050600154610c789043613211565b60008054815260026020526040902055506001919050565b600091505090565b600061077582600261131a565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b610ce9611938565b6012805460ff1916911515919091179055565b600081815260026020526040812054600160ff1b811615610d1d5780610d20565b60005b9392505050565b6000818152673ec412a9852d173d60c11b601c526020902081018101546001600160a01b031680610d605763ceea21b66000526004601cfd5b919050565b610d6d611938565b600f55565b600081610d8757638f4eb6046000526004601cfd5b673ec412a9852d173d60c11b601c528160005263ffffffff601c600c2054169050919050565b610db5611938565b610b7460006119fb565b610dc7611938565b601055565b6001610dd933600061131a565b610de4906001613211565b1115610e035760405163303b682f60e01b815260040160405180910390fd5b61076060016011546001610e179190613211565b610e2191906131fe565b1115610e405760405163124212e560e21b815260040160405180910390fd5b604080513360601b6bffffffffffffffffffffffff19166020808301919091528251601481840301815260349092019092528051910120600f54610e8890849084908461145e565b610ea5576040516309bde33960e01b815260040160405180910390fd5b610ead610ba3565b50610ebb3360016000611498565b60118054610a79913391906000610ed183613265565b90915550600054611565565b610ee5611938565b610ef181610320611a39565b50565b610efc611938565b6011546107606001610f0e8584613211565b610f1891906131fe565b1115610f375760405163124212e560e21b815260040160405180910390fd5b610f3f610ba3565b508260116000828254610f529190613211565b90915550600090505b83811015610f7957610f71836109648385613211565b600101610f5b565b50505050565b801515905081601c52670a5a2e7a0000000060085233600052806030600c2055806000528160601b60601c337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160206000a35050565b610fe085858561097d565b833b156110295761102985858585858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061196f92505050565b5050505050565b6040805160808101825260008082526020820181905291810182905260608101919091526107f86000545b60408051608081018252600080825260208201819052918101829052606081019190915260008281526002602052604081205490600160ff1b821690036110b0576001600160801b03811660208301526110b4565b8082525b15156040820152805115156060820152919050565b60606110f3826000818152673ec412a9852d173d60c11b601c52602090208101015460601b151590565b5060006110ff83611a89565b905060008160405180610180016040528061014881526020016141676101489139611129866115f0565b61113287611acd565b604051602001611145949392919061329a565b604051602081830303815290604052905061115f81611f17565b60405160200161116f919061337b565b60405160208183030381529060405292505050919050565b600061077582600061131a565b60006111a133600261131a565b6011546012549192509060ff166111cb5760405163b7b2409760e01b815260040160405180910390fd5b600a6111d78484613211565b11156111f65760405163303b682f60e01b815260040160405180910390fd5b61076060016112058584613211565b61120f91906131fe565b111561122e5760405163124212e560e21b815260040160405180910390fd5b6112408367013b7b21280e0000613224565b341461125f57604051632a9ffab760e21b815260040160405180910390fd5b611267610ba3565b5061127d336112768585613211565b6002611498565b826011600082825461128f9190613211565b90915550600090505b83811015610f79576112ae336109648385613211565b600101611298565b6112be611938565b63389a75e1600c52806000526020600c2080544211156112e657636f5e88186000526004601cfd5b60009055610ef1816119fb565b6112fb611938565b8060601b61131157637448fbae6000526004601cfd5b610ef1816119fb565b60008061134284673ec412a9852d173d60c11b601c908152600091909152600c205460201c90565b90506000836002811115611358576113586133c0565b03611367576001169050610775565b600183600281111561137b5761137b6133c0565b0361138d5760011c6003169050610775565b60028360028111156113a1576113a16133c0565b036113b35760031c600f169050610775565b5060009392505050565b60001960601c828116925083811693508160005283673ec412a9852d173d60c11b17601c52602060002082018201805482169150816114045763ceea21b66000526004601cfd5b81851485151761142a57816000526030600c205461142a57634b6e7f186000526004601cfd5b6001018390558183827f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600038a450505050565b60008315611490578360051b8501855b803580851160051b9485526020948518526040600020930181811061146e5750505b501492915050565b673ec412a9852d173d60c11b601c9081526000848152600c919091205460201c908260028111156114cb576114cb6133c0565b036114db57600119168217611539565b60018260028111156114ef576114ef6133c0565b0361150c57600619166002600160e11b03600184901b1617611539565b6002826002811115611520576115206133c0565b0361153957607819166008600160e31b03600384901b16175b673ec412a9852d173d60c11b601c9081526000859052600c208054602081811c8418901b189055610f79565b8260601b60601c925081600052673ec412a9852d173d60c11b601c52828160a01b176020600020830183015582600052601c600c20600181540163ffffffff811685026115c15767ea553b3401336cea851560021b526004601cfd5b9055818360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8138a4505050565b606060006115fd83611f25565b9050600061160a8461200f565b90506060600a83600a811115611622576116226133c0565b036116555761164e6040518060400160405280600681526020016545414541454160d01b815250612088565b9050611843565b600083600a811115611669576116696133c0565b036116925761164e6040518060400160405280600381526020016223232360e91b815250612088565b600183600a8111156116a6576116a66133c0565b036116cb576040518060600160405280603a8152602001614400603a91399050611843565b600283600a8111156116df576116df6133c0565b036117575761170c82604051806040016040528060068152602001651a5cd1dbdb1960d21b8152506120b3565b156117345760405180610180016040528061015181526020016142af61015191399050611843565b604051806101800160405280610152815260200161401561015291399050611843565b600383600a81111561176b5761176b6133c0565b0361177d5761164e82600460006120f7565b600483600a811115611791576117916133c0565b036117a35761164e82600660006120f7565b600583600a8111156117b7576117b76133c0565b036117c95761164e82600860006120f7565b600683600a8111156117dd576117dd6133c0565b036117ef5761164e82600a60006120f7565b600783600a811115611803576118036133c0565b036118115761164e82612274565b600883600a811115611825576118256133c0565b036118335761164e8261233b565b61184082600c60016120f7565b90505b61184c82612485565b15611874578060405160200161186291906133d6565b60405160208183030381529060405290505b80604051806101c0016040528061018d815260200161443a61018d91396040516020016118a29291906134d5565b60405160208183030381529060405293506118bc82612485565b156118e457836040516020016118d2919061361b565b60405160208183030381529060405293505b836040516020016118f59190613759565b604051602081830303815290604052935061190f84611f17565b60405160200161191f91906137ff565b6040516020818303038152906040529350505050919050565b638b78c6d819543314610b74576382b429006000526004601cfd5b60003860003847855af1610ef15763b12d13eb6000526004601cfd5b60405163150b7a028082523360208301528560601b60601c604083015283606083015260808083015282518060a084015280156119b6578060c08401826020870160045afa505b60208360a48301601c860160008a5af16119d9573d156119d9573d6000843e3d83fd5b508060e01b8251146119f35763d1a57ed66000526004601cfd5b505050505050565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b6bffffffffffffffffffffffff1661271080821115611a605763350a88b36000526004601cfd5b8260601b80611a775763b4457eaa6000526004601cfd5b90911768aa4ec00224afccfdb7555050565b60606080604051019050602081016040526000815280600019835b928101926030600a8206018453600a900480611aa4575050819003601f19909101908152919050565b60606000611ada83611f25565b90506000611ae78461200f565b9050604051806040016040528060018152602001605b60f81b8152509250611be98360405180604001604052806009815260200168417274205374796c6560b81b815250600385600a811115611b3f57611b3f6133c0565b81548110611b4f57611b4f613844565b906000526020600020018054611b649061385a565b80601f0160208091040260200160405190810160405280929190818152602001828054611b909061385a565b8015611bdd5780601f10611bb257610100808354040283529160200191611bdd565b820191906000526020600020905b815481529060010190602001808311611bc057829003601f168201915b505050505060006124d5565b92506060600a83600a811115611c0157611c016133c0565b14611f045783604051602001611c179190613894565b6040516020818303038152906040529350611c3182612485565b15611c8057611c7d846040518060400160405280600681526020016508ed8d2e8c6d60d31b815250604051806040016040528060048152602001635472756560e01b81525060016124d5565b93505b600983600a811115611c9457611c946133c0565b1480611cb15750600783600a811115611caf57611caf6133c0565b145b80611ccd5750600883600a811115611ccb57611ccb6133c0565b145b15611ce557611cde8284600d612542565b9050611f04565b600083600a811115611cf957611cf96133c0565b03611d4257611cde60405180604001604052806005815260200164576869746560d81b81525060405180604001604052806005815260200164426c61636b60d81b815250612980565b600183600a811115611d5657611d566133c0565b03611d9f57611cde60405180604001604052806005815260200164426c61636b60d81b81525060405180604001604052806005815260200164576869746560d81b815250612980565b600283600a811115611db357611db36133c0565b03611e6d57611de082604051806040016040528060068152602001651a5cd1dbdb1960d21b8152506120b3565b15611e2857611cde6040518060400160405280600481526020016311dbdb1960e21b81525060405180604001604052806005815260200164426c61636b60d81b815250612980565b611cde6040518060400160405280600681526020016529b4b63b32b960d11b81525060405180604001604052806005815260200164426c61636b60d81b815250612980565b600383600a811115611e8157611e816133c0565b03611e9257611cde82846005612542565b600483600a811115611ea657611ea66133c0565b03611eb757611cde82846007612542565b600583600a811115611ecb57611ecb6133c0565b03611edc57611cde82846009612542565b600683600a811115611ef057611ef06133c0565b03611f0457611f018284600b612542565b90505b838160405160200161191f9291906138b9565b606061077582600080612a8a565b600080611f318361200f565b905080600003611f445750600a92915050565b6000611f52612710836138f4565b90506014811015611f67575060009392505050565b602d811015611f7a575060019392505050565b6072811015611f8d575060029392505050565b61019e811015611fa1575060039392505050565b6102ca811015611fb5575060049392505050565b6103f6811015611fc9575060059392505050565b610522811015611fdd575060069392505050565b61077a811015611ff1575060079392505050565b610d56811015612005575060089392505050565b5060099392505050565b60008061204e61203b846000818152673ec412a9852d173d60c11b601c52602090208101015460a01c90565b6bffffffffffffffffffffffff16610cfc565b90508015610d1d5760408051602081018390529081018490526060016040516020818303038152906040528051906020012060001c610d20565b6060818260405160200161209d929190613908565b6040516020818303038152906040529050919050565b6000600283836040516020016120ca92919061399a565b6040516020818303038152906040528051906020012060001c6120ed91906138f4565b6001149392505050565b60608082156121305761212d856040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b81525086612b7f565b90505b61215885604051806040016040528060048152602001634e65636b60e01b8152508684612c6e565b612181866040518060400160405280600581526020016409adeeae8d60db1b8152508785612c6e565b6121a987604051806040016040528060048152602001634e6f736560e01b8152508886612c6e565b6121d0886040518060400160405280600381526020016245796560e81b8152508987612c6e565b6121fa8960405180604001604052806006815260200165436972636c6560d01b8152508a88612ca7565b60405160200161220e9594939291906139c0565b6040516020818303038152906040529150821561224a578181604051602001612238929190613a6d565b60405160208183030381529060405291505b8160405160200161225b9190613ab0565b6040516020818303038152906040529150509392505050565b60606122a18260405180604001604052806007815260200166436f6c6f72204960c81b815250600c612b7f565b6122cd8360405180604001604052806008815260200167436f6c6f7220494960c01b815250600c612b7f565b6122fa8460405180604001604052806009815260200168436f6c6f722049494960b81b815250600c612b7f565b612328856040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b815250600c612b7f565b60405160200161209d9493929190613b41565b60606000600883604051602001612366918152682234b932b1ba34b7b760b91b602082015260290190565b6040516020818303038152906040528051906020012060001c61238991906138f4565b9050600e818154811061239e5761239e613844565b906000526020600020016123d38460405180604001604052806007815260200166436f6c6f72204960c81b815250600c612b7f565b6123ff8560405180604001604052806008815260200167436f6c6f7220494960c01b815250600c612b7f565b61242c8660405180604001604052806009815260200168436f6c6f722049494960b81b815250600c612b7f565b61245a876040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b815250600c612b7f565b60405160200161246e959493929190613cf6565b604051602081830303815290604052915050919050565b60006064826040516020016124ab9181526508ed8d2e8c6d60d31b602082015260260190565b6040516020818303038152906040528051906020012060001c6124ce91906138f4565b1592915050565b60606000826124f3576040518060200160405280600081525061250e565b604051806040016040528060018152602001600b60fa1b8152505b9050858585836040516020016125279493929190613f03565b6040516020818303038152906040529150505b949350505050565b6060600a83600a811115612558576125586133c0565b14610d2057600783600a811115612571576125716133c0565b148061258e5750600883600a81111561258c5761258c6133c0565b145b156126f2576125e88160405180604001604052806007815260200166436f6c6f72204960c81b8152506125e18760405180604001604052806007815260200166436f6c6f72204960c81b81525087612b7f565b60016124d5565b905061263a8160405180604001604052806008815260200167436f6c6f7220494960c01b8152506125e18760405180604001604052806008815260200167436f6c6f7220494960c01b81525087612b7f565b905061268e8160405180604001604052806009815260200168436f6c6f722049494960b81b8152506125e18760405180604001604052806009815260200168436f6c6f722049494960b81b81525087612b7f565b90506126eb816040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b8152506126e4876040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b81525087612b7f565b60006124d5565b9050610d20565b6000600984600a811115612708576127086133c0565b146127305760405180604001604052806005815260200164426c61636b60d81b81525061275d565b61275d856040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b81525085612b7f565b90506127a882604051806040016040528060048152602001634e65636b60e01b8152506125e188604051806040016040528060048152602001634e65636b60e01b8152508887612ca7565b91506127f5826040518060400160405280600581526020016409adeeae8d60db1b8152506125e1886040518060400160405280600581526020016409adeeae8d60db1b8152508887612ca7565b915061284082604051806040016040528060048152602001634e6f736560e01b8152506125e188604051806040016040528060048152602001634e6f736560e01b8152508887612ca7565b9150612889826040518060400160405280600381526020016245796560e81b8152506125e1886040518060400160405280600381526020016245796560e81b8152508887612ca7565b91506128d88260405180604001604052806006815260200165436972636c6560d01b8152506125e18860405180604001604052806006815260200165436972636c6560d01b8152508887612ca7565b9150600984600a8111156128ee576128ee6133c0565b0361292957612922826040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b8152508360006124d5565b9150612978565b612975826040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b81525060405180604001604052806005815260200164426c61636b60d81b81525060006124d5565b91505b509392505050565b60606129ab81604051806040016040528060048152602001634e65636b60e01b8152508560016124d5565b90506129d7816040518060400160405280600581526020016409adeeae8d60db1b8152508560016124d5565b9050612a0281604051806040016040528060048152602001634e6f736560e01b8152508560016124d5565b9050612a2c816040518060400160405280600381526020016245796560e81b8152508560016124d5565b9050612a598160405180604001604052806006815260200165436972636c6560d01b8152508560016124d5565b9050610d20816040518060400160405280600a815260200169109858dad9dc9bdd5b9960b21b8152508460006124d5565b606083518015612978576003600282010460021b60405192507f4142434445464748494a4b4c4d4e4f505152535455565758595a616263646566601f526106708515027f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392d5f18603f52602083018181018388602001018051600082525b60038a0199508951603f8160121c1651600053603f81600c1c1651600153603f8160061c1651600253603f811651600353506000518452600484019350828410612b06579052602001604052613d3d60f01b60038406600204808303919091526000861515909102918290035290038252509392505050565b8054604051606091600091612b9a908790879060200161399a565b6040516020818303038152906040528051906020012060001c612bbd91906138f4565b9050828181548110612bd157612bd1613844565b906000526020600020018054612be69061385a565b80601f0160208091040260200160405190810160405280929190818152602001828054612c129061385a565b8015612c5f5780601f10612c3457610100808354040283529160200191612c5f565b820191906000526020600020905b815481529060010190602001808311612c4257829003601f168201915b50505050509150509392505050565b606083612c7d86868686612ca7565b604051602001612c8e929190613f9e565b6040516020818303038152906040529050949350505050565b8154604051606091600091612cc2908890889060200161399a565b6040516020818303038152906040528051906020012060001c612ce591906138f4565b90506000848281548110612cfb57612cfb613844565b906000526020600020018054612d109061385a565b80601f0160208091040260200160405190810160405280929190818152602001828054612d3c9061385a565b8015612d895780601f10612d5e57610100808354040283529160200191612d89565b820191906000526020600020905b815481529060010190602001808311612d6c57829003601f168201915b505050505090508380519060200120818051906020012003612e6a5784548590612db4846001613211565b612dbe91906138f4565b81548110612dce57612dce613844565b906000526020600020018054612de39061385a565b80601f0160208091040260200160405190810160405280929190818152602001828054612e0f9061385a565b8015612e5c5780601f10612e3157610100808354040283529160200191612e5c565b820191906000526020600020905b815481529060010190602001808311612e3f57829003601f168201915b50505050509250505061253a565b9695505050505050565b80356001600160a01b0381168114610d6057600080fd5b600060208284031215612e9d57600080fd5b610d2082612e74565b600060208284031215612eb857600080fd5b81356001600160e01b031981168114610d2057600080fd5b60005b83811015612eeb578181015183820152602001612ed3565b50506000910152565b6020815260008251806020840152612f13816040850160208701612ed0565b601f01601f19169190910160400192915050565b600060208284031215612f3957600080fd5b5035919050565b60008060408385031215612f5357600080fd5b612f5c83612e74565b946020939093013593505050565b60008083601f840112612f7c57600080fd5b50813567ffffffffffffffff811115612f9457600080fd5b6020830191508360208260051b8501011115612faf57600080fd5b9250929050565b600080600060408486031215612fcb57600080fd5b83359250602084013567ffffffffffffffff811115612fe957600080fd5b612ff586828701612f6a565b9497909650939450505050565b60008060006060848603121561301757600080fd5b61302084612e74565b925061302e60208501612e74565b9150604084013590509250925092565b6000806040838503121561305157600080fd5b50508035926020909101359150565b80358015158114610d6057600080fd5b60006020828403121561308257600080fd5b610d2082613060565b6000806020838503121561309e57600080fd5b823567ffffffffffffffff8111156130b557600080fd5b6130c185828601612f6a565b90969095509350505050565b600080604083850312156130e057600080fd5b823591506130f060208401612e74565b90509250929050565b6000806040838503121561310c57600080fd5b61311583612e74565b91506130f060208401613060565b60008060008060006080868803121561313b57600080fd5b61314486612e74565b945061315260208701612e74565b935060408601359250606086013567ffffffffffffffff8082111561317657600080fd5b818801915088601f83011261318a57600080fd5b81358181111561319957600080fd5b8960208285010111156131ab57600080fd5b9699959850939650602001949392505050565b600080604083850312156131d157600080fd5b6131da83612e74565b91506130f060208401612e74565b634e487b7160e01b600052601160045260246000fd5b81810381811115610775576107756131e8565b80820180821115610775576107756131e8565b8082028115828204841417610775576107756131e8565b634e487b7160e01b600052601260045260246000fd5b6000826132605761326061323b565b500490565b600060018201613277576132776131e8565b5060010190565b60008151613290818560208601612ed0565b9290920192915050565b7f7b226e616d65223a2242617568617573205369676e65742023000000000000008152600085516132d2816019850160208a01612ed0565b701116113232b9b1b934b83a34b7b7111d1160791b601991840191820152855161330381602a840160208a01612ed0565b6a11161134b6b0b3b2911d1160a91b602a9290910191820152845161332f816035840160208901612ed0565b6e11161130ba3a3934b13aba32b9911d60891b60359290910191820152835161335f816044840160208801612ed0565b607d60f81b604492909101918201526045019695505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516133b381601d850160208701612ed0565b91909101601d0192915050565b634e487b7160e01b600052602160045260246000fd5b600082516133e8818460208701612ed0565b7f406b65796672616d657320676c697463687b30252c746f7b7472616e73666f729201918252507f6d3a7472616e736c61746528302c30297d3230257b7472616e73666f726d3a7460208201527f72616e736c617465282d3570782c2d357078297d3430257b7472616e73666f7260408201527f6d3a7472616e736c617465283570782c357078297d3630257b7472616e73666f60608201527f726d3a7472616e736c617465282d313570782c30297d3830257b7472616e736660808201527f6f726d3a7472616e736c61746528313570782c30297d7d00000000000000000060a082015260b701919050565b7f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323081527f30302f7376672220646174612d6e616d653d2242617568617573205369676e6560208201527f74222069643d22426175686175735f5369676e657422207374796c653d22626160408201527f636b67726f756e642d636f6c6f723a7472616e73706172656e742220766965776060820152732137bc1e91181018101899999b901899999b911f60611b60808201526000835161359c816094850160208801612ed0565b6e1e17b9ba3cb6329f1e17b232b3399f60891b60949184019182015283516135cb8160a3840160208801612ed0565b7f3c636972636c652063783d22353025222063793d223530252220723d2236323860a392909101918201527011103334b6361e91313630b1b59110179f60791b60c382015260d401949350505050565b6000825161362d818460208701612ed0565b7f3c75736520687265663d22236865616447726f757022207472616e73666f726d9201918252507f3d227472616e736c617465282d31302c202d312922207374796c653d22616e6960208201527f6d6174696f6e3a676c697463682032307320696e66696e6974653b2d2d636f6c60408201527f6f723a20234630303b22202f3e3c75736520687265663d22236865616447726f60608201527f757022207472616e73666f726d3d227472616e736c6174652831302c2031292260808201527f207374796c653d22616e696d6174696f6e3a676c697463682032307320696e6660a08201527f696e6974653b616e696d6174696f6e2d64656c61793a2d3130733b2d2d636f6c60c08201526f37b91d1011981821a1a31a9d9110179f60811b60e082015260f001919050565b6000825161376b818460208701612ed0565b7f3c75736520687265663d22236865616447726f757022202f3e3c636972636c659201918252507f2063783d22353025222063793d223530252220723d2236323822207374726f6b60208201527f652d77696474683d223130707822207374796c653d2266696c6c3a7472616e7360408201526f3830b932b73a1110179f1e17b9bb339f60811b6060820152607001919050565b7f646174613a696d6167652f7376672b786d6c3b6261736536342c00000000000081526000825161383781601a850160208701612ed0565b91909101601a0192915050565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061386e57607f821691505b60208210810361388e57634e487b7160e01b600052602260045260246000fd5b50919050565b600082516138a6818460208701612ed0565b600b60fa1b920191825250600101919050565b600083516138cb818460208801612ed0565b8351908301906138df818360208801612ed0565b605d60f81b9101908152600101949350505050565b6000826139035761390361323b565b500690565b7f3c646566733e3c7374796c653e2e686561647b66696c6c3a766172282d2d636f8152656c6f722c202360d01b60208201526000835161394f816026850160208801612ed0565b70297d636972636c657b7374726f6b653a2360781b6026918401918201528351613980816037840160208801612ed0565b607d60f81b60379290910191820152603801949350505050565b828152600082516139b2816020850160208701612ed0565b919091016020019392505050565b6c1e3232b3399f1e39ba3cb6329f60991b8152600086516139e881600d850160208b01612ed0565b8651908301906139ff81600d840160208b01612ed0565b8651910190613a1581600d840160208a01612ed0565b8551910190613a2b81600d840160208901612ed0565b71636972636c65207b207374726f6b653a202360701b600d92909101918201528351613a5e81601f840160208801612ed0565b01601f01979650505050505050565b60008351613a7f818460208801612ed0565b673b66696c6c3a202360c01b9083019081528351613aa4816008840160208801612ed0565b01600801949350505050565b60008251613ac2818460208701612ed0565b613b7d60f01b920191825250600201919050565b7f222f3e3c73746f70206f66667365743d22353025222073746f702d636f6c6f728152623d222360e81b602082015260230190565b7f222f3e3c73746f70206f66667365743d2231303025222073746f702d636f6c6f815263723d222360e01b602082015260240190565b7f3c646566733e3c72616469616c4772616469656e742069643d2252616469616c81527f4772616469656e74222063783d22353025222063793d223530252220723d223460208201527f3725222066783d22353025222066793d2235302522206772616469656e74556e60408201527f6974733d227573657253706163654f6e557365223e3c73746f70206f66667365606082015273743d223025222073746f702d636f6c6f723d222360601b608082015260008551613c08816094850160208a01612ed0565b613c16609482850101613ad6565b90508551613c28818360208a01612ed0565b613c33818301613b0b565b9150508451613c46818360208901612ed0565b7f222f3e3c2f72616469616c4772616469656e743e3c7374796c653e2e6865616491019081527f7b66696c6c3a766172282d2d636f6c6f722c75726c282352616469616c47726160208201527f6469656e7429297d636972636c657b7374726f6b653a75726c282352616469616040820152716c4772616469656e74293b66696c6c3a202360701b6060820152613ce0607282018561327e565b613b7d60f01b8152600201979650505050505050565b7f3c646566733e3c6c696e6561724772616469656e742069643d224c696e656172815269023b930b234b2b73a11160b51b60208201528554600090602a908290600181811c9080831680613d4b57607f831692505b602083108103613d6957634e487b7160e01b85526022600452602485fd5b808015613d7d5760018114613d9857613dcb565b60ff198516602a8a0152602a84151585028a01019550613dcb565b60008e81526020902060005b85811015613dc05781548b82018a015290840190602001613da4565b5050602a848a010195505b50507f206772616469656e74556e6974733d227573657253706163654f6e557365223e845250507f3c73746f70206f66667365743d223025222073746f702d636f6c6f723d222300602083015250613ee4613ede613e4e613e48613e43613e3d613e38603f88018f61327e565b613ad6565b8c61327e565b613b0b565b8961327e565b7f222f3e3c2f6c696e6561724772616469656e743e3c7374796c653e2e6865616481527f7b66696c6c3a766172282d2d636f6c6f722c75726c28234c696e65617247726160208201527f6469656e7429297d636972636c657b7374726f6b653a75726c28234c696e6561604082015271724772616469656e74293b66696c6c3a202360701b606082015260720190565b8661327e565b915050613ef581613b7d60f01b9052565b600201979650505050505050565b60008551613f15818460208a01612ed0565b6e3d913a3930b4ba2fba3cb832911d1160891b9083019081528551613f4181600f840160208a01612ed0565b6a1116113b30b63ab2911d1160a91b600f92909101918201528451613f6d81601a840160208901612ed0565b61227d60f01b601a92909101918201528351613f9081601c840160208801612ed0565b01601c019695505050505050565b602360f81b815260008351613fba816001850160208801612ed0565b7f207b2066696c6c3a20766172282d2d636f6c6f722c20230000000000000000006001918401918201528351613ff7816018840160208801612ed0565b63293b207d60e01b60189290910191820152601c0194935050505056fe3c646566733e3c6c696e6561724772616469656e742069643d2253696c7665724772616469656e74222078313d223025222079313d223025222078323d2231303025222079323d2231303025223e3c73746f70206f66667365743d223025222073746f702d636f6c6f723d2273696c766572222f3e3c73746f70206f66667365743d22343525222073746f702d636f6c6f723d2223464646222f3e3c73746f70206f66667365743d22353525222073746f702d636f6c6f723d2223464646222f3e3c73746f70206f66667365743d2231303025222073746f702d636f6c6f723d2273696c766572222f3e3c2f6c696e6561724772616469656e743e3c7374796c653e2e686561647b66696c6c3a766172282d2d636f6c6f722c75726c282353696c7665724772616469656e7429297d636972636c657b7374726f6b653a75726c282353696c7665724772616469656e74297d54686520e2809c42617568617573205369676e6574e2809d204e46542c206f726967696e616c6c79206372656174656420696e2031393233206279204f736b6172205363686c656d6d65722c20697320616e20617574686f72697a656420636f6c6c61626f726174696f6e207769746820546865204f736b6172205363686c656d6d657220546865617472652041726368697665732074686174206272696e677320612073656d696e616c20776f726b206f6620323074682d63656e747572792064657369676e20696e746f2074686520626c6f636b636861696e206572612e205468652069636f6e69632042617568617573207369676e65742077696c6c2070657273697374206f6e20457468657265756d20666f72657665722c2061732066756c6c79206f6e636861696e205356472067656e657261746976652072656e646974696f6e732e3c646566733e3c6c696e6561724772616469656e742069643d22476f6c644772616469656e74222078313d223025222079313d223025222078323d2231303025222079323d2231303025223e3c73746f70206f66667365743d223025222073746f702d636f6c6f723d22676f6c64222f3e3c73746f70206f66667365743d22343525222073746f702d636f6c6f723d2223666666656331222f3e3c73746f70206f66667365743d22353525222073746f702d636f6c6f723d2223666666656331222f3e3c73746f70206f66667365743d2231303025222073746f702d636f6c6f723d2223653463323030222f3e3c2f6c696e6561724772616469656e743e3c7374796c653e2e686561647b66696c6c3a766172282d2d636f6c6f722c75726c2823476f6c644772616469656e7429297d636972636c657b7374726f6b653a75726c2823476f6c644772616469656e74297d3c646566733e3c7374796c653e2e686561647b66696c6c3a233030307d636972636c657b7374726f6b653a233030303b66696c6c3a234646467d3c672069643d226865616447726f7570223e3c7061746820643d224d3539322e383520313134372e35683134362e3833763134372e3235483539322e38357a2220636c6173733d2268656164222069643d224e65636b22202f3e3c7061746820643d224d3739322e3638203831302e3336763334352e3235483530322e31762d31352e3234683233342e3634563936342e3734682d35382e3331762d32352e35396835382e3331563831302e33367a2220636c6173733d2268656164222069643d224d6f75746822202f3e3c7061746820643d224d3831392e3532203830372e303776382e3533483638302e3533762d382e3533683130352e34336c2e32382d3735332e353620333320377a2220636c6173733d2268656164222069643d224e6f736522202f3e3c7061746820643d224d3634372e3235203235352e3731763331372e37682d31302e3633762d3131392e37483434352e3839563236362e3334483333302e3232762d31302e36337a2220636c6173733d2268656164222069643d2245796522202f3e3c2f673ea26469706673582212205e048e289624563b256452fe664a79af8d562f4a2231f35538b10bb0f905c88b64736f6c63430008170033

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  ]

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.