ETH Price: $3,346.82 (-0.50%)

Contract

0x7E4343831C173125B21d162bA19B5C95b9853509
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BaseFacet

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 25 : BaseFacet.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {AddressUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import {ERC721AUpgradeable} from "erc721a-upgradeable/contracts/ERC721AUpgradeable.sol";
import {ERC2981} from "@solidstate/contracts/token/common/ERC2981/ERC2981.sol";
import {ERC2981Storage} from "@solidstate/contracts/token/common/ERC2981/ERC2981Storage.sol";
import {IERC165} from "@solidstate/contracts/interfaces/IERC165.sol";
import {OperatorFilterer} from "closedsea/src/OperatorFilterer.sol";
import {MinimalOwnableRoles} from "../internals/MinimalOwnableRoles.sol";
import {INiftyKitAppRegistry} from "../interfaces/INiftyKitAppRegistry.sol";
import {IDiamondCut} from "../interfaces/IDiamondCut.sol";
import {DiamondLoupeFacet} from "./DiamondLoupeFacet.sol";
import {LibDiamond} from "../libraries/LibDiamond.sol";
import {BaseStorage} from "./BaseStorage.sol";

contract BaseFacet is
    ERC721AUpgradeable,
    MinimalOwnableRoles,
    ERC2981,
    OperatorFilterer,
    DiamondLoupeFacet
{
    modifier preventTransfers(address from, uint256 tokenId) virtual {
        BaseStorage.Layout storage layout = BaseStorage.layout();
        BaseStorage.Transfer status = layout._transferStatus;

        if (
            status == BaseStorage.Transfer.BlockAll ||
            (status == BaseStorage.Transfer.AllowedOperatorsOnly &&
                !layout._allowedOperators[from] &&
                from != _msgSenderERC721A()) ||
            (layout._blockedTokenIds[tokenId])
        ) {
            revert("Transfers not allowed");
        }
        _;
    }

    constructor() initializerERC721A {}

    function _initialize(
        address owner_,
        address admin_,
        string calldata name_,
        string calldata symbol_,
        address royalty_,
        uint16 royaltyBps_
    ) external initializerERC721A {
        __ERC721A_init(name_, symbol_);
        _initializeOwner(owner_);

        if (admin_ != address(0)) {
            BaseStorage.layout()._mintSigner = admin_;
            _grantRoles(
                admin_,
                BaseStorage.ADMIN_ROLE + BaseStorage.MANAGER_ROLE
            );
        }

        ERC2981Storage.Layout storage layout = ERC2981Storage.layout();
        layout.defaultRoyaltyBPS = royaltyBps_;
        layout.defaultRoyaltyReceiver = royalty_;
    }

    function setBaseURI(
        string memory newBaseURI
    ) external onlyRolesOrOwner(BaseStorage.MANAGER_ROLE) {
        BaseStorage.layout()._baseURI = newBaseURI;
    }

    function setTreasury(
        address newTreasury
    ) external onlyRolesOrOwner(BaseStorage.ADMIN_ROLE) {
        BaseStorage.layout()._treasury = newTreasury;
    }

    function withdraw() external onlyRolesOrOwner(BaseStorage.ADMIN_ROLE) {
        BaseStorage.Layout storage layout = BaseStorage.layout();
        uint256 balance = address(this).balance;
        require(balance > 0, "0 balance");

        AddressUpgradeable.sendValue(payable(layout._treasury), balance);
    }

    function setMintSigner(
        address signer_
    ) external onlyRolesOrOwner(BaseStorage.ADMIN_ROLE) {
        BaseStorage.layout()._mintSigner = signer_;
    }

    function getMintSigner() external view returns (address) {
        return BaseStorage.layout()._mintSigner;
    }

    function installApp(
        bytes32 name
    ) external onlyRolesOrOwner(BaseStorage.ADMIN_ROLE) {
        _installApp(name, address(0), "");
    }

    function installApp(
        bytes32 name,
        bytes memory data
    ) external onlyRolesOrOwner(BaseStorage.ADMIN_ROLE) {
        _installApp(name, address(this), data);
    }

    function removeApp(
        bytes32 name
    ) external onlyRolesOrOwner(BaseStorage.ADMIN_ROLE) {
        _removeApp(name, address(0), "");
    }

    function removeApp(
        bytes32 name,
        bytes memory data
    ) external onlyRolesOrOwner(BaseStorage.ADMIN_ROLE) {
        _removeApp(name, address(this), data);
    }

    function setTrustedForwarder(
        address trustedForwarder
    ) external onlyRolesOrOwner(BaseStorage.ADMIN_ROLE) {
        BaseStorage.layout()._trustedForwarder = trustedForwarder;
    }

    function isApprovedForAll(
        address owner,
        address operator
    ) public view override returns (bool) {
        BaseStorage.Layout storage layout = BaseStorage.layout();
        if (
            layout._transferStatus == BaseStorage.Transfer.AllowedOperatorsOnly
        ) {
            return layout._allowedOperators[operator];
        }

        return super.isApprovedForAll(owner, operator);
    }

    function setApprovalForAll(
        address operator,
        bool approved
    )
        public
        override
        preventTransfers(operator, 0)
        onlyAllowedOperatorApproval(operator)
    {
        super.setApprovalForAll(operator, approved);
    }

    function approve(
        address operator,
        uint256 tokenId
    )
        public
        payable
        override
        preventTransfers(operator, tokenId)
        onlyAllowedOperatorApproval(operator)
    {
        super.approve(operator, tokenId);
    }

    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    )
        public
        payable
        override
        preventTransfers(from, tokenId)
        onlyAllowedOperator(from)
    {
        super.transferFrom(from, to, tokenId);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    )
        public
        payable
        override
        preventTransfers(from, tokenId)
        onlyAllowedOperator(from)
    {
        super.safeTransferFrom(from, to, tokenId);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    )
        public
        payable
        override
        preventTransfers(from, tokenId)
        onlyAllowedOperator(from)
    {
        super.safeTransferFrom(from, to, tokenId, data);
    }

    function tokenURI(
        uint256 tokenId
    ) public view virtual override returns (string memory) {
        if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
        BaseStorage.URIEntry memory uri = BaseStorage.layout()._tokenURIs[
            tokenId
        ];
        if (uri.isValue) return uri.tokenURI;

        string memory baseURI = _baseURI();
        return
            bytes(baseURI).length != 0
                ? string(abi.encodePacked(baseURI, _toString(tokenId)))
                : "";
    }

    function treasury() external view returns (address) {
        return BaseStorage.layout()._treasury;
    }

    function getApp(
        bytes32 name
    ) external view returns (INiftyKitAppRegistry.App memory) {
        return BaseStorage.layout()._apps[name];
    }

    function _baseURI() internal view virtual override returns (string memory) {
        return BaseStorage.layout()._baseURI;
    }

    function _isPriorityOperator(
        address operator
    ) internal view override returns (bool) {
        return BaseStorage.layout()._allowedOperators[operator];
    }

    function _operatorFilteringEnabled() internal view override returns (bool) {
        return BaseStorage.layout()._operatorFilteringEnabled;
    }

    function _startTokenId() internal pure override returns (uint256) {
        return 1;
    }

    function _installApp(
        bytes32 name,
        address init,
        bytes memory data
    ) internal {
        BaseStorage.Layout storage layout = BaseStorage.layout();
        LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
        INiftyKitAppRegistry registry = INiftyKitAppRegistry(
            layout._niftyKit.appRegistry()
        );
        INiftyKitAppRegistry.App memory app = registry.getApp(name);
        require(app.version > 0, "App does not exist");

        IDiamondCut.FacetCut[] memory facetCuts = new IDiamondCut.FacetCut[](1);
        facetCuts[0] = IDiamondCut.FacetCut({
            facetAddress: app.implementation,
            action: IDiamondCut.FacetCutAction.Add,
            functionSelectors: app.selectors
        });

        ds.supportedInterfaces[app.interfaceId] = true;

        LibDiamond.diamondCut(facetCuts, init, data);
        layout._apps[name] = app;
    }

    function _removeApp(
        bytes32 name,
        address init,
        bytes memory data
    ) internal {
        BaseStorage.Layout storage layout = BaseStorage.layout();
        LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
        INiftyKitAppRegistry.App memory app = layout._apps[name];
        require(app.version > 0, "App does not exist");

        IDiamondCut.FacetCut[] memory facetCuts = new IDiamondCut.FacetCut[](1);
        facetCuts[0] = IDiamondCut.FacetCut({
            facetAddress: address(0),
            action: IDiamondCut.FacetCutAction.Remove,
            functionSelectors: app.selectors
        });

        ds.supportedInterfaces[app.interfaceId] = false;

        // execute callback function before performing a diamond cut
        LibDiamond.initializeDiamondCut(init, data);
        LibDiamond.diamondCut(facetCuts, address(0), "");
        delete layout._apps[name];
    }

    /**
     * Override this to use the trusted forwarder.
     */
    function _msgSenderERC721A()
        internal
        view
        override
        returns (address sender)
    {
        if (_isTrustedForwarder(msg.sender)) {
            // The assembly code is more direct than the Solidity version using `abi.decode`.
            /// @solidity memory-safe-assembly
            assembly {
                sender := shr(96, calldataload(sub(calldatasize(), 20)))
            }
        } else {
            return super._msgSenderERC721A();
        }
    }

    function _msgDataERC721A() internal view virtual returns (bytes calldata) {
        if (_isTrustedForwarder(msg.sender)) {
            return msg.data[:msg.data.length - 20];
        } else {
            return msg.data;
        }
    }

    function _isTrustedForwarder(
        address forwarder
    ) internal view returns (bool) {
        return BaseStorage.layout()._trustedForwarder == forwarder;
    }

    function supportsInterface(
        bytes4 interfaceId
    )
        public
        view
        virtual
        override(DiamondLoupeFacet, ERC721AUpgradeable, IERC165)
        returns (bool)
    {
        LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
        return ds.supportedInterfaces[interfaceId];
    }
}

File 2 of 25 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 3 of 25 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.8;

import { IERC165Internal } from './IERC165Internal.sol';

/**
 * @title ERC165 interface registration interface
 * @dev see https://eips.ethereum.org/EIPS/eip-165
 */
interface IERC165 is IERC165Internal {
    /**
     * @notice query whether contract has registered support for given interface
     * @param interfaceId interface id
     * @return bool whether interface is supported
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 4 of 25 : IERC165Internal.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.8;

import { IERC165Internal } from './IERC165Internal.sol';

/**
 * @title ERC165 interface registration interface
 */
interface IERC165Internal {

}

File 5 of 25 : IERC2981.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.8;

import { IERC165 } from './IERC165.sol';
import { IERC2981Internal } from './IERC2981Internal.sol';

/**
 * @title ERC2981 interface
 * @dev see https://eips.ethereum.org/EIPS/eip-2981
 */
interface IERC2981 is IERC2981Internal, IERC165 {
    /**
     * @notice called with the sale price to determine how much royalty is owed and to whom
     * @param tokenId the ERC721 or ERC1155 token id to query for royalty information
     * @param salePrice the sale price of the given asset
     * @return receiever rightful recipient of royalty
     * @return royaltyAmount amount of royalty owed
     */
    function royaltyInfo(
        uint256 tokenId,
        uint256 salePrice
    ) external view returns (address receiever, uint256 royaltyAmount);
}

File 6 of 25 : IERC2981Internal.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.8;

/**
 * @title ERC2981 interface
 */
interface IERC2981Internal {

}

File 7 of 25 : ERC2981.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.8;

import { IERC2981 } from '../../../interfaces/IERC2981.sol';

import { ERC2981Storage } from './ERC2981Storage.sol';
import { ERC2981Internal } from './ERC2981Internal.sol';

/**
 * @title ERC2981 implementation
 */
abstract contract ERC2981 is IERC2981, ERC2981Internal {
    /**
     * @notice inheritdoc IERC2981
     */
    function royaltyInfo(
        uint256 tokenId,
        uint256 salePrice
    ) external view returns (address, uint256) {
        return _royaltyInfo(tokenId, salePrice);
    }
}

File 8 of 25 : ERC2981Internal.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.8;

import { ERC2981Storage } from './ERC2981Storage.sol';
import { IERC2981Internal } from '../../../interfaces/IERC2981Internal.sol';

/**
 * @title ERC2981 internal functions
 */
abstract contract ERC2981Internal is IERC2981Internal {
    /**
     * @notice calculate how much royalty is owed and to whom
     * @dev royalty must be paid in addition to, rather than deducted from, salePrice
     * @param tokenId the ERC721 or ERC1155 token id to query for royalty information
     * @param salePrice the sale price of the given asset
     * @return royaltyReceiver rightful recipient of royalty
     * @return royalty amount of royalty owed
     */
    function _royaltyInfo(
        uint256 tokenId,
        uint256 salePrice
    ) internal view virtual returns (address royaltyReceiver, uint256 royalty) {
        uint256 royaltyBPS = _getRoyaltyBPS(tokenId);

        // intermediate multiplication overflow is theoretically possible here, but
        // not an issue in practice because of practical constraints of salePrice
        return (_getRoyaltyReceiver(tokenId), (royaltyBPS * salePrice) / 10000);
    }

    /**
     * @notice query the royalty rate (denominated in basis points) for given token id
     * @dev implementation supports per-token-id values as well as a global default
     * @param tokenId token whose royalty rate to query
     * @return royaltyBPS royalty rate
     */
    function _getRoyaltyBPS(
        uint256 tokenId
    ) internal view virtual returns (uint16 royaltyBPS) {
        ERC2981Storage.Layout storage l = ERC2981Storage.layout();
        royaltyBPS = l.royaltiesBPS[tokenId];

        if (royaltyBPS == 0) {
            royaltyBPS = l.defaultRoyaltyBPS;
        }
    }

    /**
     * @notice query the royalty receiver for given token id
     * @dev implementation supports per-token-id values as well as a global default
     * @param tokenId token whose royalty receiver to query
     * @return royaltyReceiver royalty receiver
     */
    function _getRoyaltyReceiver(
        uint256 tokenId
    ) internal view virtual returns (address royaltyReceiver) {
        ERC2981Storage.Layout storage l = ERC2981Storage.layout();
        royaltyReceiver = l.royaltyReceivers[tokenId];

        if (royaltyReceiver == address(0)) {
            royaltyReceiver = l.defaultRoyaltyReceiver;
        }
    }
}

File 9 of 25 : ERC2981Storage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.8;

library ERC2981Storage {
    struct Layout {
        // token id -> royalty (denominated in basis points)
        mapping(uint256 => uint16) royaltiesBPS;
        uint16 defaultRoyaltyBPS;
        // token id -> receiver address
        mapping(uint256 => address) royaltyReceivers;
        address defaultRoyaltyReceiver;
    }

    bytes32 internal constant STORAGE_SLOT =
        keccak256('solidstate.contracts.storage.ERC2981');

    function layout() internal pure returns (Layout storage l) {
        bytes32 slot = STORAGE_SLOT;
        assembly {
            l.slot := slot
        }
    }
}

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

/// @notice Optimized and flexible operator filterer to abide to OpenSea's
/// mandatory on-chain royalty enforcement in order for new collections to
/// receive royalties.
/// For more information, see:
/// See: https://github.com/ProjectOpenSea/operator-filter-registry
abstract contract OperatorFilterer {
    /// @dev The default OpenSea operator blocklist subscription.
    address internal constant _DEFAULT_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;

    /// @dev The OpenSea operator filter registry.
    address internal constant _OPERATOR_FILTER_REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E;

    /// @dev Registers the current contract to OpenSea's operator filter,
    /// and subscribe to the default OpenSea operator blocklist.
    /// Note: Will not revert nor update existing settings for repeated registration.
    function _registerForOperatorFiltering() internal virtual {
        _registerForOperatorFiltering(_DEFAULT_SUBSCRIPTION, true);
    }

    /// @dev Registers the current contract to OpenSea's operator filter.
    /// Note: Will not revert nor update existing settings for repeated registration.
    function _registerForOperatorFiltering(address subscriptionOrRegistrantToCopy, bool subscribe)
        internal
        virtual
    {
        /// @solidity memory-safe-assembly
        assembly {
            let functionSelector := 0x7d3e3dbe // `registerAndSubscribe(address,address)`.

            // Clean the upper 96 bits of `subscriptionOrRegistrantToCopy` in case they are dirty.
            subscriptionOrRegistrantToCopy := shr(96, shl(96, subscriptionOrRegistrantToCopy))

            for {} iszero(subscribe) {} {
                if iszero(subscriptionOrRegistrantToCopy) {
                    functionSelector := 0x4420e486 // `register(address)`.
                    break
                }
                functionSelector := 0xa0af2903 // `registerAndCopyEntries(address,address)`.
                break
            }
            // Store the function selector.
            mstore(0x00, shl(224, functionSelector))
            // Store the `address(this)`.
            mstore(0x04, address())
            // Store the `subscriptionOrRegistrantToCopy`.
            mstore(0x24, subscriptionOrRegistrantToCopy)
            // Register into the registry.
            if iszero(call(gas(), _OPERATOR_FILTER_REGISTRY, 0, 0x00, 0x44, 0x00, 0x04)) {
                // If the function selector has not been overwritten,
                // it is an out-of-gas error.
                if eq(shr(224, mload(0x00)), functionSelector) {
                    // To prevent gas under-estimation.
                    revert(0, 0)
                }
            }
            // Restore the part of the free memory pointer that was overwritten,
            // which is guaranteed to be zero, because of Solidity's memory size limits.
            mstore(0x24, 0)
        }
    }

    /// @dev Modifier to guard a function and revert if the caller is a blocked operator.
    modifier onlyAllowedOperator(address from) virtual {
        if (from != msg.sender) {
            if (!_isPriorityOperator(msg.sender)) {
                if (_operatorFilteringEnabled()) _revertIfBlocked(msg.sender);
            }
        }
        _;
    }

    /// @dev Modifier to guard a function from approving a blocked operator..
    modifier onlyAllowedOperatorApproval(address operator) virtual {
        if (!_isPriorityOperator(operator)) {
            if (_operatorFilteringEnabled()) _revertIfBlocked(operator);
        }
        _;
    }

    /// @dev Helper function that reverts if the `operator` is blocked by the registry.
    function _revertIfBlocked(address operator) private view {
        /// @solidity memory-safe-assembly
        assembly {
            // Store the function selector of `isOperatorAllowed(address,address)`,
            // shifted left by 6 bytes, which is enough for 8tb of memory.
            // We waste 6-3 = 3 bytes to save on 6 runtime gas (PUSH1 0x224 SHL).
            mstore(0x00, 0xc6171134001122334455)
            // Store the `address(this)`.
            mstore(0x1a, address())
            // Store the `operator`.
            mstore(0x3a, operator)

            // `isOperatorAllowed` always returns true if it does not revert.
            if iszero(staticcall(gas(), _OPERATOR_FILTER_REGISTRY, 0x16, 0x44, 0x00, 0x00)) {
                // Bubble up the revert if the staticcall reverts.
                returndatacopy(0x00, 0x00, returndatasize())
                revert(0x00, returndatasize())
            }

            // We'll skip checking if `from` is inside the blacklist.
            // Even though that can block transferring out of wrapper contracts,
            // we don't want tokens to be stuck.

            // Restore the part of the free memory pointer that was overwritten,
            // which is guaranteed to be zero, if less than 8tb of memory is used.
            mstore(0x3a, 0)
        }
    }

    /// @dev For deriving contracts to override, so that operator filtering
    /// can be turned on / off.
    /// Returns true by default.
    function _operatorFilteringEnabled() internal view virtual returns (bool) {
        return true;
    }

    /// @dev For deriving contracts to override, so that preferred marketplaces can
    /// skip operator filtering, helping users save gas.
    /// Returns false for all inputs by default.
    function _isPriorityOperator(address) internal view virtual returns (bool) {
        return false;
    }
}

File 11 of 25 : BaseStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {INiftyKitAppRegistry} from "../interfaces/INiftyKitAppRegistry.sol";
import {INiftyKitV3} from "../interfaces/INiftyKitV3.sol";

library BaseStorage {
    enum Transfer {
        AllowAll,
        AllowedOperatorsOnly,
        BlockAll
    }

    struct URIEntry {
        bool isValue;
        string tokenURI;
    }

    bytes32 private constant STORAGE_SLOT = keccak256("niftykit.base.storage");

    uint256 public constant ADMIN_ROLE = 1 << 0;
    uint256 public constant MANAGER_ROLE = 1 << 1;
    uint256 public constant API_ROLE = 1 << 2;

    struct Layout {
        mapping(bytes32 => INiftyKitAppRegistry.App) _apps;
        mapping(address => bool) _allowedOperators;
        mapping(uint256 => bool) _blockedTokenIds;
        mapping(uint256 => URIEntry) _tokenURIs;
        bool _operatorFilteringEnabled;
        Transfer _transferStatus;
        INiftyKitV3 _niftyKit;
        uint8 _baseVersion;
        address _treasury;
        string _baseURI;
        address _mintSigner;
        address _trustedForwarder;
    }

    function layout() internal pure returns (Layout storage ds) {
        bytes32 position = STORAGE_SLOT;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            ds.slot := position
        }
    }
}

