ETH Price: $2,468.05 (+0.94%)

Contract

0x83c8e59daD2905E53203F8448f84bD525D82b56B
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040149490152022-06-12 7:49:41854 days ago1655020181IN
 Create: BaseNFTFacet
0 ETH0.1618993233.35749225

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BaseNFTFacet

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
File 1 of 38 : BaseNFTFacet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import {ERC721AFacet, ERC721ALib} from "./ERC721A/ERC721AFacet.sol";
import {AccessControlModifiers, AccessControlLib} from "./AccessControl/AccessControlModifiers.sol";
import {BaseNFTLib} from "./BaseNFTLib.sol";
import {SaleStateModifiers} from "./BaseNFTModifiers.sol";
import {URIStorageLib} from "./URIStorage/URIStorageLib.sol";
import {URIStorageFacet} from "./URIStorage/URIStorageFacet.sol";
import {PaymentSplitterFacet} from "./PaymentSplitter/PaymentSplitterFacet.sol";
import {RoyaltyStandardFacet} from "./RoyaltyStandard/RoyaltyStandardFacet.sol";
import {RoyaltyStandardLib} from "./RoyaltyStandard/RoyaltyStandardLib.sol";

error NonExistentToken();
error AlreadyInitialized();

// Inherit from other facets in the BaseNFTFacet
// Why inherit to one facet instead of deploying Each Facet Separately?
// Because its cheaper for end customers to just store / cut one facet address

contract BaseNFTFacet is
    SaleStateModifiers,
    AccessControlModifiers,
    ERC721AFacet,
    RoyaltyStandardFacet,
    URIStorageFacet
{
    function setTokenMeta(
        string memory _name,
        string memory _symbol,
        uint96 _defaultRoyalty
    ) public onlyOwner whenNotPaused {
        ERC721ALib.ERC721AStorage storage s = ERC721ALib.erc721AStorage();
        s._name = _name;
        s._symbol = _symbol;
        RoyaltyStandardLib._setDefaultRoyalty(_defaultRoyalty);
    }

    function devMint(address to, uint256 quantity)
        public
        payable
        onlyOperator
        whenNotPaused
    {
        BaseNFTLib._safeMint(to, quantity);
    }

    function devMintUnsafe(address to, uint256 quantity)
        public
        payable
        onlyOperator
        whenNotPaused
    {
        BaseNFTLib._unsafeMint(to, quantity);
    }

    function devMintWithTokenURI(address to, string memory _tokenURI)
        public
        payable
        onlyOperator
        whenNotPaused
    {
        uint256 tokenId = BaseNFTLib._safeMint(to, 1);
        URIStorageLib.setTokenURI(tokenId, _tokenURI);
    }

    function saleState() public view returns (uint256) {
        return BaseNFTLib.saleState();
    }

    function setSaleState(uint256 _saleState)
        public
        onlyOperator
        whenNotPaused
    {
        BaseNFTLib.setSaleState(_saleState);
    }

    function setMaxMintable(uint256 _maxMintable)
        public
        onlyOperator
        whenNotPaused
    {
        return BaseNFTLib.setMaxMintable(_maxMintable);
    }

    function maxMintable() public view returns (uint256) {
        return BaseNFTLib.maxMintable();
    }

    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        if (!ERC721ALib._exists(tokenId)) {
            revert NonExistentToken();
        }

        return URIStorageLib.tokenURI(tokenId);
    }

    function allOwners() external view returns (address[] memory) {
        return BaseNFTLib.allOwners();
    }

    function allTokensForOwner(address _owner)
        external
        view
        returns (uint256[] memory)
    {
        return BaseNFTLib.allTokensForOwner(_owner);
    }
}

File 2 of 38 : ERC721AFacet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "./ERC721ALib.sol";
import {PausableModifiers} from "../Pausable/PausableModifiers.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension. Built to optimize for lower gas during batch mints.
 *
 * Assumes serials are sequentially minted starting at ERC721ALib._startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).
 *
 * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 *
 * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
 */
abstract contract ERC721AFacet is IERC721Metadata, PausableModifiers {
    using Address for address;
    using Strings for uint256;

    /**
     * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
     */
    function totalSupply() public view returns (uint256) {
        ERC721ALib.ERC721AStorage storage s = ERC721ALib.erc721AStorage();
        // Counter underflow is impossible as _burnCounter cannot be incremented
        // more than _currentIndex - _startTokenId() times
        unchecked {
            return s._currentIndex - s._burnCounter - 1;
        }
    }

    /**
     * Returns the total amount of tokens minted in the contract.
     */
    function totalMinted() public view returns (uint256) {
        return ERC721ALib.totalMinted();
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view override returns (uint256) {
        return ERC721ALib.balanceOf(owner);
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view override returns (address) {
        return ERC721ALib._ownershipOf(tokenId).addr;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return ERC721ALib.erc721AStorage()._name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return ERC721ALib.erc721AStorage()._symbol;
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId)
        public
        override
        whenNotPaused
    {
        address owner = ERC721AFacet.ownerOf(tokenId);
        if (to == owner) revert ApprovalToCurrentOwner();

        if (msg.sender != owner && !isApprovedForAll(owner, msg.sender)) {
            revert ApprovalCallerNotOwnerNorApproved();
        }

        ERC721ALib._approve(to, tokenId, owner);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId)
        public
        view
        override
        returns (address)
    {
        return ERC721ALib._getApproved(tokenId);
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved)
        public
        virtual
        override
        whenNotPaused
    {
        if (operator == msg.sender) revert ApproveToCaller();

        ERC721ALib.erc721AStorage()._operatorApprovals[msg.sender][
            operator
        ] = approved;
        emit ApprovalForAll(msg.sender, operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator)
        public
        view
        virtual
        override
        returns (bool)
    {
        return ERC721ALib._isApprovedForAll(owner, operator);
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override whenNotPaused {
        ERC721ALib._transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override whenNotPaused {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override whenNotPaused {
        ERC721ALib._transfer(from, to, tokenId);
        if (
            to.isContract() &&
            !ERC721ALib._checkContractOnERC721Received(from, to, tokenId, _data)
        ) {
            revert TransferToNonERC721ReceiverImplementer();
        }
    }

    function burn(uint256 tokenId) public whenNotPaused {
        ERC721ALib._burn(tokenId);
    }

    function startTokenId() public pure returns (uint256) {
        return ERC721ALib._startTokenId();
    }

    function exists(uint256 tokenId) public view returns (bool) {
        return ERC721ALib._exists(tokenId);
    }

    function numberMinted(address tokenOwner) public view returns (uint256) {
        return ERC721ALib._numberMinted(tokenOwner);
    }
}

File 3 of 38 : AccessControlModifiers.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./AccessControlLib.sol";

abstract contract AccessControlModifiers {
    modifier onlyOperator() {
        AccessControlLib._checkRole(AccessControlLib.OPERATOR_ROLE, msg.sender);
        _;
    }

    modifier onlyOwner() {
        AccessControlLib._enforceOwner();
        _;
    }
}

File 4 of 38 : BaseNFTLib.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import {ERC721ALib} from "./ERC721A/ERC721ALib.sol";

error ExceedsMaxMintable();
error MaxMintableTooSmall();
error MaxMintableLocked();

library BaseNFTLib {
    struct BaseNFTStorage {
        uint256 saleState;
        uint256 maxMintable; // the max number of tokens able to be minted
        bool maxMintableLocked;
    }

    function baseNFTStorage()
        internal
        pure
        returns (BaseNFTStorage storage es)
    {
        bytes32 position = keccak256("base.nft.diamond.storage");
        assembly {
            es.slot := position
        }
    }

    function saleState() internal view returns (uint256) {
        return baseNFTStorage().saleState;
    }

    function setSaleState(uint256 _saleState) internal {
        baseNFTStorage().saleState = _saleState;
    }

    function _safeMint(address to, uint256 quantity)
        internal
        returns (uint256 initialTokenId)
    {
        // if max mintable is zero, unlimited mints are allowed
        uint256 max = baseNFTStorage().maxMintable;
        if (max != 0 && max < (ERC721ALib.totalMinted() + quantity)) {
            revert ExceedsMaxMintable();
        }

        // returns the id of the first token minted!
        initialTokenId = ERC721ALib.currentIndex();
        ERC721ALib._safeMint(to, quantity);
    }

    // skips checks about sending to contract addresses
    function _unsafeMint(address to, uint256 quantity)
        internal
        returns (uint256 initialTokenId)
    {
        // if max mintable is zero, unlimited mints are allowed
        uint256 max = baseNFTStorage().maxMintable;
        if (max != 0 && max < (ERC721ALib.totalMinted() + quantity)) {
            revert ExceedsMaxMintable();
        }

        // returns the id of the first token minted!
        initialTokenId = ERC721ALib.currentIndex();
        ERC721ALib._mint(to, quantity, "", false);
    }

    function maxMintable() internal view returns (uint256) {
        return baseNFTStorage().maxMintable;
    }

    function setMaxMintable(uint256 _maxMintable) internal {
        if (_maxMintable < ERC721ALib.totalMinted()) {
            revert MaxMintableTooSmall();
        }
        if (baseNFTStorage().maxMintableLocked) {
            revert MaxMintableLocked();
        }

        baseNFTStorage().maxMintable = _maxMintable;
    }

    // NOTE: this returns an array of owner addresses for each token
    // this may return duplicate addresses if one address owns multiple
    // tokens. The client should de-doop as needed
    function allOwners() internal view returns (address[] memory) {
        uint256 currIndex = ERC721ALib.erc721AStorage()._currentIndex;

        address[] memory _allOwners = new address[](currIndex - 1);

        for (uint256 i = 0; i < currIndex - 1; i++) {
            uint256 tokenId = i + 1;
            if (ERC721ALib._exists(tokenId)) {
                address owner = ERC721ALib._ownershipOf(tokenId).addr;
                _allOwners[i] = owner;
            } else {
                _allOwners[i] = address(0x0);
            }
        }

        return _allOwners;
    }

    function allTokensForOwner(address _owner)
        internal
        view
        returns (uint256[] memory)
    {
        uint256 balance = ERC721ALib.balanceOf(_owner);
        uint256 currIndex = ERC721ALib.erc721AStorage()._currentIndex;

        uint256[] memory tokens = new uint256[](balance);
        uint256 tokenCount = 0;

        for (uint256 i = 1; i < currIndex; i++) {
            if (ERC721ALib._exists(i)) {
                address ownerOfToken = ERC721ALib._ownershipOf(i).addr;

                if (ownerOfToken == _owner) {
                    tokens[tokenCount] = i;
                    tokenCount++;
                }
            }
        }

        return tokens;
    }
}

File 5 of 38 : BaseNFTModifiers.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

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

// sale states
// 0 - closed
// 1 - public sale
// 2 - allow list sale

error IncorrectSaleState();

abstract contract SaleStateModifiers {
    modifier onlyAtSaleState(uint256 _gatedSaleState) {
        if (_gatedSaleState != BaseNFTLib.saleState()) {
            revert IncorrectSaleState();
        }
        _;
    }

    modifier onlyAtOneOfSaleStates(uint256[] calldata _gatedSaleStates) {
        uint256 currState = BaseNFTLib.saleState();
        for (uint256 i; i < _gatedSaleStates.length; i++) {
            if (_gatedSaleStates[i] == currState) {
                _;
                return;
            }
        }

        revert IncorrectSaleState();
    }
}

File 6 of 38 : URIStorageLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {DiamondCloneLib} from "../DiamondClone/DiamondCloneLib.sol";
import {Strings} from "../ERC721A/ERC721ALib.sol";
import {DiamondSaw} from "../../DiamondSaw.sol";

error MetaDataLocked();

library URIStorageLib {
    using Strings for uint256;

    struct URIStorage {
        mapping(uint256 => string) _tokenURIs;
        string folderStorageBaseURI;
        string tokenStorageBaseURI;
        bytes4 tokenURIOverrideSelector;
        bool metadataLocked;
    }

    function uriStorage() internal pure returns (URIStorage storage s) {
        bytes32 position = keccak256("uri.storage.facet.storage");
        assembly {
            s.slot := position
        }
    }

    function setFolderStorageBaseURI(string memory _baseURI) internal {
        URIStorage storage s = uriStorage();
        if (s.metadataLocked) revert MetaDataLocked();
        s.folderStorageBaseURI = _baseURI;
    }

    function setTokenStorageBaseURI(string memory _baseURI) internal {
        URIStorage storage s = uriStorage();
        if (s.metadataLocked) revert MetaDataLocked();
        s.tokenStorageBaseURI = _baseURI;
    }

    function tokenURIFromStorage(uint256 tokenId)
        internal
        view
        returns (string storage)
    {
        return uriStorage()._tokenURIs[tokenId];
    }

    function setTokenURI(uint256 tokenId, string memory _tokenURI) internal {
        URIStorage storage s = uriStorage();
        if (s.metadataLocked) revert MetaDataLocked();
        s._tokenURIs[tokenId] = _tokenURI;
    }

    function _burn(uint256 tokenId) internal {
        URIStorage storage s = uriStorage();
        if (bytes(s._tokenURIs[tokenId]).length != 0) {
            delete s._tokenURIs[tokenId];
        }
    }

    function setTokenURIOverrideSelector(bytes4 selector) internal {
        URIStorage storage s = uriStorage();
        if (s.metadataLocked) revert MetaDataLocked();

        address sawAddress = DiamondCloneLib
            .diamondCloneStorage()
            .diamondSawAddress;
        bool isApproved = DiamondSaw(sawAddress).isTokenURISelectorApproved(
            selector
        );
        require(isApproved, "selector not approved");
        s.tokenURIOverrideSelector = selector;
    }

    function removeTokenURIOverrideSelector() internal {
        URIStorage storage s = uriStorage();
        if (s.metadataLocked) revert MetaDataLocked();
        s.tokenURIOverrideSelector = bytes4(0);
    }

    // Check for
    // 1. tokenURIOverride (approved override function)
    // 2. if individual token uri is set
    // 3. folder storage
    function tokenURI(uint256 tokenId) internal view returns (string memory) {
        URIStorage storage s = uriStorage();

        // the override is set, use that
        if (s.tokenURIOverrideSelector != bytes4(0)) {
            (bool success, bytes memory result) = address(this).staticcall(
                abi.encodeWithSelector(s.tokenURIOverrideSelector, tokenId)
            );
            require(success, "Token URI Override Failed");

            string memory uri = abi.decode(result, (string));
            return uri;
        }

        // fall back on "normal" token storage
        string storage individualTokenURI = tokenURIFromStorage(tokenId);
        string storage folderStorageBaseURI = s.folderStorageBaseURI;
        string storage tokenStorageBaseURI = s.tokenStorageBaseURI;

        return
            bytes(individualTokenURI).length != 0
                ? string(
                    abi.encodePacked(tokenStorageBaseURI, individualTokenURI)
                )
                : string(
                    abi.encodePacked(folderStorageBaseURI, tokenId.toString())
                );
    }

    function lockMetadata() internal {
        uriStorage().metadataLocked = true;
    }
}

File 7 of 38 : URIStorageFacet.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {URIStorageLib} from "./URIStorageLib.sol";
import {AccessControlModifiers} from "../AccessControl/AccessControlModifiers.sol";
import {PausableModifiers} from "../Pausable/PausableModifiers.sol";

contract URIStorageFacet is AccessControlModifiers, PausableModifiers {
    function setTokenURI(uint256 tokenId, string memory _tokenURI)
        external
        onlyOperator
        whenNotPaused
    {
        URIStorageLib.setTokenURI(tokenId, _tokenURI);
    }

    function setFolderStorageBaseURI(string memory _baseURI)
        public
        onlyOperator
        whenNotPaused
    {
        URIStorageLib.setFolderStorageBaseURI(_baseURI);
    }

    function setTokenStorageBaseURI(string memory _baseURI)
        public
        onlyOperator
        whenNotPaused
    {
        URIStorageLib.setTokenStorageBaseURI(_baseURI);
    }

    function lockMetadata() public onlyOwner whenNotPaused {
        URIStorageLib.lockMetadata();
    }

    function metadataLocked() public view returns (bool) {
        return URIStorageLib.uriStorage().metadataLocked;
    }

    function folderStorageBaseURI() public view returns (string memory) {
        return URIStorageLib.uriStorage().folderStorageBaseURI;
    }

    function tokenStorageBaseURI() public view returns (string memory) {
        return URIStorageLib.uriStorage().tokenStorageBaseURI;
    }

    function setTokenURIOverrideSelector(bytes4 selector)
        external
        onlyOwner
        whenNotPaused
    {
        URIStorageLib.setTokenURIOverrideSelector(selector);
    }

    function removeTokenURIOverrideSelector() external onlyOwner whenNotPaused {
        URIStorageLib.removeTokenURIOverrideSelector();
    }

    function tokenURIOverrideSelector() public view returns (bytes4) {
        return URIStorageLib.uriStorage().tokenURIOverrideSelector;
    }
}

File 8 of 38 : PaymentSplitterFacet.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {PaymentSplitterLib, IERC20} from "./PaymentSplitterLib.sol";
import {AccessControlModifiers} from "../AccessControl/AccessControlModifiers.sol";
import {DiamondInitializable} from "../../utils/DiamondInitializable.sol";
import {PausableModifiers} from "../Pausable/PausableModifiers.sol";

contract PaymentSplitterFacet is
    AccessControlModifiers,
    DiamondInitializable,
    PausableModifiers
{
    function setPaymentSplits(address[] memory payees, uint256[] memory shares_)
        external
        onlyOwner
        initializer("payment.splitter")
        whenNotPaused
    {
        PaymentSplitterLib.setPaymentSplits(payees, shares_);
    }

    function releaseToken(IERC20 token, address account)
        external
        whenNotPaused
    {
        PaymentSplitterLib.release(token, account);
    }

    function release(address payable account) external whenNotPaused {
        PaymentSplitterLib.release(account);
    }

    function payee(uint256 index) public view returns (address) {
        return PaymentSplitterLib.payee(index);
    }

    function releasedToken(IERC20 token, address account)
        public
        view
        returns (uint256)
    {
        return PaymentSplitterLib.released(token, account);
    }

    function released(address account) public view returns (uint256) {
        return PaymentSplitterLib.released(account);
    }

    function shares(address account) public view returns (uint256) {
        return PaymentSplitterLib.shares(account);
    }

    function totalReleasedToken(IERC20 token) public view returns (uint256) {
        return PaymentSplitterLib.totalReleased(token);
    }

    function totalReleased() public view returns (uint256) {
        return PaymentSplitterLib.totalReleased();
    }

    function totalShares() public view returns (uint256) {
        return PaymentSplitterLib.totalShares();
    }

    function getPaymentSplits()
        public
        view
        returns (address[] memory, uint256[] memory)
    {
        return PaymentSplitterLib.getPaymentSplits();
    }
}

File 9 of 38 : RoyaltyStandardFacet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../interfaces/IERC2981.sol";

import {AccessControlModifiers} from "../AccessControl/AccessControlModifiers.sol";
import {PausableModifiers} from "../Pausable/PausableModifiers.sol";
import {RoyaltyStandardLib} from "./RoyaltyStandardLib.sol";

contract RoyaltyStandardFacet is
    IERC2981,
    AccessControlModifiers,
    PausableModifiers
{
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        override
        returns (address, uint256)
    {
        require(tokenId > 0, "tokenId may not exist"); // to please compiler warning
        return RoyaltyStandardLib.royaltyInfo(salePrice);
    }

    function setDefaultRoyalty(uint96 feeNumerator)
        external
        onlyOwner
        whenNotPaused
    {
        RoyaltyStandardLib._setDefaultRoyalty(feeNumerator);
    }

    function deleteDefaultRoyalty() external onlyOwner whenNotPaused {
        RoyaltyStandardLib._deleteDefaultRoyalty();
    }

    function defaultRoyaltyFraction() external view returns (uint256) {
        return
            RoyaltyStandardLib
                .royaltyStandardStorage()
                ._defaultRoyaltyInfo
                .royaltyFraction;
    }
}

File 10 of 38 : RoyaltyStandardLib.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.0;

/**
 * Simplified version of royalty standard that only supports default royalties
 * We plan to support token based royalties, but the royalties will always
 * flow through the main contract first. This is so we can support more complex
 * rev shares, as well as marketplaces such as OpenSea that don't currently support
 * the royalty standard
 */
library RoyaltyStandardLib {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

    struct RoyaltyStandardStorage {
        RoyaltyInfo _defaultRoyaltyInfo;
    }

    function royaltyStandardStorage()
        internal
        pure
        returns (RoyaltyStandardStorage storage s)
    {
        bytes32 position = keccak256("royalty.standard.facet.storage");
        assembly {
            s.slot := position
        }
    }

    function royaltyInfo(uint256 _salePrice)
        internal
        view
        returns (address, uint256)
    {
        RoyaltyStandardStorage storage s = royaltyStandardStorage();

        RoyaltyInfo memory royalty = s._defaultRoyaltyInfo;

        uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) /
            _feeDenominator();

        return (royalty.receiver, royaltyAmount);
    }

    /**
     * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
     * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
     * override.
     */
    function _feeDenominator() internal pure returns (uint96) {
        return 10000;
    }

    /**
     * @dev Sets the royalty information that all ids in this contract will default to.
     *
     * Requirements:
     *
     * - `feeNumerator` cannot be greater than the fee denominator.
     * - receiver is always the contract address where payment splitting is implemented
     */
    function _setDefaultRoyalty(uint96 feeNumerator) internal {
        require(
            feeNumerator <= _feeDenominator(),
            "ERC2981: royalty fee will exceed salePrice"
        );

        royaltyStandardStorage()._defaultRoyaltyInfo = RoyaltyInfo(
            address(this),
            feeNumerator
        );
    }

    /**
     * @dev Removes default royalty information.
     */
    function _deleteDefaultRoyalty() internal {
        delete royaltyStandardStorage()._defaultRoyaltyInfo;
    }
}

File 11 of 38 : ERC721ALib.sol
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "../../interfaces/IERC721Metadata.sol";
import {TransferHooksLib} from "../TransferHooks/TransferHooksLib.sol";

pragma solidity ^0.8.4;

error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerQueryForNonexistentToken();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();

library ERC721ALib {
    using Address for address;
    using Strings for uint256;

    bytes32 constant ERC721A_STORAGE_POSITION =
        keccak256("erc721a.facet.storage");

    event Transfer(
        address indexed from,
        address indexed to,
        uint256 indexed tokenId
    );

    event Approval(
        address indexed owner,
        address indexed approved,
        uint256 indexed tokenId
    );

    // Compiler will pack this into a single 256bit word.
    struct TokenOwnership {
        // The address of the owner.
        address addr;
        // Keeps track of the start time of ownership with minimal overhead for tokenomics.
        uint64 startTimestamp;
        // Whether the token has been burned.
        bool burned;
    }

    // Compiler will pack this into a single 256bit word.
    struct AddressData {
        // Realistically, 2**64-1 is more than enough.
        uint64 balance;
        // Keeps track of mint count with minimal overhead for tokenomics.
        uint64 numberMinted;
        // Keeps track of burn count with minimal overhead for tokenomics.
        uint64 numberBurned;
        // For miscellaneous variable(s) pertaining to the address
        // (e.g. number of whitelist mint slots used).
        // If there are multiple variables, please pack them into a uint64.
        uint64 aux; // NOTE - this is unused in Juice implementation
    }

    struct ERC721AStorage {
        // The tokenId of the next token 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 _ownershipOf implementation for details.
        mapping(uint256 => TokenOwnership) _ownerships;
        // Mapping owner address to address data
        mapping(address => AddressData) _addressData;
        // Mapping from token ID to approved address
        mapping(uint256 => address) _tokenApprovals;
        // Mapping from owner to operator approvals
        mapping(address => mapping(address => bool)) _operatorApprovals;
    }

    function erc721AStorage()
        internal
        pure
        returns (ERC721AStorage storage es)
    {
        bytes32 position = ERC721A_STORAGE_POSITION;
        assembly {
            es.slot := position
        }
    }

    function _safeMint(address to, uint256 quantity) internal {
        _safeMint(to, 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.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal {
        _mint(to, quantity, _data, true);
    }

    /**
     * @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.
     */
    function _mint(
        address to,
        uint256 quantity,
        bytes memory _data,
        bool safe
    ) internal {
        ERC721ALib.ERC721AStorage storage s = ERC721ALib.erc721AStorage();

        uint256 startTokenId = s._currentIndex;
        if (to == address(0)) revert MintToZeroAddress();
        if (quantity == 0) revert MintZeroQuantity();

        TransferHooksLib.beforeTokenTransfers(
            address(0),
            to,
            startTokenId,
            quantity
        );

        // Overflows are incredibly unrealistic.
        // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
        // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
        unchecked {
            s._addressData[to].balance += uint64(quantity);
            s._addressData[to].numberMinted += uint64(quantity);

            s._ownerships[startTokenId].addr = to;
            s._ownerships[startTokenId].startTimestamp = uint64(
                block.timestamp
            );

            uint256 updatedIndex = startTokenId;
            uint256 end = updatedIndex + quantity;

            if (safe && to.isContract()) {
                do {
                    emit Transfer(address(0), to, updatedIndex);
                    if (
                        !_checkContractOnERC721Received(
                            address(0),
                            to,
                            updatedIndex++,
                            _data
                        )
                    ) {
                        revert TransferToNonERC721ReceiverImplementer();
                    }
                } while (updatedIndex != end);
                // Reentrancy protection
                if (s._currentIndex != startTokenId) revert();
            } else {
                do {
                    emit Transfer(address(0), to, updatedIndex++);
                } while (updatedIndex != end);
            }
            s._currentIndex = updatedIndex;
        }
        TransferHooksLib.afterTokenTransfers(
            address(0),
            to,
            startTokenId,
            quantity
        );
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkContractOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal returns (bool) {
        try
            IERC721Receiver(to).onERC721Received(
                msg.sender,
                from,
                tokenId,
                _data
            )
        returns (bytes4 retval) {
            return retval == IERC721Receiver(to).onERC721Received.selector;
        } catch (bytes memory reason) {
            if (reason.length == 0) {
                revert TransferToNonERC721ReceiverImplementer();
            } else {
                assembly {
                    revert(add(32, reason), mload(reason))
                }
            }
        }
    }

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

    function currentIndex() internal view returns (uint256) {
        return erc721AStorage()._currentIndex;
    }

    function totalMinted() internal view returns (uint256) {
        // Counter underflow is impossible as _currentIndex does not decrement,
        // and it is initialized to ERC721ALib._startTokenId()
        unchecked {
            return erc721AStorage()._currentIndex - _startTokenId();
        }
    }

    function _exists(uint256 tokenId) internal view returns (bool) {
        return
            ERC721ALib._startTokenId() <= tokenId &&
            tokenId < ERC721ALib.erc721AStorage()._currentIndex &&
            !ERC721ALib.erc721AStorage()._ownerships[tokenId].burned;
    }

    /**
     * Gas spent here starts off proportional to the maximum mint batch size.
     * It gradually moves to O(1) as tokens get transferred around in the collection over time.
     */
    function _ownershipOf(uint256 tokenId)
        internal
        view
        returns (ERC721ALib.TokenOwnership memory)
    {
        uint256 curr = tokenId;

        ERC721ALib.ERC721AStorage storage s = ERC721ALib.erc721AStorage();
        unchecked {
            if (ERC721ALib._startTokenId() <= curr && curr < s._currentIndex) {
                ERC721ALib.TokenOwnership memory ownership = s._ownerships[
                    curr
                ];
                if (!ownership.burned) {
                    if (ownership.addr != address(0)) {
                        return ownership;
                    }
                    // Invariant:
                    // There will always be an ownership that has an address and is not burned
                    // before an ownership that does not have an address and is not burned.
                    // Hence, curr will not underflow.
                    while (true) {
                        curr--;
                        ownership = s._ownerships[curr];
                        if (ownership.addr != address(0)) {
                            return ownership;
                        }
                    }
                }
            }
        }
        revert OwnerQueryForNonexistentToken();
    }

    function balanceOf(address owner) internal view returns (uint256) {
        if (owner == address(0)) revert BalanceQueryForZeroAddress();
        return uint256(ERC721ALib.erc721AStorage()._addressData[owner].balance);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(
        address to,
        uint256 tokenId,
        address owner
    ) internal {
        ERC721ALib.erc721AStorage()._tokenApprovals[tokenId] = to;
        emit Approval(owner, to, tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal {
        ERC721ALib.ERC721AStorage storage s = ERC721ALib.erc721AStorage();
        ERC721ALib.TokenOwnership memory prevOwnership = ERC721ALib
            ._ownershipOf(tokenId);

        if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();

        bool isApprovedOrOwner = (msg.sender == from ||
            _isApprovedForAll(from, msg.sender) ||
            _getApproved(tokenId) == msg.sender);

        if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
        if (to == address(0)) revert TransferToZeroAddress();

        TransferHooksLib.beforeTokenTransfers(from, to, tokenId, 1);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId, from);

        // 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 {
            s._addressData[from].balance -= 1;
            s._addressData[to].balance += 1;

            ERC721ALib.TokenOwnership storage currSlot = s._ownerships[tokenId];
            currSlot.addr = to;
            currSlot.startTimestamp = uint64(block.timestamp);

            // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
            // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
            uint256 nextTokenId = tokenId + 1;
            ERC721ALib.TokenOwnership storage nextSlot = s._ownerships[
                nextTokenId
            ];
            if (nextSlot.addr == address(0)) {
                // This will suffice for checking _exists(nextTokenId),
                // as a burned slot cannot contain the zero address.
                if (nextTokenId != s._currentIndex) {
                    nextSlot.addr = from;
                    nextSlot.startTimestamp = prevOwnership.startTimestamp;
                }
            }
        }

        emit Transfer(from, to, tokenId);
        TransferHooksLib.afterTokenTransfers(from, to, tokenId, 1);
    }

    /**
     * @dev This is equivalent to _burn(tokenId, true)
     */
    function _burn(uint256 tokenId) internal {
        _burn(tokenId, true);
    }

    /**
     * Returns the number of tokens minted by `owner`.
     */
    function _numberMinted(address owner) internal view returns (uint256) {
        return
            uint256(
                ERC721ALib.erc721AStorage()._addressData[owner].numberMinted
            );
    }

    /**
     * Returns the number of tokens burned by or on behalf of `owner`.
     */
    function _numberBurned(address owner) internal view returns (uint256) {
        return
            uint256(
                ERC721ALib.erc721AStorage()._addressData[owner].numberBurned
            );
    }

    /**
     * @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 {
        ERC721ALib.TokenOwnership memory prevOwnership = ERC721ALib
            ._ownershipOf(tokenId);
        ERC721ALib.ERC721AStorage storage s = ERC721ALib.erc721AStorage();

        address from = prevOwnership.addr;

        if (approvalCheck) {
            bool isApprovedOrOwner = (msg.sender == from ||
                _isApprovedForAll(from, msg.sender) ||
                _getApproved(tokenId) == msg.sender);

            if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
        }

        TransferHooksLib.beforeTokenTransfers(from, address(0), tokenId, 1);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId, from);

        // 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 {
            ERC721ALib.AddressData storage addressData = s._addressData[from];
            addressData.balance -= 1;
            addressData.numberBurned += 1;

            // Keep track of who burned the token, and the timestamp of burning.
            ERC721ALib.TokenOwnership storage currSlot = s._ownerships[tokenId];
            currSlot.addr = from;
            currSlot.startTimestamp = uint64(block.timestamp);
            currSlot.burned = true;

            // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.
            // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
            uint256 nextTokenId = tokenId + 1;
            ERC721ALib.TokenOwnership storage nextSlot = s._ownerships[
                nextTokenId
            ];
            if (nextSlot.addr == address(0)) {
                // This will suffice for checking _exists(nextTokenId),
                // as a burned slot cannot contain the zero address.
                if (nextTokenId != s._currentIndex) {
                    nextSlot.addr = from;
                    nextSlot.startTimestamp = prevOwnership.startTimestamp;
                }
            }
        }

        emit Transfer(from, address(0), tokenId);
        TransferHooksLib.afterTokenTransfers(from, address(0), tokenId, 1);

        // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
        unchecked {
            s._burnCounter++;
        }
    }

    function _isApprovedForAll(address owner, address operator)
        internal
        view
        returns (bool)
    {
        return ERC721ALib.erc721AStorage()._operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function _getApproved(uint256 tokenId) internal view returns (address) {
        if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();

        return ERC721ALib.erc721AStorage()._tokenApprovals[tokenId];
    }
}

File 12 of 38 : PausableModifiers.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

abstract contract PausableModifiers {
    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        PausableLib.enforceUnpaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        PausableLib.enforcePaused();
        _;
    }
}

File 13 of 38 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @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
     * ====
     *
     * [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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 14 of 38 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 15 of 38 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

File 16 of 38 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @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);
}

File 17 of 38 : TransferHooksLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {DiamondCloneLib} from "../DiamondClone/DiamondCloneLib.sol";
import {DiamondSaw} from "../../DiamondSaw.sol";

library TransferHooksLib {
    struct TransferHooksStorage {
        bytes4 beforeTransfersHook; // selector of before transfer hook
        bytes4 afterTransfersHook; // selector of after transfer hook
    }

    function transferHooksStorage()
        internal
        pure
        returns (TransferHooksStorage storage s)
    {
        bytes32 position = keccak256("transfer.hooks.facet.storage");
        assembly {
            s.slot := position
        }
    }

    function setBeforeTransfersHook(bytes4 _beforeTransfersHook) internal {
        address sawAddress = DiamondCloneLib
            .diamondCloneStorage()
            .diamondSawAddress;

        bool isApproved = DiamondSaw(sawAddress).isTransferHookSelectorApproved(
            _beforeTransfersHook
        );
        require(isApproved, "selector not approved");
        transferHooksStorage().beforeTransfersHook = _beforeTransfersHook;
    }

    function setAfterTransfersHook(bytes4 _afterTransfersHook) internal {
        address sawAddress = DiamondCloneLib
            .diamondCloneStorage()
            .diamondSawAddress;
        bool isApproved = DiamondSaw(sawAddress).isTransferHookSelectorApproved(
            _afterTransfersHook
        );
        require(isApproved, "selector not approved");
        transferHooksStorage().afterTransfersHook = _afterTransfersHook;
    }

    function maybeCallTransferHook(
        bytes4 selector,
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal {
        if (selector == bytes4(0)) {
            return;
        }

        (bool success, ) = address(this).call(
            abi.encodeWithSelector(selector, from, to, startTokenId, quantity)
        );

        require(success, "Transfer hook failed");
    }

    function beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal {
        bytes4 selector = transferHooksStorage().beforeTransfersHook;
        maybeCallTransferHook(selector, from, to, startTokenId, quantity);
    }

    function afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal {
        bytes4 selector = transferHooksStorage().afterTransfersHook;
        maybeCallTransferHook(selector, from, to, startTokenId, quantity);
    }
}

File 18 of 38 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must 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
    ) external;

    /**
     * @dev Transfers `tokenId` token 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;

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

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the 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);
}

File 19 of 38 : DiamondCloneLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {DiamondSaw} from "../../DiamondSaw.sol";
import {IDiamondLoupe} from "./IDiamondLoupe.sol";
import {IDiamondCut} from "./IDiamondCut.sol";

library DiamondCloneLib {
    bytes32 constant DIAMOND_CLONE_STORAGE_POSITION =
        keccak256("diamond.standard.diamond.clone.storage");

    bytes32 constant ERC721A_STORAGE_POSITION =
        keccak256("erc721a.facet.storage");

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

    struct DiamondCloneStorage {
        // address of the diamond saw contract
        address diamondSawAddress;
        // mapping to all the facets this diamond implements.
        mapping(address => bool) facetAddresses;
        // number of facets supported
        uint256 numFacets;
        // optional gas cache for highly trafficked write selectors
        mapping(bytes4 => address) selectorGasCache;
        // immutability window
        uint256 immutableUntilBlock;
    }

    // minimal copy  of ERC721AStorage for initialization
    struct ERC721AStorage {
        // The tokenId of the next token to be minted.
        uint256 _currentIndex;
    }

    function diamondCloneStorage()
        internal
        pure
        returns (DiamondCloneStorage storage s)
    {
        bytes32 position = DIAMOND_CLONE_STORAGE_POSITION;
        assembly {
            s.slot := position
        }
    }

    // calls externally to the saw to find the appropriate facet to delegate to
    function _getFacetAddressForCall() internal view returns (address addr) {
        DiamondCloneStorage storage s = diamondCloneStorage();

        addr = s.selectorGasCache[msg.sig];
        if (addr != address(0)) {
            return addr;
        }

        (bool success, bytes memory res) = s.diamondSawAddress.staticcall(
            abi.encodeWithSelector(0x14bc7560, msg.sig)
        );
        require(success, "Failed to fetch facet address for call");

        assembly {
            addr := mload(add(res, 32))
        }

        return s.facetAddresses[addr] ? addr : address(0);
    }

    function initNFT() internal {
        ERC721AStorage storage es;
        bytes32 position = ERC721A_STORAGE_POSITION;
        assembly {
            es.slot := position
        }

        es._currentIndex = 1;
    }

    function initializeDiamondClone(
        address diamondSawAddress,
        address[] calldata _facetAddresses
    ) internal {
        DiamondCloneLib.DiamondCloneStorage storage s = DiamondCloneLib
            .diamondCloneStorage();

        require(diamondSawAddress != address(0), "Must set saw addy");
        require(s.diamondSawAddress == address(0), "Already inited");

        initNFT();

        s.diamondSawAddress = diamondSawAddress;
        IDiamondCut.FacetCut[] memory cuts = new IDiamondCut.FacetCut[](
            _facetAddresses.length
        );

        // emit the diamond cut event
        for (uint256 i; i < _facetAddresses.length; i++) {
            address facetAddress = _facetAddresses[i];
            bytes4[] memory selectors = DiamondSaw(diamondSawAddress)
                .functionSelectorsForFacetAddress(facetAddress);
            require(selectors.length > 0, "Facet is not supported by the saw");
            cuts[i].facetAddress = _facetAddresses[i];
            cuts[i].functionSelectors = selectors;
            s.facetAddresses[facetAddress] = true;
        }

        emit DiamondCut(cuts, address(0), "");

        s.numFacets = _facetAddresses.length;
    }

    function _purgeGasCache(bytes4[] memory selectors) internal {
        DiamondCloneStorage storage s = diamondCloneStorage();

        for (uint256 i; i < selectors.length; i++) {
            if (s.selectorGasCache[selectors[i]] != address(0)) {
                delete s.selectorGasCache[selectors[i]];
            }
        }
    }

    function cutWithDiamondSaw(
        IDiamondCut.FacetCut[] memory _diamondCut,
        address _init,
        bytes calldata _calldata
    ) internal {
        DiamondCloneStorage storage s = diamondCloneStorage();

        uint256 newNumFacets = s.numFacets;

        // emit the diamond cut event
        for (uint256 i; i < _diamondCut.length; i++) {
            IDiamondCut.FacetCut memory cut = _diamondCut[i];
            bytes4[] memory selectors = DiamondSaw(s.diamondSawAddress)
                .functionSelectorsForFacetAddress(cut.facetAddress);

            require(selectors.length > 0, "Facet is not supported by the saw");
            require(
                selectors.length == cut.functionSelectors.length,
                "You can only modify all selectors at once with diamond saw"
            );

            // NOTE we override the passed selectors after validating the length matches
            // With diamond saw we can only add / remove all selectors for a given facet
            cut.functionSelectors = selectors;

            // if the address is already in the facet map
            // remove it and remove all the selectors
            // otherwise add the selectors
            if (s.facetAddresses[cut.facetAddress]) {
                require(
                    cut.action == IDiamondCut.FacetCutAction.Remove,
                    "Can only remove existing facet selectors"
                );
                delete s.facetAddresses[cut.facetAddress];
                _purgeGasCache(selectors);
                newNumFacets -= 1;
            } else {
                require(
                    cut.action == IDiamondCut.FacetCutAction.Add,
                    "Can only add non-existing facet selectors"
                );
                s.facetAddresses[cut.facetAddress] = true;
                newNumFacets += 1;
            }
        }

        emit DiamondCut(_diamondCut, _init, _calldata);

        // call the init function
        (bool success, bytes memory error) = _init.delegatecall(_calldata);
        if (!success) {
            if (error.length > 0) {
                // bubble up the error
                revert(string(error));
            } else {
                revert("DiamondCloneLib: _init function reverted");
            }
        }

        s.numFacets = newNumFacets;
    }

    function upgradeDiamondSaw(
        address _upgradeSawAddress,
        address[] calldata _oldFacetAddresses,
        address[] calldata _newFacetAddresses,
        address _init,
        bytes calldata _calldata
    ) internal {
        require(
            !isImmutable(),
            "Cannot upgrade saw during immutability window"
        );
        require(
            _upgradeSawAddress != address(0),
            "Cannot set saw to zero address"
        );

        DiamondCloneStorage storage s = diamondCloneStorage();

        require(
            _oldFacetAddresses.length == s.numFacets,
            "Must remove all facets to upgrade saw"
        );

        DiamondSaw oldSawInstance = DiamondSaw(s.diamondSawAddress);

        require(
            oldSawInstance.isUpgradeSawSupported(_upgradeSawAddress),
            "Upgrade saw is not supported"
        );
        DiamondSaw newSawInstance = DiamondSaw(_upgradeSawAddress);

        IDiamondCut.FacetCut[] memory cuts = new IDiamondCut.FacetCut[](
            _oldFacetAddresses.length + _newFacetAddresses.length
        );

        for (
            uint256 i;
            i < _oldFacetAddresses.length + _newFacetAddresses.length;
            i++
        ) {
            if (i < _oldFacetAddresses.length) {
                address facetAddress = _oldFacetAddresses[i];
                require(
                    s.facetAddresses[facetAddress],
                    "Cannot remove facet that is not supported"
                );
                bytes4[] memory selectors = oldSawInstance
                    .functionSelectorsForFacetAddress(facetAddress);
                require(
                    selectors.length > 0,
                    "Facet is not supported by the saw"
                );

                cuts[i].action = IDiamondCut.FacetCutAction.Remove;
                cuts[i].facetAddress = facetAddress;
                cuts[i].functionSelectors = selectors;

                _purgeGasCache(selectors);
                delete s.facetAddresses[facetAddress];
            } else {
                address facetAddress = _newFacetAddresses[
                    i - _oldFacetAddresses.length
                ];
                bytes4[] memory selectors = newSawInstance
                    .functionSelectorsForFacetAddress(facetAddress);
                require(
                    selectors.length > 0,
                    "Facet is not supported by the new saw"
                );

                cuts[i].action = IDiamondCut.FacetCutAction.Add;
                cuts[i].facetAddress = facetAddress;
                cuts[i].functionSelectors = selectors;

                s.facetAddresses[facetAddress] = true;
            }
        }

        emit DiamondCut(cuts, _init, _calldata);

        // actually update the diamond saw address
        s.numFacets = _newFacetAddresses.length;
        s.diamondSawAddress = _upgradeSawAddress;

        // call the init function
        (bool success, bytes memory error) = _init.delegatecall(_calldata);
        if (!success) {
            if (error.length > 0) {
                // bubble up the error
                revert(string(error));
            } else {
                revert("DiamondCloneLib: _init function reverted");
            }
        }
    }

    function setGasCacheForSelector(bytes4 selector) internal {
        DiamondCloneStorage storage s = diamondCloneStorage();

        address facetAddress = DiamondSaw(s.diamondSawAddress)
            .facetAddressForSelector(selector);
        require(facetAddress != address(0), "Facet not supported");
        require(s.facetAddresses[facetAddress], "Facet not included in clone");

        s.selectorGasCache[selector] = facetAddress;
    }

    function setImmutableUntilBlock(uint256 blockNum) internal {
        diamondCloneStorage().immutableUntilBlock = blockNum;
    }

    function isImmutable() internal view returns (bool) {
        return block.number < diamondCloneStorage().immutableUntilBlock;
    }

    function immutableUntilBlock() internal view returns (uint256) {
        return diamondCloneStorage().immutableUntilBlock;
    }

    /**
     * LOUPE FUNCTIONALITY BELOW
     */

    function facets()
        internal
        view
        returns (IDiamondLoupe.Facet[] memory facets_)
    {
        DiamondCloneLib.DiamondCloneStorage storage ds = DiamondCloneLib
            .diamondCloneStorage();
        IDiamondLoupe.Facet[] memory allSawFacets = DiamondSaw(
            ds.diamondSawAddress
        ).allFacetsWithSelectors();

        uint256 copyIndex = 0;

        facets_ = new IDiamondLoupe.Facet[](ds.numFacets);

        for (uint256 i; i < allSawFacets.length; i++) {
            if (ds.facetAddresses[allSawFacets[i].facetAddress]) {
                facets_[copyIndex] = allSawFacets[i];
                copyIndex++;
            }
        }
    }

    function facetAddresses()
        internal
        view
        returns (address[] memory facetAddresses_)
    {
        DiamondCloneLib.DiamondCloneStorage storage ds = DiamondCloneLib
            .diamondCloneStorage();

        address[] memory allSawFacetAddresses = DiamondSaw(ds.diamondSawAddress)
            .allFacetAddresses();
        facetAddresses_ = new address[](ds.numFacets);

        uint256 copyIndex = 0;

        for (uint256 i; i < allSawFacetAddresses.length; i++) {
            if (ds.facetAddresses[allSawFacetAddresses[i]]) {
                facetAddresses_[copyIndex] = allSawFacetAddresses[i];
                copyIndex++;
            }
        }
    }
}

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

import "@openzeppelin/contracts/access/Ownable.sol";

import {IDiamondCut} from "./facets/DiamondClone/IDiamondCut.sol";
import {IDiamondLoupe} from "./facets/DiamondClone/IDiamondLoupe.sol";
import {DiamondSawLib} from "./libraries/DiamondSawLib.sol";
import {BasicAccessControlFacet} from "./facets/AccessControl/BasicAccessControlFacet.sol";
import {AccessControlModifiers} from "./facets/AccessControl/AccessControlModifiers.sol";
import {AccessControlLib} from "./facets/AccessControl/AccessControlLib.sol";
import {PausableFacet} from "./facets/Pausable/PausableFacet.sol";
import {PausableModifiers} from "./facets/Pausable/PausableModifiers.sol";

/**
 * DiamondSaw is meant to be used as a
 * Singleton to "cut" many minimal diamond clones
 * In a gas efficient manner for deployments.
 *
 * This is accomplished by handling the storage intensive
 * selector mappings in one contract, "the saw" instead of in each diamond.
 *
 * Adding a new facet to the saw enables new diamond "patterns"
 *
 * This should be used if you
 *
 * 1. Need cheap deployments of many similar cloned diamonds that
 * utilize the same pre-deployed facets
 *
 * 2. Are okay with gas overhead on write txn to the diamonds
 * to communicate with the singleton (saw) to fetch selectors
 *
 */
contract DiamondSaw is
    BasicAccessControlFacet,
    AccessControlModifiers,
    PausableFacet,
    PausableModifiers
{
    constructor() {
        AccessControlLib._transferOwnership(msg.sender);
    }

    function addFacetPattern(
        IDiamondCut.FacetCut[] calldata _facetAdds,
        address _init,
        bytes calldata _calldata
    ) external onlyOwner whenNotPaused {
        DiamondSawLib.diamondCutAddOnly(_facetAdds, _init, _calldata);
    }

    // if a facet has no selectors, it is not supported
    function checkFacetSupported(address _facetAddress) external view {
        DiamondSawLib.checkFacetSupported(_facetAddress);
    }

    function facetAddressForSelector(bytes4 selector)
        external
        view
        returns (address)
    {
        return
            DiamondSawLib
                .diamondSawStorage()
                .selectorToFacetAndPosition[selector]
                .facetAddress;
    }

    function functionSelectorsForFacetAddress(address facetAddress)
        external
        view
        returns (bytes4[] memory)
    {
        return
            DiamondSawLib
                .diamondSawStorage()
                .facetFunctionSelectors[facetAddress]
                .functionSelectors;
    }

    function allFacetAddresses() external view returns (address[] memory) {
        return DiamondSawLib.diamondSawStorage().facetAddresses;
    }

    function allFacetsWithSelectors()
        external
        view
        returns (IDiamondLoupe.Facet[] memory _facetsWithSelectors)
    {
        DiamondSawLib.DiamondSawStorage storage ds = DiamondSawLib
            .diamondSawStorage();

        uint256 numFacets = ds.facetAddresses.length;
        _facetsWithSelectors = new IDiamondLoupe.Facet[](numFacets);
        for (uint256 i; i < numFacets; i++) {
            address facetAddress_ = ds.facetAddresses[i];
            _facetsWithSelectors[i].facetAddress = facetAddress_;
            _facetsWithSelectors[i].functionSelectors = ds
                .facetFunctionSelectors[facetAddress_]
                .functionSelectors;
        }
    }

    function facetAddressForInterface(bytes4 _interface)
        external
        view
        returns (address)
    {
        DiamondSawLib.DiamondSawStorage storage ds = DiamondSawLib
            .diamondSawStorage();
        return ds.interfaceToFacet[_interface];
    }

    function setFacetForERC165Interface(bytes4 _interface, address _facet)
        external
        onlyOwner
        whenNotPaused
    {
        DiamondSawLib.checkFacetSupported(_facet);
        require(
            DiamondSawLib.diamondSawStorage().interfaceToFacet[_interface] ==
                address(0),
            "Only one facet can implement an interface"
        );
        DiamondSawLib.diamondSawStorage().interfaceToFacet[_interface] = _facet;
    }

    function approveTransferHookSelector(bytes4 selector)
        external
        onlyOwner
        whenNotPaused
    {
        DiamondSawLib.approveTransferHookSelector(selector);
    }

    function approveTokenURISelector(bytes4 selector)
        external
        onlyOwner
        whenNotPaused
    {
        DiamondSawLib.approveTokenURISelector(selector);
    }

    function isTokenURISelectorApproved(bytes4 selector)
        external
        view
        returns (bool)
    {
        return
            DiamondSawLib.diamondSawStorage().approvedTokenURIFunctionSelectors[
                selector
            ];
    }

    function isTransferHookSelectorApproved(bytes4 selector)
        external
        view
        returns (bool)
    {
        return
            DiamondSawLib
                .diamondSawStorage()
                .approvedTransferHookFunctionSelectors[selector];
    }

    function setUpgradeSawAddress(address _upgradeSaw)
        external
        onlyOwner
        whenNotPaused
    {
        DiamondSawLib.setUpgradeSawAddress(_upgradeSaw);
    }

    function isUpgradeSawSupported(address _upgradeSaw)
        external
        view
        returns (bool)
    {
        return
            DiamondSawLib.diamondSawStorage().supportedSawAddresses[
                _upgradeSaw
            ];
    }
}

File 21 of 38 : 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 22 of 38 : 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 23 of 38 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 24 of 38 : DiamondSawLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IDiamondCut} from "../facets/DiamondClone/IDiamondCut.sol";

library DiamondSawLib {
    bytes32 constant DIAMOND_SAW_STORAGE_POSITION =
        keccak256("diamond.standard.diamond.saw.storage");

    struct FacetAddressAndPosition {
        address facetAddress;
        uint96 functionSelectorPosition; // position in facetFunctionSelectors.functionSelectors array
    }

    struct FacetFunctionSelectors {
        bytes4[] functionSelectors;
        uint256 facetAddressPosition; // position of facetAddress in facetAddresses array
    }

    struct DiamondSawStorage {
        // maps function selector to the facet address and
        // the position of the selector in the facetFunctionSelectors.selectors array
        mapping(bytes4 => FacetAddressAndPosition) selectorToFacetAndPosition;
        // maps facet addresses to function selectors
        mapping(address => FacetFunctionSelectors) facetFunctionSelectors;
        // facet addresses
        address[] facetAddresses;
        // Used to query if a facet implements a given interface
        // Note: this works because no interface can be implemented by
        // two different facets with diamond saw because no
        // selector overlap is permitted!!
        mapping(bytes4 => address) interfaceToFacet;
        // for transfer hooks, selectors must be approved in the saw
        mapping(bytes4 => bool) approvedTransferHookFunctionSelectors;
        // for tokenURI overrides, selectors must be approved in the saw
        mapping(bytes4 => bool) approvedTokenURIFunctionSelectors;
        // Saw contracts which clients can upgrade to
        mapping(address => bool) supportedSawAddresses;
    }

    function diamondSawStorage()
        internal
        pure
        returns (DiamondSawStorage storage ds)
    {
        bytes32 position = DIAMOND_SAW_STORAGE_POSITION;
        assembly {
            ds.slot := position
        }
    }

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

    // Internal function version of diamondCut
    // only supports adding new selectors
    function diamondCutAddOnly(
        IDiamondCut.FacetCut[] memory _diamondCut,
        address _init,
        bytes memory _calldata
    ) internal {
        for (
            uint256 facetIndex;
            facetIndex < _diamondCut.length;
            facetIndex++
        ) {
            require(
                _diamondCut[facetIndex].action ==
                    IDiamondCut.FacetCutAction.Add,
                "Only add action supported in saw"
            );
            require(
                !isFacetSupported(_diamondCut[facetIndex].facetAddress),
                "Facet already exists in saw"
            );
            addFunctions(
                _diamondCut[facetIndex].facetAddress,
                _diamondCut[facetIndex].functionSelectors
            );
        }
        emit DiamondCut(_diamondCut, _init, _calldata);
        initializeDiamondCut(_init, _calldata);
    }

    function addFunctions(
        address _facetAddress,
        bytes4[] memory _functionSelectors
    ) internal {
        require(
            _functionSelectors.length > 0,
            "LibDiamondCut: No selectors in facet to cut"
        );
        DiamondSawStorage storage ds = diamondSawStorage();
        require(
            _facetAddress != address(0),
            "LibDiamondCut: Add facet can't be address(0)"
        );
        uint96 selectorPosition = uint96(
            ds.facetFunctionSelectors[_facetAddress].functionSelectors.length
        );
        // add new facet address if it does not exist
        if (selectorPosition == 0) {
            addFacet(ds, _facetAddress);
        }
        for (
            uint256 selectorIndex;
            selectorIndex < _functionSelectors.length;
            selectorIndex++
        ) {
            bytes4 selector = _functionSelectors[selectorIndex];
            address oldFacetAddress = ds
                .selectorToFacetAndPosition[selector]
                .facetAddress;

            require(
                oldFacetAddress == address(0),
                "Cannot add function that already exists"
            );
            addFunction(ds, selector, selectorPosition, _facetAddress);
            selectorPosition++;
        }
    }

    function addFacet(DiamondSawStorage storage ds, address _facetAddress)
        internal
    {
        enforceHasContractCode(
            _facetAddress,
            "LibDiamondCut: New facet has no code"
        );
        ds.facetFunctionSelectors[_facetAddress].facetAddressPosition = ds
            .facetAddresses
            .length;
        ds.facetAddresses.push(_facetAddress);
    }

    function addFunction(
        DiamondSawStorage storage ds,
        bytes4 _selector,
        uint96 _selectorPosition,
        address _facetAddress
    ) internal {
        ds
            .selectorToFacetAndPosition[_selector]
            .functionSelectorPosition = _selectorPosition;
        ds.facetFunctionSelectors[_facetAddress].functionSelectors.push(
            _selector
        );
        ds.selectorToFacetAndPosition[_selector].facetAddress = _facetAddress;
    }

    function initializeDiamondCut(address _init, bytes memory _calldata)
        internal
    {
        if (_init == address(0)) {
            require(
                _calldata.length == 0,
                "LibDiamondCut: _init is address(0) but_calldata is not empty"
            );
        } else {
            require(
                _calldata.length > 0,
                "LibDiamondCut: _calldata is empty but _init is not address(0)"
            );
            if (_init != address(this)) {
                enforceHasContractCode(
                    _init,
                    "LibDiamondCut: _init address has no code"
                );
            }
            (bool success, bytes memory error) = _init.delegatecall(_calldata);
            if (!success) {
                if (error.length > 0) {
                    // bubble up the error
                    revert(string(error));
                } else {
                    revert("LibDiamondCut: _init function reverted");
                }
            }
        }
    }

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

    function setFacetSupportsInterface(bytes4 _interface, address _facetAddress)
        internal
    {
        checkFacetSupported(_facetAddress);
        DiamondSawStorage storage ds = diamondSawStorage();
        ds.interfaceToFacet[_interface] = _facetAddress;
    }

    function isFacetSupported(address _facetAddress)
        internal
        view
        returns (bool)
    {
        return
            diamondSawStorage()
                .facetFunctionSelectors[_facetAddress]
                .functionSelectors
                .length > 0;
    }

    function checkFacetSupported(address _facetAddress) internal view {
        require(isFacetSupported(_facetAddress), "Facet not supported");
    }

    function approveTransferHookSelector(bytes4 transferHookSelector) internal {
        DiamondSawStorage storage s = diamondSawStorage();
        address facetImplementation = s
            .selectorToFacetAndPosition[transferHookSelector]
            .facetAddress;

        require(
            facetImplementation != address(0),
            "Cannot set transfer hook to unsupported selector"
        );

        s.approvedTransferHookFunctionSelectors[transferHookSelector] = true;
    }

    function approveTokenURISelector(bytes4 tokenURISelector) internal {
        DiamondSawStorage storage s = diamondSawStorage();
        address facetImplementation = s
            .selectorToFacetAndPosition[tokenURISelector]
            .facetAddress;
        require(
            facetImplementation != address(0),
            "Cannot set token uri override to unsupported selector"
        );
        s.approvedTokenURIFunctionSelectors[tokenURISelector] = true;
    }

    function setUpgradeSawAddress(address _upgradeSaw) internal {
        diamondSawStorage().supportedSawAddresses[_upgradeSaw] = true;
    }
}

File 25 of 38 : BasicAccessControlFacet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/IAccessControl.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "./AccessControlLib.sol";
import {PausableLib} from "../Pausable/PausableLib.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract BasicAccessControlFacet is Context {
    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return AccessControlLib.accessControlStorage()._owner;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual {
        PausableLib.enforceUnpaused();
        AccessControlLib._enforceOwner();
        AccessControlLib._transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual {
        PausableLib.enforceUnpaused();
        AccessControlLib._enforceOwner();
        require(
            newOwner != address(0),
            "Ownable: new owner is the zero address"
        );
        AccessControlLib._transferOwnership(newOwner);
    }

    function grantOperator(address _operator) public virtual {
        PausableLib.enforceUnpaused();
        AccessControlLib._enforceOwner();

        AccessControlLib.grantRole(AccessControlLib.OPERATOR_ROLE, _operator);
    }

    function revokeOperator(address _operator) public virtual {
        PausableLib.enforceUnpaused();
        AccessControlLib._enforceOwner();
        AccessControlLib.revokeRole(AccessControlLib.OPERATOR_ROLE, _operator);
    }
}

File 26 of 38 : AccessControlLib.sol
// SPDX-License-Identifier: MIT

import "@openzeppelin/contracts/utils/Strings.sol";
import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

pragma solidity ^0.8.0;

library AccessControlLib {
    bytes32 constant DEFAULT_ADMIN_ROLE = 0x00;
    bytes32 constant OPERATOR_ROLE = keccak256("operator.role");

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(
        bytes32 indexed role,
        bytes32 indexed previousAdminRole,
        bytes32 indexed newAdminRole
    );

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(
        bytes32 indexed role,
        address indexed account,
        address indexed sender
    );

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(
        bytes32 indexed role,
        address indexed account,
        address indexed sender
    );

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

    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    struct AccessControlStorage {
        address _owner;
        mapping(bytes32 => RoleData) _roles;
    }

    bytes32 constant ACCESS_CONTROL_STORAGE_POSITION =
        keccak256("Access.Control.library.storage");

    function accessControlStorage()
        internal
        pure
        returns (AccessControlStorage storage s)
    {
        bytes32 position = ACCESS_CONTROL_STORAGE_POSITION;
        assembly {
            s.slot := position
        }
    }

    function _isOwner() internal view returns (bool) {
        return accessControlStorage()._owner == msg.sender;
    }

    function owner() internal view returns (address) {
        return accessControlStorage()._owner;
    }

    function _enforceOwner() internal view {
        require(_isOwner(), "Caller is not the owner");
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal {
        address oldOwner = accessControlStorage()._owner;
        accessControlStorage()._owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, msg.sender);
        _;
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account)
        internal
        view
        returns (bool)
    {
        return accessControlStorage()._roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * NOTE: Modified to always pass if the account is the owner
     * and to always fail if ownership is revoked!
     */
    function _checkRole(bytes32 role, address account) internal view {
        address ownerAddress = accessControlStorage()._owner;
        require(ownerAddress != address(0), "Admin functionality revoked");
        if (!hasRole(role, account) && account != ownerAddress) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) internal view returns (bytes32) {
        return accessControlStorage()._roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account)
        internal
        onlyRole(getRoleAdmin(role))
    {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account)
        internal
        onlyRole(getRoleAdmin(role))
    {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) internal {
        require(
            account == msg.sender,
            "AccessControl: can only renounce roles for self"
        );

        _revokeRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal {
        bytes32 previousAdminRole = getRoleAdmin(role);
        accessControlStorage()._roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal {
        if (!hasRole(role, account)) {
            accessControlStorage()._roles[role].members[account] = true;
            emit RoleGranted(role, account, msg.sender);
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal {
        if (hasRole(role, account)) {
            accessControlStorage()._roles[role].members[account] = false;
            emit RoleRevoked(role, account, msg.sender);
        }
    }
}

File 27 of 38 : PausableFacet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import {AccessControlModifiers} from "../AccessControl/AccessControlModifiers.sol";
import {PausableLib} from "./PausableLib.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableFacet is AccessControlModifiers {
    function pause() public onlyOwner {
        PausableLib._pause();
    }

    function unpause() public onlyOwner {
        PausableLib._unpause();
    }

    function paused() public view returns (bool) {
        return PausableLib._paused();
    }
}

File 28 of 38 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 29 of 38 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 30 of 38 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 31 of 38 : PausableLib.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

error ContractPaused();
error ContractUnpaused();

library PausableLib {
    bytes32 constant PAUSABLE_STORAGE_POSITION =
        keccak256("pausable.facet.storage");
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    struct PausableStorage {
        bool _paused;
    }

    function pausableStorage()
        internal
        pure
        returns (PausableStorage storage s)
    {
        bytes32 position = PAUSABLE_STORAGE_POSITION;
        assembly {
            s.slot := position
        }
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function _paused() internal view returns (bool) {
        return pausableStorage()._paused;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal {
        PausableStorage storage s = pausableStorage();
        if (s._paused) revert ContractPaused();
        s._paused = true;
        emit Paused(msg.sender);
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal {
        PausableStorage storage s = pausableStorage();
        if (!s._paused) revert ContractUnpaused();
        s._paused = false;
        emit Unpaused(msg.sender);
    }

    function enforceUnpaused() internal view {
        if (pausableStorage()._paused) revert ContractPaused();
    }

    function enforcePaused() internal view {
        if (!pausableStorage()._paused) revert ContractUnpaused();
    }
}

File 32 of 38 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 33 of 38 : PaymentSplitterLib.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (finance/PaymentSplitter.sol)

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";

/**
 * @title PaymentSplitter
 * @dev This library allows to split Ether payments among a group of accounts. The sender does not need to be aware
 * that the Ether will be split in this way, since it is handled transparently by the contract.
 *
 * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each
 * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim
 * an amount proportional to the percentage of total shares they were assigned.
 *
 * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the
 * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}
 * function.
 *
 * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and
 * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you
 * to run tests before sending real value to this contract.
 */
library PaymentSplitterLib {
    bytes32 constant PAYMENT_SPLITTER_STORAGE_POSITION =
        keccak256("payment.splitter.facet.storage");

    event PayeeAdded(address account, uint256 shares);
    event PaymentReleased(address to, uint256 amount);
    event ERC20PaymentReleased(
        IERC20 indexed token,
        address to,
        uint256 amount
    );
    event PaymentReceived(address from, uint256 amount);

    struct PaymentSplitterStorage {
        uint256 _totalShares;
        uint256 _totalReleased;
        mapping(address => uint256) _shares;
        mapping(address => uint256) _released;
        address[] _payees;
        mapping(IERC20 => uint256) _erc20TotalReleased;
        mapping(IERC20 => mapping(address => uint256)) _erc20Released;
    }

    function paymentSplitterStorage()
        internal
        pure
        returns (PaymentSplitterStorage storage s)
    {
        bytes32 position = PAYMENT_SPLITTER_STORAGE_POSITION;
        assembly {
            s.slot := position
        }
    }

    /**
     * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at
     * the matching position in the `shares` array.
     *
     * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no
     * duplicates in `payees`.
     */
    function setPaymentSplits(address[] memory payees, uint256[] memory shares_)
        internal
    {
        require(
            payees.length == shares_.length,
            "PaymentSplitter: payees and shares length mismatch"
        );
        require(payees.length > 0, "PaymentSplitter: no payees");

        for (uint256 i = 0; i < payees.length; i++) {
            _addPayee(payees[i], shares_[i]);
        }
    }

    function getPaymentSplits()
        internal
        view
        returns (address[] memory, uint256[] memory)
    {
        PaymentSplitterStorage storage s = paymentSplitterStorage();
        uint256[] memory allShares = new uint256[](s._payees.length);

        for (uint256 i; i < s._payees.length; i++) {
            allShares[i] = s._shares[s._payees[i]];
        }

        return (s._payees, allShares);
    }

    /**
     * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully
     * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the
     * reliability of the events, and not the actual splitting of Ether.
     *
     * To learn more about this see the Solidity documentation for
     * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback
     * functions].
     */
    function receivePayment() internal {
        emit PaymentReceived(msg.sender, msg.value);
    }

    /**
     * @dev Getter for the total shares held by payees.
     */
    function totalShares() internal view returns (uint256) {
        return paymentSplitterStorage()._totalShares;
    }

    /**
     * @dev Getter for the total amount of Ether already released.
     */
    function totalReleased() internal view returns (uint256) {
        return paymentSplitterStorage()._totalReleased;
    }

    /**
     * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20
     * contract.
     */
    function totalReleased(IERC20 token) internal view returns (uint256) {
        return paymentSplitterStorage()._erc20TotalReleased[token];
    }

    /**
     * @dev Getter for the amount of shares held by an account.
     */
    function shares(address account) internal view returns (uint256) {
        return paymentSplitterStorage()._shares[account];
    }

    /**
     * @dev Getter for the amount of Ether already released to a payee.
     */
    function released(address account) internal view returns (uint256) {
        return paymentSplitterStorage()._released[account];
    }

    /**
     * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an
     * IERC20 contract.
     */
    function released(IERC20 token, address account)
        internal
        view
        returns (uint256)
    {
        return paymentSplitterStorage()._erc20Released[token][account];
    }

    /**
     * @dev Getter for the address of the payee number `index`.
     */
    function payee(uint256 index) internal view returns (address) {
        return paymentSplitterStorage()._payees[index];
    }

    /**
     * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the
     * total shares and their previous withdrawals.
     */
    function release(address payable account) internal {
        PaymentSplitterStorage storage s = paymentSplitterStorage();
        require(
            s._shares[account] > 0,
            "PaymentSplitter: account has no shares"
        );

        uint256 totalReceived = address(this).balance + totalReleased();
        uint256 payment = _pendingPayment(
            account,
            totalReceived,
            released(account)
        );

        require(payment != 0, "PaymentSplitter: account is not due payment");

        s._released[account] += payment;
        s._totalReleased += payment;

        Address.sendValue(account, payment);
        emit PaymentReleased(account, payment);
    }

    /**
     * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their
     * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20
     * contract.
     */
    function release(IERC20 token, address account) internal {
        PaymentSplitterStorage storage s = paymentSplitterStorage();
        require(
            s._shares[account] > 0,
            "PaymentSplitter: account has no shares"
        );

        uint256 totalReceived = token.balanceOf(address(this)) +
            totalReleased(token);
        uint256 payment = _pendingPayment(
            account,
            totalReceived,
            released(token, account)
        );

        require(payment != 0, "PaymentSplitter: account is not due payment");

        s._erc20Released[token][account] += payment;
        s._erc20TotalReleased[token] += payment;

        SafeERC20.safeTransfer(token, account, payment);
        emit ERC20PaymentReleased(token, account, payment);
    }

    /**
     * @dev internal logic for computing the pending payment of an `account` given the token historical balances and
     * already released amounts.
     */
    function _pendingPayment(
        address account,
        uint256 totalReceived,
        uint256 alreadyReleased
    ) internal view returns (uint256) {
        PaymentSplitterStorage storage s = paymentSplitterStorage();
        return
            (totalReceived * s._shares[account]) /
            s._totalShares -
            alreadyReleased;
    }

    /**
     * @dev Add a new payee to the contract.
     * @param account The address of the payee to add.
     * @param shares_ The number of shares owned by the payee.
     */
    function _addPayee(address account, uint256 shares_) internal {
        require(
            account != address(0),
            "PaymentSplitter: account is the zero address"
        );
        require(shares_ > 0, "PaymentSplitter: shares are 0");
        PaymentSplitterStorage storage s = paymentSplitterStorage();
        require(
            s._shares[account] == 0,
            "PaymentSplitter: account already has shares"
        );

        s._payees.push(account);
        s._shares[account] = shares_;
        s._totalShares = s._totalShares + shares_;
        emit PayeeAdded(account, shares_);
    }
}

File 34 of 38 : DiamondInitializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";

/**
 * Author: Zac Denham
 *
 * This is a modification of Open Zeppelin's Initializable Util
 * that works with diamond storage, you must pass a unique string to the
 * modifier to avoid storage conflicts across contracts
 *
 * Usage: function yourInitializer() public initializer("super.unique.string") {}
 *
 * @dev This is a base contract to aid in writing upgradeable 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.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract DiamondInitializable {
    struct DiamondInitializableStorage {
        bool _initialized;
        bool _initializing;
    }

    /**
     * @dev Warning, you must pass a unique storage string
     * for each facet that inherits diamondInitializeable
     * or you may risk storage conflicts
     */
    function getDiamondInitializableStorage(string memory uniqueStorageString) internal pure returns (DiamondInitializableStorage storage s) {
        bytes32 position = keccak256(abi.encodePacked("diamond.initializable.", uniqueStorageString));
        assembly {
            s.slot := position
        }
    }

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer(string memory uniqueStorageString) {
        DiamondInitializableStorage storage s = getDiamondInitializableStorage(uniqueStorageString);
        // 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(s._initializing ? _isConstructor() : !s._initialized, "Initializable: contract is already initialized");

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

        _;

        if (isTopLevelCall) {
            s._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 onlyInitializing(string memory uniqueStorageString) {
        require(getDiamondInitializableStorage(uniqueStorageString)._initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 35 of 38 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 36 of 38 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 37 of 38 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.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
     * ====
     *
     * [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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 38 of 38 : IERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"ContractPaused","type":"error"},{"inputs":[],"name":"ExceedsMaxMintable","type":"error"},{"inputs":[],"name":"MaxMintableLocked","type":"error"},{"inputs":[],"name":"MaxMintableTooSmall","type":"error"},{"inputs":[],"name":"MetaDataLocked","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NonExistentToken","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","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":"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":[],"name":"allOwners","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"allTokensForOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"defaultRoyaltyFraction","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deleteDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"devMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"devMintUnsafe","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"devMintWithTokenURI","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"folderStorageBaseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":"lockMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxMintable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadataLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenOwner","type":"address"}],"name":"numberMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"removeTokenURIOverrideSelector","outputs":[],"stateMutability":"nonpayable","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":"nonpayable","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":"nonpayable","type":"function"},{"inputs":[],"name":"saleState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setFolderStorageBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxMintable","type":"uint256"}],"name":"setMaxMintable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_saleState","type":"uint256"}],"name":"setSaleState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint96","name":"_defaultRoyalty","type":"uint96"}],"name":"setTokenMeta","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setTokenStorageBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"setTokenURIOverrideSelector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenStorageBaseURI","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":"tokenURIOverrideSelector","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061573a80620000216000396000f3fe6080604052600436106102515760003560e01c806369d2ceb111610139578063aa1b103f116100b6578063ce52f6111161007a578063ce52f61114610860578063d6948b7514610889578063dc33e681146108b2578063e6798baa146108ef578063e985e9c51461091a578063ecedaf1c1461095757610251565b8063aa1b103f1461077d578063b88d4fde14610794578063b8f8d04e146107bd578063c014a36d146107fa578063c87b56dd1461082357610251565b806395d89b41116100fd57806395d89b41146106bc578063989bdbb6146106e7578063a12a52dc146106fe578063a22cb46514610729578063a2309ff81461075257610251565b806369d2ceb1146105e75780636d0042b81461061257806370a082311461063d5780637c5ff07c1461067a5780637cbe7361146106a557610251565b80632a55205a116101d25780634f558e79116101965780634f558e79146104df5780635c42ea7a1461051c578063603f4d521461054757806360ff97e514610572578063627804af1461058e5780636352211e146105aa57610251565b80632a55205a1461040a57806332fef5da14610448578063374d7ea01461046457806342842e0e1461048d57806342966c68146104b657610251565b8063162094c411610219578063162094c41461033957806318160ddd146103625780632154dc391461038d57806323b872dd146103b857806325d387b5146103e157610251565b80630357f5291461025657806306fdde031461027f578063081812fc146102aa578063084c4088146102e7578063095ea7b314610310575b600080fd5b34801561026257600080fd5b5061027d60048036038101906102789190614741565b610982565b005b34801561028b57600080fd5b506102946109df565b6040516102a19190614e81565b60405180910390f35b3480156102b657600080fd5b506102d160048036038101906102cc91906147c0565b610a7a565b6040516102de9190614d32565b60405180910390f35b3480156102f357600080fd5b5061030e600480360381019061030991906147c0565b610a8c565b005b34801561031c57600080fd5b5061033760048036038101906103329190614608565b610aca565b005b34801561034557600080fd5b50610360600480360381019061035b91906147e9565b610bcf565b005b34801561036e57600080fd5b50610377610c0f565b6040516103849190614fa3565b60405180910390f35b34801561039957600080fd5b506103a2610c30565b6040516103af9190614fa3565b60405180910390f35b3480156103c457600080fd5b506103df60048036038101906103da91906144ae565b610c3f565b005b3480156103ed57600080fd5b50610408600480360381019061040391906147c0565b610c57565b005b34801561041657600080fd5b50610431600480360381019061042c919061483d565b610c95565b60405161043f929190614dde565b60405180910390f35b610462600480360381019061045d91906145b4565b610cef565b005b34801561047057600080fd5b5061048b6004803603810190610486919061466d565b610d3f565b005b34801561049957600080fd5b506104b460048036038101906104af91906144ae565b610d5b565b005b3480156104c257600080fd5b506104dd60048036038101906104d891906147c0565b610d83565b005b3480156104eb57600080fd5b50610506600480360381019061050191906147c0565b610d97565b6040516105139190614e4b565b60405180910390f35b34801561052857600080fd5b50610531610da9565b60405161053e9190614e66565b60405180910390f35b34801561055357600080fd5b5061055c610dc9565b6040516105699190614fa3565b60405180910390f35b61058c60048036038101906105879190614608565b610dd8565b005b6105a860048036038101906105a39190614608565b610e19565b005b3480156105b657600080fd5b506105d160048036038101906105cc91906147c0565b610e5a565b6040516105de9190614d32565b60405180910390f35b3480156105f357600080fd5b506105fc610e70565b6040516106099190614e4b565b60405180910390f35b34801561061e57600080fd5b50610627610e90565b6040516106349190614fa3565b60405180910390f35b34801561064957600080fd5b50610664600480360381019061065f9190614449565b610ecc565b6040516106719190614fa3565b60405180910390f35b34801561068657600080fd5b5061068f610ede565b60405161069c9190614e81565b60405180910390f35b3480156106b157600080fd5b506106ba610f79565b005b3480156106c857600080fd5b506106d1610f93565b6040516106de9190614e81565b60405180910390f35b3480156106f357600080fd5b506106fc61102e565b005b34801561070a57600080fd5b50610713611048565b6040516107209190614e07565b60405180910390f35b34801561073557600080fd5b50610750600480360381019061074b9190614578565b611057565b005b34801561075e57600080fd5b506107676111cb565b6040516107749190614fa3565b60405180910390f35b34801561078957600080fd5b506107926111da565b005b3480156107a057600080fd5b506107bb60048036038101906107b691906144fd565b6111f4565b005b3480156107c957600080fd5b506107e460048036038101906107df9190614449565b611278565b6040516107f19190614e29565b60405180910390f35b34801561080657600080fd5b50610821600480360381019061081c91906146bf565b61128a565b005b34801561082f57600080fd5b5061084a600480360381019061084591906147c0565b6112c8565b6040516108579190614e81565b60405180910390f35b34801561086c57600080fd5b50610887600480360381019061088291906146bf565b611319565b005b34801561089557600080fd5b506108b060048036038101906108ab9190614879565b611357565b005b3480156108be57600080fd5b506108d960048036038101906108d49190614449565b611373565b6040516108e69190614fa3565b60405180910390f35b3480156108fb57600080fd5b50610904611385565b6040516109119190614fa3565b60405180910390f35b34801561092657600080fd5b50610941600480360381019061093c9190614472565b611394565b60405161094e9190614e4b565b60405180910390f35b34801561096357600080fd5b5061096c6113a8565b6040516109799190614e81565b60405180910390f35b61098a611443565b61099261148c565b600061099c6114de565b9050838160020190805190602001906109b6929190614198565b50828160030190805190602001906109cf929190614198565b506109d98261150b565b50505050565b60606109e96114de565b60020180546109f790615327565b80601f0160208091040260200160405190810160405280929190818152602001828054610a2390615327565b8015610a705780601f10610a4557610100808354040283529160200191610a70565b820191906000526020600020905b815481529060010190602001808311610a5357829003601f168201915b5050505050905090565b6000610a8582611639565b9050919050565b610ab67fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b610abe61148c565b610ac781611836565b50565b610ad261148c565b6000610add82610e5a565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b45576040517f943f7b8c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015610b885750610b868133611394565b155b15610bbf576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610bca838383611849565b505050565b610bf97fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b610c0161148c565b610c0b8282611904565b5050565b600080610c1a6114de565b9050600181600101548260000154030391505090565b6000610c3a611988565b905090565b610c4761148c565b610c5283838361199b565b505050565b610c817fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b610c8961148c565b610c9281611e53565b50565b60008060008411610cdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd290614f83565b60405180910390fd5b610ce483611ef7565b915091509250929050565b610d197fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b610d2161148c565b6000610d2e836001612001565b9050610d3a8183611904565b505050565b610d47611443565b610d4f61148c565b610d5881612086565b50565b610d6361148c565b610d7e838383604051806020016040528060008152506111f4565b505050565b610d8b61148c565b610d94816121fe565b50565b6000610da28261220c565b9050919050565b6000610db361226c565b60030160009054906101000a900460e01b905090565b6000610dd3612299565b905090565b610e027fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b610e0a61148c565b610e1482826122ac565b505050565b610e437fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b610e4b61148c565b610e558282612001565b505050565b6000610e6582612343565b600001519050919050565b6000610e7a61226c565b60030160049054906101000a900460ff16905090565b6000610e9a6125e6565b60000160000160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16905090565b6000610ed782612613565b9050919050565b6060610ee861226c565b6002018054610ef690615327565b80601f0160208091040260200160405190810160405280929190818152602001828054610f2290615327565b8015610f6f5780601f10610f4457610100808354040283529160200191610f6f565b820191906000526020600020905b815481529060010190602001808311610f5257829003601f168201915b5050505050905090565b610f81611443565b610f8961148c565b610f916126ec565b565b6060610f9d6114de565b6003018054610fab90615327565b80601f0160208091040260200160405190810160405280929190818152602001828054610fd790615327565b80156110245780601f10610ff957610100808354040283529160200191611024565b820191906000526020600020905b81548152906001019060200180831161100757829003601f168201915b5050505050905090565b611036611443565b61103e61148c565b611046612768565b565b606061105261278e565b905090565b61105f61148c565b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110c5576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806110ce6114de565b60070160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516111bf9190614e4b565b60405180910390a35050565b60006111d5612973565b905090565b6111e2611443565b6111ea61148c565b6111f261298f565b565b6111fc61148c565b61120784848461199b565b6112268373ffffffffffffffffffffffffffffffffffffffff166129e5565b801561123b575061123984848484612a08565b155b15611272576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b606061128382612b61565b9050919050565b6112b47fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b6112bc61148c565b6112c581612ccd565b50565b60606112d38261220c565b611309576040517f9430a17e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61131282612d3f565b9050919050565b6113437fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b61134b61148c565b61135481612f88565b50565b61135f611443565b61136761148c565b6113708161150b565b50565b600061137e82612ffa565b9050919050565b600061138f61306d565b905090565b60006113a08383613076565b905092915050565b60606113b261226c565b60010180546113c090615327565b80601f01602080910402602001604051908101604052809291908181526020018280546113ec90615327565b80156114395780601f1061140e57610100808354040283529160200191611439565b820191906000526020600020905b81548152906001019060200180831161141c57829003601f168201915b5050505050905090565b61144b613113565b61148a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148190614ee3565b60405180910390fd5b565b611494613174565b60000160009054906101000a900460ff16156114dc576040517fab35696f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b6000807f01a26df8f98be538b506e7341ca6cba96284d7be9a0bfd18f1c9c8aa652ad02990508091505090565b6115136131a1565b6bffffffffffffffffffffffff16816bffffffffffffffffffffffff161115611571576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156890614f43565b60405180910390fd5b60405180604001604052803073ffffffffffffffffffffffffffffffffffffffff168152602001826bffffffffffffffffffffffff168152506115b26125e6565b60000160008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505050565b60006116448261220c565b61167a576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6116826114de565b600601600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60006116c86131ab565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561175e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175590614ec3565b60405180910390fd5b61176883836131d8565b1580156117a157508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611831576117c78273ffffffffffffffffffffffffffffffffffffffff16601461324c565b6117d58460001c602061324c565b6040516020016117e6929190614cf8565b6040516020818303038152906040526040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118289190614e81565b60405180910390fd5b505050565b8061183f613546565b6000018190555050565b826118526114de565b600601600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b600061190e61226c565b90508060030160049054906101000a900460ff1615611959576040517fbb867ced00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b818160000160008581526020019081526020016000209080519060200190611982929190614198565b50505050565b6000611992613546565b60010154905090565b60006119a56114de565b905060006119b283612343565b90508473ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1614611a1d576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611a5f5750611a5e8633613076565b5b80611a9d57503373ffffffffffffffffffffffffffffffffffffffff16611a8585611639565b73ffffffffffffffffffffffffffffffffffffffff16145b905080611ad6576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611b3d576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611b4a8686866001613573565b611b5660008588611849565b60018360050160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900467ffffffffffffffff160392506101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060018360050160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900467ffffffffffffffff160192506101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060008360040160008681526020019081526020016000209050858160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550428160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550600060018601905060008560040160008381526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611de05785600001548214611ddf57888160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084602001518160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505b5b505050838573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4611e4b86868660016135a4565b505050505050565b611e5b612973565b811015611e94576040517f2374ca4a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611e9c613546565b60020160009054906101000a900460ff1615611ee4576040517f45ce653d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80611eed613546565b6001018190555050565b6000806000611f046125e6565b90506000816000016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff168152505090506000611fb76131a1565b6bffffffffffffffffffffffff1682602001516bffffffffffffffffffffffff1687611fe391906151a1565b611fed9190615170565b905081600001518194509450505050915091565b60008061200c613546565b60010154905060008114158015612034575082612027612973565b612031919061511a565b81105b1561206b576040517f3d48002000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6120736135d5565b915061207f84846135e8565b5092915050565b600061209061226c565b90508060030160049054906101000a900460ff16156120db576040517fbb867ced00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006120e5613606565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff166324a40579856040518263ffffffff1660e01b81526004016121469190614e66565b60206040518083038186803b15801561215e57600080fd5b505afa158015612172573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121969190614644565b9050806121d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121cf90614f03565b60405180910390fd5b838360030160006101000a81548163ffffffff021916908360e01c021790555050505050565b612209816001613633565b50565b60008161221761306d565b1115801561222f57506122286114de565b6000015482105b8015612265575061223e6114de565b6004016000838152602001908152602001600020600001601c9054906101000a900460ff16155b9050919050565b6000807f5e5514afa683d9ce5fd3fca09a19478b0d21dc40c41b7c60f141411145a2c9f490508091505090565b60006122a3613546565b60000154905090565b6000806122b7613546565b600101549050600081141580156122df5750826122d2612973565b6122dc919061511a565b81105b15612316576040517f3d48002000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61231e6135d5565b915061233c8484604051806020016040528060008152506000613a25565b5092915050565b61234b61421e565b6000829050600061235a6114de565b90508161236561306d565b111580156123765750806000015482105b156125af5760008160040160008481526020019081526020016000206040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200160008201601c9054906101000a900460ff161515151581525050905080604001516125ad57600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff161461248e578093505050506125e1565b5b6001156125ac578280600190039350508160040160008481526020019081526020016000206040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200160008201601c9054906101000a900460ff1615151515815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff16146125a7578093505050506125e1565b61248f565b5b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b6000807f340b363f5bbd9e1dfb1cf0d96dd39355fab5ada73fba48b7ecf5df4c50808c9c90508091505090565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561267b576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6126836114de565b60050160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900467ffffffffffffffff1667ffffffffffffffff169050919050565b60006126f661226c565b90508060030160049054906101000a900460ff1615612741576040517fbb867ced00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060e01b8160030160006101000a81548163ffffffff021916908360e01c021790555050565b600161277261226c565b60030160046101000a81548160ff021916908315150217905550565b6060600061279a6114de565b60000154905060006001826127af91906151fb565b67ffffffffffffffff8111156127ee577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561281c5781602001602082028036833780820191505090505b50905060005b60018361282f91906151fb565b81101561296a576000600182612845919061511a565b90506128508161220c565b156128e057600061286082612343565b600001519050808484815181106128a0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505050612956565b600083838151811061291b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250505b5080806129629061538a565b915050612822565b50809250505090565b600061297d61306d565b6129856114de565b6000015403905090565b6129976125e6565b600001600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556000820160146101000a8154906bffffffffffffffffffffffff02191690555050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60008373ffffffffffffffffffffffffffffffffffffffff1663150b7a02338786866040518563ffffffff1660e01b8152600401612a499493929190614d4d565b602060405180830381600087803b158015612a6357600080fd5b505af1925050508015612a9457506040513d601f19601f82011682018060405250810190612a919190614696565b60015b612b0e573d8060008114612ac4576040519150601f19603f3d011682016040523d82523d6000602084013e612ac9565b606091505b50600081511415612b06576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050949350505050565b60606000612b6e83612613565b90506000612b7a6114de565b60000154905060008267ffffffffffffffff811115612bc2577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015612bf05781602001602082028036833780820191505090505b509050600080600190505b83811015612cc057612c0c8161220c565b15612cad576000612c1c82612343565b6000015190508773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612cab5781848481518110612c90577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181815250508280612ca79061538a565b9350505b505b8080612cb89061538a565b915050612bfb565b5081945050505050919050565b6000612cd761226c565b90508060030160049054906101000a900460ff1615612d22576040517fbb867ced00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81816001019080519060200190612d3a929190614198565b505050565b60606000612d4b61226c565b9050600060e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168160030160009054906101000a900460e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612ef7576000803073ffffffffffffffffffffffffffffffffffffffff168360030160009054906101000a900460e01b86604051602401612de49190614fa3565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051612e4e9190614c99565b600060405180830381855afa9150503d8060008114612e89576040519150601f19603f3d011682016040523d82523d6000602084013e612e8e565b606091505b509150915081612ed3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612eca90614f63565b60405180910390fd5b600081806020019051810190612ee99190614700565b905080945050505050612f83565b6000612f0284613e0f565b9050600082600101905060008360020190506000838054612f2290615327565b90501415612f595781612f3487613e34565b604051602001612f45929190614cb0565b604051602081830303815290604052612f7c565b8083604051602001612f6c929190614cd4565b6040516020818303038152906040525b9450505050505b919050565b6000612f9261226c565b90508060030160049054906101000a900460ff1615612fdd576040517fbb867ced00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81816002019080519060200190612ff5929190614198565b505050565b60006130046114de565b60050160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160089054906101000a900467ffffffffffffffff1667ffffffffffffffff169050919050565b60006001905090565b60006130806114de565b60070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60003373ffffffffffffffffffffffffffffffffffffffff166131346131ab565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905090565b6000807f898bcb892ce96890816cc7d1ea86c592f314ff2e839268e378d8f279767ea82290508091505090565b6000612710905090565b6000807f23a3985ff794c67d8d516a95b83c7dfb32e426521153078d1eadc4dc887e2d3e90508091505090565b60006131e26131ab565b600101600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60606000600283600261325f91906151a1565b613269919061511a565b67ffffffffffffffff8111156132a8577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156132da5781602001600182028036833780820191505090505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110613338577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106133c2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600261340291906151a1565b61340c919061511a565b90505b60018111156134f8577f3031323334353637383961626364656600000000000000000000000000000000600f861660108110613474577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b1a60f81b8282815181106134b1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c9450806134f1906152fd565b905061340f565b506000841461353c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161353390614ea3565b60405180910390fd5b8091505092915050565b6000807fad43ad2482c0e34f469927438c71a0c1b7f2931bd74b6681aa5cc14821daa0aa90508091505090565b600061357d613fe1565b60000160009054906101000a900460e01b905061359d818686868661400d565b5050505050565b60006135ae613fe1565b60000160049054906101000a900460e01b90506135ce818686868661400d565b5050505050565b60006135df6114de565b60000154905090565b613602828260405180602001604052806000815250614186565b5050565b6000807ff8a1c6908b780da9d81bb8be40154a49e4eccafd820fcb10aeac624fcb8e2f8990508091505090565b600061363e83612343565b9050600061364a6114de565b905060008260000151905083156137165760008173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061369d575061369c8233613076565b5b806136db57503373ffffffffffffffffffffffffffffffffffffffff166136c387611639565b73ffffffffffffffffffffffffffffffffffffffff16145b905080613714576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b613724816000876001613573565b61373060008683611849565b60008260050160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060018160000160008282829054906101000a900467ffffffffffffffff160392506101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060018160000160108282829054906101000a900467ffffffffffffffff160192506101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060008360040160008881526020019081526020016000209050828160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550428160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550600181600001601c6101000a81548160ff021916908315150217905550600060018801905060008560040160008381526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561399c578560000154821461399b57848160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555086602001518160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505b5b5050505084600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4613a0a8160008760016135a4565b81600101600081548092919060010191905055505050505050565b6000613a2f6114de565b9050600081600001549050600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415613aa1576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000851415613adc576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613ae96000878388613573565b848260050160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900467ffffffffffffffff160192506101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550848260050160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160088282829054906101000a900467ffffffffffffffff160192506101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055508582600401600083815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055504282600401600083815260200190815260200160002060000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550600081905060008682019050848015613cbb5750613cba8873ffffffffffffffffffffffffffffffffffffffff166129e5565b5b15613d83575b818873ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4613d306000898480600101955089612a08565b613d66576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80821415613cc15782846000015414613d7e57600080fd5b613def565b5b818060010192508873ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a480821415613d84575b8184600001819055505050613e0760008783886135a4565b505050505050565b6000613e1961226c565b60000160008381526020019081526020016000209050919050565b60606000821415613e7c576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050613fdc565b600082905060005b60008214613eae578080613e979061538a565b915050600a82613ea79190615170565b9150613e84565b60008167ffffffffffffffff811115613ef0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613f225781602001600182028036833780820191505090505b5090505b60008514613fd557600182613f3b91906151fb565b9150600a85613f4a91906153d3565b6030613f56919061511a565b60f81b818381518110613f92577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85613fce9190615170565b9450613f26565b8093505050505b919050565b6000807eedd92670a3023a8d3294bd858c00eecb0723cd4bed7aeb7a60b082ade1ab1a90508091505090565b600060e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916857bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561405c5761417f565b60003073ffffffffffffffffffffffffffffffffffffffff16868686868660405160240161408d9493929190614d99565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516140f79190614c99565b6000604051808303816000865af19150503d8060008114614134576040519150601f19603f3d011682016040523d82523d6000602084013e614139565b606091505b505090508061417d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161417490614f23565b60405180910390fd5b505b5050505050565b6141938383836001613a25565b505050565b8280546141a490615327565b90600052602060002090601f0160209004810192826141c6576000855561420d565b82601f106141df57805160ff191683800117855561420d565b8280016001018555821561420d579182015b8281111561420c5782518255916020019190600101906141f1565b5b50905061421a9190614261565b5090565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600067ffffffffffffffff1681526020016000151581525090565b5b8082111561427a576000816000905550600101614262565b5090565b600061429161428c84614fe3565b614fbe565b9050828152602081018484840111156142a957600080fd5b6142b48482856152bb565b509392505050565b60006142cf6142ca84615014565b614fbe565b9050828152602081018484840111156142e757600080fd5b6142f28482856152bb565b509392505050565b600061430d61430884615014565b614fbe565b90508281526020810184848401111561432557600080fd5b6143308482856152ca565b509392505050565b60008135905061434781615691565b92915050565b60008135905061435c816156a8565b92915050565b600081519050614371816156a8565b92915050565b600081359050614386816156bf565b92915050565b60008151905061439b816156bf565b92915050565b600082601f8301126143b257600080fd5b81356143c284826020860161427e565b91505092915050565b600082601f8301126143dc57600080fd5b81356143ec8482602086016142bc565b91505092915050565b600082601f83011261440657600080fd5b81516144168482602086016142fa565b91505092915050565b60008135905061442e816156d6565b92915050565b600081359050614443816156ed565b92915050565b60006020828403121561445b57600080fd5b600061446984828501614338565b91505092915050565b6000806040838503121561448557600080fd5b600061449385828601614338565b92505060206144a485828601614338565b9150509250929050565b6000806000606084860312156144c357600080fd5b60006144d186828701614338565b93505060206144e286828701614338565b92505060406144f38682870161441f565b9150509250925092565b6000806000806080858703121561451357600080fd5b600061452187828801614338565b945050602061453287828801614338565b93505060406145438782880161441f565b925050606085013567ffffffffffffffff81111561456057600080fd5b61456c878288016143a1565b91505092959194509250565b6000806040838503121561458b57600080fd5b600061459985828601614338565b92505060206145aa8582860161434d565b9150509250929050565b600080604083850312156145c757600080fd5b60006145d585828601614338565b925050602083013567ffffffffffffffff8111156145f257600080fd5b6145fe858286016143cb565b9150509250929050565b6000806040838503121561461b57600080fd5b600061462985828601614338565b925050602061463a8582860161441f565b9150509250929050565b60006020828403121561465657600080fd5b600061466484828501614362565b91505092915050565b60006020828403121561467f57600080fd5b600061468d84828501614377565b91505092915050565b6000602082840312156146a857600080fd5b60006146b68482850161438c565b91505092915050565b6000602082840312156146d157600080fd5b600082013567ffffffffffffffff8111156146eb57600080fd5b6146f7848285016143cb565b91505092915050565b60006020828403121561471257600080fd5b600082015167ffffffffffffffff81111561472c57600080fd5b614738848285016143f5565b91505092915050565b60008060006060848603121561475657600080fd5b600084013567ffffffffffffffff81111561477057600080fd5b61477c868287016143cb565b935050602084013567ffffffffffffffff81111561479957600080fd5b6147a5868287016143cb565b92505060406147b686828701614434565b9150509250925092565b6000602082840312156147d257600080fd5b60006147e08482850161441f565b91505092915050565b600080604083850312156147fc57600080fd5b600061480a8582860161441f565b925050602083013567ffffffffffffffff81111561482757600080fd5b614833858286016143cb565b9150509250929050565b6000806040838503121561485057600080fd5b600061485e8582860161441f565b925050602061486f8582860161441f565b9150509250929050565b60006020828403121561488b57600080fd5b600061489984828501614434565b91505092915050565b60006148ae83836148d2565b60208301905092915050565b60006148c68383614c7b565b60208301905092915050565b6148db8161522f565b82525050565b6148ea8161522f565b82525050565b60006148fb8261507a565b61490581856150c0565b935061491083615045565b8060005b8381101561494157815161492888826148a2565b9750614933836150a6565b925050600181019050614914565b5085935050505092915050565b600061495982615085565b61496381856150d1565b935061496e83615055565b8060005b8381101561499f57815161498688826148ba565b9750614991836150b3565b925050600181019050614972565b5085935050505092915050565b6149b581615241565b82525050565b6149c48161524d565b82525050565b60006149d582615090565b6149df81856150e2565b93506149ef8185602086016152ca565b6149f8816154c0565b840191505092915050565b6000614a0e82615090565b614a1881856150f3565b9350614a288185602086016152ca565b80840191505092915050565b6000614a3f8261509b565b614a4981856150fe565b9350614a598185602086016152ca565b614a62816154c0565b840191505092915050565b6000614a788261509b565b614a82818561510f565b9350614a928185602086016152ca565b80840191505092915050565b60008154614aab81615327565b614ab5818661510f565b94506001821660008114614ad05760018114614ae157614b14565b60ff19831686528186019350614b14565b614aea85615065565b60005b83811015614b0c57815481890152600182019150602081019050614aed565b838801955050505b50505092915050565b6000614b2a6020836150fe565b9150614b35826154d1565b602082019050919050565b6000614b4d601b836150fe565b9150614b58826154fa565b602082019050919050565b6000614b706017836150fe565b9150614b7b82615523565b602082019050919050565b6000614b936015836150fe565b9150614b9e8261554c565b602082019050919050565b6000614bb66014836150fe565b9150614bc182615575565b602082019050919050565b6000614bd960178361510f565b9150614be48261559e565b601782019050919050565b6000614bfc602a836150fe565b9150614c07826155c7565b604082019050919050565b6000614c1f6019836150fe565b9150614c2a82615616565b602082019050919050565b6000614c426015836150fe565b9150614c4d8261563f565b602082019050919050565b6000614c6560118361510f565b9150614c7082615668565b601182019050919050565b614c8481615299565b82525050565b614c9381615299565b82525050565b6000614ca58284614a03565b915081905092915050565b6000614cbc8285614a9e565b9150614cc88284614a6d565b91508190509392505050565b6000614ce08285614a9e565b9150614cec8284614a9e565b91508190509392505050565b6000614d0382614bcc565b9150614d0f8285614a6d565b9150614d1a82614c58565b9150614d268284614a6d565b91508190509392505050565b6000602082019050614d4760008301846148e1565b92915050565b6000608082019050614d6260008301876148e1565b614d6f60208301866148e1565b614d7c6040830185614c8a565b8181036060830152614d8e81846149ca565b905095945050505050565b6000608082019050614dae60008301876148e1565b614dbb60208301866148e1565b614dc86040830185614c8a565b614dd56060830184614c8a565b95945050505050565b6000604082019050614df360008301856148e1565b614e006020830184614c8a565b9392505050565b60006020820190508181036000830152614e2181846148f0565b905092915050565b60006020820190508181036000830152614e43818461494e565b905092915050565b6000602082019050614e6060008301846149ac565b92915050565b6000602082019050614e7b60008301846149bb565b92915050565b60006020820190508181036000830152614e9b8184614a34565b905092915050565b60006020820190508181036000830152614ebc81614b1d565b9050919050565b60006020820190508181036000830152614edc81614b40565b9050919050565b60006020820190508181036000830152614efc81614b63565b9050919050565b60006020820190508181036000830152614f1c81614b86565b9050919050565b60006020820190508181036000830152614f3c81614ba9565b9050919050565b60006020820190508181036000830152614f5c81614bef565b9050919050565b60006020820190508181036000830152614f7c81614c12565b9050919050565b60006020820190508181036000830152614f9c81614c35565b9050919050565b6000602082019050614fb86000830184614c8a565b92915050565b6000614fc8614fd9565b9050614fd48282615359565b919050565b6000604051905090565b600067ffffffffffffffff821115614ffe57614ffd615491565b5b615007826154c0565b9050602081019050919050565b600067ffffffffffffffff82111561502f5761502e615491565b5b615038826154c0565b9050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b600061512582615299565b915061513083615299565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561516557615164615404565b5b828201905092915050565b600061517b82615299565b915061518683615299565b92508261519657615195615433565b5b828204905092915050565b60006151ac82615299565b91506151b783615299565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156151f0576151ef615404565b5b828202905092915050565b600061520682615299565b915061521183615299565b92508282101561522457615223615404565b5b828203905092915050565b600061523a82615279565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006bffffffffffffffffffffffff82169050919050565b82818337600083830152505050565b60005b838110156152e85780820151818401526020810190506152cd565b838111156152f7576000848401525b50505050565b600061530882615299565b9150600082141561531c5761531b615404565b5b600182039050919050565b6000600282049050600182168061533f57607f821691505b6020821081141561535357615352615462565b5b50919050565b615362826154c0565b810181811067ffffffffffffffff8211171561538157615380615491565b5b80604052505050565b600061539582615299565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156153c8576153c7615404565b5b600182019050919050565b60006153de82615299565b91506153e983615299565b9250826153f9576153f8615433565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b7f41646d696e2066756e6374696f6e616c697479207265766f6b65640000000000600082015250565b7f43616c6c6572206973206e6f7420746865206f776e6572000000000000000000600082015250565b7f73656c6563746f72206e6f7420617070726f7665640000000000000000000000600082015250565b7f5472616e7366657220686f6f6b206661696c6564000000000000000000000000600082015250565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b7f455243323938313a20726f79616c7479206665652077696c6c2065786365656460008201527f2073616c65507269636500000000000000000000000000000000000000000000602082015250565b7f546f6b656e20555249204f76657272696465204661696c656400000000000000600082015250565b7f746f6b656e4964206d6179206e6f742065786973740000000000000000000000600082015250565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b61569a8161522f565b81146156a557600080fd5b50565b6156b181615241565b81146156bc57600080fd5b50565b6156c88161524d565b81146156d357600080fd5b50565b6156df81615299565b81146156ea57600080fd5b50565b6156f6816152a3565b811461570157600080fd5b5056fea26469706673582212207c8029a20032c3101c719683cab9adcc29cac35a9fdc8020a2e206bf3d1b201c64736f6c63430008040033

Deployed Bytecode

0x6080604052600436106102515760003560e01c806369d2ceb111610139578063aa1b103f116100b6578063ce52f6111161007a578063ce52f61114610860578063d6948b7514610889578063dc33e681146108b2578063e6798baa146108ef578063e985e9c51461091a578063ecedaf1c1461095757610251565b8063aa1b103f1461077d578063b88d4fde14610794578063b8f8d04e146107bd578063c014a36d146107fa578063c87b56dd1461082357610251565b806395d89b41116100fd57806395d89b41146106bc578063989bdbb6146106e7578063a12a52dc146106fe578063a22cb46514610729578063a2309ff81461075257610251565b806369d2ceb1146105e75780636d0042b81461061257806370a082311461063d5780637c5ff07c1461067a5780637cbe7361146106a557610251565b80632a55205a116101d25780634f558e79116101965780634f558e79146104df5780635c42ea7a1461051c578063603f4d521461054757806360ff97e514610572578063627804af1461058e5780636352211e146105aa57610251565b80632a55205a1461040a57806332fef5da14610448578063374d7ea01461046457806342842e0e1461048d57806342966c68146104b657610251565b8063162094c411610219578063162094c41461033957806318160ddd146103625780632154dc391461038d57806323b872dd146103b857806325d387b5146103e157610251565b80630357f5291461025657806306fdde031461027f578063081812fc146102aa578063084c4088146102e7578063095ea7b314610310575b600080fd5b34801561026257600080fd5b5061027d60048036038101906102789190614741565b610982565b005b34801561028b57600080fd5b506102946109df565b6040516102a19190614e81565b60405180910390f35b3480156102b657600080fd5b506102d160048036038101906102cc91906147c0565b610a7a565b6040516102de9190614d32565b60405180910390f35b3480156102f357600080fd5b5061030e600480360381019061030991906147c0565b610a8c565b005b34801561031c57600080fd5b5061033760048036038101906103329190614608565b610aca565b005b34801561034557600080fd5b50610360600480360381019061035b91906147e9565b610bcf565b005b34801561036e57600080fd5b50610377610c0f565b6040516103849190614fa3565b60405180910390f35b34801561039957600080fd5b506103a2610c30565b6040516103af9190614fa3565b60405180910390f35b3480156103c457600080fd5b506103df60048036038101906103da91906144ae565b610c3f565b005b3480156103ed57600080fd5b50610408600480360381019061040391906147c0565b610c57565b005b34801561041657600080fd5b50610431600480360381019061042c919061483d565b610c95565b60405161043f929190614dde565b60405180910390f35b610462600480360381019061045d91906145b4565b610cef565b005b34801561047057600080fd5b5061048b6004803603810190610486919061466d565b610d3f565b005b34801561049957600080fd5b506104b460048036038101906104af91906144ae565b610d5b565b005b3480156104c257600080fd5b506104dd60048036038101906104d891906147c0565b610d83565b005b3480156104eb57600080fd5b50610506600480360381019061050191906147c0565b610d97565b6040516105139190614e4b565b60405180910390f35b34801561052857600080fd5b50610531610da9565b60405161053e9190614e66565b60405180910390f35b34801561055357600080fd5b5061055c610dc9565b6040516105699190614fa3565b60405180910390f35b61058c60048036038101906105879190614608565b610dd8565b005b6105a860048036038101906105a39190614608565b610e19565b005b3480156105b657600080fd5b506105d160048036038101906105cc91906147c0565b610e5a565b6040516105de9190614d32565b60405180910390f35b3480156105f357600080fd5b506105fc610e70565b6040516106099190614e4b565b60405180910390f35b34801561061e57600080fd5b50610627610e90565b6040516106349190614fa3565b60405180910390f35b34801561064957600080fd5b50610664600480360381019061065f9190614449565b610ecc565b6040516106719190614fa3565b60405180910390f35b34801561068657600080fd5b5061068f610ede565b60405161069c9190614e81565b60405180910390f35b3480156106b157600080fd5b506106ba610f79565b005b3480156106c857600080fd5b506106d1610f93565b6040516106de9190614e81565b60405180910390f35b3480156106f357600080fd5b506106fc61102e565b005b34801561070a57600080fd5b50610713611048565b6040516107209190614e07565b60405180910390f35b34801561073557600080fd5b50610750600480360381019061074b9190614578565b611057565b005b34801561075e57600080fd5b506107676111cb565b6040516107749190614fa3565b60405180910390f35b34801561078957600080fd5b506107926111da565b005b3480156107a057600080fd5b506107bb60048036038101906107b691906144fd565b6111f4565b005b3480156107c957600080fd5b506107e460048036038101906107df9190614449565b611278565b6040516107f19190614e29565b60405180910390f35b34801561080657600080fd5b50610821600480360381019061081c91906146bf565b61128a565b005b34801561082f57600080fd5b5061084a600480360381019061084591906147c0565b6112c8565b6040516108579190614e81565b60405180910390f35b34801561086c57600080fd5b50610887600480360381019061088291906146bf565b611319565b005b34801561089557600080fd5b506108b060048036038101906108ab9190614879565b611357565b005b3480156108be57600080fd5b506108d960048036038101906108d49190614449565b611373565b6040516108e69190614fa3565b60405180910390f35b3480156108fb57600080fd5b50610904611385565b6040516109119190614fa3565b60405180910390f35b34801561092657600080fd5b50610941600480360381019061093c9190614472565b611394565b60405161094e9190614e4b565b60405180910390f35b34801561096357600080fd5b5061096c6113a8565b6040516109799190614e81565b60405180910390f35b61098a611443565b61099261148c565b600061099c6114de565b9050838160020190805190602001906109b6929190614198565b50828160030190805190602001906109cf929190614198565b506109d98261150b565b50505050565b60606109e96114de565b60020180546109f790615327565b80601f0160208091040260200160405190810160405280929190818152602001828054610a2390615327565b8015610a705780601f10610a4557610100808354040283529160200191610a70565b820191906000526020600020905b815481529060010190602001808311610a5357829003601f168201915b5050505050905090565b6000610a8582611639565b9050919050565b610ab67fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b610abe61148c565b610ac781611836565b50565b610ad261148c565b6000610add82610e5a565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b45576040517f943f7b8c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015610b885750610b868133611394565b155b15610bbf576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610bca838383611849565b505050565b610bf97fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b610c0161148c565b610c0b8282611904565b5050565b600080610c1a6114de565b9050600181600101548260000154030391505090565b6000610c3a611988565b905090565b610c4761148c565b610c5283838361199b565b505050565b610c817fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b610c8961148c565b610c9281611e53565b50565b60008060008411610cdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd290614f83565b60405180910390fd5b610ce483611ef7565b915091509250929050565b610d197fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b610d2161148c565b6000610d2e836001612001565b9050610d3a8183611904565b505050565b610d47611443565b610d4f61148c565b610d5881612086565b50565b610d6361148c565b610d7e838383604051806020016040528060008152506111f4565b505050565b610d8b61148c565b610d94816121fe565b50565b6000610da28261220c565b9050919050565b6000610db361226c565b60030160009054906101000a900460e01b905090565b6000610dd3612299565b905090565b610e027fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b610e0a61148c565b610e1482826122ac565b505050565b610e437fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b610e4b61148c565b610e558282612001565b505050565b6000610e6582612343565b600001519050919050565b6000610e7a61226c565b60030160049054906101000a900460ff16905090565b6000610e9a6125e6565b60000160000160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16905090565b6000610ed782612613565b9050919050565b6060610ee861226c565b6002018054610ef690615327565b80601f0160208091040260200160405190810160405280929190818152602001828054610f2290615327565b8015610f6f5780601f10610f4457610100808354040283529160200191610f6f565b820191906000526020600020905b815481529060010190602001808311610f5257829003601f168201915b5050505050905090565b610f81611443565b610f8961148c565b610f916126ec565b565b6060610f9d6114de565b6003018054610fab90615327565b80601f0160208091040260200160405190810160405280929190818152602001828054610fd790615327565b80156110245780601f10610ff957610100808354040283529160200191611024565b820191906000526020600020905b81548152906001019060200180831161100757829003601f168201915b5050505050905090565b611036611443565b61103e61148c565b611046612768565b565b606061105261278e565b905090565b61105f61148c565b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110c5576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806110ce6114de565b60070160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516111bf9190614e4b565b60405180910390a35050565b60006111d5612973565b905090565b6111e2611443565b6111ea61148c565b6111f261298f565b565b6111fc61148c565b61120784848461199b565b6112268373ffffffffffffffffffffffffffffffffffffffff166129e5565b801561123b575061123984848484612a08565b155b15611272576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b606061128382612b61565b9050919050565b6112b47fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b6112bc61148c565b6112c581612ccd565b50565b60606112d38261220c565b611309576040517f9430a17e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61131282612d3f565b9050919050565b6113437fb905253714c57beb31c9b4f35be6565322dce8a529999da99d3bd3479785d83e336116be565b61134b61148c565b61135481612f88565b50565b61135f611443565b61136761148c565b6113708161150b565b50565b600061137e82612ffa565b9050919050565b600061138f61306d565b905090565b60006113a08383613076565b905092915050565b60606113b261226c565b60010180546113c090615327565b80601f01602080910402602001604051908101604052809291908181526020018280546113ec90615327565b80156114395780601f1061140e57610100808354040283529160200191611439565b820191906000526020600020905b81548152906001019060200180831161141c57829003601f168201915b5050505050905090565b61144b613113565b61148a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148190614ee3565b60405180910390fd5b565b611494613174565b60000160009054906101000a900460ff16156114dc576040517fab35696f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b6000807f01a26df8f98be538b506e7341ca6cba96284d7be9a0bfd18f1c9c8aa652ad02990508091505090565b6115136131a1565b6bffffffffffffffffffffffff16816bffffffffffffffffffffffff161115611571576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156890614f43565b60405180910390fd5b60405180604001604052803073ffffffffffffffffffffffffffffffffffffffff168152602001826bffffffffffffffffffffffff168152506115b26125e6565b60000160008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505050565b60006116448261220c565b61167a576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6116826114de565b600601600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60006116c86131ab565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561175e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175590614ec3565b60405180910390fd5b61176883836131d8565b1580156117a157508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611831576117c78273ffffffffffffffffffffffffffffffffffffffff16601461324c565b6117d58460001c602061324c565b6040516020016117e6929190614cf8565b6040516020818303038152906040526040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118289190614e81565b60405180910390fd5b505050565b8061183f613546565b6000018190555050565b826118526114de565b600601600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b600061190e61226c565b90508060030160049054906101000a900460ff1615611959576040517fbb867ced00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b818160000160008581526020019081526020016000209080519060200190611982929190614198565b50505050565b6000611992613546565b60010154905090565b60006119a56114de565b905060006119b283612343565b90508473ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1614611a1d576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611a5f5750611a5e8633613076565b5b80611a9d57503373ffffffffffffffffffffffffffffffffffffffff16611a8585611639565b73ffffffffffffffffffffffffffffffffffffffff16145b905080611ad6576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611b3d576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611b4a8686866001613573565b611b5660008588611849565b60018360050160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900467ffffffffffffffff160392506101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060018360050160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900467ffffffffffffffff160192506101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060008360040160008681526020019081526020016000209050858160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550428160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550600060018601905060008560040160008381526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611de05785600001548214611ddf57888160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084602001518160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505b5b505050838573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4611e4b86868660016135a4565b505050505050565b611e5b612973565b811015611e94576040517f2374ca4a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611e9c613546565b60020160009054906101000a900460ff1615611ee4576040517f45ce653d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80611eed613546565b6001018190555050565b6000806000611f046125e6565b90506000816000016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff168152505090506000611fb76131a1565b6bffffffffffffffffffffffff1682602001516bffffffffffffffffffffffff1687611fe391906151a1565b611fed9190615170565b905081600001518194509450505050915091565b60008061200c613546565b60010154905060008114158015612034575082612027612973565b612031919061511a565b81105b1561206b576040517f3d48002000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6120736135d5565b915061207f84846135e8565b5092915050565b600061209061226c565b90508060030160049054906101000a900460ff16156120db576040517fbb867ced00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006120e5613606565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff166324a40579856040518263ffffffff1660e01b81526004016121469190614e66565b60206040518083038186803b15801561215e57600080fd5b505afa158015612172573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121969190614644565b9050806121d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121cf90614f03565b60405180910390fd5b838360030160006101000a81548163ffffffff021916908360e01c021790555050505050565b612209816001613633565b50565b60008161221761306d565b1115801561222f57506122286114de565b6000015482105b8015612265575061223e6114de565b6004016000838152602001908152602001600020600001601c9054906101000a900460ff16155b9050919050565b6000807f5e5514afa683d9ce5fd3fca09a19478b0d21dc40c41b7c60f141411145a2c9f490508091505090565b60006122a3613546565b60000154905090565b6000806122b7613546565b600101549050600081141580156122df5750826122d2612973565b6122dc919061511a565b81105b15612316576040517f3d48002000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61231e6135d5565b915061233c8484604051806020016040528060008152506000613a25565b5092915050565b61234b61421e565b6000829050600061235a6114de565b90508161236561306d565b111580156123765750806000015482105b156125af5760008160040160008481526020019081526020016000206040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200160008201601c9054906101000a900460ff161515151581525050905080604001516125ad57600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff161461248e578093505050506125e1565b5b6001156125ac578280600190039350508160040160008481526020019081526020016000206040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200160008201601c9054906101000a900460ff1615151515815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff16146125a7578093505050506125e1565b61248f565b5b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b6000807f340b363f5bbd9e1dfb1cf0d96dd39355fab5ada73fba48b7ecf5df4c50808c9c90508091505090565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561267b576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6126836114de565b60050160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900467ffffffffffffffff1667ffffffffffffffff169050919050565b60006126f661226c565b90508060030160049054906101000a900460ff1615612741576040517fbb867ced00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060e01b8160030160006101000a81548163ffffffff021916908360e01c021790555050565b600161277261226c565b60030160046101000a81548160ff021916908315150217905550565b6060600061279a6114de565b60000154905060006001826127af91906151fb565b67ffffffffffffffff8111156127ee577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561281c5781602001602082028036833780820191505090505b50905060005b60018361282f91906151fb565b81101561296a576000600182612845919061511a565b90506128508161220c565b156128e057600061286082612343565b600001519050808484815181106128a0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505050612956565b600083838151811061291b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250505b5080806129629061538a565b915050612822565b50809250505090565b600061297d61306d565b6129856114de565b6000015403905090565b6129976125e6565b600001600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556000820160146101000a8154906bffffffffffffffffffffffff02191690555050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60008373ffffffffffffffffffffffffffffffffffffffff1663150b7a02338786866040518563ffffffff1660e01b8152600401612a499493929190614d4d565b602060405180830381600087803b158015612a6357600080fd5b505af1925050508015612a9457506040513d601f19601f82011682018060405250810190612a919190614696565b60015b612b0e573d8060008114612ac4576040519150601f19603f3d011682016040523d82523d6000602084013e612ac9565b606091505b50600081511415612b06576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050949350505050565b60606000612b6e83612613565b90506000612b7a6114de565b60000154905060008267ffffffffffffffff811115612bc2577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015612bf05781602001602082028036833780820191505090505b509050600080600190505b83811015612cc057612c0c8161220c565b15612cad576000612c1c82612343565b6000015190508773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612cab5781848481518110612c90577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181815250508280612ca79061538a565b9350505b505b8080612cb89061538a565b915050612bfb565b5081945050505050919050565b6000612cd761226c565b90508060030160049054906101000a900460ff1615612d22576040517fbb867ced00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81816001019080519060200190612d3a929190614198565b505050565b60606000612d4b61226c565b9050600060e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168160030160009054906101000a900460e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612ef7576000803073ffffffffffffffffffffffffffffffffffffffff168360030160009054906101000a900460e01b86604051602401612de49190614fa3565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051612e4e9190614c99565b600060405180830381855afa9150503d8060008114612e89576040519150601f19603f3d011682016040523d82523d6000602084013e612e8e565b606091505b509150915081612ed3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612eca90614f63565b60405180910390fd5b600081806020019051810190612ee99190614700565b905080945050505050612f83565b6000612f0284613e0f565b9050600082600101905060008360020190506000838054612f2290615327565b90501415612f595781612f3487613e34565b604051602001612f45929190614cb0565b604051602081830303815290604052612f7c565b8083604051602001612f6c929190614cd4565b6040516020818303038152906040525b9450505050505b919050565b6000612f9261226c565b90508060030160049054906101000a900460ff1615612fdd576040517fbb867ced00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81816002019080519060200190612ff5929190614198565b505050565b60006130046114de565b60050160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160089054906101000a900467ffffffffffffffff1667ffffffffffffffff169050919050565b60006001905090565b60006130806114de565b60070160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60003373ffffffffffffffffffffffffffffffffffffffff166131346131ab565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905090565b6000807f898bcb892ce96890816cc7d1ea86c592f314ff2e839268e378d8f279767ea82290508091505090565b6000612710905090565b6000807f23a3985ff794c67d8d516a95b83c7dfb32e426521153078d1eadc4dc887e2d3e90508091505090565b60006131e26131ab565b600101600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60606000600283600261325f91906151a1565b613269919061511a565b67ffffffffffffffff8111156132a8577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156132da5781602001600182028036833780820191505090505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110613338577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106133c2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000600184600261340291906151a1565b61340c919061511a565b90505b60018111156134f8577f3031323334353637383961626364656600000000000000000000000000000000600f861660108110613474577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b1a60f81b8282815181106134b1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c9450806134f1906152fd565b905061340f565b506000841461353c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161353390614ea3565b60405180910390fd5b8091505092915050565b6000807fad43ad2482c0e34f469927438c71a0c1b7f2931bd74b6681aa5cc14821daa0aa90508091505090565b600061357d613fe1565b60000160009054906101000a900460e01b905061359d818686868661400d565b5050505050565b60006135ae613fe1565b60000160049054906101000a900460e01b90506135ce818686868661400d565b5050505050565b60006135df6114de565b60000154905090565b613602828260405180602001604052806000815250614186565b5050565b6000807ff8a1c6908b780da9d81bb8be40154a49e4eccafd820fcb10aeac624fcb8e2f8990508091505090565b600061363e83612343565b9050600061364a6114de565b905060008260000151905083156137165760008173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061369d575061369c8233613076565b5b806136db57503373ffffffffffffffffffffffffffffffffffffffff166136c387611639565b73ffffffffffffffffffffffffffffffffffffffff16145b905080613714576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b613724816000876001613573565b61373060008683611849565b60008260050160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060018160000160008282829054906101000a900467ffffffffffffffff160392506101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060018160000160108282829054906101000a900467ffffffffffffffff160192506101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060008360040160008881526020019081526020016000209050828160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550428160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550600181600001601c6101000a81548160ff021916908315150217905550600060018801905060008560040160008381526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561399c578560000154821461399b57848160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555086602001518160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505b5b5050505084600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4613a0a8160008760016135a4565b81600101600081548092919060010191905055505050505050565b6000613a2f6114de565b9050600081600001549050600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415613aa1576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000851415613adc576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613ae96000878388613573565b848260050160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900467ffffffffffffffff160192506101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550848260050160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160088282829054906101000a900467ffffffffffffffff160192506101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055508582600401600083815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055504282600401600083815260200190815260200160002060000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550600081905060008682019050848015613cbb5750613cba8873ffffffffffffffffffffffffffffffffffffffff166129e5565b5b15613d83575b818873ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4613d306000898480600101955089612a08565b613d66576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80821415613cc15782846000015414613d7e57600080fd5b613def565b5b818060010192508873ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a480821415613d84575b8184600001819055505050613e0760008783886135a4565b505050505050565b6000613e1961226c565b60000160008381526020019081526020016000209050919050565b60606000821415613e7c576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050613fdc565b600082905060005b60008214613eae578080613e979061538a565b915050600a82613ea79190615170565b9150613e84565b60008167ffffffffffffffff811115613ef0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613f225781602001600182028036833780820191505090505b5090505b60008514613fd557600182613f3b91906151fb565b9150600a85613f4a91906153d3565b6030613f56919061511a565b60f81b818381518110613f92577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85613fce9190615170565b9450613f26565b8093505050505b919050565b6000807eedd92670a3023a8d3294bd858c00eecb0723cd4bed7aeb7a60b082ade1ab1a90508091505090565b600060e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916857bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561405c5761417f565b60003073ffffffffffffffffffffffffffffffffffffffff16868686868660405160240161408d9493929190614d99565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516140f79190614c99565b6000604051808303816000865af19150503d8060008114614134576040519150601f19603f3d011682016040523d82523d6000602084013e614139565b606091505b505090508061417d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161417490614f23565b60405180910390fd5b505b5050505050565b6141938383836001613a25565b505050565b8280546141a490615327565b90600052602060002090601f0160209004810192826141c6576000855561420d565b82601f106141df57805160ff191683800117855561420d565b8280016001018555821561420d579182015b8281111561420c5782518255916020019190600101906141f1565b5b50905061421a9190614261565b5090565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600067ffffffffffffffff1681526020016000151581525090565b5b8082111561427a576000816000905550600101614262565b5090565b600061429161428c84614fe3565b614fbe565b9050828152602081018484840111156142a957600080fd5b6142b48482856152bb565b509392505050565b60006142cf6142ca84615014565b614fbe565b9050828152602081018484840111156142e757600080fd5b6142f28482856152bb565b509392505050565b600061430d61430884615014565b614fbe565b90508281526020810184848401111561432557600080fd5b6143308482856152ca565b509392505050565b60008135905061434781615691565b92915050565b60008135905061435c816156a8565b92915050565b600081519050614371816156a8565b92915050565b600081359050614386816156bf565b92915050565b60008151905061439b816156bf565b92915050565b600082601f8301126143b257600080fd5b81356143c284826020860161427e565b91505092915050565b600082601f8301126143dc57600080fd5b81356143ec8482602086016142bc565b91505092915050565b600082601f83011261440657600080fd5b81516144168482602086016142fa565b91505092915050565b60008135905061442e816156d6565b92915050565b600081359050614443816156ed565b92915050565b60006020828403121561445b57600080fd5b600061446984828501614338565b91505092915050565b6000806040838503121561448557600080fd5b600061449385828601614338565b92505060206144a485828601614338565b9150509250929050565b6000806000606084860312156144c357600080fd5b60006144d186828701614338565b93505060206144e286828701614338565b92505060406144f38682870161441f565b9150509250925092565b6000806000806080858703121561451357600080fd5b600061452187828801614338565b945050602061453287828801614338565b93505060406145438782880161441f565b925050606085013567ffffffffffffffff81111561456057600080fd5b61456c878288016143a1565b91505092959194509250565b6000806040838503121561458b57600080fd5b600061459985828601614338565b92505060206145aa8582860161434d565b9150509250929050565b600080604083850312156145c757600080fd5b60006145d585828601614338565b925050602083013567ffffffffffffffff8111156145f257600080fd5b6145fe858286016143cb565b9150509250929050565b6000806040838503121561461b57600080fd5b600061462985828601614338565b925050602061463a8582860161441f565b9150509250929050565b60006020828403121561465657600080fd5b600061466484828501614362565b91505092915050565b60006020828403121561467f57600080fd5b600061468d84828501614377565b91505092915050565b6000602082840312156146a857600080fd5b60006146b68482850161438c565b91505092915050565b6000602082840312156146d157600080fd5b600082013567ffffffffffffffff8111156146eb57600080fd5b6146f7848285016143cb565b91505092915050565b60006020828403121561471257600080fd5b600082015167ffffffffffffffff81111561472c57600080fd5b614738848285016143f5565b91505092915050565b60008060006060848603121561475657600080fd5b600084013567ffffffffffffffff81111561477057600080fd5b61477c868287016143cb565b935050602084013567ffffffffffffffff81111561479957600080fd5b6147a5868287016143cb565b92505060406147b686828701614434565b9150509250925092565b6000602082840312156147d257600080fd5b60006147e08482850161441f565b91505092915050565b600080604083850312156147fc57600080fd5b600061480a8582860161441f565b925050602083013567ffffffffffffffff81111561482757600080fd5b614833858286016143cb565b9150509250929050565b6000806040838503121561485057600080fd5b600061485e8582860161441f565b925050602061486f8582860161441f565b9150509250929050565b60006020828403121561488b57600080fd5b600061489984828501614434565b91505092915050565b60006148ae83836148d2565b60208301905092915050565b60006148c68383614c7b565b60208301905092915050565b6148db8161522f565b82525050565b6148ea8161522f565b82525050565b60006148fb8261507a565b61490581856150c0565b935061491083615045565b8060005b8381101561494157815161492888826148a2565b9750614933836150a6565b925050600181019050614914565b5085935050505092915050565b600061495982615085565b61496381856150d1565b935061496e83615055565b8060005b8381101561499f57815161498688826148ba565b9750614991836150b3565b925050600181019050614972565b5085935050505092915050565b6149b581615241565b82525050565b6149c48161524d565b82525050565b60006149d582615090565b6149df81856150e2565b93506149ef8185602086016152ca565b6149f8816154c0565b840191505092915050565b6000614a0e82615090565b614a1881856150f3565b9350614a288185602086016152ca565b80840191505092915050565b6000614a3f8261509b565b614a4981856150fe565b9350614a598185602086016152ca565b614a62816154c0565b840191505092915050565b6000614a788261509b565b614a82818561510f565b9350614a928185602086016152ca565b80840191505092915050565b60008154614aab81615327565b614ab5818661510f565b94506001821660008114614ad05760018114614ae157614b14565b60ff19831686528186019350614b14565b614aea85615065565b60005b83811015614b0c57815481890152600182019150602081019050614aed565b838801955050505b50505092915050565b6000614b2a6020836150fe565b9150614b35826154d1565b602082019050919050565b6000614b4d601b836150fe565b9150614b58826154fa565b602082019050919050565b6000614b706017836150fe565b9150614b7b82615523565b602082019050919050565b6000614b936015836150fe565b9150614b9e8261554c565b602082019050919050565b6000614bb66014836150fe565b9150614bc182615575565b602082019050919050565b6000614bd960178361510f565b9150614be48261559e565b601782019050919050565b6000614bfc602a836150fe565b9150614c07826155c7565b604082019050919050565b6000614c1f6019836150fe565b9150614c2a82615616565b602082019050919050565b6000614c426015836150fe565b9150614c4d8261563f565b602082019050919050565b6000614c6560118361510f565b9150614c7082615668565b601182019050919050565b614c8481615299565b82525050565b614c9381615299565b82525050565b6000614ca58284614a03565b915081905092915050565b6000614cbc8285614a9e565b9150614cc88284614a6d565b91508190509392505050565b6000614ce08285614a9e565b9150614cec8284614a9e565b91508190509392505050565b6000614d0382614bcc565b9150614d0f8285614a6d565b9150614d1a82614c58565b9150614d268284614a6d565b91508190509392505050565b6000602082019050614d4760008301846148e1565b92915050565b6000608082019050614d6260008301876148e1565b614d6f60208301866148e1565b614d7c6040830185614c8a565b8181036060830152614d8e81846149ca565b905095945050505050565b6000608082019050614dae60008301876148e1565b614dbb60208301866148e1565b614dc86040830185614c8a565b614dd56060830184614c8a565b95945050505050565b6000604082019050614df360008301856148e1565b614e006020830184614c8a565b9392505050565b60006020820190508181036000830152614e2181846148f0565b905092915050565b60006020820190508181036000830152614e43818461494e565b905092915050565b6000602082019050614e6060008301846149ac565b92915050565b6000602082019050614e7b60008301846149bb565b92915050565b60006020820190508181036000830152614e9b8184614a34565b905092915050565b60006020820190508181036000830152614ebc81614b1d565b9050919050565b60006020820190508181036000830152614edc81614b40565b9050919050565b60006020820190508181036000830152614efc81614b63565b9050919050565b60006020820190508181036000830152614f1c81614b86565b9050919050565b60006020820190508181036000830152614f3c81614ba9565b9050919050565b60006020820190508181036000830152614f5c81614bef565b9050919050565b60006020820190508181036000830152614f7c81614c12565b9050919050565b60006020820190508181036000830152614f9c81614c35565b9050919050565b6000602082019050614fb86000830184614c8a565b92915050565b6000614fc8614fd9565b9050614fd48282615359565b919050565b6000604051905090565b600067ffffffffffffffff821115614ffe57614ffd615491565b5b615007826154c0565b9050602081019050919050565b600067ffffffffffffffff82111561502f5761502e615491565b5b615038826154c0565b9050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b600061512582615299565b915061513083615299565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561516557615164615404565b5b828201905092915050565b600061517b82615299565b915061518683615299565b92508261519657615195615433565b5b828204905092915050565b60006151ac82615299565b91506151b783615299565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156151f0576151ef615404565b5b828202905092915050565b600061520682615299565b915061521183615299565b92508282101561522457615223615404565b5b828203905092915050565b600061523a82615279565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006bffffffffffffffffffffffff82169050919050565b82818337600083830152505050565b60005b838110156152e85780820151818401526020810190506152cd565b838111156152f7576000848401525b50505050565b600061530882615299565b9150600082141561531c5761531b615404565b5b600182039050919050565b6000600282049050600182168061533f57607f821691505b6020821081141561535357615352615462565b5b50919050565b615362826154c0565b810181811067ffffffffffffffff8211171561538157615380615491565b5b80604052505050565b600061539582615299565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156153c8576153c7615404565b5b600182019050919050565b60006153de82615299565b91506153e983615299565b9250826153f9576153f8615433565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b7f41646d696e2066756e6374696f6e616c697479207265766f6b65640000000000600082015250565b7f43616c6c6572206973206e6f7420746865206f776e6572000000000000000000600082015250565b7f73656c6563746f72206e6f7420617070726f7665640000000000000000000000600082015250565b7f5472616e7366657220686f6f6b206661696c6564000000000000000000000000600082015250565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b7f455243323938313a20726f79616c7479206665652077696c6c2065786365656460008201527f2073616c65507269636500000000000000000000000000000000000000000000602082015250565b7f546f6b656e20555249204f76657272696465204661696c656400000000000000600082015250565b7f746f6b656e4964206d6179206e6f742065786973740000000000000000000000600082015250565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b61569a8161522f565b81146156a557600080fd5b50565b6156b181615241565b81146156bc57600080fd5b50565b6156c88161524d565b81146156d357600080fd5b50565b6156df81615299565b81146156ea57600080fd5b50565b6156f6816152a3565b811461570157600080fd5b5056fea26469706673582212207c8029a20032c3101c719683cab9adcc29cac35a9fdc8020a2e206bf3d1b201c64736f6c63430008040033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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