File 12 of 25 : DiamondLoupeFacet.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/******************************************************************************\
* Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen)
* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535
/******************************************************************************/

import { LibDiamond } from  "../libraries/LibDiamond.sol";
import { IDiamondLoupe } from "../interfaces/IDiamondLoupe.sol";
import { IERC165 } from "../interfaces/IERC165.sol";

// The functions in DiamondLoupeFacet MUST be added to a diamond.
// The EIP-2535 Diamond standard requires these functions

contract DiamondLoupeFacet is IDiamondLoupe, IERC165 {
    // Diamond Loupe Functions
    ////////////////////////////////////////////////////////////////////
    /// These functions are expected to be called frequently by tools.
    //
    // struct Facet {
    //     address facetAddress;
    //     bytes4[] functionSelectors;
    // }
    /// @notice Gets all facets and their selectors.
    /// @return facets_ Facet
    function facets() external override view returns (Facet[] memory facets_) {
        LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
        facets_ = new Facet[](ds.selectorCount);
        uint16[] memory numFacetSelectors = new uint16[](ds.selectorCount);
        uint256 numFacets;
        uint256 selectorIndex;
        // loop through function selectors
        for (uint256 slotIndex; selectorIndex < ds.selectorCount; slotIndex++) {
            bytes32 slot = ds.selectorSlots[slotIndex];
            for (uint256 selectorSlotIndex; selectorSlotIndex < 8; selectorSlotIndex++) {
                selectorIndex++;
                if (selectorIndex > ds.selectorCount) {
                    break;
                }
                // " << 5 is the same as multiplying by 32 ( * 32)
                bytes4 selector = bytes4(slot << (selectorSlotIndex << 5));
                address facetAddress_ = address(bytes20(ds.facets[selector]));
                bool continueLoop;
                for (uint256 facetIndex; facetIndex < numFacets; facetIndex++) {
                    if (facets_[facetIndex].facetAddress == facetAddress_) {
                        facets_[facetIndex].functionSelectors[numFacetSelectors[facetIndex]] = selector;
                        // probably will never have more than 256 functions from one facet contract
                        require(numFacetSelectors[facetIndex] < 255);
                        numFacetSelectors[facetIndex]++;
                        continueLoop = true;
                        break;
                    }
                }
                if (continueLoop) {
                    continue;
                }
                facets_[numFacets].facetAddress = facetAddress_;
                facets_[numFacets].functionSelectors = new bytes4[](ds.selectorCount);
                facets_[numFacets].functionSelectors[0] = selector;
                numFacetSelectors[numFacets] = 1;
                numFacets++;
            }
        }
        for (uint256 facetIndex; facetIndex < numFacets; facetIndex++) {
            uint256 numSelectors = numFacetSelectors[facetIndex];
            bytes4[] memory selectors = facets_[facetIndex].functionSelectors;
            // setting the number of selectors
            assembly {
                mstore(selectors, numSelectors)
            }
        }
        // setting the number of facets
        assembly {
            mstore(facets_, numFacets)
        }
    }

    /// @notice Gets all the function selectors supported by a specific facet.
    /// @param _facet The facet address.
    /// @return _facetFunctionSelectors The selectors associated with a facet address.
    function facetFunctionSelectors(address _facet) external override view returns (bytes4[] memory _facetFunctionSelectors) {
        LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
        uint256 numSelectors;
        _facetFunctionSelectors = new bytes4[](ds.selectorCount);
        uint256 selectorIndex;
        // loop through function selectors
        for (uint256 slotIndex; selectorIndex < ds.selectorCount; slotIndex++) {
            bytes32 slot = ds.selectorSlots[slotIndex];
            for (uint256 selectorSlotIndex; selectorSlotIndex < 8; selectorSlotIndex++) {
                selectorIndex++;
                if (selectorIndex > ds.selectorCount) {
                    break;
                }
                // " << 5 is the same as multiplying by 32 ( * 32)
                bytes4 selector = bytes4(slot << (selectorSlotIndex << 5));
                address facet = address(bytes20(ds.facets[selector]));
                if (_facet == facet) {
                    _facetFunctionSelectors[numSelectors] = selector;
                    numSelectors++;
                }
            }
        }
        // Set the number of selectors in the array
        assembly {
            mstore(_facetFunctionSelectors, numSelectors)
        }
    }

    /// @notice Get all the facet addresses used by a diamond.
    /// @return facetAddresses_
    function facetAddresses() external override view returns (address[] memory facetAddresses_) {
        LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
        facetAddresses_ = new address[](ds.selectorCount);
        uint256 numFacets;
        uint256 selectorIndex;
        // loop through function selectors
        for (uint256 slotIndex; selectorIndex < ds.selectorCount; slotIndex++) {
            bytes32 slot = ds.selectorSlots[slotIndex];
            for (uint256 selectorSlotIndex; selectorSlotIndex < 8; selectorSlotIndex++) {
                selectorIndex++;
                if (selectorIndex > ds.selectorCount) {
                    break;
                }
                // " << 5 is the same as multiplying by 32 ( * 32)
                bytes4 selector = bytes4(slot << (selectorSlotIndex << 5));
                address facetAddress_ = address(bytes20(ds.facets[selector]));
                bool continueLoop;
                for (uint256 facetIndex; facetIndex < numFacets; facetIndex++) {
                    if (facetAddress_ == facetAddresses_[facetIndex]) {
                        continueLoop = true;
                        break;
                    }
                }
                if (continueLoop) {                    
                    continue;
                }
                facetAddresses_[numFacets] = facetAddress_;
                numFacets++;
            }
        }
        // Set the number of facet addresses in the array
        assembly {
            mstore(facetAddresses_, numFacets)
        }
    }

    /// @notice Gets the facet that supports the given selector.
    /// @dev If facet is not found return address(0).
    /// @param _functionSelector The function selector.
    /// @return facetAddress_ The facet address.
    function facetAddress(bytes4 _functionSelector) external override view returns (address facetAddress_) {
        LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
        facetAddress_ = address(bytes20(ds.facets[_functionSelector]));
    }

    // This implements ERC-165.
    function supportsInterface(bytes4 _interfaceId) external virtual override view returns (bool) {
        LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
        return ds.supportedInterfaces[_interfaceId];
    }
}

File 13 of 25 : IDiamondCut.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/******************************************************************************\
* Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen)
* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535
/******************************************************************************/

interface IDiamondCut {
    enum FacetCutAction {Add, Replace, Remove}
    // Add=0, Replace=1, Remove=2

    struct FacetCut {
        address facetAddress;
        FacetCutAction action;
        bytes4[] functionSelectors;
    }

    /// @notice Add/replace/remove any number of functions and optionally execute
    ///         a function with delegatecall
    /// @param _diamondCut Contains the facet addresses and function selectors
    /// @param _init The address of the contract or facet to execute _calldata
    /// @param _calldata A function call, including function selector and arguments
    ///                  _calldata is executed with delegatecall on _init
    function diamondCut(
        FacetCut[] calldata _diamondCut,
        address _init,
        bytes calldata _calldata
    ) external;

    event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata);
}

File 14 of 25 : IDiamondLoupe.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/******************************************************************************\
* Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen)
* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535
/******************************************************************************/

// A loupe is a small magnifying glass used to look at diamonds.
// These functions look at diamonds
interface IDiamondLoupe {
    /// These functions are expected to be called frequently
    /// by tools.

    struct Facet {
        address facetAddress;
        bytes4[] functionSelectors;
    }

    /// @notice Gets all facet addresses and their four byte function selectors.
    /// @return facets_ Facet
    function facets() external view returns (Facet[] memory facets_);

    /// @notice Gets all the function selectors supported by a specific facet.
    /// @param _facet The facet address.
    /// @return facetFunctionSelectors_
    function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_);

    /// @notice Get all the facet addresses used by a diamond.
    /// @return facetAddresses_
    function facetAddresses() external view returns (address[] memory facetAddresses_);

    /// @notice Gets the facet that supports the given selector.
    /// @dev If facet is not found return address(0).
    /// @param _functionSelector The function selector.
    /// @return facetAddress_ The facet address.
    function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_);
}

File 15 of 25 : IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IERC165 {
    /// @notice Query if a contract implements an interface
    /// @param interfaceId The interface identifier, as specified in ERC-165
    /// @dev Interface identification is specified in ERC-165. This function
    ///  uses less than 30,000 gas.
    /// @return `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 16 of 25 : INiftyKitAppRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

interface INiftyKitAppRegistry {
    struct App {
        address implementation;
        bytes4 interfaceId;
        bytes4[] selectors;
        uint8 version;
    }

    struct Base {
        address implementation;
        bytes4[] interfaceIds;
        bytes4[] selectors;
        uint8 version;
    }

    /**
     * Get App Facet by app name
     * @param name app name
     */
    function getApp(bytes32 name) external view returns (App memory);

    /**
     * Get base Facet
     */
    function getBase() external view returns (Base memory);
}

File 17 of 25 : INiftyKitV3.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

interface INiftyKitV3 {
    struct DiamondArgs {
        address owner;
        address admin;
        address treasury;
        address royalty;
        address trustedForwarder;
        uint16 royaltyBps;
        string name;
        string symbol;
        string baseURI;
        bytes32[] apps;
    }

    /**
     * @dev Returns app registry address.
     */
    function appRegistry() external returns (address);

    /**
     * @dev Returns the commission amount (sellerFee, buyerFee).
     */
    function commission(
        address collection,
        uint256 amount
    ) external view returns (uint256, uint256);

    /**
     * @dev Get fees by amount (called from collection)
     */
    function getFees(uint256 amount) external view returns (uint256, uint256);
}

File 18 of 25 : MinimalOwnable.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 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 MinimalOwnable {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       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 `bytes4(keccak256(bytes("Unauthorized()")))`.
    uint256 private constant _UNAUTHORIZED_ERROR_SELECTOR = 0x82b42900;

    /// @dev `bytes4(keccak256(bytes("NewOwnerIsZeroAddress()")))`.
    uint256 private constant _NEW_OWNER_IS_ZERO_ADDRESS_ERROR_SELECTOR = 0x7448fbae;

    /// @dev `bytes4(keccak256(bytes("NoHandoverRequest()")))`.
    uint256 private constant _NO_HANDOVER_REQUEST_ERROR_SELECTOR = 0x6f5e8818;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                           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: `not(_OWNER_SLOT_NOT)`.
    /// It is intentionally choosen 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.
    uint256 private constant _OWNER_SLOT_NOT = 0x8b78c6d8;

    /// 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 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 {
        /// @solidity memory-safe-assembly
        assembly {
            // Clean the upper 96 bits.
            newOwner := shr(96, shl(96, newOwner))
            // Store the new value.
            sstore(not(_OWNER_SLOT_NOT), 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 {
        /// @solidity memory-safe-assembly
        assembly {
            let ownerSlot := not(_OWNER_SLOT_NOT)
            // 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(not(_OWNER_SLOT_NOT)))) {
                mstore(0x00, _UNAUTHORIZED_ERROR_SELECTOR)
                revert(0x1c, 0x04)
            }
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                  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, _NEW_OWNER_IS_ZERO_ADDRESS_ERROR_SELECTOR)
                revert(0x1c, 0x04)
            }
        }
        _setOwner(newOwner);
    }

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

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   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(not(_OWNER_SLOT_NOT))
        }
    }

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

    /// @dev Marks a function as only callable by the owner.
    modifier onlyOwner() virtual {
        _checkOwner();
        _;
    }
}

File 19 of 25 : MinimalOwnableRoles.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "./MinimalOwnable.sol";

/// @notice Simple single owner and multiroles authorization mixin.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)
/// @dev While the ownable portion follows [EIP-173](https://eips.ethereum.org/EIPS/eip-173)
/// for compatibility, the nomenclature for the 2-step ownership handover and roles
/// may be unique to this codebase.
abstract contract MinimalOwnableRoles is MinimalOwnable {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev `bytes4(keccak256(bytes("Unauthorized()")))`.
    uint256 private constant _UNAUTHORIZED_ERROR_SELECTOR = 0x82b42900;

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

    /// @dev The `user`'s roles is updated to `roles`.
    /// Each bit of `roles` represents whether the role is set.
    event RolesUpdated(address indexed user, uint256 indexed roles);

    /// @dev `keccak256(bytes("RolesUpdated(address,uint256)"))`.
    uint256 private constant _ROLES_UPDATED_EVENT_SIGNATURE =
        0x715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26;

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

    /// @dev The role slot of `user` is given by:
    /// ```
    ///     mstore(0x00, or(shl(96, user), _ROLE_SLOT_SEED))
    ///     let roleSlot := keccak256(0x00, 0x20)
    /// ```
    /// This automatically ignores the upper bits of the `user` in case
    /// they are not clean, as well as keep the `keccak256` under 32-bytes.
    ///
    /// Note: This is equal to `_OWNER_SLOT_NOT` in for gas efficiency.
    uint256 private constant _ROLE_SLOT_SEED = 0x8b78c6d8;

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

    /// @dev Grants the roles directly without authorization guard.
    /// Each bit of `roles` represents the role to turn on.
    function _grantRoles(address user, uint256 roles) internal virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute the role slot.
            mstore(0x0c, _ROLE_SLOT_SEED)
            mstore(0x00, user)
            let roleSlot := keccak256(0x0c, 0x20)
            // Load the current value and `or` it with `roles`.
            roles := or(sload(roleSlot), roles)
            // Store the new value.
            sstore(roleSlot, roles)
            // Emit the {RolesUpdated} event.
            log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles)
        }
    }

    /// @dev Removes the roles directly without authorization guard.
    /// Each bit of `roles` represents the role to turn off.
    function _removeRoles(address user, uint256 roles) internal virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute the role slot.
            mstore(0x0c, _ROLE_SLOT_SEED)
            mstore(0x00, user)
            let roleSlot := keccak256(0x0c, 0x20)
            // Load the current value.
            let currentRoles := sload(roleSlot)
            // Use `and` to compute the intersection of `currentRoles` and `roles`,
            // `xor` it with `currentRoles` to flip the bits in the intersection.
            roles := xor(currentRoles, and(currentRoles, roles))
            // Then, store the new value.
            sstore(roleSlot, roles)
            // Emit the {RolesUpdated} event.
            log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles)
        }
    }

    /// @dev Throws if the sender does not have any of the `roles`.
    function _checkRoles(uint256 roles) internal view virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute the role slot.
            mstore(0x0c, _ROLE_SLOT_SEED)
            mstore(0x00, caller())
            // Load the stored value, and if the `and` intersection
            // of the value and `roles` is zero, revert.
            if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
                mstore(0x00, _UNAUTHORIZED_ERROR_SELECTOR)
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Throws if the sender is not the owner,
    /// and does not have any of the `roles`.
    /// Checks for ownership first, then lazily checks for roles.
    function _checkOwnerOrRoles(uint256 roles) internal view virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // If the caller is not the stored owner.
            // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`.
            if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) {
                // Compute the role slot.
                mstore(0x0c, _ROLE_SLOT_SEED)
                mstore(0x00, caller())
                // Load the stored value, and if the `and` intersection
                // of the value and `roles` is zero, revert.
                if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
                    mstore(0x00, _UNAUTHORIZED_ERROR_SELECTOR)
                    revert(0x1c, 0x04)
                }
            }
        }
    }

    /// @dev Throws if the sender does not have any of the `roles`,
    /// and is not the owner.
    /// Checks for roles first, then lazily checks for ownership.
    function _checkRolesOrOwner(uint256 roles) internal view virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute the role slot.
            mstore(0x0c, _ROLE_SLOT_SEED)
            mstore(0x00, caller())
            // Load the stored value, and if the `and` intersection
            // of the value and `roles` is zero, revert.
            if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
                // If the caller is not the stored owner.
                // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`.
                if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) {
                    mstore(0x00, _UNAUTHORIZED_ERROR_SELECTOR)
                    revert(0x1c, 0x04)
                }
            }
        }
    }

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

    /// @dev Allows the owner to grant `user` `roles`.
    /// If the `user` already has a role, then it will be an no-op for the role.
    function grantRoles(address user, uint256 roles) public payable virtual onlyOwner {
        _grantRoles(user, roles);
    }

    /// @dev Allows the owner to remove `user` `roles`.
    /// If the `user` does not have a role, then it will be an no-op for the role.
    function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner {
        _removeRoles(user, roles);
    }

    /// @dev Allow the caller to remove their own roles.
    /// If the caller does not have a role, then it will be an no-op for the role.
    function renounceRoles(uint256 roles) public payable virtual {
        _removeRoles(msg.sender, roles);
    }

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

    /// @dev Returns the roles of `user`.
    function rolesOf(address user) public view virtual returns (uint256 roles) {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute the role slot.
            mstore(0x0c, _ROLE_SLOT_SEED)
            mstore(0x00, user)
            // Load the stored value.
            roles := sload(keccak256(0x0c, 0x20))
        }
    }

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

    /// @dev Marks a function as only callable by an account with `roles`.
    modifier onlyRoles(uint256 roles) virtual {
        _checkRoles(roles);
        _;
    }

    /// @dev Marks a function as only callable by the owner or by an account
    /// with `roles`. Checks for ownership first, then lazily checks for roles.
    modifier onlyOwnerOrRoles(uint256 roles) virtual {
        _checkOwnerOrRoles(roles);
        _;
    }

    /// @dev Marks a function as only callable by an account with `roles`
    /// or the owner. Checks for roles first, then lazily checks for ownership.
    modifier onlyRolesOrOwner(uint256 roles) virtual {
        _checkRolesOrOwner(roles);
        _;
    }

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

    // IYKYK

    uint256 internal constant _ROLE_0 = 1 << 0;
    uint256 internal constant _ROLE_1 = 1 << 1;
    uint256 internal constant _ROLE_2 = 1 << 2;
    uint256 internal constant _ROLE_3 = 1 << 3;
    uint256 internal constant _ROLE_4 = 1 << 4;
    uint256 internal constant _ROLE_5 = 1 << 5;
    uint256 internal constant _ROLE_6 = 1 << 6;
    uint256 internal constant _ROLE_7 = 1 << 7;
    uint256 internal constant _ROLE_8 = 1 << 8;
    uint256 internal constant _ROLE_9 = 1 << 9;
    uint256 internal constant _ROLE_10 = 1 << 10;
    uint256 internal constant _ROLE_11 = 1 << 11;
    uint256 internal constant _ROLE_12 = 1 << 12;
    uint256 internal constant _ROLE_13 = 1 << 13;
    uint256 internal constant _ROLE_14 = 1 << 14;
    uint256 internal constant _ROLE_15 = 1 << 15;
    uint256 internal constant _ROLE_16 = 1 << 16;
    uint256 internal constant _ROLE_17 = 1 << 17;
    uint256 internal constant _ROLE_18 = 1 << 18;
    uint256 internal constant _ROLE_19 = 1 << 19;
    uint256 internal constant _ROLE_20 = 1 << 20;
    uint256 internal constant _ROLE_21 = 1 << 21;
    uint256 internal constant _ROLE_22 = 1 << 22;
    uint256 internal constant _ROLE_23 = 1 << 23;
    uint256 internal constant _ROLE_24 = 1 << 24;
    uint256 internal constant _ROLE_25 = 1 << 25;
    uint256 internal constant _ROLE_26 = 1 << 26;
    uint256 internal constant _ROLE_27 = 1 << 27;
    uint256 internal constant _ROLE_28 = 1 << 28;
    uint256 internal constant _ROLE_29 = 1 << 29;
    uint256 internal constant _ROLE_30 = 1 << 30;
    uint256 internal constant _ROLE_31 = 1 << 31;
    uint256 internal constant _ROLE_32 = 1 << 32;
    uint256 internal constant _ROLE_33 = 1 << 33;
    uint256 internal constant _ROLE_34 = 1 << 34;
    uint256 internal constant _ROLE_35 = 1 << 35;
    uint256 internal constant _ROLE_36 = 1 << 36;
    uint256 internal constant _ROLE_37 = 1 << 37;
    uint256 internal constant _ROLE_38 = 1 << 38;
    uint256 internal constant _ROLE_39 = 1 << 39;
    uint256 internal constant _ROLE_40 = 1 << 40;
    uint256 internal constant _ROLE_41 = 1 << 41;
    uint256 internal constant _ROLE_42 = 1 << 42;
    uint256 internal constant _ROLE_43 = 1 << 43;
    uint256 internal constant _ROLE_44 = 1 << 44;
    uint256 internal constant _ROLE_45 = 1 << 45;
    uint256 internal constant _ROLE_46 = 1 << 46;
    uint256 internal constant _ROLE_47 = 1 << 47;
    uint256 internal constant _ROLE_48 = 1 << 48;
    uint256 internal constant _ROLE_49 = 1 << 49;
    uint256 internal constant _ROLE_50 = 1 << 50;
    uint256 internal constant _ROLE_51 = 1 << 51;
    uint256 internal constant _ROLE_52 = 1 << 52;
    uint256 internal constant _ROLE_53 = 1 << 53;
    uint256 internal constant _ROLE_54 = 1 << 54;
    uint256 internal constant _ROLE_55 = 1 << 55;
    uint256 internal constant _ROLE_56 = 1 << 56;
    uint256 internal constant _ROLE_57 = 1 << 57;
    uint256 internal constant _ROLE_58 = 1 << 58;
    uint256 internal constant _ROLE_59 = 1 << 59;
    uint256 internal constant _ROLE_60 = 1 << 60;
    uint256 internal constant _ROLE_61 = 1 << 61;
    uint256 internal constant _ROLE_62 = 1 << 62;
    uint256 internal constant _ROLE_63 = 1 << 63;
    uint256 internal constant _ROLE_64 = 1 << 64;
    uint256 internal constant _ROLE_65 = 1 << 65;
    uint256 internal constant _ROLE_66 = 1 << 66;
    uint256 internal constant _ROLE_67 = 1 << 67;
    uint256 internal constant _ROLE_68 = 1 << 68;
    uint256 internal constant _ROLE_69 = 1 << 69;
    uint256 internal constant _ROLE_70 = 1 << 70;
    uint256 internal constant _ROLE_71 = 1 << 71;
    uint256 internal constant _ROLE_72 = 1 << 72;
    uint256 internal constant _ROLE_73 = 1 << 73;
    uint256 internal constant _ROLE_74 = 1 << 74;
    uint256 internal constant _ROLE_75 = 1 << 75;
    uint256 internal constant _ROLE_76 = 1 << 76;
    uint256 internal constant _ROLE_77 = 1 << 77;
    uint256 internal constant _ROLE_78 = 1 << 78;
    uint256 internal constant _ROLE_79 = 1 << 79;
    uint256 internal constant _ROLE_80 = 1 << 80;
    uint256 internal constant _ROLE_81 = 1 << 81;
    uint256 internal constant _ROLE_82 = 1 << 82;
    uint256 internal constant _ROLE_83 = 1 << 83;
    uint256 internal constant _ROLE_84 = 1 << 84;
    uint256 internal constant _ROLE_85 = 1 << 85;
    uint256 internal constant _ROLE_86 = 1 << 86;
    uint256 internal constant _ROLE_87 = 1 << 87;
    uint256 internal constant _ROLE_88 = 1 << 88;
    uint256 internal constant _ROLE_89 = 1 << 89;
    uint256 internal constant _ROLE_90 = 1 << 90;
    uint256 internal constant _ROLE_91 = 1 << 91;
    uint256 internal constant _ROLE_92 = 1 << 92;
    uint256 internal constant _ROLE_93 = 1 << 93;
    uint256 internal constant _ROLE_94 = 1 << 94;
    uint256 internal constant _ROLE_95 = 1 << 95;
    uint256 internal constant _ROLE_96 = 1 << 96;
    uint256 internal constant _ROLE_97 = 1 << 97;
    uint256 internal constant _ROLE_98 = 1 << 98;
    uint256 internal constant _ROLE_99 = 1 << 99;
    uint256 internal constant _ROLE_100 = 1 << 100;
    uint256 internal constant _ROLE_101 = 1 << 101;
    uint256 internal constant _ROLE_102 = 1 << 102;
    uint256 internal constant _ROLE_103 = 1 << 103;
    uint256 internal constant _ROLE_104 = 1 << 104;
    uint256 internal constant _ROLE_105 = 1 << 105;
    uint256 internal constant _ROLE_106 = 1 << 106;
    uint256 internal constant _ROLE_107 = 1 << 107;
    uint256 internal constant _ROLE_108 = 1 << 108;
    uint256 internal constant _ROLE_109 = 1 << 109;
    uint256 internal constant _ROLE_110 = 1 << 110;
    uint256 internal constant _ROLE_111 = 1 << 111;
    uint256 internal constant _ROLE_112 = 1 << 112;
    uint256 internal constant _ROLE_113 = 1 << 113;
    uint256 internal constant _ROLE_114 = 1 << 114;
    uint256 internal constant _ROLE_115 = 1 << 115;
    uint256 internal constant _ROLE_116 = 1 << 116;
    uint256 internal constant _ROLE_117 = 1 << 117;
    uint256 internal constant _ROLE_118 = 1 << 118;
    uint256 internal constant _ROLE_119 = 1 << 119;
    uint256 internal constant _ROLE_120 = 1 << 120;
    uint256 internal constant _ROLE_121 = 1 << 121;
    uint256 internal constant _ROLE_122 = 1 << 122;
    uint256 internal constant _ROLE_123 = 1 << 123;
    uint256 internal constant _ROLE_124 = 1 << 124;
    uint256 internal constant _ROLE_125 = 1 << 125;
    uint256 internal constant _ROLE_126 = 1 << 126;
    uint256 internal constant _ROLE_127 = 1 << 127;
    uint256 internal constant _ROLE_128 = 1 << 128;
    uint256 internal constant _ROLE_129 = 1 << 129;
    uint256 internal constant _ROLE_130 = 1 << 130;
    uint256 internal constant _ROLE_131 = 1 << 131;
    uint256 internal constant _ROLE_132 = 1 << 132;
    uint256 internal constant _ROLE_133 = 1 << 133;
    uint256 internal constant _ROLE_134 = 1 << 134;
    uint256 internal constant _ROLE_135 = 1 << 135;
    uint256 internal constant _ROLE_136 = 1 << 136;
    uint256 internal constant _ROLE_137 = 1 << 137;
    uint256 internal constant _ROLE_138 = 1 << 138;
    uint256 internal constant _ROLE_139 = 1 << 139;
    uint256 internal constant _ROLE_140 = 1 << 140;
    uint256 internal constant _ROLE_141 = 1 << 141;
    uint256 internal constant _ROLE_142 = 1 << 142;
    uint256 internal constant _ROLE_143 = 1 << 143;
    uint256 internal constant _ROLE_144 = 1 << 144;
    uint256 internal constant _ROLE_145 = 1 << 145;
    uint256 internal constant _ROLE_146 = 1 << 146;
    uint256 internal constant _ROLE_147 = 1 << 147;
    uint256 internal constant _ROLE_148 = 1 << 148;
    uint256 internal constant _ROLE_149 = 1 << 149;
    uint256 internal constant _ROLE_150 = 1 << 150;
    uint256 internal constant _ROLE_151 = 1 << 151;
    uint256 internal constant _ROLE_152 = 1 << 152;
    uint256 internal constant _ROLE_153 = 1 << 153;
    uint256 internal constant _ROLE_154 = 1 << 154;
    uint256 internal constant _ROLE_155 = 1 << 155;
    uint256 internal constant _ROLE_156 = 1 << 156;
    uint256 internal constant _ROLE_157 = 1 << 157;
    uint256 internal constant _ROLE_158 = 1 << 158;
    uint256 internal constant _ROLE_159 = 1 << 159;
    uint256 internal constant _ROLE_160 = 1 << 160;
    uint256 internal constant _ROLE_161 = 1 << 161;
    uint256 internal constant _ROLE_162 = 1 << 162;
    uint256 internal constant _ROLE_163 = 1 << 163;
    uint256 internal constant _ROLE_164 = 1 << 164;
    uint256 internal constant _ROLE_165 = 1 << 165;
    uint256 internal constant _ROLE_166 = 1 << 166;
    uint256 internal constant _ROLE_167 = 1 << 167;
    uint256 internal constant _ROLE_168 = 1 << 168;
    uint256 internal constant _ROLE_169 = 1 << 169;
    uint256 internal constant _ROLE_170 = 1 << 170;
    uint256 internal constant _ROLE_171 = 1 << 171;
    uint256 internal constant _ROLE_172 = 1 << 172;
    uint256 internal constant _ROLE_173 = 1 << 173;
    uint256 internal constant _ROLE_174 = 1 << 174;
    uint256 internal constant _ROLE_175 = 1 << 175;
    uint256 internal constant _ROLE_176 = 1 << 176;
    uint256 internal constant _ROLE_177 = 1 << 177;
    uint256 internal constant _ROLE_178 = 1 << 178;
    uint256 internal constant _ROLE_179 = 1 << 179;
    uint256 internal constant _ROLE_180 = 1 << 180;
    uint256 internal constant _ROLE_181 = 1 << 181;
    uint256 internal constant _ROLE_182 = 1 << 182;
    uint256 internal constant _ROLE_183 = 1 << 183;
    uint256 internal constant _ROLE_184 = 1 << 184;
    uint256 internal constant _ROLE_185 = 1 << 185;
    uint256 internal constant _ROLE_186 = 1 << 186;
    uint256 internal constant _ROLE_187 = 1 << 187;
    uint256 internal constant _ROLE_188 = 1 << 188;
    uint256 internal constant _ROLE_189 = 1 << 189;
    uint256 internal constant _ROLE_190 = 1 << 190;
    uint256 internal constant _ROLE_191 = 1 << 191;
    uint256 internal constant _ROLE_192 = 1 << 192;
    uint256 internal constant _ROLE_193 = 1 << 193;
    uint256 internal constant _ROLE_194 = 1 << 194;
    uint256 internal constant _ROLE_195 = 1 << 195;
    uint256 internal constant _ROLE_196 = 1 << 196;
    uint256 internal constant _ROLE_197 = 1 << 197;
    uint256 internal constant _ROLE_198 = 1 << 198;
    uint256 internal constant _ROLE_199 = 1 << 199;
    uint256 internal constant _ROLE_200 = 1 << 200;
    uint256 internal constant _ROLE_201 = 1 << 201;
    uint256 internal constant _ROLE_202 = 1 << 202;
    uint256 internal constant _ROLE_203 = 1 << 203;
    uint256 internal constant _ROLE_204 = 1 << 204;
    uint256 internal constant _ROLE_205 = 1 << 205;
    uint256 internal constant _ROLE_206 = 1 << 206;
    uint256 internal constant _ROLE_207 = 1 << 207;
    uint256 internal constant _ROLE_208 = 1 << 208;
    uint256 internal constant _ROLE_209 = 1 << 209;
    uint256 internal constant _ROLE_210 = 1 << 210;
    uint256 internal constant _ROLE_211 = 1 << 211;
    uint256 internal constant _ROLE_212 = 1 << 212;
    uint256 internal constant _ROLE_213 = 1 << 213;
    uint256 internal constant _ROLE_214 = 1 << 214;
    uint256 internal constant _ROLE_215 = 1 << 215;
    uint256 internal constant _ROLE_216 = 1 << 216;
    uint256 internal constant _ROLE_217 = 1 << 217;
    uint256 internal constant _ROLE_218 = 1 << 218;
    uint256 internal constant _ROLE_219 = 1 << 219;
    uint256 internal constant _ROLE_220 = 1 << 220;
    uint256 internal constant _ROLE_221 = 1 << 221;
    uint256 internal constant _ROLE_222 = 1 << 222;
    uint256 internal constant _ROLE_223 = 1 << 223;
    uint256 internal constant _ROLE_224 = 1 << 224;
    uint256 internal constant _ROLE_225 = 1 << 225;
    uint256 internal constant _ROLE_226 = 1 << 226;
    uint256 internal constant _ROLE_227 = 1 << 227;
    uint256 internal constant _ROLE_228 = 1 << 228;
    uint256 internal constant _ROLE_229 = 1 << 229;
    uint256 internal constant _ROLE_230 = 1 << 230;
    uint256 internal constant _ROLE_231 = 1 << 231;
    uint256 internal constant _ROLE_232 = 1 << 232;
    uint256 internal constant _ROLE_233 = 1 << 233;
    uint256 internal constant _ROLE_234 = 1 << 234;
    uint256 internal constant _ROLE_235 = 1 << 235;
    uint256 internal constant _ROLE_236 = 1 << 236;
    uint256 internal constant _ROLE_237 = 1 << 237;
    uint256 internal constant _ROLE_238 = 1 << 238;
    uint256 internal constant _ROLE_239 = 1 << 239;
    uint256 internal constant _ROLE_240 = 1 << 240;
    uint256 internal constant _ROLE_241 = 1 << 241;
    uint256 internal constant _ROLE_242 = 1 << 242;
    uint256 internal constant _ROLE_243 = 1 << 243;
    uint256 internal constant _ROLE_244 = 1 << 244;
    uint256 internal constant _ROLE_245 = 1 << 245;
    uint256 internal constant _ROLE_246 = 1 << 246;
    uint256 internal constant _ROLE_247 = 1 << 247;
    uint256 internal constant _ROLE_248 = 1 << 248;
    uint256 internal constant _ROLE_249 = 1 << 249;
    uint256 internal constant _ROLE_250 = 1 << 250;
    uint256 internal constant _ROLE_251 = 1 << 251;
    uint256 internal constant _ROLE_252 = 1 << 252;
    uint256 internal constant _ROLE_253 = 1 << 253;
    uint256 internal constant _ROLE_254 = 1 << 254;
    uint256 internal constant _ROLE_255 = 1 << 255;
}

File 20 of 25 : LibDiamond.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/******************************************************************************\
* Author: Nick Mudge <[email protected]> (https://twitter.com/mudgen)
* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535
/******************************************************************************/
import { IDiamondCut } from "../interfaces/IDiamondCut.sol";

// Remember to add the loupe functions from DiamondLoupeFacet to the diamond.
// The loupe functions are required by the EIP2535 Diamonds standard

error InitializationFunctionReverted(address _initializationContractAddress, bytes _calldata);

library LibDiamond {
    bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage");

    struct DiamondStorage {
        // maps function selectors to the facets that execute the functions.
        // and maps the selectors to their position in the selectorSlots array.
        // func selector => address facet, selector position
        mapping(bytes4 => bytes32) facets;
        // array of slots of function selectors.
        // each slot holds 8 function selectors.
        mapping(uint256 => bytes32) selectorSlots;
        // The number of function selectors in selectorSlots
        uint16 selectorCount;
        // Used to query if a contract implements an interface.
        // Used to implement ERC-165.
        mapping(bytes4 => bool) supportedInterfaces;
        // owner of the contract
        address contractOwner;
    }

    function diamondStorage() internal pure returns (DiamondStorage storage ds) {
        bytes32 position = DIAMOND_STORAGE_POSITION;
        assembly {
            ds.slot := position
        }
    }

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    function setContractOwner(address _newOwner) internal {
        DiamondStorage storage ds = diamondStorage();
        address previousOwner = ds.contractOwner;
        ds.contractOwner = _newOwner;
        emit OwnershipTransferred(previousOwner, _newOwner);
    }

    function contractOwner() internal view returns (address contractOwner_) {
        contractOwner_ = diamondStorage().contractOwner;
    }

    function enforceIsContractOwner() internal view {
        require(msg.sender == diamondStorage().contractOwner, "LibDiamond: Must be contract owner");
    }

    event DiamondCut(IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata);

    bytes32 constant CLEAR_ADDRESS_MASK = bytes32(uint256(0xffffffffffffffffffffffff));
    bytes32 constant CLEAR_SELECTOR_MASK = bytes32(uint256(0xffffffff << 224));

    // Internal function version of diamondCut
    // This code is almost the same as the external diamondCut,
    // except it is using 'Facet[] memory _diamondCut' instead of
    // 'Facet[] calldata _diamondCut'.
    // The code is duplicated to prevent copying calldata to memory which
    // causes an error for a two dimensional array.
    function diamondCut(
        IDiamondCut.FacetCut[] memory _diamondCut,
        address _init,
        bytes memory _calldata
    ) internal {
        DiamondStorage storage ds = diamondStorage();
        uint256 originalSelectorCount = ds.selectorCount;
        uint256 selectorCount = originalSelectorCount;
        bytes32 selectorSlot;
        // Check if last selector slot is not full
        // "selectorCount & 7" is a gas efficient modulo by eight "selectorCount % 8" 
        if (selectorCount & 7 > 0) {
            // get last selectorSlot
            // "selectorSlot >> 3" is a gas efficient division by 8 "selectorSlot / 8"
            selectorSlot = ds.selectorSlots[selectorCount >> 3];
        }
        // loop through diamond cut
        for (uint256 facetIndex; facetIndex < _diamondCut.length; ) {
            (selectorCount, selectorSlot) = addReplaceRemoveFacetSelectors(
                selectorCount,
                selectorSlot,
                _diamondCut[facetIndex].facetAddress,
                _diamondCut[facetIndex].action,
                _diamondCut[facetIndex].functionSelectors
            );

            unchecked {
                facetIndex++;
            }
        }
        if (selectorCount != originalSelectorCount) {
            ds.selectorCount = uint16(selectorCount);
        }
        // If last selector slot is not full
        // "selectorCount & 7" is a gas efficient modulo by eight "selectorCount % 8" 
        if (selectorCount & 7 > 0) {
            // "selectorSlot >> 3" is a gas efficient division by 8 "selectorSlot / 8"
            ds.selectorSlots[selectorCount >> 3] = selectorSlot;
        }
        emit DiamondCut(_diamondCut, _init, _calldata);
        initializeDiamondCut(_init, _calldata);
    }

    function addReplaceRemoveFacetSelectors(
        uint256 _selectorCount,
        bytes32 _selectorSlot,
        address _newFacetAddress,
        IDiamondCut.FacetCutAction _action,
        bytes4[] memory _selectors
    ) internal returns (uint256, bytes32) {
        DiamondStorage storage ds = diamondStorage();
        require(_selectors.length > 0, "LibDiamondCut: No selectors in facet to cut");
        if (_action == IDiamondCut.FacetCutAction.Add) {
            enforceHasContractCode(_newFacetAddress, "LibDiamondCut: Add facet has no code");
            for (uint256 selectorIndex; selectorIndex < _selectors.length; ) {
                bytes4 selector = _selectors[selectorIndex];
                bytes32 oldFacet = ds.facets[selector];
                require(address(bytes20(oldFacet)) == address(0), "LibDiamondCut: Can't add function that already exists");
                // add facet for selector
                ds.facets[selector] = bytes20(_newFacetAddress) | bytes32(_selectorCount);
                // "_selectorCount & 7" is a gas efficient modulo by eight "_selectorCount % 8" 
                // " << 5 is the same as multiplying by 32 ( * 32)
                uint256 selectorInSlotPosition = (_selectorCount & 7) << 5;
                // clear selector position in slot and add selector
                _selectorSlot = (_selectorSlot & ~(CLEAR_SELECTOR_MASK >> selectorInSlotPosition)) | (bytes32(selector) >> selectorInSlotPosition);
                // if slot is full then write it to storage
                if (selectorInSlotPosition == 224) {
                    // "_selectorSlot >> 3" is a gas efficient division by 8 "_selectorSlot / 8"
                    ds.selectorSlots[_selectorCount >> 3] = _selectorSlot;
                    _selectorSlot = 0;
                }
                _selectorCount++;

                unchecked {
                    selectorIndex++;
                }
            }
        } else if (_action == IDiamondCut.FacetCutAction.Replace) {
            enforceHasContractCode(_newFacetAddress, "LibDiamondCut: Replace facet has no code");
            for (uint256 selectorIndex; selectorIndex < _selectors.length; ) {
                bytes4 selector = _selectors[selectorIndex];
                bytes32 oldFacet = ds.facets[selector];
                address oldFacetAddress = address(bytes20(oldFacet));
                // only useful if immutable functions exist
                require(oldFacetAddress != address(this), "LibDiamondCut: Can't replace immutable function");
                require(oldFacetAddress != _newFacetAddress, "LibDiamondCut: Can't replace function with same function");
                require(oldFacetAddress != address(0), "LibDiamondCut: Can't replace function that doesn't exist");
                // replace old facet address
                ds.facets[selector] = (oldFacet & CLEAR_ADDRESS_MASK) | bytes20(_newFacetAddress);

                unchecked {
                    selectorIndex++;
                }
            }
        } else if (_action == IDiamondCut.FacetCutAction.Remove) {
            require(_newFacetAddress == address(0), "LibDiamondCut: Remove facet address must be address(0)");
            // "_selectorCount >> 3" is a gas efficient division by 8 "_selectorCount / 8"
            uint256 selectorSlotCount = _selectorCount >> 3;
            // "_selectorCount & 7" is a gas efficient modulo by eight "_selectorCount % 8" 
            uint256 selectorInSlotIndex = _selectorCount & 7;
            for (uint256 selectorIndex; selectorIndex < _selectors.length; ) {
                if (_selectorSlot == 0) {
                    // get last selectorSlot
                    selectorSlotCount--;
                    _selectorSlot = ds.selectorSlots[selectorSlotCount];
                    selectorInSlotIndex = 7;
                } else {
                    selectorInSlotIndex--;
                }
                bytes4 lastSelector;
                uint256 oldSelectorsSlotCount;
                uint256 oldSelectorInSlotPosition;
                // adding a block here prevents stack too deep error
                {
                    bytes4 selector = _selectors[selectorIndex];
                    bytes32 oldFacet = ds.facets[selector];
                    require(address(bytes20(oldFacet)) != address(0), "LibDiamondCut: Can't remove function that doesn't exist");
                    // only useful if immutable functions exist
                    require(address(bytes20(oldFacet)) != address(this), "LibDiamondCut: Can't remove immutable function");
                    // replace selector with last selector in ds.facets
                    // gets the last selector
                    // " << 5 is the same as multiplying by 32 ( * 32)
                    lastSelector = bytes4(_selectorSlot << (selectorInSlotIndex << 5));
                    if (lastSelector != selector) {
                        // update last selector slot position info
                        ds.facets[lastSelector] = (oldFacet & CLEAR_ADDRESS_MASK) | bytes20(ds.facets[lastSelector]);
                    }
                    delete ds.facets[selector];
                    uint256 oldSelectorCount = uint16(uint256(oldFacet));
                    // "oldSelectorCount >> 3" is a gas efficient division by 8 "oldSelectorCount / 8"
                    oldSelectorsSlotCount = oldSelectorCount >> 3;
                    // "oldSelectorCount & 7" is a gas efficient modulo by eight "oldSelectorCount % 8" 
                    // " << 5 is the same as multiplying by 32 ( * 32)
                    oldSelectorInSlotPosition = (oldSelectorCount & 7) << 5;
                }
                if (oldSelectorsSlotCount != selectorSlotCount) {
                    bytes32 oldSelectorSlot = ds.selectorSlots[oldSelectorsSlotCount];
                    // clears the selector we are deleting and puts the last selector in its place.
                    oldSelectorSlot =
                        (oldSelectorSlot & ~(CLEAR_SELECTOR_MASK >> oldSelectorInSlotPosition)) |
                        (bytes32(lastSelector) >> oldSelectorInSlotPosition);
                    // update storage with the modified slot
                    ds.selectorSlots[oldSelectorsSlotCount] = oldSelectorSlot;
                } else {
                    // clears the selector we are deleting and puts the last selector in its place.
                    _selectorSlot =
                        (_selectorSlot & ~(CLEAR_SELECTOR_MASK >> oldSelectorInSlotPosition)) |
                        (bytes32(lastSelector) >> oldSelectorInSlotPosition);
                }
                if (selectorInSlotIndex == 0) {
                    delete ds.selectorSlots[selectorSlotCount];
                    _selectorSlot = 0;
                }

                unchecked {
                    selectorIndex++;
                }
            }
            _selectorCount = selectorSlotCount * 8 + selectorInSlotIndex;
        } else {
            revert("LibDiamondCut: Incorrect FacetCutAction");
        }
        return (_selectorCount, _selectorSlot);
    }

    function initializeDiamondCut(address _init, bytes memory _calldata) internal {
        if (_init == address(0)) {
            return;
        }
        enforceHasContractCode(_init, "LibDiamondCut: _init address has no code");        
        (bool success, bytes memory error) = _init.delegatecall(_calldata);
        if (!success) {
            if (error.length > 0) {
                // bubble up error
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(error)
                    revert(add(32, error), returndata_size)
                }
            } else {
                revert InitializationFunctionReverted(_init, _calldata);
            }
        }
    }

    function enforceHasContractCode(address _contract, string memory _errorMessage) internal view {
        uint256 contractSize;
        assembly {
            contractSize := extcodesize(_contract)
        }
        require(contractSize > 0, _errorMessage);
    }
}

File 21 of 25 : ERC721A__Initializable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable diamond facet contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */

import {ERC721A__InitializableStorage} from './ERC721A__InitializableStorage.sol';

abstract contract ERC721A__Initializable {
    using ERC721A__InitializableStorage for ERC721A__InitializableStorage.Layout;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializerERC721A() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(
            ERC721A__InitializableStorage.layout()._initializing
                ? _isConstructor()
                : !ERC721A__InitializableStorage.layout()._initialized,
            'ERC721A__Initializable: contract is already initialized'
        );

        bool isTopLevelCall = !ERC721A__InitializableStorage.layout()._initializing;
        if (isTopLevelCall) {
            ERC721A__InitializableStorage.layout()._initializing = true;
            ERC721A__InitializableStorage.layout()._initialized = true;
        }

        _;

        if (isTopLevelCall) {
            ERC721A__InitializableStorage.layout()._initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializingERC721A() {
        require(
            ERC721A__InitializableStorage.layout()._initializing,
            'ERC721A__Initializable: contract is not initializing'
        );
        _;
    }

    /// @dev Returns true if and only if the function is running in the constructor
    function _isConstructor() private view returns (bool) {
        // extcodesize checks the size of the code stored in an address, and
        // address returns the current address. Since the code is still not
        // deployed when running a constructor, any checks on its code size will
        // yield zero, making it an effective way to detect if a contract is
        // under construction or not.
        address self = address(this);
        uint256 cs;
        assembly {
            cs := extcodesize(self)
        }
        return cs == 0;
    }
}

File 22 of 25 : ERC721A__InitializableStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev This is a base storage for the  initialization function for upgradeable diamond facet contracts
 **/

library ERC721A__InitializableStorage {
    struct Layout {
        /*
         * Indicates that the contract has been initialized.
         */
        bool _initialized;
        /*
         * Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    bytes32 internal constant STORAGE_SLOT = keccak256('ERC721A.contracts.storage.initializable.facet');

    function layout() internal pure returns (Layout storage l) {
        bytes32 slot = STORAGE_SLOT;
        assembly {
            l.slot := slot
        }
    }
}

File 23 of 25 : ERC721AStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

library ERC721AStorage {
    // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
    struct TokenApprovalRef {
        address value;
    }

    struct Layout {
        // =============================================================
        //                            STORAGE
        // =============================================================

        // The next token ID to be minted.
        uint256 _currentIndex;
        // The number of tokens burned.
        uint256 _burnCounter;
        // Token name
        string _name;
        // Token symbol
        string _symbol;
        // Mapping from token ID to ownership details
        // An empty struct value does not necessarily mean the token is unowned.
        // See {_packedOwnershipOf} implementation for details.
        //
        // Bits Layout:
        // - [0..159]   `addr`
        // - [160..223] `startTimestamp`
        // - [224]      `burned`
        // - [225]      `nextInitialized`
        // - [232..255] `extraData`
        mapping(uint256 => uint256) _packedOwnerships;
        // Mapping owner address to address data.
        //
        // Bits Layout:
        // - [0..63]    `balance`
        // - [64..127]  `numberMinted`
        // - [128..191] `numberBurned`
        // - [192..255] `aux`
        mapping(address => uint256) _packedAddressData;
        // Mapping from token ID to approved address.
        mapping(uint256 => ERC721AStorage.TokenApprovalRef) _tokenApprovals;
        // Mapping from owner to operator approvals
        mapping(address => mapping(address => bool)) _operatorApprovals;
    }

    bytes32 internal constant STORAGE_SLOT = keccak256('ERC721A.contracts.storage.ERC721A');

    function layout() internal pure returns (Layout storage l) {
        bytes32 slot = STORAGE_SLOT;
        assembly {
            l.slot := slot
        }
    }
}

File 24 of 25 : ERC721AUpgradeable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721AUpgradeable.sol';
import {ERC721AStorage} from './ERC721AStorage.sol';
import './ERC721A__Initializable.sol';

/**
 * @dev Interface of ERC721 token receiver.
 */
interface ERC721A__IERC721ReceiverUpgradeable {
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

/**
 * @title ERC721A
 *
 * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
 * Non-Fungible Token Standard, including the Metadata extension.
 * Optimized for lower gas during batch mints.
 *
 * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
 * starting from `_startTokenId()`.
 *
 * Assumptions:
 *
 * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
 */
contract ERC721AUpgradeable is ERC721A__Initializable, IERC721AUpgradeable {
    using ERC721AStorage for ERC721AStorage.Layout;

    // =============================================================
    //                           CONSTANTS
    // =============================================================

    // Mask of an entry in packed address data.
    uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;

    // The bit position of `numberMinted` in packed address data.
    uint256 private constant _BITPOS_NUMBER_MINTED = 64;

    // The bit position of `numberBurned` in packed address data.
    uint256 private constant _BITPOS_NUMBER_BURNED = 128;

    // The bit position of `aux` in packed address data.
    uint256 private constant _BITPOS_AUX = 192;

    // Mask of all 256 bits in packed address data except the 64 bits for `aux`.
    uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;

    // The bit position of `startTimestamp` in packed ownership.
    uint256 private constant _BITPOS_START_TIMESTAMP = 160;

    // The bit mask of the `burned` bit in packed ownership.
    uint256 private constant _BITMASK_BURNED = 1 << 224;

    // The bit position of the `nextInitialized` bit in packed ownership.
    uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;

    // The bit mask of the `nextInitialized` bit in packed ownership.
    uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;

    // The bit position of `extraData` in packed ownership.
    uint256 private constant _BITPOS_EXTRA_DATA = 232;

    // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
    uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;

    // The mask of the lower 160 bits for addresses.
    uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;

    // The maximum `quantity` that can be minted with {_mintERC2309}.
    // This limit is to prevent overflows on the address data entries.
    // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
    // is required to cause an overflow, which is unrealistic.
    uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;

    // The `Transfer` event signature is given by:
    // `keccak256(bytes("Transfer(address,address,uint256)"))`.
    bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
        0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;

    // =============================================================
    //                          CONSTRUCTOR
    // =============================================================

    function __ERC721A_init(string memory name_, string memory symbol_) internal onlyInitializingERC721A {
        __ERC721A_init_unchained(name_, symbol_);
    }

    function __ERC721A_init_unchained(string memory name_, string memory symbol_) internal onlyInitializingERC721A {
        ERC721AStorage.layout()._name = name_;
        ERC721AStorage.layout()._symbol = symbol_;
        ERC721AStorage.layout()._currentIndex = _startTokenId();
    }

    // =============================================================
    //                   TOKEN COUNTING OPERATIONS
    // =============================================================

    /**
     * @dev Returns the starting token ID.
     * To change the starting token ID, please override this function.
     */
    function _startTokenId() internal view virtual returns (uint256) {
        return 0;
    }

    /**
     * @dev Returns the next token ID to be minted.
     */
    function _nextTokenId() internal view virtual returns (uint256) {
        return ERC721AStorage.layout()._currentIndex;
    }

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see {_totalMinted}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        // Counter underflow is impossible as _burnCounter cannot be incremented
        // more than `_currentIndex - _startTokenId()` times.
        unchecked {
            return ERC721AStorage.layout()._currentIndex - ERC721AStorage.layout()._burnCounter - _startTokenId();
        }
    }

    /**
     * @dev Returns the total amount of tokens minted in the contract.
     */
    function _totalMinted() internal view virtual returns (uint256) {
        // Counter underflow is impossible as `_currentIndex` does not decrement,
        // and it is initialized to `_startTokenId()`.
        unchecked {
            return ERC721AStorage.layout()._currentIndex - _startTokenId();
        }
    }

    /**
     * @dev Returns the total number of tokens burned.
     */
    function _totalBurned() internal view virtual returns (uint256) {
        return ERC721AStorage.layout()._burnCounter;
    }

    // =============================================================
    //                    ADDRESS DATA OPERATIONS
    // =============================================================

    /**
     * @dev Returns the number of tokens in `owner`'s account.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        if (owner == address(0)) revert BalanceQueryForZeroAddress();
        return ERC721AStorage.layout()._packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens minted by `owner`.
     */
    function _numberMinted(address owner) internal view returns (uint256) {
        return
            (ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens burned by or on behalf of `owner`.
     */
    function _numberBurned(address owner) internal view returns (uint256) {
        return
            (ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     */
    function _getAux(address owner) internal view returns (uint64) {
        return uint64(ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_AUX);
    }

    /**
     * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     * If there are multiple variables, please pack them into a uint64.
     */
    function _setAux(address owner, uint64 aux) internal virtual {
        uint256 packed = ERC721AStorage.layout()._packedAddressData[owner];
        uint256 auxCasted;
        // Cast `aux` with assembly to avoid redundant masking.
        assembly {
            auxCasted := aux
        }
        packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
        ERC721AStorage.layout()._packedAddressData[owner] = packed;
    }

    // =============================================================
    //                            IERC165
    // =============================================================

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        // The interface IDs are constants representing the first 4 bytes
        // of the XOR of all function selectors in the interface.
        // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
        // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
        return
            interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
            interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
            interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
    }

    // =============================================================
    //                        IERC721Metadata
    // =============================================================

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

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

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        if (!_exists(tokenId)) revert URIQueryForNonexistentToken();

        string memory baseURI = _baseURI();
        return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, it can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return '';
    }

    // =============================================================
    //                     OWNERSHIPS OPERATIONS
    // =============================================================

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        return address(uint160(_packedOwnershipOf(tokenId)));
    }

    /**
     * @dev Gas spent here starts off proportional to the maximum mint batch size.
     * It gradually moves to O(1) as tokens get transferred around over time.
     */
    function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnershipOf(tokenId));
    }

    /**
     * @dev Returns the unpacked `TokenOwnership` struct at `index`.
     */
    function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {
        return _unpackedOwnership(ERC721AStorage.layout()._packedOwnerships[index]);
    }

    /**
     * @dev Initializes the ownership slot minted at `index` for efficiency purposes.
     */
    function _initializeOwnershipAt(uint256 index) internal virtual {
        if (ERC721AStorage.layout()._packedOwnerships[index] == 0) {
            ERC721AStorage.layout()._packedOwnerships[index] = _packedOwnershipOf(index);
        }
    }

    /**
     * Returns the packed ownership data of `tokenId`.
     */
    function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) {
        if (_startTokenId() <= tokenId) {
            packed = ERC721AStorage.layout()._packedOwnerships[tokenId];
            // If not burned.
            if (packed & _BITMASK_BURNED == 0) {
                // If the data at the starting slot does not exist, start the scan.
                if (packed == 0) {
                    if (tokenId >= ERC721AStorage.layout()._currentIndex) revert OwnerQueryForNonexistentToken();
                    // Invariant:
                    // There will always be an initialized ownership slot
                    // (i.e. `ownership.addr != address(0) && ownership.burned == false`)
                    // before an unintialized ownership slot
                    // (i.e. `ownership.addr == address(0) && ownership.burned == false`)
                    // Hence, `tokenId` will not underflow.
                    //
                    // We can directly compare the packed value.
                    // If the address is zero, packed will be zero.
                    for (;;) {
                        unchecked {
                            packed = ERC721AStorage.layout()._packedOwnerships[--tokenId];
                        }
                        if (packed == 0) continue;
                        return packed;
                    }
                }
                // Otherwise, the data exists and is not burned. We can skip the scan.
                // This is possible because we have already achieved the target condition.
                // This saves 2143 gas on transfers of initialized tokens.
                return packed;
            }
        }
        revert OwnerQueryForNonexistentToken();
    }

    /**
     * @dev Returns the unpacked `TokenOwnership` struct from `packed`.
     */
    function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
        ownership.addr = address(uint160(packed));
        ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
        ownership.burned = packed & _BITMASK_BURNED != 0;
        ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
    }

    /**
     * @dev Packs ownership data into a single uint256.
     */
    function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
        assembly {
            // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
            owner := and(owner, _BITMASK_ADDRESS)
            // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
            result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
        }
    }

    /**
     * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
     */
    function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
        // For branchless setting of the `nextInitialized` flag.
        assembly {
            // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
            result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
        }
    }

    // =============================================================
    //                      APPROVAL OPERATIONS
    // =============================================================

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     */
    function approve(address to, uint256 tokenId) public payable virtual override {
        _approve(to, tokenId, true);
    }

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();

        return ERC721AStorage.layout()._tokenApprovals[tokenId].value;
    }

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom}
     * for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        ERC721AStorage.layout()._operatorApprovals[_msgSenderERC721A()][operator] = approved;
        emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
    }

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return ERC721AStorage.layout()._operatorApprovals[owner][operator];
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted. See {_mint}.
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return
            _startTokenId() <= tokenId &&
            tokenId < ERC721AStorage.layout()._currentIndex && // If within bounds,
            ERC721AStorage.layout()._packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
    }

    /**
     * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
     */
    function _isSenderApprovedOrOwner(
        address approvedAddress,
        address owner,
        address msgSender
    ) private pure returns (bool result) {
        assembly {
            // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
            owner := and(owner, _BITMASK_ADDRESS)
            // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
            msgSender := and(msgSender, _BITMASK_ADDRESS)
            // `msgSender == owner || msgSender == approvedAddress`.
            result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
        }
    }

    /**
     * @dev Returns the storage slot and value for the approved address of `tokenId`.
     */
    function _getApprovedSlotAndAddress(uint256 tokenId)
        private
        view
        returns (uint256 approvedAddressSlot, address approvedAddress)
    {
        ERC721AStorage.TokenApprovalRef storage tokenApproval = ERC721AStorage.layout()._tokenApprovals[tokenId];
        // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
        assembly {
            approvedAddressSlot := tokenApproval.slot
            approvedAddress := sload(approvedAddressSlot)
        }
    }

    // =============================================================
    //                      TRANSFER OPERATIONS
    // =============================================================

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token
     * by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public payable virtual override {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

        if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();

        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);

        // The nested ifs save around 20+ gas over a compound boolean condition.
        if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
            if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();

        if (to == address(0)) revert TransferToZeroAddress();

        _beforeTokenTransfers(from, to, tokenId, 1);

        // Clear approvals from the previous owner.
        assembly {
            if approvedAddress {
                // This is equivalent to `delete _tokenApprovals[tokenId]`.
                sstore(approvedAddressSlot, 0)
            }
        }

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
        unchecked {
            // We can directly increment and decrement the balances.
            --ERC721AStorage.layout()._packedAddressData[from]; // Updates: `balance -= 1`.
            ++ERC721AStorage.layout()._packedAddressData[to]; // Updates: `balance += 1`.

            // Updates:
            // - `address` to the next owner.
            // - `startTimestamp` to the timestamp of transfering.
            // - `burned` to `false`.
            // - `nextInitialized` to `true`.
            ERC721AStorage.layout()._packedOwnerships[tokenId] = _packOwnershipData(
                to,
                _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
            );

            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
            if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
                uint256 nextTokenId = tokenId + 1;
                // If the next slot's address is zero and not burned (i.e. packed value is zero).
                if (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != ERC721AStorage.layout()._currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

        emit Transfer(from, to, tokenId);
        _afterTokenTransfers(from, to, tokenId, 1);
    }

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public payable virtual override {
        safeTransferFrom(from, to, tokenId, '');
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token
     * by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement
     * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public payable virtual override {
        transferFrom(from, to, tokenId);
        if (to.code.length != 0)
            if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                revert TransferToNonERC721ReceiverImplementer();
            }
    }

    /**
     * @dev Hook that is called before a set of serially-ordered token IDs
     * are about to be transferred. This includes minting.
     * And also called before burning one token.
     *
     * `startTokenId` - the first token ID to be transferred.
     * `quantity` - the amount to be transferred.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Hook that is called after a set of serially-ordered token IDs
     * have been transferred. This includes minting.
     * And also called after one token has been burned.
     *
     * `startTokenId` - the first token ID to be transferred.
     * `quantity` - the amount to be transferred.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
     * transferred to `to`.
     * - When `from` is zero, `tokenId` has been minted for `to`.
     * - When `to` is zero, `tokenId` has been burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
     *
     * `from` - Previous owner of the given token ID.
     * `to` - Target address that will receive the token.
     * `tokenId` - Token ID to be transferred.
     * `_data` - Optional data to send along with the call.
     *
     * Returns whether the call correctly returned the expected magic value.
     */
    function _checkContractOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        try
            ERC721A__IERC721ReceiverUpgradeable(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data)
        returns (bytes4 retval) {
            return retval == ERC721A__IERC721ReceiverUpgradeable(to).onERC721Received.selector;
        } catch (bytes memory reason) {
            if (reason.length == 0) {
                revert TransferToNonERC721ReceiverImplementer();
            } else {
                assembly {
                    revert(add(32, reason), mload(reason))
                }
            }
        }
    }

    // =============================================================
    //                        MINT OPERATIONS
    // =============================================================

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` must be greater than 0.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _mint(address to, uint256 quantity) internal virtual {
        uint256 startTokenId = ERC721AStorage.layout()._currentIndex;
        if (quantity == 0) revert MintZeroQuantity();

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        // Overflows are incredibly unrealistic.
        // `balance` and `numberMinted` have a maximum limit of 2**64.
        // `tokenId` has a maximum limit of 2**256.
        unchecked {
            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            ERC721AStorage.layout()._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);

            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            uint256 toMasked;
            uint256 end = startTokenId + quantity;

            // Use assembly to loop and emit the `Transfer` event for gas savings.
            // The duplicated `log4` removes an extra check and reduces stack juggling.
            // The assembly, together with the surrounding Solidity code, have been
            // delicately arranged to nudge the compiler into producing optimized opcodes.
            assembly {
                // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
                toMasked := and(to, _BITMASK_ADDRESS)
                // Emit the `Transfer` event.
                log4(
                    0, // Start of data (0, since no data).
                    0, // End of data (0, since no data).
                    _TRANSFER_EVENT_SIGNATURE, // Signature.
                    0, // `address(0)`.
                    toMasked, // `to`.
                    startTokenId // `tokenId`.
                )

                // The `iszero(eq(,))` check ensures that large values of `quantity`
                // that overflows uint256 will make the loop run out of gas.
                // The compiler will optimize the `iszero` away for performance.
                for {
                    let tokenId := add(startTokenId, 1)
                } iszero(eq(tokenId, end)) {
                    tokenId := add(tokenId, 1)
                } {
                    // Emit the `Transfer` event. Similar to above.
                    log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
                }
            }
            if (toMasked == 0) revert MintToZeroAddress();

            ERC721AStorage.layout()._currentIndex = end;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * This function is intended for efficient minting only during contract creation.
     *
     * It emits only one {ConsecutiveTransfer} as defined in
     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
     * instead of a sequence of {Transfer} event(s).
     *
     * Calling this function outside of contract creation WILL make your contract
     * non-compliant with the ERC721 standard.
     * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
     * {ConsecutiveTransfer} event is only permissible during contract creation.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` must be greater than 0.
     *
     * Emits a {ConsecutiveTransfer} event.
     */
    function _mintERC2309(address to, uint256 quantity) internal virtual {
        uint256 startTokenId = ERC721AStorage.layout()._currentIndex;
        if (to == address(0)) revert MintToZeroAddress();
        if (quantity == 0) revert MintZeroQuantity();
        if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        // Overflows are unrealistic due to the above check for `quantity` to be below the limit.
        unchecked {
            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            ERC721AStorage.layout()._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);

            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);

            ERC721AStorage.layout()._currentIndex = startTokenId + quantity;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Safely mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement
     * {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
     * - `quantity` must be greater than 0.
     *
     * See {_mint}.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal virtual {
        _mint(to, quantity);

        unchecked {
            if (to.code.length != 0) {
                uint256 end = ERC721AStorage.layout()._currentIndex;
                uint256 index = end - quantity;
                do {
                    if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
                        revert TransferToNonERC721ReceiverImplementer();
                    }
                } while (index < end);
                // Reentrancy protection.
                if (ERC721AStorage.layout()._currentIndex != end) revert();
            }
        }
    }

    /**
     * @dev Equivalent to `_safeMint(to, quantity, '')`.
     */
    function _safeMint(address to, uint256 quantity) internal virtual {
        _safeMint(to, quantity, '');
    }

    // =============================================================
    //                       APPROVAL OPERATIONS
    // =============================================================

    /**
     * @dev Equivalent to `_approve(to, tokenId, false)`.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _approve(to, tokenId, false);
    }

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the
     * zero address clears previous approvals.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function _approve(
        address to,
        uint256 tokenId,
        bool approvalCheck
    ) internal virtual {
        address owner = ownerOf(tokenId);

        if (approvalCheck)
            if (_msgSenderERC721A() != owner)
                if (!isApprovedForAll(owner, _msgSenderERC721A())) {
                    revert ApprovalCallerNotOwnerNorApproved();
                }

        ERC721AStorage.layout()._tokenApprovals[tokenId].value = to;
        emit Approval(owner, to, tokenId);
    }

    // =============================================================
    //                        BURN OPERATIONS
    // =============================================================

    /**
     * @dev Equivalent to `_burn(tokenId, false)`.
     */
    function _burn(uint256 tokenId) internal virtual {
        _burn(tokenId, false);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

        address from = address(uint160(prevOwnershipPacked));

        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);

        if (approvalCheck) {
            // The nested ifs save around 20+ gas over a compound boolean condition.
            if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
                if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
        }

        _beforeTokenTransfers(from, address(0), tokenId, 1);

        // Clear approvals from the previous owner.
        assembly {
            if approvedAddress {
                // This is equivalent to `delete _tokenApprovals[tokenId]`.
                sstore(approvedAddressSlot, 0)
            }
        }

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
        unchecked {
            // Updates:
            // - `balance -= 1`.
            // - `numberBurned += 1`.
            //
            // We can directly decrement the balance, and increment the number burned.
            // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
            ERC721AStorage.layout()._packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;

            // Updates:
            // - `address` to the last owner.
            // - `startTimestamp` to the timestamp of burning.
            // - `burned` to `true`.
            // - `nextInitialized` to `true`.
            ERC721AStorage.layout()._packedOwnerships[tokenId] = _packOwnershipData(
                from,
                (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
            );

            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
            if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
                uint256 nextTokenId = tokenId + 1;
                // If the next slot's address is zero and not burned (i.e. packed value is zero).
                if (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != ERC721AStorage.layout()._currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

        emit Transfer(from, address(0), tokenId);
        _afterTokenTransfers(from, address(0), tokenId, 1);

        // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
        unchecked {
            ERC721AStorage.layout()._burnCounter++;
        }
    }

    // =============================================================
    //                     EXTRA DATA OPERATIONS
    // =============================================================

    /**
     * @dev Directly sets the extra data for the ownership data `index`.
     */
    function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
        uint256 packed = ERC721AStorage.layout()._packedOwnerships[index];
        if (packed == 0) revert OwnershipNotInitializedForExtraData();
        uint256 extraDataCasted;
        // Cast `extraData` with assembly to avoid redundant masking.
        assembly {
            extraDataCasted := extraData
        }
        packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
        ERC721AStorage.layout()._packedOwnerships[index] = packed;
    }

    /**
     * @dev Called during each token transfer to set the 24bit `extraData` field.
     * Intended to be overridden by the cosumer contract.
     *
     * `previousExtraData` - the value of `extraData` before transfer.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _extraData(
        address from,
        address to,
        uint24 previousExtraData
    ) internal view virtual returns (uint24) {}

    /**
     * @dev Returns the next extra data for the packed ownership data.
     * The returned result is shifted into position.
     */
    function _nextExtraData(
        address from,
        address to,
        uint256 prevOwnershipPacked
    ) private view returns (uint256) {
        uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);
        return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;
    }

    // =============================================================
    //                       OTHER OPERATIONS
    // =============================================================

    /**
     * @dev Returns the message sender (defaults to `msg.sender`).
     *
     * If you are writing GSN compatible contracts, you need to override this function.
     */
    function _msgSenderERC721A() internal view virtual returns (address) {
        return msg.sender;
    }

    /**
     * @dev Converts a uint256 to its ASCII string decimal representation.
     */
    function _toString(uint256 value) internal pure virtual returns (string memory str) {
        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. Total: 5 * 0x20 = 0xa0.
            let m := add(mload(0x40), 0xa0)
            // Update the free memory pointer to allocate.
            mstore(0x40, m)
            // Assign the `str` to the end.
            str := sub(m, 0x20)
            // Zeroize the slot after the string.
            mstore(str, 0)

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

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

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

File 25 of 25 : IERC721AUpgradeable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

/**
 * @dev Interface of ERC721A.
 */
interface IERC721AUpgradeable {
    /**
     * The caller must own the token or be an approved operator.
     */
    error ApprovalCallerNotOwnerNorApproved();

    /**
     * The token does not exist.
     */
    error ApprovalQueryForNonexistentToken();

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

    /**
     * Cannot mint to the zero address.
     */
    error MintToZeroAddress();

    /**
     * The quantity of tokens minted must be more than zero.
     */
    error MintZeroQuantity();

    /**
     * The token does not exist.
     */
    error OwnerQueryForNonexistentToken();

    /**
     * The caller must own the token or be an approved operator.
     */
    error TransferCallerNotOwnerNorApproved();

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

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

    /**
     * Cannot transfer to the zero address.
     */
    error TransferToZeroAddress();

    /**
     * The token does not exist.
     */
    error URIQueryForNonexistentToken();

    /**
     * The `quantity` minted with ERC2309 exceeds the safety limit.
     */
    error MintERC2309QuantityExceedsLimit();

    /**
     * The `extraData` cannot be set on an unintialized ownership slot.
     */
    error OwnershipNotInitializedForExtraData();

    // =============================================================
    //                            STRUCTS
    // =============================================================

    struct TokenOwnership {
        // The address of the owner.
        address addr;
        // Stores the start time of ownership with minimal overhead for tokenomics.
        uint64 startTimestamp;
        // Whether the token has been burned.
        bool burned;
        // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
        uint24 extraData;
    }

    // =============================================================
    //                         TOKEN COUNTERS
    // =============================================================

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see {_totalMinted}.
     */
    function totalSupply() external view returns (uint256);

    // =============================================================
    //                            IERC165
    // =============================================================

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);

    // =============================================================
    //                            IERC721
    // =============================================================

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

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

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

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

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

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

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external payable;

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom}
     * whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token
     * by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external payable;

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

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

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

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

    // =============================================================
    //                        IERC721Metadata
    // =============================================================

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

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

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);

    // =============================================================
    //                           IERC2309
    // =============================================================

    /**
     * @dev Emitted when tokens in `fromTokenId` to `toTokenId`
     * (inclusive) is transferred from `from` to `to`, as defined in the
     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
     *
     * See {_mintERC2309} for more details.
     */
    event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[{"internalType":"address","name":"_initializationContractAddress","type":"address"},{"internalType":"bytes","name":"_calldata","type":"bytes"}],"name":"InitializationFunctionReverted","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","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":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","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":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"roles","type":"uint256"}],"name":"RolesUpdated","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":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"},{"internalType":"address","name":"admin_","type":"address"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"address","name":"royalty_","type":"address"},{"internalType":"uint16","name":"royaltyBps_","type":"uint16"}],"name":"_initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_functionSelector","type":"bytes4"}],"name":"facetAddress","outputs":[{"internalType":"address","name":"facetAddress_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"facetAddresses","outputs":[{"internalType":"address[]","name":"facetAddresses_","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_facet","type":"address"}],"name":"facetFunctionSelectors","outputs":[{"internalType":"bytes4[]","name":"_facetFunctionSelectors","type":"bytes4[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"facets","outputs":[{"components":[{"internalType":"address","name":"facetAddress","type":"address"},{"internalType":"bytes4[]","name":"functionSelectors","type":"bytes4[]"}],"internalType":"struct IDiamondLoupe.Facet[]","name":"facets_","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"name","type":"bytes32"}],"name":"getApp","outputs":[{"components":[{"internalType":"address","name":"implementation","type":"address"},{"internalType":"bytes4","name":"interfaceId","type":"bytes4"},{"internalType":"bytes4[]","name":"selectors","type":"bytes4[]"},{"internalType":"uint8","name":"version","type":"uint8"}],"internalType":"struct INiftyKitAppRegistry.App","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMintSigner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"grantRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"name","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"installApp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"name","type":"bytes32"}],"name":"installApp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"name","type":"bytes32"}],"name":"removeApp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"name","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"removeApp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"renounceRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"revokeRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"rolesOf","outputs":[{"internalType":"uint256","name":"roles","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"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":"tokenId","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":"tokenId","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":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer_","type":"address"}],"name":"setMintSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newTreasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"trustedForwarder","type":"address"}],"name":"setTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","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":"tokenId","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":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506000805160206200467583398151915254610100900460ff166200004b57600080516020620046758339815191525460ff16156200004f565b303b155b620000c65760405162461bcd60e51b815260206004820152603760248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e747261637460448201527f20697320616c726561647920696e697469616c697a6564000000000000000000606482015260840160405180910390fd5b6000805160206200467583398151915254610100900460ff16158015620001055760008051602062004675833981519152805461ffff19166101011790555b8015620001265760008051602062004675833981519152805461ff00191690555b5061453e80620001376000396000f3fe6080604052600436106102305760003560e01c806361d027b31161012e578063adfca15e116100ab578063da7422281161006f578063da742228146106b3578063e84a9728146106d3578063e985e9c5146106f3578063f0f4426014610713578063f2fde38b1461073357600080fd5b8063adfca15e146105ec578063b88d4fde14610619578063c00cf3ab1461062c578063c87b56dd1461064c578063cdffacc61461066c57600080fd5b80637a0ed627116100f25780637a0ed6271461055c5780638aebc3531461057e5780638da5cb5b1461059e57806395d89b41146105b7578063a22cb465146105cc57600080fd5b806361d027b3146104ea5780636352211e146104ff57806370a082311461051f578063715018a61461053f57806373e996531461054757600080fd5b806323b872dd116101bc57806342842e0e1161018057806342842e0e1461045557806342c71f1d146104685780634a4ee7b11461049557806352ef6b2c146104a857806355f804b3146104ca57600080fd5b806323b872dd1461039b5780632a55205a146103ae5780632de94807146103ed5780632fa8374b146104205780633ccfd60b1461044057600080fd5b806318160ddd1161020357806318160ddd14610312578063183a4f6e146103355780631c10893f146103485780631f1bf78b1461035b5780632099ba841461037b57600080fd5b806301ffc9a71461023557806306fdde03146102a3578063081812fc146102c5578063095ea7b3146102fd575b600080fd5b34801561024157600080fd5b5061028e61025036600461389b565b6001600160e01b03191660009081527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131f602052604090205460ff1690565b60405190151581526020015b60405180910390f35b3480156102af57600080fd5b506102b8610746565b60405161029a919061390f565b3480156102d157600080fd5b506102e56102e0366004613922565b6107e1565b6040516001600160a01b03909116815260200161029a565b61031061030b366004613950565b61082e565b005b34801561031e57600080fd5b5061032761093e565b60405190815260200161029a565b610310610343366004613922565b61095e565b610310610356366004613950565b61096b565b34801561036757600080fd5b50610310610376366004613922565b610981565b34801561038757600080fd5b50610310610396366004613a61565b6109a7565b6103106103a9366004613aa7565b6109c2565b3480156103ba57600080fd5b506103ce6103c9366004613ae8565b610adb565b604080516001600160a01b03909316835260208301919091520161029a565b3480156103f957600080fd5b50610327610408366004613b0a565b638b78c6d8600c908152600091909152602090205490565b34801561042c57600080fd5b5061031061043b366004613922565b610af4565b34801561044c57600080fd5b50610310610b1a565b610310610463366004613aa7565b610b83565b34801561047457600080fd5b50610488610483366004613922565b610c92565b60405161029a9190613b6c565b6103106104a3366004613950565b610d92565b3480156104b457600080fd5b506104bd610da4565b60405161029a9190613bc9565b3480156104d657600080fd5b506103106104e5366004613c16565b610f55565b3480156104f657600080fd5b506102e5610f77565b34801561050b57600080fd5b506102e561051a366004613922565b610f93565b34801561052b57600080fd5b5061032761053a366004613b0a565b610fa4565b61031061100c565b34801561055357600080fd5b506102e5611020565b34801561056857600080fd5b5061057161103c565b60405161029a9190613c5e565b34801561058a57600080fd5b50610310610599366004613a61565b611475565b3480156105aa57600080fd5b50638b78c6d819546102e5565b3480156105c357600080fd5b506102b861148b565b3480156105d857600080fd5b506103106105e7366004613cdb565b6114a3565b3480156105f857600080fd5b5061060c610607366004613b0a565b6115a1565b60405161029a9190613d19565b610310610627366004613d2c565b611700565b34801561063857600080fd5b50610310610647366004613dd8565b61181b565b34801561065857600080fd5b506102b8610667366004613922565b611a5f565b34801561067857600080fd5b506102e561068736600461389b565b6001600160e01b0319166000908152600080516020614435833981519152602052604090205460601c90565b3480156106bf57600080fd5b506103106106ce366004613b0a565b611bc1565b3480156106df57600080fd5b506103106106ee366004613b0a565b611bfa565b3480156106ff57600080fd5b5061028e61070e366004613e99565b611c33565b34801561071f57600080fd5b5061031061072e366004613b0a565b611c95565b610310610741366004613b0a565b611cce565b6060610750611cf5565b600201805461075e90613ec7565b80601f016020809104026020016040519081016040528092919081815260200182805461078a90613ec7565b80156107d75780601f106107ac576101008083540402835291602001916107d7565b820191906000526020600020905b8154815290600101906020018083116107ba57829003601f168201915b5050505050905090565b60006107ec82611d19565b610809576040516333d1c03960e21b815260040160405180910390fd5b610811611cf5565b60009283526006016020525060409020546001600160a01b031690565b8181600061083a611d62565b6004810154909150610100900460ff16600281600281111561085e5761085e613efb565b14806108c65750600181600281111561087957610879613efb565b1480156108a157506001600160a01b038416600090815260018301602052604090205460ff16155b80156108c657506108b0611d86565b6001600160a01b0316846001600160a01b031614155b806108e15750600083815260028301602052604090205460ff165b156109075760405162461bcd60e51b81526004016108fe90613f11565b60405180910390fd5b8561091181611da8565b61092b5761091d611dd7565b1561092b5761092b81611ded565b6109358787611e31565b50505050505050565b6000600161094a611cf5565b60010154610956611cf5565b540303919050565b6109683382611e3d565b50565b610973611e8c565b61097d8282611ea7565b5050565b600161098c81611ef2565b61097d82600060405180602001604052806000815250611f25565b60016109b281611ef2565b6109bd833084612174565b505050565b828160006109ce611d62565b6004810154909150610100900460ff1660028160028111156109f2576109f2613efb565b1480610a5a57506001816002811115610a0d57610a0d613efb565b148015610a3557506001600160a01b038416600090815260018301602052604090205460ff16155b8015610a5a5750610a44611d86565b6001600160a01b0316846001600160a01b031614155b80610a755750600083815260028301602052604090205460ff165b15610a925760405162461bcd60e51b81526004016108fe90613f11565b866001600160a01b0381163314610ac657610aac33611da8565b610ac657610ab8611dd7565b15610ac657610ac633611ded565b610ad188888861241c565b5050505050505050565b600080610ae88484612616565b915091505b9250929050565b6001610aff81611ef2565b61097d82600060405180602001604052806000815250612174565b6001610b2581611ef2565b6000610b2f611d62565b90504780610b6b5760405162461bcd60e51b8152602060048201526009602482015268302062616c616e636560b81b60448201526064016108fe565b60058201546109bd906001600160a01b031682612656565b82816000610b8f611d62565b6004810154909150610100900460ff166002816002811115610bb357610bb3613efb565b1480610c1b57506001816002811115610bce57610bce613efb565b148015610bf657506001600160a01b038416600090815260018301602052604090205460ff16155b8015610c1b5750610c05611d86565b6001600160a01b0316846001600160a01b031614155b80610c365750600083815260028301602052604090205460ff165b15610c535760405162461bcd60e51b81526004016108fe90613f11565b866001600160a01b0381163314610c8757610c6d33611da8565b610c8757610c79611dd7565b15610c8757610c8733611ded565b610ad188888861276f565b60408051608081018252600080825260208201819052606092820183905291810191909152610cbf611d62565b60008381526020918252604090819020815160808101835281546001600160a01b0381168252600160a01b900460e01b6001600160e01b03191681850152600182018054845181870281018701865281815292959394860193830182828015610d7457602002820191906000526020600020906000905b82829054906101000a900460e01b6001600160e01b03191681526020019060040190602082600301049283019260010382029150808411610d365790505b50505091835250506002919091015460ff1660209091015292915050565b610d9a611e8c565b61097d8282611e3d565b6000805160206144a1833981519152546060906000805160206144358339815191529061ffff166001600160401b03811115610de257610de261397c565b604051908082528060200260200182016040528015610e0b578160200160208202803683370190505b50915060008060005b600284015461ffff16821015610f4d576000818152600185016020526040812054905b6008811015610f385783610e4a81613f56565b600288015490955061ffff1685119050610f3857600581901b82901b6001600160e01b0319811660009081526020889052604081205460601c90805b88811015610edb578a8181518110610ea057610ea0613f6f565b60200260200101516001600160a01b0316836001600160a01b031603610ec95760019150610edb565b80610ed381613f56565b915050610e86565b508015610eea57505050610f26565b818a8981518110610efd57610efd613f6f565b6001600160a01b039092166020928302919091019091015287610f1f81613f56565b9850505050505b80610f3081613f56565b915050610e37565b50508080610f4590613f56565b915050610e14565b505082525090565b6002610f6081611ef2565b81610f69611d62565b600601906109bd9082613fcb565b6000610f81611d62565b600501546001600160a01b0316919050565b6000610f9e8261278a565b92915050565b60006001600160a01b038216610fcd576040516323d3ad8160e21b815260040160405180910390fd5b6001600160401b03610fdd611cf5565b6005016000846001600160a01b03166001600160a01b0316815260200190815260200160002054169050919050565b611014611e8c565b61101e6000612837565b565b600061102a611d62565b600701546001600160a01b0316919050565b6000805160206144a1833981519152546060906000805160206144358339815191529061ffff166001600160401b0381111561107a5761107a61397c565b6040519080825280602002602001820160405280156110c057816020015b6040805180820190915260008152606060208201528152602001906001900390816110985790505b50600282015490925060009061ffff166001600160401b038111156110e7576110e761397c565b604051908082528060200260200182016040528015611110578160200160208202803683370190505b50905060008060005b600285015461ffff16821015611402576000818152600186016020526040812054905b60088110156113ed578361114f81613f56565b600289015490955061ffff16851190506113ed57600581901b82901b6001600160e01b0319811660009081526020899052604081205460601c90805b888110156112ab57826001600160a01b03168c82815181106111af576111af613f6f565b6020026020010151600001516001600160a01b03160361129957838c82815181106111dc576111dc613f6f565b6020026020010151602001518b83815181106111fa576111fa613f6f565b602002602001015161ffff168151811061121657611216613f6f565b60200260200101906001600160e01b03191690816001600160e01b0319168152505060ff8a828151811061124c5761124c613f6f565b602002602001015161ffff161061126257600080fd5b89818151811061127457611274613f6f565b6020026020010180518091906112899061408a565b61ffff16905250600191506112ab565b806112a381613f56565b91505061118b565b5080156112ba575050506113db565b818b89815181106112cd576112cd613f6f565b60209081029190910101516001600160a01b03909116905260028a015461ffff166001600160401b038111156113055761130561397c565b60405190808252806020026020018201604052801561132e578160200160208202803683370190505b508b898151811061134157611341613f6f565b602002602001015160200181905250828b898151811061136357611363613f6f565b60200260200101516020015160008151811061138157611381613f6f565b60200260200101906001600160e01b03191690816001600160e01b0319168152505060018989815181106113b7576113b7613f6f565b61ffff90921660209283029190910190910152876113d481613f56565b9850505050505b806113e581613f56565b91505061113c565b505080806113fa90613f56565b915050611119565b5060005b8281101561146a57600084828151811061142257611422613f6f565b602002602001015161ffff169050600087838151811061144457611444613f6f565b60200260200101516020015190508181525050808061146290613f56565b915050611406565b508185525050505090565b600161148081611ef2565b6109bd833084611f25565b6060611495611cf5565b600301805461075e90613ec7565b816000806114af611d62565b6004810154909150610100900460ff1660028160028111156114d3576114d3613efb565b148061153b575060018160028111156114ee576114ee613efb565b14801561151657506001600160a01b038416600090815260018301602052604090205460ff16155b801561153b5750611525611d86565b6001600160a01b0316846001600160a01b031614155b806115565750600083815260028301602052604090205460ff165b156115735760405162461bcd60e51b81526004016108fe90613f11565b8561157d81611da8565b61159757611589611dd7565b156115975761159781611ded565b6109358787612875565b6000805160206144a1833981519152546060906000805160206144358339815191529060009061ffff166001600160401b038111156115e2576115e261397c565b60405190808252806020026020018201604052801561160b578160200160208202803683370190505b5092506000805b600284015461ffff168210156116f6576000818152600185016020526040812054905b60088110156116e1578361164881613f56565b600288015490955061ffff16851190506116e157600581901b82901b6001600160e01b0319811660009081526020889052604090205460601c6001600160a01b038a168190036116cc57818988815181106116a5576116a5613f6f565b6001600160e01b031990921660209283029190910190910152866116c881613f56565b9750505b505080806116d990613f56565b915050611635565b505080806116ee90613f56565b915050611612565b5050825250919050565b8382600061170c611d62565b6004810154909150610100900460ff16600281600281111561173057611730613efb565b14806117985750600181600281111561174b5761174b613efb565b14801561177357506001600160a01b038416600090815260018301602052604090205460ff16155b80156117985750611782611d86565b6001600160a01b0316846001600160a01b031614155b806117b35750600083815260028301602052604090205460ff165b156117d05760405162461bcd60e51b81526004016108fe90613f11565b876001600160a01b0381163314611804576117ea33611da8565b611804576117f6611dd7565b156118045761180433611ded565b61181089898989612917565b505050505050505050565b6000805160206144e983398151915254610100900460ff16611850576000805160206144e98339815191525460ff1615611854565b303b155b6118c65760405162461bcd60e51b815260206004820152603760248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e747261637460448201527f20697320616c726561647920696e697469616c697a656400000000000000000060648201526084016108fe565b6000805160206144e983398151915254610100900460ff16158015611902576000805160206144e9833981519152805461ffff19166101011790555b61197587878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8b01819004810282018101909252898152925089915088908190840183828082843760009201919091525061296192505050565b61197e8961299f565b6001600160a01b038816156119cc5787611996611d62565b60070180546001600160a01b0319166001600160a01b03929092169190911790556119cc886119c7600260016140ab565b611ea7565b7ff298352fd56f58214bf2245c2b202523f72fca3199077ce992640958228b2820805461ffff191661ffff84161790557ff298352fd56f58214bf2245c2b202523f72fca3199077ce992640958228b282280546001600160a01b0319166001600160a01b03851617905580156118105750506000805160206144e9833981519152805461ff001916905550505050505050565b6060611a6a82611d19565b611a8757604051630a14c4b560e41b815260040160405180910390fd5b6000611a91611d62565b600084815260039190910160209081526040918290208251808401909352805460ff16151583526001810180549192840191611acc90613ec7565b80601f0160208091040260200160405190810160405280929190818152602001828054611af890613ec7565b8015611b455780601f10611b1a57610100808354040283529160200191611b45565b820191906000526020600020905b815481529060010190602001808311611b2857829003601f168201915b5050505050815250509050806000015115611b64576020015192915050565b6000611b6e6129db565b90508051600003611b8e5760405180602001604052806000815250611bb9565b80611b98856129f3565b604051602001611ba99291906140be565b6040516020818303038152906040525b949350505050565b6001611bcc81611ef2565b81611bd5611d62565b60080180546001600160a01b0319166001600160a01b03929092169190911790555050565b6001611c0581611ef2565b81611c0e611d62565b60070180546001600160a01b0319166001600160a01b03929092169190911790555050565b600080611c3e611d62565b905060016004820154610100900460ff166002811115611c6057611c60613efb565b03611c8b576001600160a01b03831660009081526001909101602052604090205460ff169050610f9e565b611bb98484612a37565b6001611ca081611ef2565b81611ca9611d62565b60050180546001600160a01b0319166001600160a01b03929092169190911790555050565b611cd6611e8c565b8060601b611cec57637448fbae6000526004601cfd5b61096881612837565b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4090565b600081600111158015611d335750611d2f611cf5565b5482105b8015610f9e5750600160e01b611d47611cf5565b60008481526004919091016020526040902054161592915050565b7f45f38af8fd646bf817698fe2be76218d850d401ba88ffd7c9cd1b4f5c9a1db5690565b6000611d9133612a74565b15611da3575060131936013560601c90565b503390565b6000611db2611d62565b6001600160a01b03909216600090815260019290920160205250604090205460ff1690565b6000611de1611d62565b6004015460ff16919050565b69c617113400112233445560005230601a5280603a52600080604460166daaeb6d7670e522a718067333cd4e5afa611e29573d6000803e3d6000fd5b6000603a5250565b61097d82826001612a9c565b638b78c6d8600c52816000526020600c20805482811681189250508181555080600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a35050565b638b78c6d81954331461101e576382b429006000526004601cfd5b638b78c6d8600c52816000526020600c208181541791508181555080600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a35050565b638b78c6d8600c5233600052806020600c20541661096857638b78c6d819543314610968576382b429006000526004601cfd5b6000611f2f611d62565b600085815260208281526040808320815160808101835281546001600160a01b0381168252600160a01b900460e01b6001600160e01b0319168185015260018201805484518187028101870186528181529798506000805160206144358339815191529792959394860193830182828015611ff657602002820191906000526020600020906000905b82829054906101000a900460e01b6001600160e01b03191681526020019060040190602082600301049283019260010382029150808411611fb85790505b50505091835250506002919091015460ff90811660209092019190915260608201519192501661205d5760405162461bcd60e51b8152602060048201526012602482015271105c1c08191bd95cc81b9bdd08195e1a5cdd60721b60448201526064016108fe565b604080516001808252818301909252600091816020015b604080516060808201835260008083526020830152918101919091528152602001906001900390816120745790505060408051606081019091526000815290915060208101600281526020018360400151815250816000815181106120db576120db613f6f565b602090810291909101810191909152828101516001600160e01b03191660009081526003850190915260409020805460ff1916905561211a8686612b63565b61213581600060405180602001604052806000815250612c29565b600087815260208590526040812080546001600160c01b03191681559061215f600183018261379f565b50600201805460ff1916905550505050505050565b600061217e611d62565b90506000600080516020614435833981519152905060008260040160029054906101000a90046001600160a01b03166001600160a01b031663bb4fceb96040518163ffffffff1660e01b81526004016020604051808303816000875af11580156121ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061221091906140ed565b6040516342c71f1d60e01b8152600481018890529091506000906001600160a01b038316906342c71f1d90602401600060405180830381865afa15801561225b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612283919081019061411b565b90506000816060015160ff16116122d15760405162461bcd60e51b8152602060048201526012602482015271105c1c08191bd95cc81b9bdd08195e1a5cdd60721b60448201526064016108fe565b604080516001808252818301909252600091816020015b604080516060808201835260008083526020830152918101919091528152602001906001900390816122e857905050604080516060810190915283516001600160a01b03168152909150602081016000815260200183604001518152508160008151811061235857612358613f6f565b602090810291909101810191909152828101516001600160e01b03191660009081526003860190915260409020805460ff1916600117905561239b818888612c29565b60008881526020868152604091829020845181548387015160e01c600160a01b026001600160c01b03199091166001600160a01b03909216919091171781559184015180518593926123f49260018501929101906137c4565b50606091909101516002909101805460ff191660ff9092169190911790555050505050505050565b60006124278261278a565b9050836001600160a01b0316816001600160a01b03161461245a5760405162a1148160e81b815260040160405180910390fd5b60008061246684612d74565b9150915061248c8187612477611d86565b6001600160a01b039081169116811491141790565b6124b95761249c8661070e611d86565b6124b957604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0385166124e057604051633a954ecd60e21b815260040160405180910390fd5b80156124eb57600082555b6124f3611cf5565b6001600160a01b038716600090815260059190910160205260409020805460001901905561251f611cf5565b6001600160a01b03861660008181526005929092016020526040909120805460010190554260a01b17600160e11b17612556611cf5565b60008681526004919091016020526040812091909155600160e11b841690036125cc5760018401612585611cf5565b6000828152600491909101602052604081205490036125ca576125a6611cf5565b5481146125ca57836125b6611cf5565b600083815260049190910160205260409020555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b600080600061262485612d9c565b61ffff16905061263385612dea565b612710612640868461422d565b61264a9190614244565b92509250509250929050565b804710156126a65760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108fe565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146126f3576040519150601f19603f3d011682016040523d82523d6000602084013e6126f8565b606091505b50509050806109bd5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108fe565b6109bd83838360405180602001604052806000815250611700565b60008160011161281e5761279c611cf5565b600083815260049190910160205260408120549150600160e01b8216900361281e5780600003612819576127ce611cf5565b5482106127ee57604051636f96cda160e11b815260040160405180910390fd5b6127f6611cf5565b6000199092016000818152600493909301602052604090922054905080156127ee575b919050565b604051636f96cda160e11b815260040160405180910390fd5b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b8061287e611cf5565b600701600061288b611d86565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff1916921515929092179091556128cf611d86565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161290b911515815260200190565b60405180910390a35050565b6129228484846109c2565b6001600160a01b0383163b1561295b5761293e84848484612e5a565b61295b576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6000805160206144e983398151915254610100900460ff166129955760405162461bcd60e51b81526004016108fe90614266565b61097d8282612f4b565b6001600160a01b0316638b78c6d8198190558060007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b60606129e5611d62565b600601805461075e90613ec7565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480612a0d5750819003601f19909101908152919050565b6000612a41611cf5565b6001600160a01b039384166000908152600791909101602090815260408083209490951682529290925250205460ff1690565b6000816001600160a01b0316612a88611d62565b600801546001600160a01b03161492915050565b6000612aa783610f93565b90508115612af857806001600160a01b0316612ac1611d86565b6001600160a01b031614612af857612adb8161070e611d86565b612af8576040516367d9dca160e11b815260040160405180910390fd5b83612b01611cf5565b6000858152600691909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551859287811692908516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a450505050565b6001600160a01b038216612b75575050565b612b978260405180606001604052806028815260200161447960289139612fbe565b600080836001600160a01b031683604051612bb291906142ba565b600060405180830381855af49150503d8060008114612bed576040519150601f19603f3d011682016040523d82523d6000602084013e612bf2565b606091505b50915091508161295b57805115612c0c5780518082602001fd5b838360405163192105d760e01b81526004016108fe9291906142d6565b6000805160206144a1833981519152546000805160206144358339815191529061ffff811690819060009060071615612c745750600381901c60009081526001840160205260409020545b60005b8751811015612cf157612ce483838a8481518110612c9757612c97613f6f565b6020026020010151600001518b8581518110612cb557612cb5613f6f565b6020026020010151602001518c8681518110612cd357612cd3613f6f565b602002602001015160400151612fdf565b9093509150600101612c77565b50828214612d0d5760028401805461ffff191661ffff84161790555b6007821615612d2f57600382901c600090815260018501602052604090208190555b7f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb673878787604051612d62939291906142fa565b60405180910390a16109358686612b63565b6000806000612d81611cf5565b60009485526006016020525050604090912080549092909150565b60008181527ff298352fd56f58214bf2245c2b202523f72fca3199077ce992640958228b281f6020819052604082205461ffff1691829003612de457600181015461ffff1691505b50919050565b60008181527ff298352fd56f58214bf2245c2b202523f72fca3199077ce992640958228b282160205260409020546001600160a01b03167ff298352fd56f58214bf2245c2b202523f72fca3199077ce992640958228b281f81612de457600301546001600160a01b031692915050565b6000836001600160a01b031663150b7a02612e73611d86565b8786866040518563ffffffff1660e01b8152600401612e9594939291906143c3565b6020604051808303816000875af1925050508015612ed0575060408051601f3d908101601f19168201909252612ecd91810190614400565b60015b612f2e573d808015612efe576040519150601f19603f3d011682016040523d82523d6000602084013e612f03565b606091505b508051600003612f26576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6000805160206144e983398151915254610100900460ff16612f7f5760405162461bcd60e51b81526004016108fe90614266565b81612f88611cf5565b60020190612f969082613fcb565b5080612fa0611cf5565b60030190612fae9082613fcb565b506001612fb9611cf5565b555050565b813b818161295b5760405162461bcd60e51b81526004016108fe919061390f565b60008080600080516020614435833981519152905060008451116130595760405162461bcd60e51b815260206004820152602b60248201527f4c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e206660448201526a1858d95d081d1bc818dd5d60aa1b60648201526084016108fe565b600085600281111561306d5761306d613efb565b036131d3576130948660405180606001604052806024815260200161445560249139612fbe565b60005b84518110156131cd5760008582815181106130b4576130b4613f6f565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c1561314d5760405162461bcd60e51b815260206004820152603560248201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f6044820152746e207468617420616c72656164792065786973747360581b60648201526084016108fe565b6001600160e01b031980831660008181526020879052604090206001600160601b031960608d901b168e17905560e060058e901b811692831c199c909c1690821c179a8190036131b15760038c901c600090815260018601602052604081209b909b555b8b6131bb81613f56565b9c505060019093019250613097915050565b50613793565b60018560028111156131e7576131e7613efb565b0361340c5761320e866040518060600160405280602881526020016144c160289139612fbe565b60005b84518110156131cd57600085828151811061322e5761322e613f6f565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c3081036132c35760405162461bcd60e51b815260206004820152602f60248201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60448201526e3aba30b1363290333ab731ba34b7b760891b60648201526084016108fe565b896001600160a01b0316816001600160a01b03160361334a5760405162461bcd60e51b815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e20776974682073616d652066756e6374696f6e000000000000000060648201526084016108fe565b6001600160a01b0381166133c65760405162461bcd60e51b815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e207468617420646f65736e2774206578697374000000000000000060648201526084016108fe565b506001600160e01b031990911660009081526020849052604090206bffffffffffffffffffffffff919091166001600160601b031960608a901b16179055600101613211565b600285600281111561342057613420613efb565b0361373b576001600160a01b0386161561349b5760405162461bcd60e51b815260206004820152603660248201527f4c69624469616d6f6e644375743a2052656d6f76652066616365742061646472604482015275657373206d757374206265206164647265737328302960501b60648201526084016108fe565b600388901c6007891660005b865181101561371b5760008a90036134e357826134c38161441d565b60008181526001870160205260409020549b509350600792506134f19050565b816134ed8161441d565b9250505b6000806000808a858151811061350957613509613f6f565b6020908102919091018101516001600160e01b031981166000908152918a9052604090912054909150606081901c6135a95760405162461bcd60e51b815260206004820152603760248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360448201527f74696f6e207468617420646f65736e277420657869737400000000000000000060648201526084016108fe565b30606082901c036136135760405162461bcd60e51b815260206004820152602e60248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560448201526d3a30b1363290333ab731ba34b7b760911b60648201526084016108fe565b600587901b8f901b94506001600160e01b031980861690831614613669576001600160e01b03198516600090815260208a90526040902080546001600160601b0319166bffffffffffffffffffffffff83161790555b6001600160e01b031991909116600090815260208990526040812055600381901c611fff16925060051b60e01690508582146136ce576000828152600188016020526040902080546001600160e01b031980841c19909116908516831c1790556136f2565b80836001600160e01b031916901c816001600160e01b031960001b901c198e16179c505b8460000361371057600086815260018801602052604081208190559c505b5050506001016134a7565b508061372883600861422d565b61373291906140ab565b99505050613793565b60405162461bcd60e51b815260206004820152602760248201527f4c69624469616d6f6e644375743a20496e636f727265637420466163657443756044820152663a20b1ba34b7b760c91b60648201526084016108fe565b50959694955050505050565b5080546000825560070160089004906000526020600020908101906109689190613870565b828054828255906000526020600020906007016008900481019282156138605791602002820160005b8382111561382e57835183826101000a81548163ffffffff021916908360e01c021790555092602001926004016020816003010492830192600103026137ed565b801561385e5782816101000a81549063ffffffff021916905560040160208160030104928301926001030261382e565b505b5061386c929150613870565b5090565b5b8082111561386c5760008155600101613871565b6001600160e01b03198116811461096857600080fd5b6000602082840312156138ad57600080fd5b81356138b881613885565b9392505050565b60005b838110156138da5781810151838201526020016138c2565b50506000910152565b600081518084526138fb8160208601602086016138bf565b601f01601f19169290920160200192915050565b6020815260006138b860208301846138e3565b60006020828403121561393457600080fd5b5035919050565b6001600160a01b038116811461096857600080fd5b6000806040838503121561396357600080fd5b823561396e8161393b565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156139b4576139b461397c565b60405290565b604051601f8201601f191681016001600160401b03811182821017156139e2576139e261397c565b604052919050565b60006001600160401b03831115613a0357613a0361397c565b613a16601f8401601f19166020016139ba565b9050828152838383011115613a2a57600080fd5b828260208301376000602084830101529392505050565b600082601f830112613a5257600080fd5b6138b8838335602085016139ea565b60008060408385031215613a7457600080fd5b8235915060208301356001600160401b03811115613a9157600080fd5b613a9d85828601613a41565b9150509250929050565b600080600060608486031215613abc57600080fd5b8335613ac78161393b565b92506020840135613ad78161393b565b929592945050506040919091013590565b60008060408385031215613afb57600080fd5b50508035926020909101359150565b600060208284031215613b1c57600080fd5b81356138b88161393b565b600081518084526020808501945080840160005b83811015613b615781516001600160e01b03191687529582019590820190600101613b3b565b509495945050505050565b602080825282516001600160a01b0316828201528201516001600160e01b03191660408083019190915282015160806060830152600090613bb060a0840182613b27565b905060ff60608501511660808401528091505092915050565b6020808252825182820181905260009190848201906040850190845b81811015613c0a5783516001600160a01b031683529284019291840191600101613be5565b50909695505050505050565b600060208284031215613c2857600080fd5b81356001600160401b03811115613c3e57600080fd5b8201601f81018413613c4f57600080fd5b611bb9848235602084016139ea565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015613ccd57888303603f19018552815180516001600160a01b03168452870151878401879052613cba87850182613b27565b9588019593505090860190600101613c85565b509098975050505050505050565b60008060408385031215613cee57600080fd5b8235613cf98161393b565b915060208301358015158114613d0e57600080fd5b809150509250929050565b6020815260006138b86020830184613b27565b60008060008060808587031215613d4257600080fd5b8435613d4d8161393b565b93506020850135613d5d8161393b565b92506040850135915060608501356001600160401b03811115613d7f57600080fd5b613d8b87828801613a41565b91505092959194509250565b60008083601f840112613da957600080fd5b5081356001600160401b03811115613dc057600080fd5b602083019150836020828501011115610aed57600080fd5b60008060008060008060008060c0898b031215613df457600080fd5b8835613dff8161393b565b97506020890135613e0f8161393b565b965060408901356001600160401b0380821115613e2b57600080fd5b613e378c838d01613d97565b909850965060608b0135915080821115613e5057600080fd5b50613e5d8b828c01613d97565b9095509350506080890135613e718161393b565b915060a089013561ffff81168114613e8857600080fd5b809150509295985092959890939650565b60008060408385031215613eac57600080fd5b8235613eb78161393b565b91506020830135613d0e8161393b565b600181811c90821680613edb57607f821691505b602082108103612de457634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b602080825260159082015274151c985b9cd9995c9cc81b9bdd08185b1b1bddd959605a1b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600060018201613f6857613f68613f40565b5060010190565b634e487b7160e01b600052603260045260246000fd5b601f8211156109bd57600081815260208120601f850160051c81016020861015613fac5750805b601f850160051c820191505b8181101561260e57828155600101613fb8565b81516001600160401b03811115613fe457613fe461397c565b613ff881613ff28454613ec7565b84613f85565b602080601f83116001811461402d57600084156140155750858301515b600019600386901b1c1916600185901b17855561260e565b600085815260208120601f198616915b8281101561405c5788860151825594840194600190910190840161403d565b508582101561407a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600061ffff8083168181036140a1576140a1613f40565b6001019392505050565b80820180821115610f9e57610f9e613f40565b600083516140d08184602088016138bf565b8351908301906140e48183602088016138bf565b01949350505050565b6000602082840312156140ff57600080fd5b81516138b88161393b565b805160ff8116811461281957600080fd5b6000602080838503121561412e57600080fd5b82516001600160401b038082111561414557600080fd5b908401906080828703121561415957600080fd5b614161613992565b825161416c8161393b565b81528284015161417b81613885565b8185015260408301518281111561419157600080fd5b8301601f810188136141a257600080fd5b8051838111156141b4576141b461397c565b8060051b93506141c58685016139ba565b818152938201860193868101908a8611156141df57600080fd5b928701925b8584101561420957835192506141f983613885565b82825292870192908701906141e4565b60408501525061421e9150506060840161410a565b60608201529695505050505050565b8082028115828204841417610f9e57610f9e613f40565b60008261426157634e487b7160e01b600052601260045260246000fd5b500490565b60208082526034908201527f455243373231415f5f496e697469616c697a61626c653a20636f6e7472616374604082015273206973206e6f7420696e697469616c697a696e6760601b606082015260800190565b600082516142cc8184602087016138bf565b9190910192915050565b6001600160a01b0383168152604060208201819052600090611bb9908301846138e3565b6000606080830181845280875180835260808601915060808160051b87010192506020808a016000805b8481101561439357898703607f19018652825180516001600160a01b03168852848101516003811061436457634e487b7160e01b84526021600452602484fd5b8886015260409081015190880189905261438089890182613b27565b9750509483019491830191600101614324565b5050506001600160a01b03891690870152505083810360408501526143b881866138e3565b979650505050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906143f6908301846138e3565b9695505050505050565b60006020828403121561441257600080fd5b81516138b881613885565b60008161442c5761442c613f40565b50600019019056fec8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c4c69624469616d6f6e644375743a2041646420666163657420686173206e6f20636f64654c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f6465c8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131e4c69624469616d6f6e644375743a205265706c61636520666163657420686173206e6f20636f6465ee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85fa26469706673582212201524751edfdc05882b3bceca22ab90b95f4e908d069775c8280424c3d412805e64736f6c63430008130033ee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85f

Deployed Bytecode

0x6080604052600436106102305760003560e01c806361d027b31161012e578063adfca15e116100ab578063da7422281161006f578063da742228146106b3578063e84a9728146106d3578063e985e9c5146106f3578063f0f4426014610713578063f2fde38b1461073357600080fd5b8063adfca15e146105ec578063b88d4fde14610619578063c00cf3ab1461062c578063c87b56dd1461064c578063cdffacc61461066c57600080fd5b80637a0ed627116100f25780637a0ed6271461055c5780638aebc3531461057e5780638da5cb5b1461059e57806395d89b41146105b7578063a22cb465146105cc57600080fd5b806361d027b3146104ea5780636352211e146104ff57806370a082311461051f578063715018a61461053f57806373e996531461054757600080fd5b806323b872dd116101bc57806342842e0e1161018057806342842e0e1461045557806342c71f1d146104685780634a4ee7b11461049557806352ef6b2c146104a857806355f804b3146104ca57600080fd5b806323b872dd1461039b5780632a55205a146103ae5780632de94807146103ed5780632fa8374b146104205780633ccfd60b1461044057600080fd5b806318160ddd1161020357806318160ddd14610312578063183a4f6e146103355780631c10893f146103485780631f1bf78b1461035b5780632099ba841461037b57600080fd5b806301ffc9a71461023557806306fdde03146102a3578063081812fc146102c5578063095ea7b3146102fd575b600080fd5b34801561024157600080fd5b5061028e61025036600461389b565b6001600160e01b03191660009081527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131f602052604090205460ff1690565b60405190151581526020015b60405180910390f35b3480156102af57600080fd5b506102b8610746565b60405161029a919061390f565b3480156102d157600080fd5b506102e56102e0366004613922565b6107e1565b6040516001600160a01b03909116815260200161029a565b61031061030b366004613950565b61082e565b005b34801561031e57600080fd5b5061032761093e565b60405190815260200161029a565b610310610343366004613922565b61095e565b610310610356366004613950565b61096b565b34801561036757600080fd5b50610310610376366004613922565b610981565b34801561038757600080fd5b50610310610396366004613a61565b6109a7565b6103106103a9366004613aa7565b6109c2565b3480156103ba57600080fd5b506103ce6103c9366004613ae8565b610adb565b604080516001600160a01b03909316835260208301919091520161029a565b3480156103f957600080fd5b50610327610408366004613b0a565b638b78c6d8600c908152600091909152602090205490565b34801561042c57600080fd5b5061031061043b366004613922565b610af4565b34801561044c57600080fd5b50610310610b1a565b610310610463366004613aa7565b610b83565b34801561047457600080fd5b50610488610483366004613922565b610c92565b60405161029a9190613b6c565b6103106104a3366004613950565b610d92565b3480156104b457600080fd5b506104bd610da4565b60405161029a9190613bc9565b3480156104d657600080fd5b506103106104e5366004613c16565b610f55565b3480156104f657600080fd5b506102e5610f77565b34801561050b57600080fd5b506102e561051a366004613922565b610f93565b34801561052b57600080fd5b5061032761053a366004613b0a565b610fa4565b61031061100c565b34801561055357600080fd5b506102e5611020565b34801561056857600080fd5b5061057161103c565b60405161029a9190613c5e565b34801561058a57600080fd5b50610310610599366004613a61565b611475565b3480156105aa57600080fd5b50638b78c6d819546102e5565b3480156105c357600080fd5b506102b861148b565b3480156105d857600080fd5b506103106105e7366004613cdb565b6114a3565b3480156105f857600080fd5b5061060c610607366004613b0a565b6115a1565b60405161029a9190613d19565b610310610627366004613d2c565b611700565b34801561063857600080fd5b50610310610647366004613dd8565b61181b565b34801561065857600080fd5b506102b8610667366004613922565b611a5f565b34801561067857600080fd5b506102e561068736600461389b565b6001600160e01b0319166000908152600080516020614435833981519152602052604090205460601c90565b3480156106bf57600080fd5b506103106106ce366004613b0a565b611bc1565b3480156106df57600080fd5b506103106106ee366004613b0a565b611bfa565b3480156106ff57600080fd5b5061028e61070e366004613e99565b611c33565b34801561071f57600080fd5b5061031061072e366004613b0a565b611c95565b610310610741366004613b0a565b611cce565b6060610750611cf5565b600201805461075e90613ec7565b80601f016020809104026020016040519081016040528092919081815260200182805461078a90613ec7565b80156107d75780601f106107ac576101008083540402835291602001916107d7565b820191906000526020600020905b8154815290600101906020018083116107ba57829003601f168201915b5050505050905090565b60006107ec82611d19565b610809576040516333d1c03960e21b815260040160405180910390fd5b610811611cf5565b60009283526006016020525060409020546001600160a01b031690565b8181600061083a611d62565b6004810154909150610100900460ff16600281600281111561085e5761085e613efb565b14806108c65750600181600281111561087957610879613efb565b1480156108a157506001600160a01b038416600090815260018301602052604090205460ff16155b80156108c657506108b0611d86565b6001600160a01b0316846001600160a01b031614155b806108e15750600083815260028301602052604090205460ff165b156109075760405162461bcd60e51b81526004016108fe90613f11565b60405180910390fd5b8561091181611da8565b61092b5761091d611dd7565b1561092b5761092b81611ded565b6109358787611e31565b50505050505050565b6000600161094a611cf5565b60010154610956611cf5565b540303919050565b6109683382611e3d565b50565b610973611e8c565b61097d8282611ea7565b5050565b600161098c81611ef2565b61097d82600060405180602001604052806000815250611f25565b60016109b281611ef2565b6109bd833084612174565b505050565b828160006109ce611d62565b6004810154909150610100900460ff1660028160028111156109f2576109f2613efb565b1480610a5a57506001816002811115610a0d57610a0d613efb565b148015610a3557506001600160a01b038416600090815260018301602052604090205460ff16155b8015610a5a5750610a44611d86565b6001600160a01b0316846001600160a01b031614155b80610a755750600083815260028301602052604090205460ff165b15610a925760405162461bcd60e51b81526004016108fe90613f11565b866001600160a01b0381163314610ac657610aac33611da8565b610ac657610ab8611dd7565b15610ac657610ac633611ded565b610ad188888861241c565b5050505050505050565b600080610ae88484612616565b915091505b9250929050565b6001610aff81611ef2565b61097d82600060405180602001604052806000815250612174565b6001610b2581611ef2565b6000610b2f611d62565b90504780610b6b5760405162461bcd60e51b8152602060048201526009602482015268302062616c616e636560b81b60448201526064016108fe565b60058201546109bd906001600160a01b031682612656565b82816000610b8f611d62565b6004810154909150610100900460ff166002816002811115610bb357610bb3613efb565b1480610c1b57506001816002811115610bce57610bce613efb565b148015610bf657506001600160a01b038416600090815260018301602052604090205460ff16155b8015610c1b5750610c05611d86565b6001600160a01b0316846001600160a01b031614155b80610c365750600083815260028301602052604090205460ff165b15610c535760405162461bcd60e51b81526004016108fe90613f11565b866001600160a01b0381163314610c8757610c6d33611da8565b610c8757610c79611dd7565b15610c8757610c8733611ded565b610ad188888861276f565b60408051608081018252600080825260208201819052606092820183905291810191909152610cbf611d62565b60008381526020918252604090819020815160808101835281546001600160a01b0381168252600160a01b900460e01b6001600160e01b03191681850152600182018054845181870281018701865281815292959394860193830182828015610d7457602002820191906000526020600020906000905b82829054906101000a900460e01b6001600160e01b03191681526020019060040190602082600301049283019260010382029150808411610d365790505b50505091835250506002919091015460ff1660209091015292915050565b610d9a611e8c565b61097d8282611e3d565b6000805160206144a1833981519152546060906000805160206144358339815191529061ffff166001600160401b03811115610de257610de261397c565b604051908082528060200260200182016040528015610e0b578160200160208202803683370190505b50915060008060005b600284015461ffff16821015610f4d576000818152600185016020526040812054905b6008811015610f385783610e4a81613f56565b600288015490955061ffff1685119050610f3857600581901b82901b6001600160e01b0319811660009081526020889052604081205460601c90805b88811015610edb578a8181518110610ea057610ea0613f6f565b60200260200101516001600160a01b0316836001600160a01b031603610ec95760019150610edb565b80610ed381613f56565b915050610e86565b508015610eea57505050610f26565b818a8981518110610efd57610efd613f6f565b6001600160a01b039092166020928302919091019091015287610f1f81613f56565b9850505050505b80610f3081613f56565b915050610e37565b50508080610f4590613f56565b915050610e14565b505082525090565b6002610f6081611ef2565b81610f69611d62565b600601906109bd9082613fcb565b6000610f81611d62565b600501546001600160a01b0316919050565b6000610f9e8261278a565b92915050565b60006001600160a01b038216610fcd576040516323d3ad8160e21b815260040160405180910390fd5b6001600160401b03610fdd611cf5565b6005016000846001600160a01b03166001600160a01b0316815260200190815260200160002054169050919050565b611014611e8c565b61101e6000612837565b565b600061102a611d62565b600701546001600160a01b0316919050565b6000805160206144a1833981519152546060906000805160206144358339815191529061ffff166001600160401b0381111561107a5761107a61397c565b6040519080825280602002602001820160405280156110c057816020015b6040805180820190915260008152606060208201528152602001906001900390816110985790505b50600282015490925060009061ffff166001600160401b038111156110e7576110e761397c565b604051908082528060200260200182016040528015611110578160200160208202803683370190505b50905060008060005b600285015461ffff16821015611402576000818152600186016020526040812054905b60088110156113ed578361114f81613f56565b600289015490955061ffff16851190506113ed57600581901b82901b6001600160e01b0319811660009081526020899052604081205460601c90805b888110156112ab57826001600160a01b03168c82815181106111af576111af613f6f565b6020026020010151600001516001600160a01b03160361129957838c82815181106111dc576111dc613f6f565b6020026020010151602001518b83815181106111fa576111fa613f6f565b602002602001015161ffff168151811061121657611216613f6f565b60200260200101906001600160e01b03191690816001600160e01b0319168152505060ff8a828151811061124c5761124c613f6f565b602002602001015161ffff161061126257600080fd5b89818151811061127457611274613f6f565b6020026020010180518091906112899061408a565b61ffff16905250600191506112ab565b806112a381613f56565b91505061118b565b5080156112ba575050506113db565b818b89815181106112cd576112cd613f6f565b60209081029190910101516001600160a01b03909116905260028a015461ffff166001600160401b038111156113055761130561397c565b60405190808252806020026020018201604052801561132e578160200160208202803683370190505b508b898151811061134157611341613f6f565b602002602001015160200181905250828b898151811061136357611363613f6f565b60200260200101516020015160008151811061138157611381613f6f565b60200260200101906001600160e01b03191690816001600160e01b0319168152505060018989815181106113b7576113b7613f6f565b61ffff90921660209283029190910190910152876113d481613f56565b9850505050505b806113e581613f56565b91505061113c565b505080806113fa90613f56565b915050611119565b5060005b8281101561146a57600084828151811061142257611422613f6f565b602002602001015161ffff169050600087838151811061144457611444613f6f565b60200260200101516020015190508181525050808061146290613f56565b915050611406565b508185525050505090565b600161148081611ef2565b6109bd833084611f25565b6060611495611cf5565b600301805461075e90613ec7565b816000806114af611d62565b6004810154909150610100900460ff1660028160028111156114d3576114d3613efb565b148061153b575060018160028111156114ee576114ee613efb565b14801561151657506001600160a01b038416600090815260018301602052604090205460ff16155b801561153b5750611525611d86565b6001600160a01b0316846001600160a01b031614155b806115565750600083815260028301602052604090205460ff165b156115735760405162461bcd60e51b81526004016108fe90613f11565b8561157d81611da8565b61159757611589611dd7565b156115975761159781611ded565b6109358787612875565b6000805160206144a1833981519152546060906000805160206144358339815191529060009061ffff166001600160401b038111156115e2576115e261397c565b60405190808252806020026020018201604052801561160b578160200160208202803683370190505b5092506000805b600284015461ffff168210156116f6576000818152600185016020526040812054905b60088110156116e1578361164881613f56565b600288015490955061ffff16851190506116e157600581901b82901b6001600160e01b0319811660009081526020889052604090205460601c6001600160a01b038a168190036116cc57818988815181106116a5576116a5613f6f565b6001600160e01b031990921660209283029190910190910152866116c881613f56565b9750505b505080806116d990613f56565b915050611635565b505080806116ee90613f56565b915050611612565b5050825250919050565b8382600061170c611d62565b6004810154909150610100900460ff16600281600281111561173057611730613efb565b14806117985750600181600281111561174b5761174b613efb565b14801561177357506001600160a01b038416600090815260018301602052604090205460ff16155b80156117985750611782611d86565b6001600160a01b0316846001600160a01b031614155b806117b35750600083815260028301602052604090205460ff165b156117d05760405162461bcd60e51b81526004016108fe90613f11565b876001600160a01b0381163314611804576117ea33611da8565b611804576117f6611dd7565b156118045761180433611ded565b61181089898989612917565b505050505050505050565b6000805160206144e983398151915254610100900460ff16611850576000805160206144e98339815191525460ff1615611854565b303b155b6118c65760405162461bcd60e51b815260206004820152603760248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e747261637460448201527f20697320616c726561647920696e697469616c697a656400000000000000000060648201526084016108fe565b6000805160206144e983398151915254610100900460ff16158015611902576000805160206144e9833981519152805461ffff19166101011790555b61197587878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8b01819004810282018101909252898152925089915088908190840183828082843760009201919091525061296192505050565b61197e8961299f565b6001600160a01b038816156119cc5787611996611d62565b60070180546001600160a01b0319166001600160a01b03929092169190911790556119cc886119c7600260016140ab565b611ea7565b7ff298352fd56f58214bf2245c2b202523f72fca3199077ce992640958228b2820805461ffff191661ffff84161790557ff298352fd56f58214bf2245c2b202523f72fca3199077ce992640958228b282280546001600160a01b0319166001600160a01b03851617905580156118105750506000805160206144e9833981519152805461ff001916905550505050505050565b6060611a6a82611d19565b611a8757604051630a14c4b560e41b815260040160405180910390fd5b6000611a91611d62565b600084815260039190910160209081526040918290208251808401909352805460ff16151583526001810180549192840191611acc90613ec7565b80601f0160208091040260200160405190810160405280929190818152602001828054611af890613ec7565b8015611b455780601f10611b1a57610100808354040283529160200191611b45565b820191906000526020600020905b815481529060010190602001808311611b2857829003601f168201915b5050505050815250509050806000015115611b64576020015192915050565b6000611b6e6129db565b90508051600003611b8e5760405180602001604052806000815250611bb9565b80611b98856129f3565b604051602001611ba99291906140be565b6040516020818303038152906040525b949350505050565b6001611bcc81611ef2565b81611bd5611d62565b60080180546001600160a01b0319166001600160a01b03929092169190911790555050565b6001611c0581611ef2565b81611c0e611d62565b60070180546001600160a01b0319166001600160a01b03929092169190911790555050565b600080611c3e611d62565b905060016004820154610100900460ff166002811115611c6057611c60613efb565b03611c8b576001600160a01b03831660009081526001909101602052604090205460ff169050610f9e565b611bb98484612a37565b6001611ca081611ef2565b81611ca9611d62565b60050180546001600160a01b0319166001600160a01b03929092169190911790555050565b611cd6611e8c565b8060601b611cec57637448fbae6000526004601cfd5b61096881612837565b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4090565b600081600111158015611d335750611d2f611cf5565b5482105b8015610f9e5750600160e01b611d47611cf5565b60008481526004919091016020526040902054161592915050565b7f45f38af8fd646bf817698fe2be76218d850d401ba88ffd7c9cd1b4f5c9a1db5690565b6000611d9133612a74565b15611da3575060131936013560601c90565b503390565b6000611db2611d62565b6001600160a01b03909216600090815260019290920160205250604090205460ff1690565b6000611de1611d62565b6004015460ff16919050565b69c617113400112233445560005230601a5280603a52600080604460166daaeb6d7670e522a718067333cd4e5afa611e29573d6000803e3d6000fd5b6000603a5250565b61097d82826001612a9c565b638b78c6d8600c52816000526020600c20805482811681189250508181555080600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a35050565b638b78c6d81954331461101e576382b429006000526004601cfd5b638b78c6d8600c52816000526020600c208181541791508181555080600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a35050565b638b78c6d8600c5233600052806020600c20541661096857638b78c6d819543314610968576382b429006000526004601cfd5b6000611f2f611d62565b600085815260208281526040808320815160808101835281546001600160a01b0381168252600160a01b900460e01b6001600160e01b0319168185015260018201805484518187028101870186528181529798506000805160206144358339815191529792959394860193830182828015611ff657602002820191906000526020600020906000905b82829054906101000a900460e01b6001600160e01b03191681526020019060040190602082600301049283019260010382029150808411611fb85790505b50505091835250506002919091015460ff90811660209092019190915260608201519192501661205d5760405162461bcd60e51b8152602060048201526012602482015271105c1c08191bd95cc81b9bdd08195e1a5cdd60721b60448201526064016108fe565b604080516001808252818301909252600091816020015b604080516060808201835260008083526020830152918101919091528152602001906001900390816120745790505060408051606081019091526000815290915060208101600281526020018360400151815250816000815181106120db576120db613f6f565b602090810291909101810191909152828101516001600160e01b03191660009081526003850190915260409020805460ff1916905561211a8686612b63565b61213581600060405180602001604052806000815250612c29565b600087815260208590526040812080546001600160c01b03191681559061215f600183018261379f565b50600201805460ff1916905550505050505050565b600061217e611d62565b90506000600080516020614435833981519152905060008260040160029054906101000a90046001600160a01b03166001600160a01b031663bb4fceb96040518163ffffffff1660e01b81526004016020604051808303816000875af11580156121ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061221091906140ed565b6040516342c71f1d60e01b8152600481018890529091506000906001600160a01b038316906342c71f1d90602401600060405180830381865afa15801561225b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612283919081019061411b565b90506000816060015160ff16116122d15760405162461bcd60e51b8152602060048201526012602482015271105c1c08191bd95cc81b9bdd08195e1a5cdd60721b60448201526064016108fe565b604080516001808252818301909252600091816020015b604080516060808201835260008083526020830152918101919091528152602001906001900390816122e857905050604080516060810190915283516001600160a01b03168152909150602081016000815260200183604001518152508160008151811061235857612358613f6f565b602090810291909101810191909152828101516001600160e01b03191660009081526003860190915260409020805460ff1916600117905561239b818888612c29565b60008881526020868152604091829020845181548387015160e01c600160a01b026001600160c01b03199091166001600160a01b03909216919091171781559184015180518593926123f49260018501929101906137c4565b50606091909101516002909101805460ff191660ff9092169190911790555050505050505050565b60006124278261278a565b9050836001600160a01b0316816001600160a01b03161461245a5760405162a1148160e81b815260040160405180910390fd5b60008061246684612d74565b9150915061248c8187612477611d86565b6001600160a01b039081169116811491141790565b6124b95761249c8661070e611d86565b6124b957604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0385166124e057604051633a954ecd60e21b815260040160405180910390fd5b80156124eb57600082555b6124f3611cf5565b6001600160a01b038716600090815260059190910160205260409020805460001901905561251f611cf5565b6001600160a01b03861660008181526005929092016020526040909120805460010190554260a01b17600160e11b17612556611cf5565b60008681526004919091016020526040812091909155600160e11b841690036125cc5760018401612585611cf5565b6000828152600491909101602052604081205490036125ca576125a6611cf5565b5481146125ca57836125b6611cf5565b600083815260049190910160205260409020555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b600080600061262485612d9c565b61ffff16905061263385612dea565b612710612640868461422d565b61264a9190614244565b92509250509250929050565b804710156126a65760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108fe565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146126f3576040519150601f19603f3d011682016040523d82523d6000602084013e6126f8565b606091505b50509050806109bd5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108fe565b6109bd83838360405180602001604052806000815250611700565b60008160011161281e5761279c611cf5565b600083815260049190910160205260408120549150600160e01b8216900361281e5780600003612819576127ce611cf5565b5482106127ee57604051636f96cda160e11b815260040160405180910390fd5b6127f6611cf5565b6000199092016000818152600493909301602052604090922054905080156127ee575b919050565b604051636f96cda160e11b815260040160405180910390fd5b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b8061287e611cf5565b600701600061288b611d86565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff1916921515929092179091556128cf611d86565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161290b911515815260200190565b60405180910390a35050565b6129228484846109c2565b6001600160a01b0383163b1561295b5761293e84848484612e5a565b61295b576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6000805160206144e983398151915254610100900460ff166129955760405162461bcd60e51b81526004016108fe90614266565b61097d8282612f4b565b6001600160a01b0316638b78c6d8198190558060007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b60606129e5611d62565b600601805461075e90613ec7565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480612a0d5750819003601f19909101908152919050565b6000612a41611cf5565b6001600160a01b039384166000908152600791909101602090815260408083209490951682529290925250205460ff1690565b6000816001600160a01b0316612a88611d62565b600801546001600160a01b03161492915050565b6000612aa783610f93565b90508115612af857806001600160a01b0316612ac1611d86565b6001600160a01b031614612af857612adb8161070e611d86565b612af8576040516367d9dca160e11b815260040160405180910390fd5b83612b01611cf5565b6000858152600691909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551859287811692908516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a450505050565b6001600160a01b038216612b75575050565b612b978260405180606001604052806028815260200161447960289139612fbe565b600080836001600160a01b031683604051612bb291906142ba565b600060405180830381855af49150503d8060008114612bed576040519150601f19603f3d011682016040523d82523d6000602084013e612bf2565b606091505b50915091508161295b57805115612c0c5780518082602001fd5b838360405163192105d760e01b81526004016108fe9291906142d6565b6000805160206144a1833981519152546000805160206144358339815191529061ffff811690819060009060071615612c745750600381901c60009081526001840160205260409020545b60005b8751811015612cf157612ce483838a8481518110612c9757612c97613f6f565b6020026020010151600001518b8581518110612cb557612cb5613f6f565b6020026020010151602001518c8681518110612cd357612cd3613f6f565b602002602001015160400151612fdf565b9093509150600101612c77565b50828214612d0d5760028401805461ffff191661ffff84161790555b6007821615612d2f57600382901c600090815260018501602052604090208190555b7f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb673878787604051612d62939291906142fa565b60405180910390a16109358686612b63565b6000806000612d81611cf5565b60009485526006016020525050604090912080549092909150565b60008181527ff298352fd56f58214bf2245c2b202523f72fca3199077ce992640958228b281f6020819052604082205461ffff1691829003612de457600181015461ffff1691505b50919050565b60008181527ff298352fd56f58214bf2245c2b202523f72fca3199077ce992640958228b282160205260409020546001600160a01b03167ff298352fd56f58214bf2245c2b202523f72fca3199077ce992640958228b281f81612de457600301546001600160a01b031692915050565b6000836001600160a01b031663150b7a02612e73611d86565b8786866040518563ffffffff1660e01b8152600401612e9594939291906143c3565b6020604051808303816000875af1925050508015612ed0575060408051601f3d908101601f19168201909252612ecd91810190614400565b60015b612f2e573d808015612efe576040519150601f19603f3d011682016040523d82523d6000602084013e612f03565b606091505b508051600003612f26576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6000805160206144e983398151915254610100900460ff16612f7f5760405162461bcd60e51b81526004016108fe90614266565b81612f88611cf5565b60020190612f969082613fcb565b5080612fa0611cf5565b60030190612fae9082613fcb565b506001612fb9611cf5565b555050565b813b818161295b5760405162461bcd60e51b81526004016108fe919061390f565b60008080600080516020614435833981519152905060008451116130595760405162461bcd60e51b815260206004820152602b60248201527f4c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e206660448201526a1858d95d081d1bc818dd5d60aa1b60648201526084016108fe565b600085600281111561306d5761306d613efb565b036131d3576130948660405180606001604052806024815260200161445560249139612fbe565b60005b84518110156131cd5760008582815181106130b4576130b4613f6f565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c1561314d5760405162461bcd60e51b815260206004820152603560248201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f6044820152746e207468617420616c72656164792065786973747360581b60648201526084016108fe565b6001600160e01b031980831660008181526020879052604090206001600160601b031960608d901b168e17905560e060058e901b811692831c199c909c1690821c179a8190036131b15760038c901c600090815260018601602052604081209b909b555b8b6131bb81613f56565b9c505060019093019250613097915050565b50613793565b60018560028111156131e7576131e7613efb565b0361340c5761320e866040518060600160405280602881526020016144c160289139612fbe565b60005b84518110156131cd57600085828151811061322e5761322e613f6f565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c3081036132c35760405162461bcd60e51b815260206004820152602f60248201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60448201526e3aba30b1363290333ab731ba34b7b760891b60648201526084016108fe565b896001600160a01b0316816001600160a01b03160361334a5760405162461bcd60e51b815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e20776974682073616d652066756e6374696f6e000000000000000060648201526084016108fe565b6001600160a01b0381166133c65760405162461bcd60e51b815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e207468617420646f65736e2774206578697374000000000000000060648201526084016108fe565b506001600160e01b031990911660009081526020849052604090206bffffffffffffffffffffffff919091166001600160601b031960608a901b16179055600101613211565b600285600281111561342057613420613efb565b0361373b576001600160a01b0386161561349b5760405162461bcd60e51b815260206004820152603660248201527f4c69624469616d6f6e644375743a2052656d6f76652066616365742061646472604482015275657373206d757374206265206164647265737328302960501b60648201526084016108fe565b600388901c6007891660005b865181101561371b5760008a90036134e357826134c38161441d565b60008181526001870160205260409020549b509350600792506134f19050565b816134ed8161441d565b9250505b6000806000808a858151811061350957613509613f6f565b6020908102919091018101516001600160e01b031981166000908152918a9052604090912054909150606081901c6135a95760405162461bcd60e51b815260206004820152603760248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360448201527f74696f6e207468617420646f65736e277420657869737400000000000000000060648201526084016108fe565b30606082901c036136135760405162461bcd60e51b815260206004820152602e60248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560448201526d3a30b1363290333ab731ba34b7b760911b60648201526084016108fe565b600587901b8f901b94506001600160e01b031980861690831614613669576001600160e01b03198516600090815260208a90526040902080546001600160601b0319166bffffffffffffffffffffffff83161790555b6001600160e01b031991909116600090815260208990526040812055600381901c611fff16925060051b60e01690508582146136ce576000828152600188016020526040902080546001600160e01b031980841c19909116908516831c1790556136f2565b80836001600160e01b031916901c816001600160e01b031960001b901c198e16179c505b8460000361371057600086815260018801602052604081208190559c505b5050506001016134a7565b508061372883600861422d565b61373291906140ab565b99505050613793565b60405162461bcd60e51b815260206004820152602760248201527f4c69624469616d6f6e644375743a20496e636f727265637420466163657443756044820152663a20b1ba34b7b760c91b60648201526084016108fe565b50959694955050505050565b5080546000825560070160089004906000526020600020908101906109689190613870565b828054828255906000526020600020906007016008900481019282156138605791602002820160005b8382111561382e57835183826101000a81548163ffffffff021916908360e01c021790555092602001926004016020816003010492830192600103026137ed565b801561385e5782816101000a81549063ffffffff021916905560040160208160030104928301926001030261382e565b505b5061386c929150613870565b5090565b5b8082111561386c5760008155600101613871565b6001600160e01b03198116811461096857600080fd5b6000602082840312156138ad57600080fd5b81356138b881613885565b9392505050565b60005b838110156138da5781810151838201526020016138c2565b50506000910152565b600081518084526138fb8160208601602086016138bf565b601f01601f19169290920160200192915050565b6020815260006138b860208301846138e3565b60006020828403121561393457600080fd5b5035919050565b6001600160a01b038116811461096857600080fd5b6000806040838503121561396357600080fd5b823561396e8161393b565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156139b4576139b461397c565b60405290565b604051601f8201601f191681016001600160401b03811182821017156139e2576139e261397c565b604052919050565b60006001600160401b03831115613a0357613a0361397c565b613a16601f8401601f19166020016139ba565b9050828152838383011115613a2a57600080fd5b828260208301376000602084830101529392505050565b600082601f830112613a5257600080fd5b6138b8838335602085016139ea565b60008060408385031215613a7457600080fd5b8235915060208301356001600160401b03811115613a9157600080fd5b613a9d85828601613a41565b9150509250929050565b600080600060608486031215613abc57600080fd5b8335613ac78161393b565b92506020840135613ad78161393b565b929592945050506040919091013590565b60008060408385031215613afb57600080fd5b50508035926020909101359150565b600060208284031215613b1c57600080fd5b81356138b88161393b565b600081518084526020808501945080840160005b83811015613b615781516001600160e01b03191687529582019590820190600101613b3b565b509495945050505050565b602080825282516001600160a01b0316828201528201516001600160e01b03191660408083019190915282015160806060830152600090613bb060a0840182613b27565b905060ff60608501511660808401528091505092915050565b6020808252825182820181905260009190848201906040850190845b81811015613c0a5783516001600160a01b031683529284019291840191600101613be5565b50909695505050505050565b600060208284031215613c2857600080fd5b81356001600160401b03811115613c3e57600080fd5b8201601f81018413613c4f57600080fd5b611bb9848235602084016139ea565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015613ccd57888303603f19018552815180516001600160a01b03168452870151878401879052613cba87850182613b27565b9588019593505090860190600101613c85565b509098975050505050505050565b60008060408385031215613cee57600080fd5b8235613cf98161393b565b915060208301358015158114613d0e57600080fd5b809150509250929050565b6020815260006138b86020830184613b27565b60008060008060808587031215613d4257600080fd5b8435613d4d8161393b565b93506020850135613d5d8161393b565b92506040850135915060608501356001600160401b03811115613d7f57600080fd5b613d8b87828801613a41565b91505092959194509250565b60008083601f840112613da957600080fd5b5081356001600160401b03811115613dc057600080fd5b602083019150836020828501011115610aed57600080fd5b60008060008060008060008060c0898b031215613df457600080fd5b8835613dff8161393b565b97506020890135613e0f8161393b565b965060408901356001600160401b0380821115613e2b57600080fd5b613e378c838d01613d97565b909850965060608b0135915080821115613e5057600080fd5b50613e5d8b828c01613d97565b9095509350506080890135613e718161393b565b915060a089013561ffff81168114613e8857600080fd5b809150509295985092959890939650565b60008060408385031215613eac57600080fd5b8235613eb78161393b565b91506020830135613d0e8161393b565b600181811c90821680613edb57607f821691505b602082108103612de457634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b602080825260159082015274151c985b9cd9995c9cc81b9bdd08185b1b1bddd959605a1b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600060018201613f6857613f68613f40565b5060010190565b634e487b7160e01b600052603260045260246000fd5b601f8211156109bd57600081815260208120601f850160051c81016020861015613fac5750805b601f850160051c820191505b8181101561260e57828155600101613fb8565b81516001600160401b03811115613fe457613fe461397c565b613ff881613ff28454613ec7565b84613f85565b602080601f83116001811461402d57600084156140155750858301515b600019600386901b1c1916600185901b17855561260e565b600085815260208120601f198616915b8281101561405c5788860151825594840194600190910190840161403d565b508582101561407a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600061ffff8083168181036140a1576140a1613f40565b6001019392505050565b80820180821115610f9e57610f9e613f40565b600083516140d08184602088016138bf565b8351908301906140e48183602088016138bf565b01949350505050565b6000602082840312156140ff57600080fd5b81516138b88161393b565b805160ff8116811461281957600080fd5b6000602080838503121561412e57600080fd5b82516001600160401b038082111561414557600080fd5b908401906080828703121561415957600080fd5b614161613992565b825161416c8161393b565b81528284015161417b81613885565b8185015260408301518281111561419157600080fd5b8301601f810188136141a257600080fd5b8051838111156141b4576141b461397c565b8060051b93506141c58685016139ba565b818152938201860193868101908a8611156141df57600080fd5b928701925b8584101561420957835192506141f983613885565b82825292870192908701906141e4565b60408501525061421e9150506060840161410a565b60608201529695505050505050565b8082028115828204841417610f9e57610f9e613f40565b60008261426157634e487b7160e01b600052601260045260246000fd5b500490565b60208082526034908201527f455243373231415f5f496e697469616c697a61626c653a20636f6e7472616374604082015273206973206e6f7420696e697469616c697a696e6760601b606082015260800190565b600082516142cc8184602087016138bf565b9190910192915050565b6001600160a01b0383168152604060208201819052600090611bb9908301846138e3565b6000606080830181845280875180835260808601915060808160051b87010192506020808a016000805b8481101561439357898703607f19018652825180516001600160a01b03168852848101516003811061436457634e487b7160e01b84526021600452602484fd5b8886015260409081015190880189905261438089890182613b27565b9750509483019491830191600101614324565b5050506001600160a01b03891690870152505083810360408501526143b881866138e3565b979650505050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906143f6908301846138e3565b9695505050505050565b60006020828403121561441257600080fd5b81516138b881613885565b60008161442c5761442c613f40565b50600019019056fec8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c4c69624469616d6f6e644375743a2041646420666163657420686173206e6f20636f64654c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f6465c8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131e4c69624469616d6f6e644375743a205265706c61636520666163657420686173206e6f20636f6465ee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85fa26469706673582212201524751edfdc05882b3bceca22ab90b95f4e908d069775c8280424c3d412805e64736f6c63430008130033

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

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.