APE Price: $1.46 (-7.51%)

Contract

0xf61CAd351e2ecc565829B97dbC8Ca3148A5639bf

Overview

APE Balance

Apechain LogoApechain LogoApechain Logo0 APE

APE Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FreeeERC721C

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 200 runs

Other Settings:
cancun EvmVersion
File 1 of 38 : FreeeERC721C.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;

import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {IERC2981, IERC165} from "@openzeppelin/contracts/interfaces/IERC2981.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import {
    ERC721ACQueryableInitializable,
    ERC721AUpgradeable,
    IERC721AUpgradeable
} from "./creator-token-standards/ERC721ACQueryableInitializable.sol";
import {IERC721Collection} from "./interfaces/IERC721Collection.sol";
import {IMetadataRenderer} from "./interfaces/IMetadataRenderer.sol";
import {IOwnable} from "./interfaces/IOwnable.sol";
import {IArbInfo} from "./interfaces/IArbInfo.sol";
import {ERC721CollectionStorageV1} from "./storage/ERC721CollectionStorageV1.sol";
import {OwnableSkeleton} from "./utils/OwnableSkeleton.sol";
import {PublicMulticall} from "./utils/PublicMulticall.sol";
import {Version} from "./utils/Version.sol";

contract FreeeERC721C is
    ERC721ACQueryableInitializable,
    IERC721Collection,
    IERC2981,
    AccessControl,
    ReentrancyGuard,
    OwnableSkeleton,
    PublicMulticall,
    Version,
    ERC721CollectionStorageV1
{
    /// @dev This is the max mint batch size for the optimized ERC721A mint contract
    uint256 internal immutable MAX_MINT_BATCH_SIZE = 8;

    /// @dev Gas limit to send funds
    uint256 internal immutable FUNDS_SEND_GAS_LIMIT = 210_000;

    /// @dev This is the max number of presale stage allowed
    uint256 internal immutable PRESALE_STAGES_ALLOWED = 5;

    /// @notice Access control roles
    bytes32 public immutable SALES_MANAGER_ROLE = keccak256("SALES_MANAGER");
    

    /// @notice Freee Mint Fee
    uint256 private immutable MINT_FEE;

    /// @notice Mint Fee Recipient
    address payable private immutable MINT_FEE_RECIPIENT;

    /// @notice Max royalty BPS
    uint16 constant MAX_ROYALTY_BPS = 50_00;

    /// @notice Only allow for users with admin access
    modifier onlyAdmin() {
        if (!hasRole(DEFAULT_ADMIN_ROLE, _msgSender())) {
            revert Access_OnlyAdmin();
        }

        _;
    }

    /// @notice Only a given role has access or admin
    /// @param role role to check for alongside the admin role
    modifier onlyRoleOrAdmin(bytes32 role) {
        if (!hasRole(DEFAULT_ADMIN_ROLE, _msgSender()) && !hasRole(role, _msgSender())) {
            revert Access_MissingRoleOrAdmin(role);
        }

        _;
    }

    /// @notice Allows user to mint tokens at a quantity
    modifier canMintTokens(uint256 quantity) {
        if (quantity + _totalMinted() > config.collectionSize) {
            revert Mint_SoldOut();
        }

        _;
    }

    function _presaleActive(uint256 stageIndex) internal view returns (bool) {
        return 
            presaleConfig[stageIndex].presaleStart > 0 && 
            presaleConfig[stageIndex].presaleStart <= block.timestamp && 
            presaleConfig[stageIndex].presaleEnd > block.timestamp;
    }

    function _publicSaleActive() internal view returns (bool) {
        return 
            !publicSaleConfig.publicSaleDisabled &&
            publicSaleConfig.publicSaleStart > 0 &&
            publicSaleConfig.publicSaleStart <= block.timestamp && 
            publicSaleConfig.publicSaleEnd > block.timestamp;
    }

    /// @notice Presale active
    modifier onlyPresaleActive(uint256 stagIndex) {
        if (!_presaleActive(stagIndex)) {
            revert Presale_Inactive();
        }

        _;
    }

    /// @notice Public sale active
    modifier onlyPublicSaleActive() {
        if (!_publicSaleActive()) {
            revert Sale_Inactive();
        }

        _;
    }

    /// @notice Can transfer token
    modifier canTradeToken() {
        bool mintedOut = uint256(config.collectionSize) == _totalMinted();
        if (config.lockBeforeMintOut && !mintedOut) {
            revert Collection_TradingLocked();
        }

        _;
    }

    /// @notice Getter for last minted token ID (gets next token id and subtracts 1)
    function _lastMintedTokenId() internal view returns (uint256) {
        return _nextTokenId() - 1;
    }

    /// @notice Start token ID for minting (1-100 vs 0-99)
    function _startTokenId() internal pure override returns (uint256) {
        return 1;
    }

    constructor(uint256 _mintFeeAmount, address _mintFeeRecipient) {
        MINT_FEE = _mintFeeAmount;
        MINT_FEE_RECIPIENT = payable(_mintFeeRecipient);
        _disableInitializers();
    }

    /// @notice Initializes the contract
    function initialize(
        string memory _contractName,
        string memory _contractSymbol,
        address _initialOwner,
        address _fundsRecipient,
        uint64 _collectionSize,
        uint16 _royaltyBPS,
        address _royaltyRecipient,
        bytes[] calldata _setupCalls,
        bool _tradingLocked,
        bool _revealed,
        address _escrowHandler
    ) external initializer initializerERC721A {
        __ERC721ACQueryableInitializable_init(_contractName, _contractSymbol);
        _setOwner(_initialOwner);
        if (_escrowHandler == address(0)) {
            // Setup default admin role
            _setupRole(DEFAULT_ADMIN_ROLE, _initialOwner);
            config.fundsRecipient = payable(_fundsRecipient);
        } else {
            // Setup default admin role to escrow address
            _setupRole(DEFAULT_ADMIN_ROLE, _escrowHandler);
            config.fundsRecipient = payable(_escrowHandler);
            // Set initial owner as sales manager
            _setupRole(SALES_MANAGER_ROLE, _initialOwner);
        }

        // Setup temporary role
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        // Execute setupCalls
        multicall(_setupCalls);
        // Remove temporary role
        _revokeRole(DEFAULT_ADMIN_ROLE, msg.sender);

        // Setup config variables
        config.collectionSize = _collectionSize;
        config.royaltyBPS = _royaltyBPS;
        config.royaltyRecipient = payable(_royaltyRecipient);
        config.revealed = _revealed;
        config.lockBeforeMintOut = _tradingLocked;

        IArbInfo(0x0000000000000000000000000000000000000065).configureAutomaticYield();

    }

    /// @dev Getter for role associated with the contract to handle metadata
    /// @return boolean if address is admin or sale manager
    function isAdmin(address user) external view returns (bool) {
        return hasRole(DEFAULT_ADMIN_ROLE, user) || hasRole(SALES_MANAGER_ROLE, user);
    }

    /// @param tokenId Token ID to burn
    /// @notice User burn function for token id
    function burn(uint256 tokenId) public {
        _burn(tokenId, true);
    }

    /// @dev Get royalty information for token
    /// @param _salePrice Sale price for the token
    function royaltyInfo(uint256, uint256 _salePrice) external view override returns (address receiver, uint256 royaltyAmount) {
        if (config.royaltyRecipient == address(0)) {
            return (config.royaltyRecipient, 0);
        }
        return (config.royaltyRecipient, (_salePrice * config.royaltyBPS) / 10_000);
    }

    /// @dev Number of NFTs the user has minted per address
    /// @param minter to get counts for
    function mintedPerAddress(address minter) external view override returns (IERC721Collection.AddressMintDetails memory) {
        uint256 totalPresaleMints = _totalPresaleMinted(_msgSender());
        uint256[] memory mintsByStage = new uint256[](PRESALE_STAGES_ALLOWED);
        mintsByStage[0] = presaleMintedByAddress[minter][1];
        mintsByStage[1] = presaleMintedByAddress[minter][2];
        mintsByStage[2] = presaleMintedByAddress[minter][3];
        mintsByStage[3] = presaleMintedByAddress[minter][4];
        mintsByStage[4] = presaleMintedByAddress[minter][5];
        return
            IERC721Collection.AddressMintDetails({
                presaleMintsByStage: mintsByStage,
                presaleMints: totalPresaleMints,
                publicMints: _numberMinted(minter) - totalPresaleMints,
                totalMints: _numberMinted(minter)
            });
    }

    /// @notice Freee fee is fixed now per mint
    /// @dev Gets the Freee fee for amount of withdraw
    function feeForAmount(uint256 quantity) public view returns (address payable recipient, uint256 fee) {
        recipient = MINT_FEE_RECIPIENT;
        fee = MINT_FEE * quantity;
    }

    /**
     *** ---------------------------------- ***
     ***                                    ***
     ***     PUBLIC MINTING FUNCTIONS       ***
     ***                                    ***
     *** ---------------------------------- ***
     ***/

    /**
      @dev This allows the user to purchase collection item
           at the given price in the contract.
     */
    /// @notice Purchase a quantity of tokens
    /// @param quantity quantity to purchase
    /// @return tokenId of the first token minted
    function purchase(uint256 quantity) external payable nonReentrant canMintTokens(quantity) onlyPublicSaleActive returns (uint256) {
        return _handlePurchase(quantity, "");
    }

    /// @notice Purchase a quantity of tokens with a comment
    /// @param quantity quantity to purchase
    /// @param comment comment to include in the IERC721Collection.Sale event
    /// @return tokenId of the first token minted
    function purchaseWithComment(
        uint256 quantity,
        string memory comment
    ) external payable nonReentrant canMintTokens(quantity) onlyPublicSaleActive returns (uint256) {
        return _handlePurchase(quantity, comment);
    }

    function _handlePurchase(uint256 quantity, string memory comment) internal returns (uint256) {
        uint256 salePrice = publicSaleConfig.publicSalePrice;

        if (msg.value != (salePrice + MINT_FEE) * quantity) {
            revert Purchase_WrongPrice((salePrice + MINT_FEE) * quantity);
        }

        uint256 presaleMinted = _totalPresaleMinted(_msgSender());
        // If max purchase per address == 0 there is no limit.
        // Any other number, the per address mint limit is that.
        if (
            publicSaleConfig.maxSalePurchasePerAddress != 0 &&
            _numberMinted(_msgSender()) + quantity - presaleMinted > publicSaleConfig.maxSalePurchasePerAddress
        ) {
            revert Purchase_TooManyForAddress();
        }

        _mintNFTs(_msgSender(), quantity);
        uint256 firstMintedTokenId = _lastMintedTokenId() - quantity;

        _payoutFreeeFee(quantity);

        emit IERC721Collection.Sale({
            phase: IERC721Collection.PhaseType.Public,
            to: _msgSender(),
            quantity: quantity,
            pricePerToken: salePrice,
            firstPurchasedTokenId: firstMintedTokenId,
            presaleStage: 0
        });
        if (bytes(comment).length > 0) {
            emit IERC721Collection.MintComment({
                sender: _msgSender(),
                tokenContract: address(this),
                tokenId: firstMintedTokenId,
                quantity: quantity,
                comment: comment
            });
        }
        return firstMintedTokenId;
    }

    /// @notice Function to mint NFTs
    /// @dev (important: Does not enforce max supply limit, enforce that limit earlier)
    /// @dev This batches in size of 8 as per recommended by ERC721A creators
    /// @param to address to mint NFTs to
    /// @param quantity number of NFTs to mint
    function _mintNFTs(address to, uint256 quantity) internal {
        do {
            uint256 toMint = quantity > MAX_MINT_BATCH_SIZE ? MAX_MINT_BATCH_SIZE : quantity;
            _mint({to: to, quantity: toMint});
            quantity -= toMint;
        } while (quantity > 0);
    }

    /// @notice Merkle-tree based presale purchase function
    /// @param quantity quantity to purchase
    /// @param maxQuantity max quantity that can be purchased via merkle proof #
    /// @param pricePerToken price that each token is purchased at
    /// @param merkleProof proof for presale mint
    function purchasePresale(
        uint256 stageIndex,
        uint256 quantity,
        uint256 maxQuantity,
        uint256 pricePerToken,
        bytes32[] memory merkleProof
    ) external payable nonReentrant canMintTokens(quantity) onlyPresaleActive(stageIndex) returns (uint256) {
        return _handlePurchasePresale(stageIndex, quantity, maxQuantity, pricePerToken, merkleProof, "");
    }

    /// @notice Merkle-tree based presale purchase function with a comment
    /// @param stageIndex targetted presale stage
    /// @param quantity quantity to purchase
    /// @param maxQuantity max quantity that can be purchased via merkle proof #
    /// @param pricePerToken price that each token is purchased at
    /// @param merkleProof proof for presale mint
    /// @param comment comment to include in the IERC721Collection.Sale event
    function purchasePresaleWithComment(
        uint256 stageIndex,
        uint256 quantity,
        uint256 maxQuantity,
        uint256 pricePerToken,
        bytes32[] memory merkleProof,
        string memory comment
    ) external payable nonReentrant canMintTokens(quantity) onlyPresaleActive(stageIndex) returns (uint256) {
        return _handlePurchasePresale(stageIndex, quantity, maxQuantity, pricePerToken, merkleProof, comment);
    }

    function _handlePurchasePresale(
        uint256 stageIndex,
        uint256 quantity,
        uint256 maxQuantity,
        uint256 pricePerToken,
        bytes32[] memory merkleProof,
        string memory comment
    ) internal returns (uint256) {
        if (stageIndex > activePresaleStageCount) {
            revert Presale_Invalid();
        }

        PresaleConfiguration memory saleConfig = presaleConfig[stageIndex];

        if (
            !MerkleProof.verify(
                merkleProof,
                saleConfig.presaleMerkleRoot,
                keccak256(
                    bytes.concat(
                        keccak256(
                            // address, uint256, uint256
                            abi.encode(_msgSender(), maxQuantity, pricePerToken)
                        )
                    )
                )
            )
        ) {
            revert Presale_MerkleNotApproved();
        }

        uint256 presalePrice = saleConfig.presalePrice;
        if (pricePerToken != presalePrice) {
            presalePrice = pricePerToken;
        }
        if (msg.value != (presalePrice + MINT_FEE) * quantity) {
            revert Purchase_WrongPrice((presalePrice + MINT_FEE) * quantity);
        }

        uint256 presaleQuantity = saleConfig.presaleMaxPurchasePerAddress;
        if (maxQuantity != presaleQuantity) {
            presaleQuantity = maxQuantity;
        }

        if (presaleMintedByAddress[_msgSender()][stageIndex] + quantity > presaleQuantity) {
            revert Presale_TooManyForAddress();
        }

        bool limitedPresaleSupply = saleConfig.presaleSupply > 0;
        if (limitedPresaleSupply && quantity + saleConfig.presaleMinted > saleConfig.presaleSupply) {
            revert Presale_ExceedStageSupply();
        }

        unchecked {
            presaleMintedByAddress[_msgSender()][stageIndex] += quantity;
            presaleConfig[stageIndex].presaleMinted += uint32(quantity);
        }

        _mintNFTs(_msgSender(), quantity);
        _payoutFreeeFee(quantity);

        uint256 firstMintedTokenId = _lastMintedTokenId() - quantity;
        emit IERC721Collection.Sale({
            phase: IERC721Collection.PhaseType.Presale,
            to: _msgSender(),
            quantity: quantity,
            pricePerToken: pricePerToken,
            firstPurchasedTokenId: firstMintedTokenId,
            presaleStage: stageIndex
        });
        if (bytes(comment).length > 0) {
            emit IERC721Collection.MintComment({
                sender: _msgSender(),
                tokenContract: address(this),
                tokenId: firstMintedTokenId,
                quantity: quantity,
                comment: comment
            });
        }

        return firstMintedTokenId;
    }

    /**
     *** ---------------------------------- ***
     ***                                    ***
     ***     ADMIN MINTING FUNCTIONS        ***
     ***                                    ***
     *** ---------------------------------- ***
     ***/

    /// @notice Mint admin
    /// @param recipient recipient to mint to
    /// @param quantity quantity to mint
    function adminMint(address recipient, uint256 quantity) external onlyRoleOrAdmin(SALES_MANAGER_ROLE) canMintTokens(quantity) returns (uint256) {
        _mintNFTs(recipient, quantity);
        uint256 firstMintedTokenId = _lastMintedTokenId() - quantity;

        emit IERC721Collection.Sale({
            phase: IERC721Collection.PhaseType.AdminMint,
            to: recipient,
            quantity: quantity,
            pricePerToken: 0,
            firstPurchasedTokenId: firstMintedTokenId,
            presaleStage: 0
        });

        return _lastMintedTokenId();
    }

    /// @dev This mints a token to the given list of addresses.
    /// @param recipients list of addresses to send the newly minted token to
    function adminMintAirdrop(address[] calldata recipients) external override onlyRoleOrAdmin(SALES_MANAGER_ROLE) canMintTokens(recipients.length) returns (uint256) {
        uint256 atId = _nextTokenId();
        uint256 startAt = atId;

        unchecked {
            for (uint256 endAt = atId + recipients.length; atId < endAt; atId++) {
                address recipient = recipients[atId - startAt];
                _mintNFTs(recipient, 1);
                uint256 firstMintedTokenId = _lastMintedTokenId() - 1;

                emit IERC721Collection.Sale({
                    phase: IERC721Collection.PhaseType.Airdrop,
                    to: recipient,
                    quantity: 1,
                    pricePerToken: 0,
                    firstPurchasedTokenId: firstMintedTokenId,
                    presaleStage: 0
                });
            }
        }
        return _lastMintedTokenId();
    }

    /**
     *** ---------------------------------- ***
     ***                                    ***
     ***  ADMIN CONFIGURATION FUNCTIONS     ***
     ***                                    ***
     *** ---------------------------------- ***
     ***/
    
    /// @dev Set new owner for royalties / opensea
    /// @param newOwner new owner to set
    function setOwner(address newOwner) public onlyAdmin {
        _setOwner(newOwner);
    }

    /// @notice Set a new metadata renderer
    /// @param newRenderer new renderer address to use
    /// @param metadataBase normal metadata to setup new renderer with
    /// @param dynamicMetadataInfo dynamic metadata to setup new renderer with
    function setMetadataRenderer(
        address newRenderer, 
        bytes memory metadataBase, 
        bytes memory dynamicMetadataInfo
    ) public onlyAdmin {
        config.metadataRenderer = IMetadataRenderer(newRenderer);
        (string memory initialBaseURI, string memory initialExtension, string memory initialContractURI) = abi.decode(metadataBase, (string, string, string));
        bytes memory metadataInitializer = abi.encode(initialBaseURI,  initialContractURI);
        config.metadataRenderer.initializeWithData(metadataInitializer, dynamicMetadataInfo);
        if (bytes(initialExtension).length > 0) {            
            config.metadataRenderer.updateMetadataBaseWithDetails(
                address(this), initialBaseURI, initialExtension, initialContractURI, 0
            );
        }

        emit UpdatedMetadataRenderer({sender: _msgSender(), renderer: config.metadataRenderer});
    }

    /// @dev This sets public sale configuration
    /// @param newConfig updated public stage config
    function setPublicSaleConfiguration(PublicSaleConfiguration memory newConfig) public onlyRoleOrAdmin(SALES_MANAGER_ROLE) {
        publicSaleConfig.publicSalePrice = newConfig.publicSalePrice;
        publicSaleConfig.maxSalePurchasePerAddress = newConfig.maxSalePurchasePerAddress;
        publicSaleConfig.publicSaleStart = newConfig.publicSaleStart;
        publicSaleConfig.publicSaleEnd = newConfig.publicSaleEnd;
        publicSaleConfig.publicSaleDisabled = newConfig.publicSaleDisabled;
        emit PublicSaleConfigChanged(_msgSender());
    }

    /// @dev This set presale configuration, use this when init presale stages or when need to remove presale stage
    /// @param presaleStages presale configuration data
    function setPresaleConfiguration(
        IERC721Collection.PresaleConfiguration[] calldata presaleStages
    ) public onlyRoleOrAdmin(SALES_MANAGER_ROLE) {
        uint256 stageLength = presaleStages.length;
        if (stageLength > PRESALE_STAGES_ALLOWED) {
            revert Setup_Presale_StageOutOfRange();
        }

        activePresaleStageCount = stageLength;

        for (uint256 i = 0; i < stageLength; ) {
            uint256 stageIndex = i + 1;
            PresaleConfiguration memory existingConfig = presaleConfig[stageIndex];
            PresaleConfiguration memory newConfig = existingConfig;
            bool allowStartTimeChange = true;

            if (existingConfig.presaleStart > 0 && existingConfig.presaleStart <= block.timestamp) {
                allowStartTimeChange = false;
            }

            if (allowStartTimeChange) {
                newConfig.presaleStart = presaleStages[i].presaleStart;   
            }

            if (presaleStages[i].presaleEnd > newConfig.presaleStart) {
                newConfig.presaleEnd = presaleStages[i].presaleEnd;
            }
            
            newConfig.presaleName = presaleStages[i].presaleName;
            newConfig.presalePrice = presaleStages[i].presalePrice;
            newConfig.presaleMaxPurchasePerAddress = presaleStages[i].presaleMaxPurchasePerAddress;
            newConfig.presaleSupply = presaleStages[i].presaleSupply;
            newConfig.presaleMerkleRoot = presaleStages[i].presaleMerkleRoot;
            
            presaleConfig[stageIndex] = newConfig;

            unchecked {
                ++i;
            }
        }
        emit PresaleConfigChanged(_msgSender());
    }

    /// @dev Reduce collection supply
    /// @param _newCollectionSize new collection size to update
    function reduceSupply(uint64 _newCollectionSize) external onlyRoleOrAdmin(SALES_MANAGER_ROLE) {
        if (_newCollectionSize >= config.collectionSize ||
            _newCollectionSize < _totalMinted()
        ) {
            revert Admin_InvalidCollectionSize();
        }

        config.collectionSize = _newCollectionSize;
        emit CollectionSizeReduced(_msgSender(), _newCollectionSize);
    }

    /// @dev Reveal collection artworks
    /// @param collectionURI collection artwork URI
    /// @param extension collection URI extension
    function revealCollection(string memory collectionURI, string memory extension) external onlyRoleOrAdmin(SALES_MANAGER_ROLE) {
        if (config.revealed) {
            revert Collection_Aready_Revealed();
        }

        config.metadataRenderer.updateMetadataBaseWithDetails(address(this), collectionURI, extension, config.metadataRenderer.contractURI(), 0);
        config.revealed = true;
        emit CollectionRevealed(_msgSender());
    }

    function setTradingLock(bool _locked) external onlyRoleOrAdmin(SALES_MANAGER_ROLE) {
        config.lockBeforeMintOut = _locked;
        emit LockTradingStatusChanged(_msgSender(), _locked);
    }

    /// @notice Set new royalty percentage
    /// @param _royaltyBPS new funds recipient address
    function setRoyalty(uint16 _royaltyBPS, address payable _royaltyRecipient) external onlyAdmin {
        if (_royaltyBPS > MAX_ROYALTY_BPS) {
            revert Setup_RoyaltyPercentageTooHigh(MAX_ROYALTY_BPS);
        }

        config.royaltyBPS = _royaltyBPS;
        config.royaltyRecipient = _royaltyRecipient;
        emit RoyaltyChanged(_msgSender(), _royaltyBPS, _royaltyRecipient);
    }

    /// @notice Set a different funds recipient
    /// @param newRecipientAddress new funds recipient address
    function setFundsRecipient(address payable newRecipientAddress) external onlyAdmin {
        config.fundsRecipient = newRecipientAddress;
        emit FundsRecipientChanged(newRecipientAddress, _msgSender());
    }

    /// @notice This withdraws ETH from the contract to the contract owner.
    function withdraw() external nonReentrant {
        address sender = _msgSender();
        uint256 funds = address(this).balance;

        // Check if withdraw is allowed for sender
        if (!hasRole(DEFAULT_ADMIN_ROLE, sender) && sender != config.fundsRecipient) {
            revert Access_WithdrawNotAllowed();
        }

        // Payout recipient
        (bool successFunds, ) = config.fundsRecipient.call{value: funds, gas: FUNDS_SEND_GAS_LIMIT}("");
        if (!successFunds) {
            revert Withdraw_FundsSendFailure();
        }

        // Emit event for indexing
        emit FundsWithdrawn(_msgSender(), config.fundsRecipient, funds, address(0), 0);
    }

    /**
     *** ---------------------------------- ***
     ***                                    ***
     ***      GENERAL GETTER FUNCTIONS      ***
     ***                                    ***
     *** ---------------------------------- ***
     ***/

    /// @notice Simple override for owner interface.
    /// @return user owner address
    function owner() public view override(IERC721Collection, OwnableSkeleton) returns (address) {
        return super.owner();
    }

    /// @notice Contract URI Getter, proxies to metadataRenderer
    /// @return Contract URI
    function contractURI() external view returns (string memory) {
        return config.metadataRenderer.contractURI();
    }

    /// @notice Getter for metadataRenderer contract
    function metadataRenderer() external view returns (IMetadataRenderer) {
        return IMetadataRenderer(config.metadataRenderer);
    }

    /// @notice Token URI Getter, proxies to metadataRenderer
    /// @param tokenId id of token to get URI for
    /// @return Token URI
    function tokenURI(uint256 tokenId) 
        public 
        view 
        override(ERC721AUpgradeable, IERC721AUpgradeable)
        returns (string memory) 
    {
        if (!_exists(tokenId)) {
            revert IERC721AUpgradeable.URIQueryForNonexistentToken();
        }

        return config.metadataRenderer.tokenURI(tokenId, config.revealed);
    }

    function _payoutFreeeFee(uint256 quantity) internal {
        // Transfer Freee fee to recipient
        (, uint256 FreeeFee) = feeForAmount(quantity);
        (bool success, ) = MINT_FEE_RECIPIENT.call{value: FreeeFee, gas: FUNDS_SEND_GAS_LIMIT}("");
        emit MintFeePayout(FreeeFee, MINT_FEE_RECIPIENT, success);
    }

    /// @notice Internal function to get total minted accross all presale stages
    /// @param minter to get presale counts for
    function _totalPresaleMinted(address minter) internal view returns (uint256) {
        uint256 totalMintCount = presaleMintedByAddress[minter][1] +
            presaleMintedByAddress[minter][2] +
            presaleMintedByAddress[minter][3] +
            presaleMintedByAddress[minter][4] +
            presaleMintedByAddress[minter][5];

        return totalMintCount;
    }

    /// @notice Checks if the contract supports a given interface
    /// @param interfaceId The interface identifier
    /// @return True if the contract supports the interface, false otherwise
    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721ACQueryableInitializable, IERC165, AccessControl)
        returns (bool)
    {
        return
            super.supportsInterface(interfaceId) ||
            ERC721ACQueryableInitializable.supportsInterface(interfaceId) ||
            type(IOwnable).interfaceId == interfaceId ||
            type(IERC2981).interfaceId == interfaceId;
    }

    function _requireCallerIsContractOwner() internal view virtual override {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    function safeTransferFrom(
        address from, 
        address to, 
        uint256 tokenId,
        bytes memory _data
    ) public payable override(ERC721AUpgradeable, IERC721AUpgradeable) canTradeToken {
        super.safeTransferFrom(from, to, tokenId, _data);
    }

    function safeTransferFrom(
        address from, 
        address to, 
        uint256 tokenId
    ) public payable override(ERC721AUpgradeable, IERC721AUpgradeable) canTradeToken {
        super.safeTransferFrom(from, to, tokenId);
    }
    
    function transferFrom(
        address from, 
        address to, 
        uint256 tokenId
    ) public payable override(ERC721AUpgradeable, IERC721AUpgradeable) canTradeToken {
        super.transferFrom(from, to, tokenId);
    }
}

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

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @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);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

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

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @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})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " 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) public view virtual override returns (bytes32) {
        return _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.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override 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.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override 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`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

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

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

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

File 3 of 38 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

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

pragma solidity ^0.8.0;

import "../utils/introspection/IERC165.sol";

/**
 * @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 is IERC165 {
    /**
     * @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);
}

File 5 of 38 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The tree and the proofs can be generated using our
 * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
 * You will find a quickstart guide in the readme.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 * OpenZeppelin's JavaScript library generates merkle trees that are safe
 * against this attack out of the box.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Calldata version of {verify}
     *
     * _Available since v4.7._
     */
    function verifyCalldata(
        bytes32[] calldata proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProofCalldata(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Calldata version of {processProof}
     *
     * _Available since v4.7._
     */
    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProof(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Calldata version of {multiProofVerify}
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
     * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
     * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
     * respectively.
     *
     * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
     * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
     * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
     *
     * _Available since v4.7._
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Calldata version of {processMultiProof}.
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
        return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

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

import "@limitbreak/creator-token-standards/src/utils/CreatorTokenBase.sol";
import "erc721a-upgradeable/contracts/extensions/ERC721AQueryableUpgradeable.sol";
import "@limitbreak/creator-token-standards/src/utils/AutomaticValidatorTransferApproval.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

/**
 * @title ERC721ACQueryableInitializable
 * @dev This contract is not meant for use in Upgradeable Proxy contracts though it may base on Upgradeable contract. The purpose of this
 * contract is for use with EIP-1167 Minimal Proxies (Clones).
 */
abstract contract ERC721ACQueryableInitializable is
    ERC721AQueryableUpgradeable,
    CreatorTokenBase,
    AutomaticValidatorTransferApproval,
    Initializable
{
    /// @notice Initializes the contract with the given name and symbol.
    function __ERC721ACQueryableInitializable_init(string memory name_, string memory symbol_) public {
        __ERC721A_init_unchained(name_, symbol_);
        __ERC721AQueryable_init_unchained();

        _emitDefaultTransferValidator();
        _registerTokenType(getTransferValidator());
    }

    /// @notice Overrides behavior of supportsInterface such that the contract implements the ICreatorToken interface.
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC721AUpgradeable, IERC721AUpgradeable)
        returns (bool)
    {
        return interfaceId == type(ICreatorToken).interfaceId || interfaceId == type(ICreatorTokenLegacy).interfaceId
            || super.supportsInterface(interfaceId);
    }

    /// @notice Returns the function selector for the transfer validator's validation function to be called
    /// @notice for transaction simulation.
    function getTransferValidationFunction() external pure returns (bytes4 functionSignature, bool isViewFunction) {
        functionSignature = bytes4(keccak256("validateTransfer(address,address,address,uint256)"));
        isViewFunction = true;
    }

    /// @notice Overrides behavior of isApprovedFor all such that if an operator is not explicitly approved
    /// @notice for all, the contract owner can optionally auto-approve the 721-C transfer validator for transfers.
    function isApprovedForAll(address owner, address operator)
        public
        view
        virtual
        override(ERC721AUpgradeable, IERC721AUpgradeable)
        returns (bool isApproved)
    {
        isApproved = super.isApprovedForAll(owner, operator);

        if (!isApproved) {
            if (autoApproveTransfersFromValidator) {
                isApproved = operator == address(getTransferValidator());
            }
        }
    }

    /// @dev Ties the erc721a _beforeTokenTransfers hook to more granular transfer validation logic
    function _beforeTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity)
        internal
        virtual
        override
    {
        for (uint256 i = 0; i < quantity;) {
            _validateBeforeTransfer(from, to, startTokenId + i);
            unchecked {
                ++i;
            }
        }
    }

    /// @dev Ties the erc721a _afterTokenTransfer hook to more granular transfer validation logic
    function _afterTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity)
        internal
        virtual
        override
    {
        for (uint256 i = 0; i < quantity;) {
            _validateAfterTransfer(from, to, startTokenId + i);
            unchecked {
                ++i;
            }
        }
    }

    function _msgSenderERC721A() internal view virtual override returns (address) {
        return _msgSender();
    }

    function _tokenType() internal pure override returns (uint16) {
        return uint16(721);
    }
}

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

import {IMetadataRenderer} from "../interfaces/IMetadataRenderer.sol";

/// @notice Interface for Freee Collection contract
interface IERC721Collection {
    // Enums
    /// @notice Phase type
    enum PhaseType {
        Public,
        Presale,
        Airdrop,
        AdminMint
    }

    // Access errors
    /// @notice Only admin can access this function
    error Access_OnlyAdmin();
    /// @notice Missing the given role or admin access
    error Access_MissingRoleOrAdmin(bytes32 role);
    /// @notice Withdraw is not allowed by this user
    error Access_WithdrawNotAllowed();
    /// @notice Cannot withdraw funds due to ETH send failure.
    error Withdraw_FundsSendFailure();
    /// @notice Call to external metadata renderer failed.
    error ExternalMetadataRenderer_CallFailed();

    // Sale/Purchase errors
    /// @notice Sale is inactive
    error Sale_Inactive();
    /// @notice Presale is inactive
    error Presale_Inactive();
    /// @notice Presale invalid, out of range
    error Presale_Invalid();
    /// @notice Exceed presale stage supply
    error Presale_ExceedStageSupply();
    /// @notice Presale merkle root is invalid
    error Presale_MerkleNotApproved();
    /// @notice Wrong price for purchase
    error Purchase_WrongPrice(uint256 correctPrice);
    /// @notice NFT sold out
    error Mint_SoldOut();
    /// @notice Too many purchase for address
    error Purchase_TooManyForAddress();
    /// @notice Too many presale for address
    error Presale_TooManyForAddress();
    /// @notice Collection already revealed
    error Collection_Aready_Revealed();
    /// @notice Trading locked before mint out
    error Collection_TradingLocked();

    // Admin errors
    /// @notice Presale stage out of supported range
    error Setup_Presale_StageOutOfRange();
    /// @notice Royalty percentage too high
    error Setup_RoyaltyPercentageTooHigh(uint16 maxRoyaltyBPS);
    /// @notice invalid collection size when update
    error Admin_InvalidCollectionSize();

    /// @notice Event emitted for mint fee payout
    /// @param mintFeeAmount amount of the mint fee
    /// @param mintFeeRecipient recipient of the mint fee
    /// @param success if the payout succeeded
    event MintFeePayout(uint256 mintFeeAmount, address mintFeeRecipient, bool success);

    /// @notice Event emitted for each sale
    /// @param phase phase of the sale
    /// @param to address sale was made to
    /// @param quantity quantity of the minted nfts
    /// @param pricePerToken price for each token
    /// @param firstPurchasedTokenId first purchased token ID (to get range add to quantity for max)
    /// @param presaleStage stageIndex of presale stage if applicable, else return 0
    event Sale(PhaseType phase, address indexed to, uint256 indexed quantity, uint256 indexed pricePerToken, uint256 firstPurchasedTokenId, uint256 presaleStage);

    /// @notice Event emitted for each sale
    /// @param sender address sale was made to
    /// @param tokenContract address of the token contract
    /// @param tokenId first purchased token ID (to get range add to quantity for max)
    /// @param quantity quantity of the minted nfts
    /// @param comment caller provided comment
    event MintComment(address indexed sender, address indexed tokenContract, uint256 indexed tokenId, uint256 quantity, string comment);

    /// @notice Contract has been configured and published
    /// @param changedBy Changed by user
    event ContractStatusChanged(address indexed changedBy);

    /// @notice Sales configuration has been changed
    /// @dev To access new sales configuration, use getter function.
    /// @param changedBy Changed by user
    event PublicSaleConfigChanged(address indexed changedBy);

    /// @notice Presale config changed
    /// @param changedBy changed by user
    event PresaleConfigChanged(address indexed changedBy);

    /// @notice Collection size reduced
    /// @param changedBy changed by user
    /// @param newSize new collection size
    event CollectionSizeReduced(address indexed changedBy, uint64 newSize);

    /// @notice event emit when user change the lock trading func
    /// @param changedBy changed by user
    /// @param status new status
    event LockTradingStatusChanged(address indexed changedBy, bool status);

    /// @notice Event emitted when the royalty percentage changed
    /// @param changedBy address that change the royalty
    /// @param newPercentage new royalty percentage
    /// @param newRecipient new royalty recipient
    event RoyaltyChanged(address indexed changedBy, uint256 newPercentage, address newRecipient);

    /// @notice Event emitted when the funds recipient is changed
    /// @param newAddress new address for the funds recipient
    /// @param changedBy address that the recipient is changed by
    event FundsRecipientChanged(address indexed newAddress, address indexed changedBy);

    /// @notice Event emitted when the funds are withdrawn from the minting contract
    /// @param withdrawnBy address that issued the withdraw
    /// @param withdrawnTo address that the funds were withdrawn to
    /// @param amount amount that was withdrawn
    /// @param feeRecipient user getting withdraw fee (if any)
    /// @param feeAmount amount of the fee getting sent (if any)
    event FundsWithdrawn(address indexed withdrawnBy, address indexed withdrawnTo, uint256 amount, address feeRecipient, uint256 feeAmount);

    /// @notice Collection dynamic metadata changed
    /// @param changedBy address that changed the info
    event DynamicMetadataChanged(address changedBy);

    /// @notice Collection has been revealed
    /// @param revealedBy Revealed by user
    event CollectionRevealed(address indexed revealedBy);

    /// @notice Event emitted when metadata renderer is updated.
    /// @param sender address of the updater
    /// @param renderer new metadata renderer address
    event UpdatedMetadataRenderer(address sender, IMetadataRenderer renderer);

    /// @notice General configuration for NFT Minting and bookkeeping
    struct Configuration {
        /// @dev Metadata renderer
        IMetadataRenderer metadataRenderer;
        /// @dev Max supply of collection
        uint64 collectionSize;
        /// @dev Royalty amount in bps
        uint16 royaltyBPS;
        /// @dev Funds recipient for sale
        address payable fundsRecipient;
        /// @dev Royalty recipient for secondary sale
        address payable royaltyRecipient;
        /// @dev collection reveal status
        bool revealed;
        /// @dev lock trading before mint out
        bool lockBeforeMintOut;
    }

    /// @notice Public sale configuration
    /// @dev Uses 1 storage slot
    struct PublicSaleConfiguration {
        /// @dev Public sale price (max ether value > 1000 ether with this value)
        uint104 publicSalePrice;
        /// @dev Purchase mint limit per address (if set to 0 === unlimited mints)
        uint32 maxSalePurchasePerAddress;
        /// @dev uint64 type allows for dates into 292 billion years
        uint64 publicSaleStart;
        uint64 publicSaleEnd;
        /// @dev Whether public sale is disabled
        bool publicSaleDisabled;
    }

    /// @notice Presale stage configuration
    struct PresaleConfiguration {
        /// @notice Presale stage human readable name
        string presaleName;
        /// @notice Presale start timestamp
        uint64 presaleStart;
        /// @notice Presale end timestamp
        uint64 presaleEnd;
        /// @notice Presale price in ether
        uint104 presalePrice;
        /// @notice Purchase mint limit per address (if set to 0 === unlimited mints)
        uint32 presaleMaxPurchasePerAddress;
        /// @notice supply allocated for presale stage
        uint32 presaleSupply;
        /// @notice amount minted for presale stage
        uint32 presaleMinted;
        /// @notice Presale merkle root
        bytes32 presaleMerkleRoot;
    }

    /// @notice Return type of specific mint counts and details per address
    struct AddressMintDetails {
        /// Number of presale mints for each stage from the given address
        uint256[] presaleMintsByStage;
        /// Number of presale mints from the given address
        uint256 presaleMints;
        /// Number of public mints from the given address
        uint256 publicMints;
        /// Number of total mints from the given address
        uint256 totalMints;
    }

    /// @notice External purchase function (payable in eth)
    /// @param quantity to purchase
    /// @return first minted token ID
    function purchase(uint256 quantity) external payable returns (uint256);

    /// @notice External purchase presale function (takes a merkle proof and matches to root) (payable in eth)
    /// @param stageIndex targetted presale stage
    /// @param quantity to purchase
    /// @param maxQuantity can purchase (verified by merkle root)
    /// @param pricePerToken price per token allowed (verified by merkle root)
    /// @param merkleProof input for merkle proof leaf verified by merkle root
    /// @return first minted token ID
    function purchasePresale(uint256 stageIndex, uint256 quantity, uint256 maxQuantity, uint256 pricePerToken, bytes32[] memory merkleProof) external payable returns (uint256);

    /// @notice Function to return the specific sales details for a given address
    /// @param minter address for minter to return mint information for
    function mintedPerAddress(address minter) external view returns (AddressMintDetails memory);

    /// @notice This is the opensea/public owner setting that can be set by the contract admin
    function owner() external view returns (address);

    /// @notice Admin function to update the public sale configuration settings
    /// @param newConfig updated public stage config
    function setPublicSaleConfiguration(PublicSaleConfiguration memory newConfig) external;

    /// @notice Admin function to update the presale configuration settings
    /// @param newConfig new presale configuration
    function setPresaleConfiguration(PresaleConfiguration[] calldata newConfig) external;

    /// @notice Admin function to reduce collection size (cut suppy)
    /// @param _newCollectionSize new collection size
    function reduceSupply(uint64 _newCollectionSize) external;

    /// @dev Reveal collection artworks
    /// @param collectionURI collection artwork URI
    /// @param extension collection artwork URI extension
    function revealCollection(string memory collectionURI, string memory extension) external;

    /// @notice Update the metadata renderer
    /// @param newRenderer new address for renderer
    /// @param metadataBase data to call to bootstrap data for the new renderer (optional)
    /// @param dynamicMetadataInfo data to call to bootstrap dynamic metadata for the new renderer (optional)
    function setMetadataRenderer(address newRenderer, bytes memory metadataBase, bytes memory dynamicMetadataInfo) external;

    /// @notice This is an admin mint function to mint a quantity to a specific address
    /// @param to address to mint to
    /// @param quantity quantity to mint
    /// @return the id of the first minted NFT
    function adminMint(address to, uint256 quantity) external returns (uint256);

    /// @notice This is an admin mint function to mint a single nft each to a list of addresses
    /// @param to list of addresses to mint an NFT each to
    /// @return the id of the first minted NFT
    function adminMintAirdrop(address[] memory to) external returns (uint256);

    /// @dev Getter for admin role associated with the contract to handle metadata
    /// @return boolean if address is admin
    function isAdmin(address user) external view returns (bool);
}

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

interface IMetadataRenderer {
    function tokenURI(uint256, bool) external view returns (string memory);
    function contractURI() external view returns (string memory);
    function initializeWithData(bytes memory metadataBase, bytes memory dynamicTokenData) external;
    function updateMetadataBase(
        address collection, 
        string memory baseURI, 
        string memory metadataURI
    ) external;
    function updateMetadataBaseWithDetails(
        address collection, 
        string memory baseURI, 
        string memory extension,
        string memory metadataURI,
        uint256 freezeAt
    ) external;
    function dynamicTokenURI(uint256) external view returns (string memory);
}

File 9 of 38 : IOwnable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

/**
 * @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.
 *
 * This ownership interface matches OZ's ownable interface.
 *
 */
interface IOwnable {
    error ONLY_OWNER();
    error ONLY_PENDING_OWNER();

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

    event OwnerPending(
        address indexed previousOwner,
        address indexed potentialNewOwner
    );

    event OwnerCanceled(
        address indexed previousOwner,
        address indexed potentialNewOwner
    );

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() external view returns (address);
}

File 10 of 38 : IArbInfo.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

interface IArbInfo {
    function configureAutomaticYield() external;
    function configureVoidYield() external;
    function configureDelegateYield(address delegate) external;
}

File 11 of 38 : ERC721CollectionStorageV1.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import {IERC721Collection} from "../interfaces/IERC721Collection.sol";

contract ERC721CollectionStorageV1 {
    /// @notice Configuration for NFT minting contract storage
    IERC721Collection.Configuration public config;

    /// @notice Public sale configuration
    IERC721Collection.PublicSaleConfiguration public publicSaleConfig;

    /// @notice Active presale stage count
    uint256 public activePresaleStageCount;

    /// @notice Presale configuration
    mapping(uint256 => IERC721Collection.PresaleConfiguration) public presaleConfig; 

    /// @dev Mapping for presale mint counts by address and stage
    mapping(address => mapping(uint256 => uint256)) public presaleMintedByAddress;

    uint256[50] private __gap;
}

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

import {IOwnable} from "../interfaces/IOwnable.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.
 *
 * This ownership interface matches OZ's ownable interface.
 */
contract OwnableSkeleton is IOwnable {
    address private _owner;

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

    function _setOwner(address newAddress) internal {
        emit OwnershipTransferred(_owner, newAddress);
        _owner = newAddress;
    }
}

File 13 of 38 : PublicMulticall.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import "@openzeppelin/contracts/utils/Address.sol";

abstract contract PublicMulticall {
    /**
     * @dev Receives and executes a batch of function calls on this contract.
     */
    function multicall(bytes[] calldata data)
        public
        virtual
        returns (bytes[] memory results)
    {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            results[i] = Address.functionDelegateCall(address(this), data[i]);
        }
    }
}

File 14 of 38 : Version.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

contract Version {
    /// @notice The version of the contract
    /// @return The version ID of this contract implementation
    function contractVersion() external pure returns (string memory) {
        return "1.0.0";
    }
}

File 15 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 16 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 17 of 38 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @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] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 18 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 19 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 20 of 38 : CreatorTokenBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "../access/OwnablePermissions.sol";
import "../interfaces/ICreatorToken.sol";
import "../interfaces/ICreatorTokenLegacy.sol";
import "../interfaces/ITransferValidator.sol";
import "./TransferValidation.sol";
import "../interfaces/ITransferValidatorSetTokenType.sol";

/**
 * @title CreatorTokenBase
 * @author Limit Break, Inc.
 * @notice CreatorTokenBaseV3 is an abstract contract that provides basic functionality for managing token 
 * transfer policies through an implementation of ICreatorTokenTransferValidator/ICreatorTokenTransferValidatorV2/ICreatorTokenTransferValidatorV3. 
 * This contract is intended to be used as a base for creator-specific token contracts, enabling customizable transfer 
 * restrictions and security policies.
 *
 * <h4>Features:</h4>
 * <ul>Ownable: This contract can have an owner who can set and update the transfer validator.</ul>
 * <ul>TransferValidation: Implements the basic token transfer validation interface.</ul>
 *
 * <h4>Benefits:</h4>
 * <ul>Provides a flexible and modular way to implement custom token transfer restrictions and security policies.</ul>
 * <ul>Allows creators to enforce policies such as account and codehash blacklists, whitelists, and graylists.</ul>
 * <ul>Can be easily integrated into other token contracts as a base contract.</ul>
 *
 * <h4>Intended Usage:</h4>
 * <ul>Use as a base contract for creator token implementations that require advanced transfer restrictions and 
 *   security policies.</ul>
 * <ul>Set and update the ICreatorTokenTransferValidator implementation contract to enforce desired policies for the 
 *   creator token.</ul>
 *
 * <h4>Compatibility:</h4>
 * <ul>Backward and Forward Compatible - V1/V2/V3 Creator Token Base will work with V1/V2/V3 Transfer Validators.</ul>
 */
abstract contract CreatorTokenBase is OwnablePermissions, TransferValidation, ICreatorToken {

    /// @dev Thrown when setting a transfer validator address that has no deployed code.
    error CreatorTokenBase__InvalidTransferValidatorContract();

    /// @dev The default transfer validator that will be used if no transfer validator has been set by the creator.
    address public constant DEFAULT_TRANSFER_VALIDATOR = address(0x721C0078c2328597Ca70F5451ffF5A7B38D4E947);

    /// @dev Used to determine if the default transfer validator is applied.
    /// @dev Set to true when the creator sets a transfer validator address.
    bool private isValidatorInitialized;
    /// @dev Address of the transfer validator to apply to transactions.
    address private transferValidator;

    constructor() {
        _emitDefaultTransferValidator();
        _registerTokenType(DEFAULT_TRANSFER_VALIDATOR);
    }

    /**
     * @notice Sets the transfer validator for the token contract.
     *
     * @dev    Throws when provided validator contract is not the zero address and does not have code.
     * @dev    Throws when the caller is not the contract owner.
     *
     * @dev    <h4>Postconditions:</h4>
     *         1. The transferValidator address is updated.
     *         2. The `TransferValidatorUpdated` event is emitted.
     *
     * @param transferValidator_ The address of the transfer validator contract.
     */
    function setTransferValidator(address transferValidator_) public {
        _requireCallerIsContractOwner();

        bool isValidTransferValidator = transferValidator_.code.length > 0;

        if(transferValidator_ != address(0) && !isValidTransferValidator) {
            revert CreatorTokenBase__InvalidTransferValidatorContract();
        }

        emit TransferValidatorUpdated(address(getTransferValidator()), transferValidator_);

        isValidatorInitialized = true;
        transferValidator = transferValidator_;

        _registerTokenType(transferValidator_);
    }

    /**
     * @notice Returns the transfer validator contract address for this token contract.
     */
    function getTransferValidator() public view override returns (address validator) {
        validator = transferValidator;

        if (validator == address(0)) {
            if (!isValidatorInitialized) {
                validator = DEFAULT_TRANSFER_VALIDATOR;
            }
        }
    }

    /**
     * @dev Pre-validates a token transfer, reverting if the transfer is not allowed by this token's security policy.
     *      Inheriting contracts are responsible for overriding the _beforeTokenTransfer function, or its equivalent
     *      and calling _validateBeforeTransfer so that checks can be properly applied during token transfers.
     *
     * @dev Be aware that if the msg.sender is the transfer validator, the transfer is automatically permitted, as the
     *      transfer validator is expected to pre-validate the transfer.
     *
     * @dev Throws when the transfer doesn't comply with the collection's transfer policy, if the transferValidator is
     *      set to a non-zero address.
     *
     * @param caller  The address of the caller.
     * @param from    The address of the sender.
     * @param to      The address of the receiver.
     * @param tokenId The token id being transferred.
     */
    function _preValidateTransfer(
        address caller, 
        address from, 
        address to, 
        uint256 tokenId, 
        uint256 /*value*/) internal virtual override {
        address validator = getTransferValidator();

        if (validator != address(0)) {
            if (msg.sender == validator) {
                return;
            }

            ITransferValidator(validator).validateTransfer(caller, from, to, tokenId);
        }
    }

    /**
     * @dev Pre-validates a token transfer, reverting if the transfer is not allowed by this token's security policy.
     *      Inheriting contracts are responsible for overriding the _beforeTokenTransfer function, or its equivalent
     *      and calling _validateBeforeTransfer so that checks can be properly applied during token transfers.
     *
     * @dev Be aware that if the msg.sender is the transfer validator, the transfer is automatically permitted, as the
     *      transfer validator is expected to pre-validate the transfer.
     * 
     * @dev Used for ERC20 and ERC1155 token transfers which have an amount value to validate in the transfer validator.
     * @dev The `tokenId` for ERC20 tokens should be set to `0`.
     *
     * @dev Throws when the transfer doesn't comply with the collection's transfer policy, if the transferValidator is
     *      set to a non-zero address.
     *
     * @param caller  The address of the caller.
     * @param from    The address of the sender.
     * @param to      The address of the receiver.
     * @param tokenId The token id being transferred.
     * @param amount  The amount of token being transferred.
     */
    function _preValidateTransfer(
        address caller, 
        address from, 
        address to, 
        uint256 tokenId, 
        uint256 amount,
        uint256 /*value*/) internal virtual override {
        address validator = getTransferValidator();

        if (validator != address(0)) {
            if (msg.sender == validator) {
                return;
            }

            ITransferValidator(validator).validateTransfer(caller, from, to, tokenId, amount);
        }
    }

    function _tokenType() internal virtual pure returns(uint16);

    function _registerTokenType(address validator) internal {
        if (validator != address(0)) {
            uint256 validatorCodeSize;
            assembly {
                validatorCodeSize := extcodesize(validator)
            }
            if(validatorCodeSize > 0) {
                try ITransferValidatorSetTokenType(validator).setTokenTypeOfCollection(address(this), _tokenType()) {
                } catch { }
            }
        }
    }

    /**
     * @dev  Used during contract deployment for constructable and cloneable creator tokens
     * @dev  to emit the `TransferValidatorUpdated` event signaling the validator for the contract
     * @dev  is the default transfer validator.
     */
    function _emitDefaultTransferValidator() internal {
        emit TransferValidatorUpdated(address(0), DEFAULT_TRANSFER_VALIDATOR);
    }
}

File 21 of 38 : ERC721AQueryableUpgradeable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721AQueryableUpgradeable.sol';
import '../ERC721AUpgradeable.sol';
import '../ERC721A__Initializable.sol';

/**
 * @title ERC721AQueryable.
 *
 * @dev ERC721A subclass with convenience query functions.
 */
abstract contract ERC721AQueryableUpgradeable is
    ERC721A__Initializable,
    ERC721AUpgradeable,
    IERC721AQueryableUpgradeable
{
    function __ERC721AQueryable_init() internal onlyInitializingERC721A {
        __ERC721AQueryable_init_unchained();
    }

    function __ERC721AQueryable_init_unchained() internal onlyInitializingERC721A {}

    /**
     * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
     *
     * If the `tokenId` is out of bounds:
     *
     * - `addr = address(0)`
     * - `startTimestamp = 0`
     * - `burned = false`
     * - `extraData = 0`
     *
     * If the `tokenId` is burned:
     *
     * - `addr = <Address of owner before token was burned>`
     * - `startTimestamp = <Timestamp when token was burned>`
     * - `burned = true`
     * - `extraData = <Extra data when token was burned>`
     *
     * Otherwise:
     *
     * - `addr = <Address of owner>`
     * - `startTimestamp = <Timestamp of start of ownership>`
     * - `burned = false`
     * - `extraData = <Extra data at start of ownership>`
     */
    function explicitOwnershipOf(uint256 tokenId)
        public
        view
        virtual
        override
        returns (TokenOwnership memory ownership)
    {
        unchecked {
            if (tokenId >= _startTokenId()) {
                if (tokenId > _sequentialUpTo()) return _ownershipAt(tokenId);

                if (tokenId < _nextTokenId()) {
                    // If the `tokenId` is within bounds,
                    // scan backwards for the initialized ownership slot.
                    while (!_ownershipIsInitialized(tokenId)) --tokenId;
                    return _ownershipAt(tokenId);
                }
            }
        }
    }

    /**
     * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
     * See {ERC721AQueryable-explicitOwnershipOf}
     */
    function explicitOwnershipsOf(uint256[] calldata tokenIds)
        external
        view
        virtual
        override
        returns (TokenOwnership[] memory)
    {
        TokenOwnership[] memory ownerships;
        uint256 i = tokenIds.length;
        assembly {
            // Grab the free memory pointer.
            ownerships := mload(0x40)
            // Store the length.
            mstore(ownerships, i)
            // Allocate one word for the length,
            // `tokenIds.length` words for the pointers.
            i := shl(5, i) // Multiply `i` by 32.
            mstore(0x40, add(add(ownerships, 0x20), i))
        }
        while (i != 0) {
            uint256 tokenId;
            assembly {
                i := sub(i, 0x20)
                tokenId := calldataload(add(tokenIds.offset, i))
            }
            TokenOwnership memory ownership = explicitOwnershipOf(tokenId);
            assembly {
                // Store the pointer of `ownership` in the `ownerships` array.
                mstore(add(add(ownerships, 0x20), i), ownership)
            }
        }
        return ownerships;
    }

    /**
     * @dev Returns an array of token IDs owned by `owner`,
     * in the range [`start`, `stop`)
     * (i.e. `start <= tokenId < stop`).
     *
     * This function allows for tokens to be queried if the collection
     * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
     *
     * Requirements:
     *
     * - `start < stop`
     */
    function tokensOfOwnerIn(
        address owner,
        uint256 start,
        uint256 stop
    ) external view virtual override returns (uint256[] memory) {
        return _tokensOfOwnerIn(owner, start, stop);
    }

    /**
     * @dev Returns an array of token IDs owned by `owner`.
     *
     * This function scans the ownership mapping and is O(`totalSupply`) in complexity.
     * It is meant to be called off-chain.
     *
     * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
     * multiple smaller scans if the collection is large enough to cause
     * an out-of-gas error (10K collections should be fine).
     */
    function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) {
        // If spot mints are enabled, full-range scan is disabled.
        if (_sequentialUpTo() != type(uint256).max) _revert(NotCompatibleWithSpotMints.selector);
        uint256 start = _startTokenId();
        uint256 stop = _nextTokenId();
        uint256[] memory tokenIds;
        if (start != stop) tokenIds = _tokensOfOwnerIn(owner, start, stop);
        return tokenIds;
    }

    /**
     * @dev Helper function for returning an array of token IDs owned by `owner`.
     *
     * Note that this function is optimized for smaller bytecode size over runtime gas,
     * since it is meant to be called off-chain.
     */
    function _tokensOfOwnerIn(
        address owner,
        uint256 start,
        uint256 stop
    ) private view returns (uint256[] memory tokenIds) {
        unchecked {
            if (start >= stop) _revert(InvalidQueryRange.selector);
            // Set `start = max(start, _startTokenId())`.
            if (start < _startTokenId()) start = _startTokenId();
            uint256 nextTokenId = _nextTokenId();
            // If spot mints are enabled, scan all the way until the specified `stop`.
            uint256 stopLimit = _sequentialUpTo() != type(uint256).max ? stop : nextTokenId;
            // Set `stop = min(stop, stopLimit)`.
            if (stop >= stopLimit) stop = stopLimit;
            // Number of tokens to scan.
            uint256 tokenIdsMaxLength = balanceOf(owner);
            // Set `tokenIdsMaxLength` to zero if the range contains no tokens.
            if (start >= stop) tokenIdsMaxLength = 0;
            // If there are one or more tokens to scan.
            if (tokenIdsMaxLength != 0) {
                // Set `tokenIdsMaxLength = min(balanceOf(owner), tokenIdsMaxLength)`.
                if (stop - start <= tokenIdsMaxLength) tokenIdsMaxLength = stop - start;
                uint256 m; // Start of available memory.
                assembly {
                    // Grab the free memory pointer.
                    tokenIds := mload(0x40)
                    // Allocate one word for the length, and `tokenIdsMaxLength` words
                    // for the data. `shl(5, x)` is equivalent to `mul(32, x)`.
                    m := add(tokenIds, shl(5, add(tokenIdsMaxLength, 1)))
                    mstore(0x40, m)
                }
                // We need to call `explicitOwnershipOf(start)`,
                // because the slot at `start` may not be initialized.
                TokenOwnership memory ownership = explicitOwnershipOf(start);
                address currOwnershipAddr;
                // If the starting slot exists (i.e. not burned),
                // initialize `currOwnershipAddr`.
                // `ownership.address` will not be zero,
                // as `start` is clamped to the valid token ID range.
                if (!ownership.burned) currOwnershipAddr = ownership.addr;
                uint256 tokenIdsIdx;
                // Use a do-while, which is slightly more efficient for this case,
                // as the array will at least contain one element.
                do {
                    if (_sequentialUpTo() != type(uint256).max) {
                        // Skip the remaining unused sequential slots.
                        if (start == nextTokenId) start = _sequentialUpTo() + 1;
                        // Reset `currOwnershipAddr`, as each spot-minted token is a batch of one.
                        if (start > _sequentialUpTo()) currOwnershipAddr = address(0);
                    }
                    ownership = _ownershipAt(start); // This implicitly allocates memory.
                    assembly {
                        switch mload(add(ownership, 0x40))
                        // if `ownership.burned == false`.
                        case 0 {
                            // if `ownership.addr != address(0)`.
                            // The `addr` already has it's upper 96 bits clearned,
                            // since it is written to memory with regular Solidity.
                            if mload(ownership) {
                                currOwnershipAddr := mload(ownership)
                            }
                            // if `currOwnershipAddr == owner`.
                            // The `shl(96, x)` is to make the comparison agnostic to any
                            // dirty upper 96 bits in `owner`.
                            if iszero(shl(96, xor(currOwnershipAddr, owner))) {
                                tokenIdsIdx := add(tokenIdsIdx, 1)
                                mstore(add(tokenIds, shl(5, tokenIdsIdx)), start)
                            }
                        }
                        // Otherwise, reset `currOwnershipAddr`.
                        // This handles the case of batch burned tokens
                        // (burned bit of first slot set, remaining slots left uninitialized).
                        default {
                            currOwnershipAddr := 0
                        }
                        start := add(start, 1)
                        // Free temporary memory implicitly allocated for ownership
                        // to avoid quadratic memory expansion costs.
                        mstore(0x40, m)
                    }
                } while (!(start == stop || tokenIdsIdx == tokenIdsMaxLength));
                // Store the length of the array.
                assembly {
                    mstore(tokenIds, tokenIdsIdx)
                }
            }
        }
    }
}

File 22 of 38 : AutomaticValidatorTransferApproval.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "../access/OwnablePermissions.sol";

/**
 * @title AutomaticValidatorTransferApproval
 * @author Limit Break, Inc.
 * @notice Base contract mix-in that provides boilerplate code giving the contract owner the
 *         option to automatically approve a 721-C transfer validator implementation for transfers.
 */
abstract contract AutomaticValidatorTransferApproval is OwnablePermissions {

    /// @dev Emitted when the automatic approval flag is modified by the creator.
    event AutomaticApprovalOfTransferValidatorSet(bool autoApproved);

    /// @dev If true, the collection's transfer validator is automatically approved to transfer holder's tokens.
    bool public autoApproveTransfersFromValidator;

    /**
     * @notice Sets if the transfer validator is automatically approved as an operator for all token owners.
     * 
     * @dev    Throws when the caller is not the contract owner.
     * 
     * @param autoApprove If true, the collection's transfer validator will be automatically approved to
     *                    transfer holder's tokens.
     */
    function setAutomaticApprovalOfTransfersFromValidator(bool autoApprove) external {
        _requireCallerIsContractOwner();
        autoApproveTransfersFromValidator = autoApprove;
        emit AutomaticApprovalOfTransferValidatorSet(autoApprove);
    }
}

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

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @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.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * 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 prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 24 of 38 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

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

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

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

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

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

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

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

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

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

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

File 25 of 38 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

File 26 of 38 : OwnablePermissions.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/Context.sol";

abstract contract OwnablePermissions is Context {
    function _requireCallerIsContractOwner() internal view virtual;
}

File 27 of 38 : ICreatorToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface ICreatorToken {
    event TransferValidatorUpdated(address oldValidator, address newValidator);
    function getTransferValidator() external view returns (address validator);
    function setTransferValidator(address validator) external;
    function getTransferValidationFunction() external view returns (bytes4 functionSignature, bool isViewFunction);
}

File 28 of 38 : ICreatorTokenLegacy.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface ICreatorTokenLegacy {
    event TransferValidatorUpdated(address oldValidator, address newValidator);
    function getTransferValidator() external view returns (address validator);
    function setTransferValidator(address validator) external;
}

File 29 of 38 : ITransferValidator.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface ITransferValidator {
    function applyCollectionTransferPolicy(address caller, address from, address to) external view;
    function validateTransfer(address caller, address from, address to) external view;
    function validateTransfer(address caller, address from, address to, uint256 tokenId) external view;
    function validateTransfer(address caller, address from, address to, uint256 tokenId, uint256 amount) external;

    function beforeAuthorizedTransfer(address operator, address token, uint256 tokenId) external;
    function afterAuthorizedTransfer(address token, uint256 tokenId) external;
    function beforeAuthorizedTransfer(address operator, address token) external;
    function afterAuthorizedTransfer(address token) external;
    function beforeAuthorizedTransfer(address token, uint256 tokenId) external;
    function beforeAuthorizedTransferWithAmount(address token, uint256 tokenId, uint256 amount) external;
    function afterAuthorizedTransferWithAmount(address token, uint256 tokenId) external;
}

File 30 of 38 : TransferValidation.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/Context.sol";

/**
 * @title TransferValidation
 * @author Limit Break, Inc.
 * @notice A mix-in that can be combined with ERC-721 contracts to provide more granular hooks.
 * Openzeppelin's ERC721 contract only provides hooks for before and after transfer.  This allows
 * developers to validate or customize transfers within the context of a mint, a burn, or a transfer.
 */
abstract contract TransferValidation is Context {
    
    /// @dev Thrown when the from and to address are both the zero address.
    error ShouldNotMintToBurnAddress();

    /*************************************************************************/
    /*                      Transfers Without Amounts                        */
    /*************************************************************************/

    /// @dev Inheriting contracts should call this function in the _beforeTokenTransfer function to get more granular hooks.
    function _validateBeforeTransfer(address from, address to, uint256 tokenId) internal virtual {
        bool fromZeroAddress = from == address(0);
        bool toZeroAddress = to == address(0);

        if(fromZeroAddress && toZeroAddress) {
            revert ShouldNotMintToBurnAddress();
        } else if(fromZeroAddress) {
            _preValidateMint(_msgSender(), to, tokenId, msg.value);
        } else if(toZeroAddress) {
            _preValidateBurn(_msgSender(), from, tokenId, msg.value);
        } else {
            _preValidateTransfer(_msgSender(), from, to, tokenId, msg.value);
        }
    }

    /// @dev Inheriting contracts should call this function in the _afterTokenTransfer function to get more granular hooks.
    function _validateAfterTransfer(address from, address to, uint256 tokenId) internal virtual {
        bool fromZeroAddress = from == address(0);
        bool toZeroAddress = to == address(0);

        if(fromZeroAddress && toZeroAddress) {
            revert ShouldNotMintToBurnAddress();
        } else if(fromZeroAddress) {
            _postValidateMint(_msgSender(), to, tokenId, msg.value);
        } else if(toZeroAddress) {
            _postValidateBurn(_msgSender(), from, tokenId, msg.value);
        } else {
            _postValidateTransfer(_msgSender(), from, to, tokenId, msg.value);
        }
    }

    /// @dev Optional validation hook that fires before a mint
    function _preValidateMint(address caller, address to, uint256 tokenId, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires after a mint
    function _postValidateMint(address caller, address to, uint256 tokenId, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires before a burn
    function _preValidateBurn(address caller, address from, uint256 tokenId, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires after a burn
    function _postValidateBurn(address caller, address from, uint256 tokenId, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires before a transfer
    function _preValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires after a transfer
    function _postValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 value) internal virtual {}

    /*************************************************************************/
    /*                         Transfers With Amounts                        */
    /*************************************************************************/

    /// @dev Inheriting contracts should call this function in the _beforeTokenTransfer function to get more granular hooks.
    function _validateBeforeTransfer(address from, address to, uint256 tokenId, uint256 amount) internal virtual {
        bool fromZeroAddress = from == address(0);
        bool toZeroAddress = to == address(0);

        if(fromZeroAddress && toZeroAddress) {
            revert ShouldNotMintToBurnAddress();
        } else if(fromZeroAddress) {
            _preValidateMint(_msgSender(), to, tokenId, amount, msg.value);
        } else if(toZeroAddress) {
            _preValidateBurn(_msgSender(), from, tokenId, amount, msg.value);
        } else {
            _preValidateTransfer(_msgSender(), from, to, tokenId, amount, msg.value);
        }
    }

    /// @dev Inheriting contracts should call this function in the _afterTokenTransfer function to get more granular hooks.
    function _validateAfterTransfer(address from, address to, uint256 tokenId, uint256 amount) internal virtual {
        bool fromZeroAddress = from == address(0);
        bool toZeroAddress = to == address(0);

        if(fromZeroAddress && toZeroAddress) {
            revert ShouldNotMintToBurnAddress();
        } else if(fromZeroAddress) {
            _postValidateMint(_msgSender(), to, tokenId, amount, msg.value);
        } else if(toZeroAddress) {
            _postValidateBurn(_msgSender(), from, tokenId, amount, msg.value);
        } else {
            _postValidateTransfer(_msgSender(), from, to, tokenId, amount, msg.value);
        }
    }

    /// @dev Optional validation hook that fires before a mint
    function _preValidateMint(address caller, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires after a mint
    function _postValidateMint(address caller, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires before a burn
    function _preValidateBurn(address caller, address from, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires after a burn
    function _postValidateBurn(address caller, address from, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires before a transfer
    function _preValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires after a transfer
    function _postValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}
}

File 31 of 38 : ITransferValidatorSetTokenType.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface ITransferValidatorSetTokenType {
    function setTokenTypeOfCollection(address collection, uint16 tokenType) external;
}

File 32 of 38 : IERC721AQueryableUpgradeable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import '../IERC721AUpgradeable.sol';

/**
 * @dev Interface of ERC721AQueryable.
 */
interface IERC721AQueryableUpgradeable is IERC721AUpgradeable {
    /**
     * Invalid query range (`start` >= `stop`).
     */
    error InvalidQueryRange();

    /**
     * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
     *
     * If the `tokenId` is out of bounds:
     *
     * - `addr = address(0)`
     * - `startTimestamp = 0`
     * - `burned = false`
     * - `extraData = 0`
     *
     * If the `tokenId` is burned:
     *
     * - `addr = <Address of owner before token was burned>`
     * - `startTimestamp = <Timestamp when token was burned>`
     * - `burned = true`
     * - `extraData = <Extra data when token was burned>`
     *
     * Otherwise:
     *
     * - `addr = <Address of owner>`
     * - `startTimestamp = <Timestamp of start of ownership>`
     * - `burned = false`
     * - `extraData = <Extra data at start of ownership>`
     */
    function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory);

    /**
     * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
     * See {ERC721AQueryable-explicitOwnershipOf}
     */
    function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory);

    /**
     * @dev Returns an array of token IDs owned by `owner`,
     * in the range [`start`, `stop`)
     * (i.e. `start <= tokenId < stop`).
     *
     * This function allows for tokens to be queried if the collection
     * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
     *
     * Requirements:
     *
     * - `start < stop`
     */
    function tokensOfOwnerIn(
        address owner,
        uint256 start,
        uint256 stop
    ) external view returns (uint256[] memory);

    /**
     * @dev Returns an array of token IDs owned by `owner`.
     *
     * This function scans the ownership mapping and is O(`totalSupply`) in complexity.
     * It is meant to be called off-chain.
     *
     * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
     * multiple smaller scans if the collection is large enough to cause
     * an out-of-gas error (10K collections should be fine).
     */
    function tokensOfOwner(address owner) external view returns (uint256[] memory);
}

File 33 of 38 : ERC721AUpgradeable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if (_sequentialUpTo() < _startTokenId()) _revert(SequentialUpToTooSmall.selector);
    }

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

    /**
     * @dev Returns the starting token ID for sequential mints.
     *
     * Override this function to change the starting token ID for sequential mints.
     *
     * Note: The value returned must never change after any tokens have been minted.
     */
    function _startTokenId() internal view virtual returns (uint256) {
        return 0;
    }

    /**
     * @dev Returns the maximum token ID (inclusive) for sequential mints.
     *
     * Override this function to return a value less than 2**256 - 1,
     * but greater than `_startTokenId()`, to enable spot (non-sequential) mints.
     *
     * Note: The value returned must never change after any tokens have been minted.
     */
    function _sequentialUpTo() internal view virtual returns (uint256) {
        return type(uint256).max;
    }

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

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see {_totalMinted}.
     */
    function totalSupply() public view virtual override returns (uint256 result) {
        // Counter underflow is impossible as `_burnCounter` cannot be incremented
        // more than `_currentIndex + _spotMinted - _startTokenId()` times.
        unchecked {
            // With spot minting, the intermediate `result` can be temporarily negative,
            // and the computation must be unchecked.
            result = ERC721AStorage.layout()._currentIndex - ERC721AStorage.layout()._burnCounter - _startTokenId();
            if (_sequentialUpTo() != type(uint256).max) result += ERC721AStorage.layout()._spotMinted;
        }
    }

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

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

    /**
     * @dev Returns the total number of tokens that are spot-minted.
     */
    function _totalSpotMinted() internal view virtual returns (uint256) {
        return ERC721AStorage.layout()._spotMinted;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Returns whether the ownership slot at `index` is initialized.
     * An uninitialized slot does not necessarily mean that the slot has no owner.
     */
    function _ownershipIsInitialized(uint256 index) internal view virtual returns (bool) {
        return ERC721AStorage.layout()._packedOwnerships[index] != 0;
    }

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

    /**
     * @dev Returns the packed ownership data of `tokenId`.
     */
    function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) {
        if (_startTokenId() <= tokenId) {
            packed = ERC721AStorage.layout()._packedOwnerships[tokenId];

            if (tokenId > _sequentialUpTo()) {
                if (_packedOwnershipExists(packed)) return packed;
                _revert(OwnerQueryForNonexistentToken.selector);
            }

            // If the data at the starting slot does not exist, start the scan.
            if (packed == 0) {
                if (tokenId >= ERC721AStorage.layout()._currentIndex) _revert(OwnerQueryForNonexistentToken.selector);
                // Invariant:
                // There will always be an initialized ownership slot
                // (i.e. `ownership.addr != address(0) && ownership.burned == false`)
                // before an unintialized ownership slot
                // (i.e. `ownership.addr == address(0) && ownership.burned == false`)
                // Hence, `tokenId` will not underflow.
                //
                // We can directly compare the packed value.
                // If the address is zero, packed will be zero.
                for (;;) {
                    unchecked {
                        packed = ERC721AStorage.layout()._packedOwnerships[--tokenId];
                    }
                    if (packed == 0) continue;
                    if (packed & _BITMASK_BURNED == 0) return packed;
                    // Otherwise, the token is burned, and we must revert.
                    // This handles the case of batch burned tokens, where only the burned bit
                    // of the starting slot is set, and remaining slots are left uninitialized.
                    _revert(OwnerQueryForNonexistentToken.selector);
                }
            }
            // Otherwise, the data exists and we can skip the scan.
            // This is possible because we have already achieved the target condition.
            // This saves 2143 gas on transfers of initialized tokens.
            // If the token is not burned, return `packed`. Otherwise, revert.
            if (packed & _BITMASK_BURNED == 0) return packed;
        }
        _revert(OwnerQueryForNonexistentToken.selector);
    }

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

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

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

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

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

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

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

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

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

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted. See {_mint}.
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool result) {
        if (_startTokenId() <= tokenId) {
            if (tokenId > _sequentialUpTo())
                return _packedOwnershipExists(ERC721AStorage.layout()._packedOwnerships[tokenId]);

            if (tokenId < ERC721AStorage.layout()._currentIndex) {
                uint256 packed;
                while ((packed = ERC721AStorage.layout()._packedOwnerships[tokenId]) == 0) --tokenId;
                result = packed & _BITMASK_BURNED == 0;
            }
        }
    }

    /**
     * @dev Returns whether `packed` represents a token that exists.
     */
    function _packedOwnershipExists(uint256 packed) private pure returns (bool result) {
        assembly {
            // The following is equivalent to `owner != address(0) && burned == false`.
            // Symbolically tested.
            result := gt(and(packed, _BITMASK_ADDRESS), and(packed, _BITMASK_BURNED))
        }
    }

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

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

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

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

        // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean.
        from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS));

        if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector);

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

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

        _beforeTokenTransfers(from, to, tokenId, 1);

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

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

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

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

        // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
        uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
        assembly {
            // Emit the `Transfer` event.
            log4(
                0, // Start of data (0, since no data).
                0, // End of data (0, since no data).
                _TRANSFER_EVENT_SIGNATURE, // Signature.
                from, // `from`.
                toMasked, // `to`.
                tokenId // `tokenId`.
            )
        }
        if (toMasked == 0) _revert(TransferToZeroAddress.selector);

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

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

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

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

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

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

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

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

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

        // Overflows are incredibly unrealistic.
        // `balance` and `numberMinted` have a maximum limit of 2**64.
        // `tokenId` has a maximum limit of 2**256.
        unchecked {
            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            ERC721AStorage.layout()._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);

            // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
            uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;

            if (toMasked == 0) _revert(MintToZeroAddress.selector);

            uint256 end = startTokenId + quantity;
            uint256 tokenId = startTokenId;

            if (end - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector);

            do {
                assembly {
                    // Emit the `Transfer` event.
                    log4(
                        0, // Start of data (0, since no data).
                        0, // End of data (0, since no data).
                        _TRANSFER_EVENT_SIGNATURE, // Signature.
                        0, // `address(0)`.
                        toMasked, // `to`.
                        tokenId // `tokenId`.
                    )
                }
                // The `!=` check ensures that large values of `quantity`
                // that overflows uint256 will make the loop run out of gas.
            } while (++tokenId != end);

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

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

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

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

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

            if (startTokenId + quantity - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector);

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

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

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

        unchecked {
            if (to.code.length != 0) {
                uint256 end = ERC721AStorage.layout()._currentIndex;
                uint256 index = end - quantity;
                do {
                    if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
                        _revert(TransferToNonERC721ReceiverImplementer.selector);
                    }
                } while (index < end);
                // This prevents reentrancy to `_safeMint`.
                // It does not prevent reentrancy to `_safeMintSpot`.
                if (ERC721AStorage.layout()._currentIndex != end) revert();
            }
        }
    }

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

    /**
     * @dev Mints a single token at `tokenId`.
     *
     * Note: A spot-minted `tokenId` that has been burned can be re-minted again.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` must be greater than `_sequentialUpTo()`.
     * - `tokenId` must not exist.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _mintSpot(address to, uint256 tokenId) internal virtual {
        if (tokenId <= _sequentialUpTo()) _revert(SpotMintTokenIdTooSmall.selector);
        uint256 prevOwnershipPacked = ERC721AStorage.layout()._packedOwnerships[tokenId];
        if (_packedOwnershipExists(prevOwnershipPacked)) _revert(TokenAlreadyExists.selector);

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

        // Overflows are incredibly unrealistic.
        // The `numberMinted` for `to` is incremented by 1, and has a max limit of 2**64 - 1.
        // `_spotMinted` is incremented by 1, and has a max limit of 2**256 - 1.
        unchecked {
            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `true` (as `quantity == 1`).
            ERC721AStorage.layout()._packedOwnerships[tokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(1) | _nextExtraData(address(0), to, prevOwnershipPacked)
            );

            // Updates:
            // - `balance += 1`.
            // - `numberMinted += 1`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            ERC721AStorage.layout()._packedAddressData[to] += (1 << _BITPOS_NUMBER_MINTED) | 1;

            // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
            uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;

            if (toMasked == 0) _revert(MintToZeroAddress.selector);

            assembly {
                // Emit the `Transfer` event.
                log4(
                    0, // Start of data (0, since no data).
                    0, // End of data (0, since no data).
                    _TRANSFER_EVENT_SIGNATURE, // Signature.
                    0, // `address(0)`.
                    toMasked, // `to`.
                    tokenId // `tokenId`.
                )
            }

            ++ERC721AStorage.layout()._spotMinted;
        }

        _afterTokenTransfers(address(0), to, tokenId, 1);
    }

    /**
     * @dev Safely mints a single token at `tokenId`.
     *
     * Note: A spot-minted `tokenId` that has been burned can be re-minted again.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}.
     * - `tokenId` must be greater than `_sequentialUpTo()`.
     * - `tokenId` must not exist.
     *
     * See {_mintSpot}.
     *
     * Emits a {Transfer} event.
     */
    function _safeMintSpot(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mintSpot(to, tokenId);

        unchecked {
            if (to.code.length != 0) {
                uint256 currentSpotMinted = ERC721AStorage.layout()._spotMinted;
                if (!_checkContractOnERC721Received(address(0), to, tokenId, _data)) {
                    _revert(TransferToNonERC721ReceiverImplementer.selector);
                }
                // This prevents reentrancy to `_safeMintSpot`.
                // It does not prevent reentrancy to `_safeMint`.
                if (ERC721AStorage.layout()._spotMinted != currentSpotMinted) revert();
            }
        }
    }

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

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

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

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

        if (approvalCheck && _msgSenderERC721A() != owner)
            if (!isApprovedForAll(owner, _msgSenderERC721A())) {
                _revert(ApprovalCallerNotOwnerNorApproved.selector);
            }

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

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

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

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

        address from = address(uint160(prevOwnershipPacked));

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Converts a uint256 to its ASCII string decimal representation.
     */
    function _toString(uint256 value) internal pure virtual returns (string memory str) {
        assembly {
            // The maximum value of a uint256 contains 78 digits (1 byte per digit), but
            // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
            // We will need 1 word for the trailing zeros padding, 1 word for the length,
            // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
            let m := add(mload(0x40), 0xa0)
            // Update the free memory pointer to allocate.
            mstore(0x40, m)
            // Assign the `str` to the end.
            str := sub(m, 0x20)
            // Zeroize the slot after the string.
            mstore(str, 0)

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

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

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

    /**
     * @dev For more efficient reverts.
     */
    function _revert(bytes4 errorSelector) internal pure {
        assembly {
            mstore(0x00, errorSelector)
            revert(0x00, 0x04)
        }
    }
}

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

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

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

abstract contract ERC721A__Initializable {
    using ERC721A__InitializableStorage for ERC721A__InitializableStorage.Layout;

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

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

        _;

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

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

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

File 35 of 38 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

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

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

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

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

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

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

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

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

File 36 of 38 : IERC721AUpgradeable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * `_sequentialUpTo()` must be greater than `_startTokenId()`.
     */
    error SequentialUpToTooSmall();

    /**
     * The `tokenId` of a sequential mint exceeds `_sequentialUpTo()`.
     */
    error SequentialMintExceedsLimit();

    /**
     * Spot minting requires a `tokenId` greater than `_sequentialUpTo()`.
     */
    error SpotMintTokenIdTooSmall();

    /**
     * Cannot mint over a token that already exists.
     */
    error TokenAlreadyExists();

    /**
     * The feature is not compatible with spot mints.
     */
    error NotCompatibleWithSpotMints();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 37 of 38 : ERC721AStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

Settings
{
  "remappings": [
    "solady/=lib/solady/",
    "solemate/=/lib/solemate/src/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "forge-std/=lib/forge-std/src/",
    "erc721a/contracts/=lib/ERC721A/contracts/",
    "erc721a-upgradeable/contracts/=lib/ERC721A-Upgradeable/contracts/",
    "@limitbreak/creator-token-standards/src/=lib/creator-token-standards/src/",
    "@limitbreak/permit-c/=lib/creator-token-standards/lib/PermitC/src/",
    "@opensea/tstorish/=lib/creator-token-standards/lib/tstorish/src/",
    "@openzeppelin/=lib/creator-token-standards/lib/openzeppelin-contracts/",
    "@rari-capital/solmate/=lib/creator-token-standards/lib/PermitC/lib/solmate/",
    "ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/",
    "ERC721A/=lib/creator-token-standards/lib/ERC721A/contracts/",
    "PermitC/=lib/creator-token-standards/lib/PermitC/",
    "creator-token-standards/=lib/creator-token-standards/",
    "ds-test/=lib/solmate/lib/ds-test/src/",
    "erc4626-tests/=lib/creator-token-standards/lib/PermitC/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "erc721a/=lib/creator-token-standards/lib/ERC721A/",
    "forge-gas-metering/=lib/creator-token-standards/lib/PermitC/lib/forge-gas-metering/",
    "murky/=lib/creator-token-standards/lib/murky/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/creator-token-standards/lib/PermitC/lib/openzeppelin-contracts/contracts/",
    "solmate/=lib/solmate/src/",
    "tstorish/=lib/creator-token-standards/lib/tstorish/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_mintFeeAmount","type":"uint256"},{"internalType":"address","name":"_mintFeeRecipient","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"Access_MissingRoleOrAdmin","type":"error"},{"inputs":[],"name":"Access_OnlyAdmin","type":"error"},{"inputs":[],"name":"Access_WithdrawNotAllowed","type":"error"},{"inputs":[],"name":"Admin_InvalidCollectionSize","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"Collection_Aready_Revealed","type":"error"},{"inputs":[],"name":"Collection_TradingLocked","type":"error"},{"inputs":[],"name":"CreatorTokenBase__InvalidTransferValidatorContract","type":"error"},{"inputs":[],"name":"ExternalMetadataRenderer_CallFailed","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"Mint_SoldOut","type":"error"},{"inputs":[],"name":"NotCompatibleWithSpotMints","type":"error"},{"inputs":[],"name":"ONLY_OWNER","type":"error"},{"inputs":[],"name":"ONLY_PENDING_OWNER","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"Presale_ExceedStageSupply","type":"error"},{"inputs":[],"name":"Presale_Inactive","type":"error"},{"inputs":[],"name":"Presale_Invalid","type":"error"},{"inputs":[],"name":"Presale_MerkleNotApproved","type":"error"},{"inputs":[],"name":"Presale_TooManyForAddress","type":"error"},{"inputs":[],"name":"Purchase_TooManyForAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"correctPrice","type":"uint256"}],"name":"Purchase_WrongPrice","type":"error"},{"inputs":[],"name":"Sale_Inactive","type":"error"},{"inputs":[],"name":"SequentialMintExceedsLimit","type":"error"},{"inputs":[],"name":"SequentialUpToTooSmall","type":"error"},{"inputs":[],"name":"Setup_Presale_StageOutOfRange","type":"error"},{"inputs":[{"internalType":"uint16","name":"maxRoyaltyBPS","type":"uint16"}],"name":"Setup_RoyaltyPercentageTooHigh","type":"error"},{"inputs":[],"name":"ShouldNotMintToBurnAddress","type":"error"},{"inputs":[],"name":"SpotMintTokenIdTooSmall","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"Withdraw_FundsSendFailure","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":false,"internalType":"bool","name":"autoApproved","type":"bool"}],"name":"AutomaticApprovalOfTransferValidatorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"revealedBy","type":"address"}],"name":"CollectionRevealed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"changedBy","type":"address"},{"indexed":false,"internalType":"uint64","name":"newSize","type":"uint64"}],"name":"CollectionSizeReduced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"changedBy","type":"address"}],"name":"ContractStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"changedBy","type":"address"}],"name":"DynamicMetadataChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newAddress","type":"address"},{"indexed":true,"internalType":"address","name":"changedBy","type":"address"}],"name":"FundsRecipientChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"withdrawnBy","type":"address"},{"indexed":true,"internalType":"address","name":"withdrawnTo","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"feeRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"feeAmount","type":"uint256"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"changedBy","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"LockTradingStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"tokenContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"},{"indexed":false,"internalType":"string","name":"comment","type":"string"}],"name":"MintComment","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mintFeeAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"mintFeeRecipient","type":"address"},{"indexed":false,"internalType":"bool","name":"success","type":"bool"}],"name":"MintFeePayout","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"potentialNewOwner","type":"address"}],"name":"OwnerCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"potentialNewOwner","type":"address"}],"name":"OwnerPending","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"changedBy","type":"address"}],"name":"PresaleConfigChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"changedBy","type":"address"}],"name":"PublicSaleConfigChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"changedBy","type":"address"},{"indexed":false,"internalType":"uint256","name":"newPercentage","type":"uint256"},{"indexed":false,"internalType":"address","name":"newRecipient","type":"address"}],"name":"RoyaltyChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum IERC721Collection.PhaseType","name":"phase","type":"uint8"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"quantity","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"firstPurchasedTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"presaleStage","type":"uint256"}],"name":"Sale","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldValidator","type":"address"},{"indexed":false,"internalType":"address","name":"newValidator","type":"address"}],"name":"TransferValidatorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"contract IMetadataRenderer","name":"renderer","type":"address"}],"name":"UpdatedMetadataRenderer","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_TRANSFER_VALIDATOR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SALES_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"}],"name":"__ERC721ACQueryableInitializable_init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"activePresaleStageCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"adminMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"recipients","type":"address[]"}],"name":"adminMintAirdrop","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"autoApproveTransfersFromValidator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":"config","outputs":[{"internalType":"contract IMetadataRenderer","name":"metadataRenderer","type":"address"},{"internalType":"uint64","name":"collectionSize","type":"uint64"},{"internalType":"uint16","name":"royaltyBPS","type":"uint16"},{"internalType":"address payable","name":"fundsRecipient","type":"address"},{"internalType":"address payable","name":"royaltyRecipient","type":"address"},{"internalType":"bool","name":"revealed","type":"bool"},{"internalType":"bool","name":"lockBeforeMintOut","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721AUpgradeable.TokenOwnership","name":"ownership","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721AUpgradeable.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"feeForAmount","outputs":[{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"}],"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":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransferValidationFunction","outputs":[{"internalType":"bytes4","name":"functionSignature","type":"bytes4"},{"internalType":"bool","name":"isViewFunction","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getTransferValidator","outputs":[{"internalType":"address","name":"validator","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_contractName","type":"string"},{"internalType":"string","name":"_contractSymbol","type":"string"},{"internalType":"address","name":"_initialOwner","type":"address"},{"internalType":"address","name":"_fundsRecipient","type":"address"},{"internalType":"uint64","name":"_collectionSize","type":"uint64"},{"internalType":"uint16","name":"_royaltyBPS","type":"uint16"},{"internalType":"address","name":"_royaltyRecipient","type":"address"},{"internalType":"bytes[]","name":"_setupCalls","type":"bytes[]"},{"internalType":"bool","name":"_tradingLocked","type":"bool"},{"internalType":"bool","name":"_revealed","type":"bool"},{"internalType":"address","name":"_escrowHandler","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"isApproved","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadataRenderer","outputs":[{"internalType":"contract IMetadataRenderer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"}],"name":"mintedPerAddress","outputs":[{"components":[{"internalType":"uint256[]","name":"presaleMintsByStage","type":"uint256[]"},{"internalType":"uint256","name":"presaleMints","type":"uint256"},{"internalType":"uint256","name":"publicMints","type":"uint256"},{"internalType":"uint256","name":"totalMints","type":"uint256"}],"internalType":"struct IERC721Collection.AddressMintDetails","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"presaleConfig","outputs":[{"internalType":"string","name":"presaleName","type":"string"},{"internalType":"uint64","name":"presaleStart","type":"uint64"},{"internalType":"uint64","name":"presaleEnd","type":"uint64"},{"internalType":"uint104","name":"presalePrice","type":"uint104"},{"internalType":"uint32","name":"presaleMaxPurchasePerAddress","type":"uint32"},{"internalType":"uint32","name":"presaleSupply","type":"uint32"},{"internalType":"uint32","name":"presaleMinted","type":"uint32"},{"internalType":"bytes32","name":"presaleMerkleRoot","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"presaleMintedByAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSaleConfig","outputs":[{"internalType":"uint104","name":"publicSalePrice","type":"uint104"},{"internalType":"uint32","name":"maxSalePurchasePerAddress","type":"uint32"},{"internalType":"uint64","name":"publicSaleStart","type":"uint64"},{"internalType":"uint64","name":"publicSaleEnd","type":"uint64"},{"internalType":"bool","name":"publicSaleDisabled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"purchase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"stageIndex","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"maxQuantity","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"purchasePresale","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"stageIndex","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"maxQuantity","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"},{"internalType":"string","name":"comment","type":"string"}],"name":"purchasePresaleWithComment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"string","name":"comment","type":"string"}],"name":"purchaseWithComment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_newCollectionSize","type":"uint64"}],"name":"reduceSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"collectionURI","type":"string"},{"internalType":"string","name":"extension","type":"string"}],"name":"revealCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"autoApprove","type":"bool"}],"name":"setAutomaticApprovalOfTransfersFromValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"newRecipientAddress","type":"address"}],"name":"setFundsRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newRenderer","type":"address"},{"internalType":"bytes","name":"metadataBase","type":"bytes"},{"internalType":"bytes","name":"dynamicMetadataInfo","type":"bytes"}],"name":"setMetadataRenderer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"presaleName","type":"string"},{"internalType":"uint64","name":"presaleStart","type":"uint64"},{"internalType":"uint64","name":"presaleEnd","type":"uint64"},{"internalType":"uint104","name":"presalePrice","type":"uint104"},{"internalType":"uint32","name":"presaleMaxPurchasePerAddress","type":"uint32"},{"internalType":"uint32","name":"presaleSupply","type":"uint32"},{"internalType":"uint32","name":"presaleMinted","type":"uint32"},{"internalType":"bytes32","name":"presaleMerkleRoot","type":"bytes32"}],"internalType":"struct IERC721Collection.PresaleConfiguration[]","name":"presaleStages","type":"tuple[]"}],"name":"setPresaleConfiguration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint104","name":"publicSalePrice","type":"uint104"},{"internalType":"uint32","name":"maxSalePurchasePerAddress","type":"uint32"},{"internalType":"uint64","name":"publicSaleStart","type":"uint64"},{"internalType":"uint64","name":"publicSaleEnd","type":"uint64"},{"internalType":"bool","name":"publicSaleDisabled","type":"bool"}],"internalType":"struct IERC721Collection.PublicSaleConfiguration","name":"newConfig","type":"tuple"}],"name":"setPublicSaleConfiguration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_royaltyBPS","type":"uint16"},{"internalType":"address payable","name":"_royaltyRecipient","type":"address"}],"name":"setRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_locked","type":"bool"}],"name":"setTradingLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"transferValidator_","type":"address"}],"name":"setTransferValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

610140346102ac576001600160401b036161ff5f601f38839003908101601f19168501908482118683101761029857808691604095869485528339810103126102ac5783516020909401516001600160a01b03811693908490036102ac578251905f82527fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac8473721c0078c2328597ca70f5451fff5a7b38d4e94793846020820152a1813b610254575b5050600160025560086080526203345060a052600560c0527f5ebbf78043a2215b522b1366a193ec74dd1f54e441e841a87b9653246a9c49a660e052610100938452610120928352805460ff8160b81c166102005760ff808260b01c16106101be575b50505190615f4e92836102b18439608051838181615424015261554f015260a05183818161125b01526158ed015260c051838181612d8a0152613305015260e051838181610ebe015281816113ca01528181611f5701528181612a0801528181613008015281816130650152818161323e015281816132d4015281816139d70152613ea3015251828181611338015281816149120152818161500f015261589701525181818161136001526158bd0152f35b60ff60b01b191660ff60b01b179055805160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602090a15f8061010c565b825162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b6064820152608490fd5b813b156102ac575f8092604486518095819363fb2de5d760e01b83523060048401526102d160248401525af1156100a95790809250116102985781525f80806100a9565b634e487b7160e01b5f52604160045260245ffd5b5f80fdfe60806040526004361015610011575f80fd5b5f3560e01c8063014635461461041457806301ffc9a71461040f57806303ee27331461040a5780630608bdf81461040557806306b3f4611461040057806306fdde03146103fb578063081812fc146103f6578063095ea7b3146103f1578063098144d4146103ec5780630d705df6146103e757806310a7eb5d146103e257806313af4035146103dd57806318160ddd146103d857806323b872dd146103d3578063248a9ca3146103ce57806324d7806c146103c95780632a55205a146103c45780632bc350e1146103bf5780632f2ff15d146103ba57806336568abe146103b55780633ccfd60b146103b057806341ef421a146103ab57806342558f55146103a657806342842e0e146103a157806342966c681461039c5780634d27c543146103975780634e44ae5e14610392578063522dd5cd1461038d5780635bbb21771461038857806360e55adf146103835780636221d13c1461037e5780636352211e146103795780636a75944214610374578063703199701461036f57806370a082311461036a57806379502c55146103655780638462151c146103605780638da5cb5b1461035b57806391d148541461035657806395d89b411461035157806399a2557a1461034c5780639e05d24014610347578063a0a8e46014610342578063a217fddf1461033d578063a22cb46514610338578063a3fd2c4414610333578063a9fc664e1461032e578063ac9650d814610329578063b88d4fde14610324578063b8ae5a2c1461031f578063c23dc68f1461031a578063c7b7cae614610315578063c87b56dd14610310578063d445b9781461030b578063d547741f14610306578063da7b7f9f14610301578063e26bd343146102fc578063e58306f9146102f7578063e8a3d485146102f2578063e985e9c5146102ed578063efef39a1146102e8578063f73134d0146102e3578063ff47a7c3146102de5763ff92cd73146102d9575f80fd5b61329f565b613204565b6131ed565b61317e565b613140565b6130cc565b61302b565b612ff1565b612f6c565b612f0d565b612d53565b612c63565b612ba8565b612b45565b6129d0565b612943565b6128c9565b6127ff565b61279f565b6126f8565b6126de565b612699565b612633565b61248e565b6123dc565b61238a565b612362565b6121cf565b612117565b6120e8565b6120c0565b611f26565b611eb4565b611e90565b611c46565b611b76565b611b01565b611a4c565b611836565b61162b565b61144b565b611394565b61131d565b6111d4565b61113e565b61107c565b610fca565b610f0a565b610e68565b610e3b565b610c99565b610c1d565b610bd2565b610b4b565b610b24565b610af8565b610a50565b6109c0565b6108d4565b610882565b61078b565b6106a0565b610467565b610427565b5f91031261042357565b5f80fd5b34610423575f36600319011261042357602060405173721c0078c2328597ca70f5451fff5a7b38d4e9478152f35b6001600160e01b031981160361042357565b34610423576020366003190112610423576104ca60043561048781610455565b63ffffffff60e01b16637965db0b60e01b8114908115610557575b81156104f0575b81156104df575b81156104ce575b5060405190151581529081906020820190565b0390f35b63152a902d60e11b1490505f6104b7565b638da5cb5b60e01b811491506104b0565b9050632b435fdb60e21b81148015610547575b8015610510575b906104a9565b506301ffc9a760e01b81148015610537575b8061050a5750635b5e139f60e01b811461050a565b506380ac58cd60e01b8114610522565b5063503e914d60e11b8114610503565b6301ffc9a760e01b811491506104a2565b634e487b7160e01b5f52604160045260245ffd5b6001600160401b03811161058f57604052565b610568565b608081019081106001600160401b0382111761058f57604052565b61010081019081106001600160401b0382111761058f57604052565b602081019081106001600160401b0382111761058f57604052565b604081019081106001600160401b0382111761058f57604052565b90601f801991011681019081106001600160401b0382111761058f57604052565b6040519061062f82610594565b565b6001600160401b03811161058f57601f01601f191660200190565b92919261065882610631565b916106666040519384610601565b829481845281830111610423578281602093845f960137010152565b9080601f830112156104235781602061069d9335910161064c565b90565b6040366003190112610423576001600160401b03600435602435828111610423576106cf903690600401610682565b916106d8614832565b5f80516020615e198339815191525482015f1901908183116107535760045460a01c161061074157610708614886565b1561072f576104ca9161071a91614900565b60016002556040519081529081906020820190565b60405163f12dcc7f60e01b8152600490fd5b604051630717c51360e41b8152600490fd5b61354d565b6004359061ffff8216820361042357565b60a4359061ffff8216820361042357565b6001600160a01b0381160361042357565b34610423576040366003190112610423576107a4610758565b6024356107b08161077a565b335f9081525f80516020615df9833981519152602052604090205460ff1615610870576113888061ffff84161161085857506004805461ffff60e01b191660e084901b61ffff60e01b16179055600680546001600160a01b0319166001600160a01b039290921691821790556040805161ffff9093168352602083019190915233917f2820bfcf7b1a159978f13dbeb50640bc4abd2dea1eae87236232e3f3305ccc079190a2005b6024906040519063334074c160e11b82526004820152fd5b6040516302bd6bd160e01b8152600490fd5b34610423575f366003190112610423576020600954604051908152f35b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b90602061069d92818152019061089f565b34610423575f366003190112610423576040515f5f80516020615e9983398151915280549061090282611912565b80855291602091600191828116908115610993575060011461093b575b6104ca8661092f81880382610601565b604051918291826108c3565b5f90815293507f933ecf8acb7824b680a8d16f3ff3db8864228d986aa4c2ebab1eeb2703b4beb35b8385106109805750505050810160200161092f826104ca5f61091f565b8054868601840152938201938101610963565b90508695506104ca9693506020925061092f94915060ff191682840152151560051b82010192935f61091f565b34610423576020366003190112610423576004356109dd81614a8f565b15610a0c575f525f80516020615e79833981519152602052602060018060a01b0360405f205416604051908152f35b6333d1c03960e21b5f5260045ffd5b6044359061062f8261077a565b6064359061062f8261077a565b60c4359061062f8261077a565b610144359061062f8261077a565b604036600319011261042357600435610a688161077a565b602435906001600160a01b0380610a7e8461527b565b1690813303610adb575b835f525f80516020615e7983398151915260205260405f20921691826001600160601b0360a01b8254161790557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9255f80a4005b610ae5338361405f565b610a88576367d9dca160e11b5f5260045ffd5b34610423575f366003190112610423576020610b1261357c565b6040516001600160a01b039091168152f35b34610423575f366003190112610423576040805163657711f560e11b815260016020820152f35b3461042357602036600319011261042357600435610b688161077a565b335f9081525f80516020615df9833981519152602052604090205460ff161561087057600580546001600160a01b0319166001600160a01b0392909216918217905533907f70a7ea5c664ab9c21baf3da59bb2f1e1ca33557b08a0031fab4f1707674499515f80a3005b3461042357602036600319011261042357600435610bef8161077a565b335f9081525f80516020615df9833981519152602052604090205460ff161561087057610c1b90614b72565b005b34610423575f366003190112610423575f80516020615e19833981519152547f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c415460405191035f19018152602090f35b606090600319011261042357600435610c858161077a565b90602435610c928161077a565b9060443590565b610ca236610c6d565b906001600160401b0360045460a01c16925f80516020615e19833981519152935f198554011460ff60065460a81c169081610e32575b50610e2057610ce68361527b565b6001600160a01b0391821694818316869003610e1b575f8581525f80516020615e79833981519152602052604090208054610d346001600160a01b03891633908114908314171590565b1590565b610e04575b610d4487878a61592c565b610dfb575b50610d5386611ac9565b80545f19019055610d6384611ac9565b805460010190556001600160a01b0384164260a01b17600160e11b17610d88866118f8565b55600160e11b821615610dc1575b505081168281855f80516020615eb98339815191525f80a415610dbc57610c1b92615a3f565b614b19565b6001850190610dcf826118f8565b5415610ddc575b50610d96565b548103610dea575b80610dd6565b610df3906118f8565b555f80610de4565b5f90555f610d49565b610e11610d30338a61405f565b15610d3957614b0a565b614afc565b60405163a36e58c360e01b8152600490fd5b9050155f610cd8565b34610423576020366003190112610423576004355f5260016020526020600160405f200154604051908152f35b34610423576020366003190112610423576020600435610e878161077a565b5f8080526001835260408082206001600160a01b038416835260205290205460ff16908115610ebc575b506040519015158152f35b7f00000000000000000000000000000000000000000000000000000000000000005f9081526001845260408082206001600160a01b0390931682526020929092522060ff915054165f610eb1565b34610423576040366003190112610423576040610f286024356135cd565b82516001600160a01b0390921682526020820152f35b6001600160401b0381160361042357565b6084359061062f82610f3e565b9181601f84011215610423578235916001600160401b038311610423576020808501948460051b01011161042357565b6101043590811515820361042357565b6101243590811515820361042357565b60043590811515820361042357565b60843590811515820361042357565b3461042357610160366003190112610423576001600160401b0360043581811161042357610ffc903690600401610682565b60243582811161042357611014903690600401610682565b61101c610a1b565b611024610a28565b61102c610f4f565b90611035610769565b61103d610a35565b9060e43597881161042357611059610c1b983690600401610f5c565b949093611064610f8c565b9661106d610f9c565b98611076610a42565b9a613601565b346104235760403660031901126104235760243560043561109c8261077a565b805f5260016020526110b4600160405f200154614cc2565b5f8181526001602090815260408083206001600160a01b038616845290915290205460ff16156110e057005b5f8181526001602090815260408083206001600160a01b03861684529091529020805460ff1916600117905533916001600160a01b0316907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d5f80a4005b346104235760403660031901126104235760243561115b8161077a565b336001600160a01b0382160361117757610c1b90600435614c3a565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b34610423575f366003190112610423576111ec614832565b5f805260016020524761122a610d30611223335f80516020615df98339815191525b9060018060a01b03165f5260205260405f2090565b5460ff1690565b806112ff575b6112ed575f8080808461125961124d60055460018060a01b031690565b6001600160a01b031690565b7f0000000000000000000000000000000000000000000000000000000000000000f1611283613a00565b50156112db57600554604080519283525f60208401819052908301526001600160a01b03169033907f8a95554e4c9dcaaf33f247387f2ee77390780487d3365e3a804788791a1df50090606090a3610c1b6001600255565b6040516339debd5b60e01b8152600490fd5b604051631dab829b60e01b8152600490fd5b50600554611315906001600160a01b031661124d565b331415611230565b3461042357602036600319011261042357604061135c6004357f00000000000000000000000000000000000000000000000000000000000000006135ba565b81517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031681526020810191909152f35b34610423576020366003190112610423576113ad610fac565b335f9081525f80516020615df983398151915260205260409020547f00000000000000000000000000000000000000000000000000000000000000009060ff16158061141f575b61140157610c1b82613a2f565b6040516333ba055f60e21b81526004810191909152602490fd5b0390fd5b505f81815260016020908152604080832033845290915290206114469060ff905b54161590565b6113f4565b61145436610c6d565b6001600160401b0360049392935460a01c16905f80516020615e19833981519152915f19835401149160ff60065460a81c16808091611623575b610e20576040519361149f856105cb565b5f8552818061161b575b610e205781611612575b50610e20576114c18261527b565b6001600160a01b0385811692909190818316849003610e1b575f8581525f80516020615e7983398151915260205260409020805461150e6001600160a01b03871633908114908314171590565b6115fb575b61151e878b8861592c565b6115f2575b5061152d84611ac9565b80545f1901905561153d88611ac9565b805460010190556001600160a01b0388164260a01b17600160e11b17611562866118f8565b55600160e11b8216156115b8575b505085168281835f80516020615eb98339815191525f80a415610dbc57818561159892615a3f565b833b6115a057005b6115ad93610d3093615b09565b6115b357005b614b28565b60018501906115c6826118f8565b54156115d3575b50611570565b5481036115e1575b806115cd565b6115ea906118f8565b555f806115db565b5f90555f611523565b611608610d30338861405f565b1561151357614b0a565b9050155f6114b3565b5080156114a9565b50831561148e565b34610423576020366003190112610423576004356116488161527b565b906001600160a01b038216611674825f525f80516020615e7983398151915260205260405f2090815490565b939061168f6001600160a01b03841633908114908714171590565b6117a8575b61170d946116a285856159ad565b61179f575b506116b182611ac9565b80546fffffffffffffffffffffffffffffffff0190556001600160a01b0382164260a01b17600360e01b176116e5846118f8565b55600160e11b81161561175f575b50815f825f80516020615eb98339815191528280a46159ad565b610c1b61173b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c415460010190565b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4155565b6001830161176c816118f8565b5415611779575b506116f3565b5f80516020615e1983398151915254811461177357611797906118f8565b555f80611773565b5f90555f6116a7565b6117b5610d30338561405f565b1561169457614b0a565b6001600160401b03811161058f5760051b60200190565b9080601f830112156104235760209082356117f0816117bf565b936117fe6040519586610601565b81855260208086019260051b82010192831161042357602001905b828210611827575050505090565b81358152908301908301611819565b60a0366003190112610423576001600160401b03602435600435608435838111610423576118689036906004016117d6565b92611871614832565b5f80516020615e198339815191525483015f1901908184116107535760045460a01c1610610741576118a281614f02565b156118e6576104ca926118cc92604051926118bc846105cb565b5f84526064359160443591614f62565b6118d66001600255565b6040519081529081906020820190565b604051634af69e0d60e11b8152600490fd5b5f525f80516020615e3983398151915260205260405f2090565b90600182811c92168015611940575b602083101461192c57565b634e487b7160e01b5f52602260045260245ffd5b91607f1691611921565b9060405191825f825461195c81611912565b908184526020946001916001811690815f146119c8575060011461198a575b50505061062f92500383610601565b5f90815285812095935091905b8183106119b057505061062f93508201015f808061197b565b85548884018501529485019487945091830191611997565b9250505061062f94925060ff191682840152151560051b8201015f808061197b565b94919360e09694611a106001600160681b03939b9a99959b610100808a5289019061089f565b9a6001600160401b03809216602089015216604087015216606085015263ffffffff928380921660808601521660a08401521660c08201520152565b34610423576020366003190112610423576004355f52600a60205260405f20611a748161194a565b6104ca6001830154916001600160401b03936002810154600363ffffffff92015492604051968796848460401c1694808560201c169416926001600160681b038260801c1692808360401c16921690896119ea565b6001600160a01b03165f9081527f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c456020526040902090565b3461042357604036600319011261042357600435611b1e8161077a565b60018060a01b03165f52600b60205260405f206024355f52602052602060405f2054604051908152f35b602060031982011261042357600435906001600160401b03821161042357611b7291600401610f5c565b9091565b3461042357611b8436611b48565b906040519180835260051b906020916020818501016040525b80818015611bc257611bb990601f198091019385010135613db9565b90850152611b9d565b848660405190602082016020835281518091526020604084019201935f5b828110611bed5784840385f35b90919282608082611c376001948a5162ffffff6060809260018060a01b0381511685526001600160401b036020820151166020860152604081015115156040860152015116910152565b01960191019492919094611be0565b346104235760603660031901126104235760048035611c648161077a565b6001600160401b039060243582811161042357611c849036908501610682565b9160443590811161042357611c9c9036908501610682565b335f9081525f80516020615df98339815191526020526040908190205490939192919060ff1615611e8057600480546001600160a01b0319166001600160a01b0390931692909217909155611cfa9060208082518301019101613abe565b90928451611d1e81611d10858760208401613b19565b03601f198101835282610601565b8654611d32906001600160a01b031661124d565b91823b1561042357611d5c925f92838a8a5196879586948593636bbde00160e01b85528401613b19565b03925af18015611e6857611e6d575b508251611dcb575b84547f046c5d913c35948c3e0e44c3599eb14bf33b73f141fa8bb282b300414998b86890611dc69086906001600160a01b03165b90513381526001600160a01b0390911660208201529081906040820190565b0390a1005b8454929392611de2906001600160a01b031661124d565b803b1561042357611e0c945f80948651978895869485936342495a9560e01b8552308d8601613b3e565b03925af18015611e68577f046c5d913c35948c3e0e44c3599eb14bf33b73f141fa8bb282b300414998b86893611dc693611da792611e4f575b5093829350611d73565b80611e5c611e629261057c565b80610419565b5f611e45565b61382e565b80611e5c611e7a9261057c565b5f611d6b565b505050516302bd6bd160e01b8152fd5b34610423575f36600319011261042357602060ff5f5460a81c166040519015158152f35b346104235760203660031901126104235760206001600160a01b03611eda60043561527b565b16604051908152f35b906040600319830112610423576001600160401b036004358181116104235783611f0f91600401610682565b926024359182116104235761069d91600401610682565b3461042357611f3436611ee3565b335f9081525f80516020615df983398151915260205260409081902054909291907f00000000000000000000000000000000000000000000000000000000000000009060ff16158061209e575b612087575060065460a01c60ff1661207657600454611fa8906001600160a01b031661124d565b835163e8a3d48560e01b8152915f83600481855afa928315611e68575f93612052575b50813b15610423575f8094611ff69651968795869485936342495a9560e01b85523060048601613b3e565b03925af18015611e685761203f575b6006805460ff60a01b1916600160a01b179055337f2a10c355cd3f8130b128e45782d3e92e6c0b4ba2e844d06f49a48ee23f1f21f75f80a2005b80611e5c61204c9261057c565b5f612005565b61206f9193503d805f833e6120678183610601565b810190613b8b565b915f611fcb565b8251635c7fae3560e01b8152600490fd5b6024908451906333ba055f60e21b82526004820152fd5b505f818152600160209081528582203383529052604090205460ff1615611f81565b34610423575f366003190112610423576004546040516001600160a01b039091168152602090f35b3461042357602036600319011261042357602061210f60043561210a8161077a565b613bb0565b604051908152f35b34610423575f3660031901126104235760e060045460ff60018060a01b038060055416906006549161ffff6040519583811687526001600160401b038160a01c166020880152871c166040860152606085015281166080840152818160a01c16151560a084015260a81c16151560c0820152f35b9081518082526020808093019301915f5b8281106121aa575050505090565b83518552938101939281019260010161219c565b90602061069d92818152019061218b565b34610423576020366003190112610423576004356121ec8161077a565b5f80516020615e198339815191525460609060609160019180830361221a575b604051806104ca86826121be565b9091925082936060938281101561235d5761223482613bb0565b958661224d575b50505050506104ca91505f808061220c565b9091929394505f19840186811115612355575b506040926040519560059184890160051b88019889604052612280613d52565b905f91612293610d306040830151151590565b612343575b505f9591959887805b6122c1575b505050505050505050506104ca925081525f8080808061223b565b15612325575b5f966122d284615689565b808b0151156122ef575050875f935b0196888d8b529793976122a1565b939093518061231d575b50848418861b1561230c575b88906122e1565b99880180871b8c018b905299612305565b93505f6122f9565b808314801561233a575b156122c757806122a6565b50818a1461232f565b516001600160a01b031691505f612298565b95505f612260565b614b46565b34610423575f366003190112610423576003546040516001600160a01b039091168152602090f35b3461042357604036600319011261042357602060ff6123d06024356123ae8161077a565b6004355f526001845260405f209060018060a01b03165f5260205260405f2090565b54166040519015158152f35b34610423575f366003190112610423576040515f5f80516020615e5983398151915280549061240a82611912565b808552916020916001918281169081156109935750600114612436576104ca8661092f81880382610601565b5f90815293507f617167b76dcc8247761fd21f427ad8ec3be6b3be203aed34e3aac08b4d31817c5b83851061247b5750505050810160200161092f826104ca5f61091f565b805486860184015293820193810161245e565b346104235760608060031936011261042357600435906124ad8261077a565b6024359060443582936060938281101561235d57600180911061262b575b5f80516020615e198339815191525480841015612623575b506124ed82613bb0565b958381101561261b575b8661250b575b604051806104ca88826121be565b83819293949596500386811115612613575b506040926040519560059184890160051b8801988960405261253e85613db9565b905f91612551610d306040830151151590565b612601575b505f9591959887805b61257f575b505050505050505050506104ca925081525f808080806124fd565b156125e3575b5f9661259084615689565b808b0151156125ad575050875f935b0196888d8b5297939761255f565b93909351806125db575b50848418861b156125ca575b889061259f565b99880180871b8c018b9052996125c3565b93505f6125b7565b80831480156125f8575b156125855780612564565b50818a146125ed565b516001600160a01b031691505f612556565b95505f61251d565b5f96506124f7565b92505f6124e3565b9450846124cb565b34610423576020366003190112610423577f6787c7f9a80aa0f5ceddab2c54f1f5169c0b88e75dd5e19d5e858a64144c7dbc602061266f610fac565b6126776152f8565b15155f5460ff60a81b8260a81b169060ff60a81b1916175f55604051908152a1005b34610423575f366003190112610423576104ca6040516126b8816105e6565b60058152640312e302e360dc1b602082015260405191829160208352602083019061089f565b34610423575f3660031901126104235760206040515f8152f35b34610423576040366003190112610423576004356127158161077a565b6024359081151580920361042357335f9081527f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c476020526040902061275b90829061120e565b60ff1981541660ff841617905560405191825260018060a01b0316907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b34610423575f3660031901126104235760a060075460ff6001600160401b036008549080604051946001600160681b038116865263ffffffff8160681c16602087015260881c1660408501528116606084015260401c1615156080820152f35b346104235760203660031901126104235760043561281c8161077a565b6128246152f8565b6001600160a01b0381161515813b15816128c1575b506128af57807fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac610c1b9261286c61357c565b604080516001600160a01b03928316815292909116602083015290a15f80546001600160a81b031916600883901b610100600160a81b0316176001179055615350565b6040516332483afb60e01b8152600490fd5b90505f612839565b34610423576128e06128da36611b48565b90613ca2565b60405160209160208201926020835281518094526040830193602060408260051b8601019301915f955b8287106129175785850386f35b909192938280612933600193603f198a8203018652885161089f565b960192019601959291909261290a565b60803660031901126104235760043561295b8161077a565b602435906129688261077a565b6001600160401b036044356064358281116104235761298b903690600401610682565b9160045460a01c165f80516020615e19833981519152905f198254011460ff60065460a81c169081809261161b57610e2057816116125750610e20576114c18261527b565b34610423576129de36611b48565b335f9081525f80516020615df98339815191526020908152604091829020546001949293919291907f00000000000000000000000000000000000000000000000000000000000000009060ff161580612b23575b612b0c57505f80516020615e1983398151915254925f19928285018401808411610753576001600160401b0360045460a01c1610612afb5784838101955b868110612a92576104ca88612a8361566c565b90519081529081906020820190565b8181039085821015612af6575f8a8a5f80516020615ed98339815191526060839660051b890135612ac28161077a565b612acb8161541d565b858d612ad561566c565b865160028152969101868e01528501526001600160a01b031692a401612a70565b613be4565b8551630717c51360e41b8152600490fd5b6024908551906333ba055f60e21b82526004820152fd5b505f818152600160209081528682203383529052604090205460ff1615612a32565b34610423576020366003190112610423576080612b63600435613db9565b612ba6604051809262ffffff6060809260018060a01b0381511685526001600160401b036020820151166020860152604081015115156040860152015116910152565bf35b60c0366003190112610423576001600160401b036004602435813560843584811161042357612bda90369085016117d6565b9260a43585811161042357612bf29036908301610682565b94612bfb614832565b5f80516020615e198339815191525484015f19019081851161075357825460a01c1610612c5457612c2b82614f02565b15612c45576104ca61071a86866064356044358888614f62565b604051634af69e0d60e11b8152fd5b604051630717c51360e41b8152fd5b3461042357602036600319011261042357600435612c8081614a8f565b15612d0857600454612ccc915f916001600160a01b031660065460a01c60ff16604051630180d19360e51b81526004810193909352151560248301529092839190829081906044820190565b03915afa8015611e68576104ca915f91612cee575b50604051918291826108c3565b612d0291503d805f833e6120678183610601565b5f612ce1565b604051630a14c4b560e41b8152600490fd5b6020815260806060612d37845183602086015260a085019061218b565b9360208101516040850152604081015182850152015191015290565b34610423576020366003190112610423576104ca600435612d738161077a565b612d7b613e23565b50612d85336156ed565b612dae7f0000000000000000000000000000000000000000000000000000000000000000613e47565b91612dda612dcc8260018060a01b03165f52600b60205260405f2090565b60015f5260205260405f2090565b54612de484613c41565b526001600160a01b0381165f908152600b60205260409020612e0e9060025f5260205260405f2090565b54612e1884613c4e565b526001600160a01b0381165f908152600b60205260409020612e43905b60035f5260205260405f2090565b54612e4d84613c5e565b526001600160a01b0381165f908152600b60205260409020612e78905b60045f5260205260405f2090565b54612e8284613c6e565b526001600160a01b0381165f908152600b60205260409020612ead905b60055f5260205260405f2090565b54612eb784613c7e565b526001600160401b03612ee1612edb8483612ed186611ac9565b5460401c16613e79565b92611ac9565b5460401c1691612eef610622565b93845260208401526040830152606082015260405191829182612d1a565b3461042357604036600319011261042357610c1b602435600435612f308261077a565b805f526001602052612f48600160405f200154614cc2565b614c3a565b6001600160681b0381160361042357565b63ffffffff81160361042357565b346104235760a03660031901126104235760405160a08101908082106001600160401b0383111761058f57610c1b91604052600435612faa81612f4d565b8152602435612fb881612f5e565b6020820152604435612fc981610f3e565b6040820152606435612fda81610f3e565b6060820152612fe7610fbb565b6080820152613e86565b34610423575f3660031901126104235760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b34610423576040366003190112610423576004356130488161077a565b335f9081525f80516020615df983398151915260205260409020547f00000000000000000000000000000000000000000000000000000000000000009060ff1615806130a2575b611401576104ca6118d660243584613fdc565b505f81815260016020908152604080832033845290915290206130c79060ff90611440565b61308f565b34610423575f366003190112610423576004805460405163e8a3d48560e01b8152915f9183919082906001600160a01b03165afa8015611e68576104ca915f91613126575b5060405191829160208352602083019061089f565b61313a91503d805f833e6120678183610601565b5f613111565b346104235760403660031901126104235760206131746004356131628161077a565b6024359061316f8261077a565b61405f565b6040519015158152f35b602036600319011261042357600435613195614832565b5f80516020615e198339815191525481015f1901808211610753576001600160401b0360045460a01c1610610741576131cc614886565b1561072f576118cc6104ca91604051906131e5826105cb565b5f8252614900565b3461042357610c1b6131fe36611ee3565b906140dc565b346104235760203660031901126104235760043561322181610f3e565b335f9081525f80516020615df983398151915260205260409020547f00000000000000000000000000000000000000000000000000000000000000009060ff161580613275575b61140157610c1b82614244565b505f818152600160209081526040808320338452909152902061329a9060ff90611440565b613268565b34610423576132ad36611b48565b335f9081525f80516020615df98339815191526020908152604091829020546001949293907f00000000000000000000000000000000000000000000000000000000000000009060ff16158061352b575b612b0c57507f0000000000000000000000000000000000000000000000000000000000000000811161351a5761333381600955565b5f5b81811061336357337f6d682cb52ae97f85ae4d472de1318858441b30323437caaa4b9a2d923f8f22315f80a2005b806134b46133718893613561565b6134af61338e613389835f52600a60205260405f2090565b6142eb565b9184878b8b898c8801908d6001600160401b0391826133b485516001600160401b031690565b16801515908161350f575b50613508575b6134e3575b506134006133f46133e6866133e08a8a8961438a565b016143ac565b93516001600160401b031690565b6001600160401b031690565b9116116134ba575b61341b915092613421926134289461438a565b80613bf8565b369161064c565b835261345360606134448161343e898c8f61438a565b016143b6565b6001600160681b031690850152565b613479608061346d81613467898c8f61438a565b016143c0565b63ffffffff1690850152565b61348d60a061346d81613467898c8f61438a565b60e08061349b878a8d61438a565b0135908401525f52600a60205260405f2090565b614604565b01613335565b6134da936134cb936133e09261438a565b6001600160401b0316848c0152565b84878b8b613408565b6134f5613502916133e089898861438a565b6001600160401b03168352565b8d6133ca565b505f6133c5565b90504210155f6133bf565b835163194539c360e31b8152600490fd5b505f818152600160209081528682203383529052604090205460ff16156132fe565b634e487b7160e01b5f52601160045260245ffd5b906001820180921161075357565b9190820180921161075357565b5f54600881901c6001600160a01b0316919082156135975750565b60ff16156135a157565b73721c0078c2328597ca70f5451fff5a7b38d4e9479150565b8181029291811591840414171561075357565b6006546001600160a01b0316919082156135fc576135f86127109161ffff60045460e01c16906135ba565b0490565b505f90565b99979593919a98969492909a5f549b60ff8d60b81c1615809d819e613725575b8115613702575b50156136a6575f805460ff60b01b1916600160b01b17905561364e9b8d61368f57613737565b61365457565b5f805460ff60b81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602090a1565b5f805460ff60b81b1916600160b81b179055613737565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b303b15915081613714575b505f613628565b60b01c60ff1660011490505f61370d565b9050600160ff8260b01c161090613621565b9a989694929099979593915f80516020615ef9833981519152549a60ff8c60081c169b8c5f146138255750303b155b156137ba5761377b9b159c8d61379a57613839565b61378157565b5f80516020615ef9833981519152805461ff0019169055565b5f80516020615ef9833981519152805461ffff1916610101179055613839565b60405162461bcd60e51b815260206004820152603760248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e747261637460448201527f20697320616c726561647920696e697469616c697a65640000000000000000006064820152608490fd5b60ff1615613766565b6040513d5f823e3d90fd5b61394c999a9861392d986138ee9461396b9e61386061390f99966138b7969c9b999c6140dc565b61386982614b72565b6001600160a01b039a8b9180831690816139a457505061388b6138a993614df1565b1660018060a01b03166001600160601b0360a01b6005541617600555565b6138b233614df1565b613ca2565b506138c133614bb9565b6004805467ffffffffffffffff60a01b191660a09290921b67ffffffffffffffff60a01b16919091179055565b6004805461ffff60e01b191660e09290921b61ffff60e01b16919091179055565b1660018060a01b03166001600160601b0360a01b6006541617600655565b6006805460ff60a01b191691151560a01b60ff60a01b16919091179055565b6006805460ff60a81b191691151560a81b60ff60a81b16919091179055565b60653b156104235760405163388a0bbd60e11b81525f816004818360655af18015611e68576139975750565b80611e5c61062f9261057c565b6139fb9493506139d592506139b890614df1565b60018060a01b03166001600160601b0360a01b6005541617600555565b7f0000000000000000000000000000000000000000000000000000000000000000614e76565b6138a9565b3d15613a2a573d90613a1182610631565b91613a1f6040519384610601565b82523d5f602084013e565b606090565b151560065460ff60a81b8260a81b169060ff60a81b1916176006556040519081527f569e33d168bfc35ada8c9257e83cd5fba5d421727e6d3b1bf319b6e82dcb399d60203392a2565b81601f8201121561042357805190613a8f82610631565b92613a9d6040519485610601565b8284526020838301011161042357815f9260208093018386015e8301015290565b9091606082840312610423578151916001600160401b03928381116104235784613ae9918301613a78565b9360208201518481116104235781613b02918401613a78565b9360408301519081116104235761069d9201613a78565b9091613b3061069d9360408452604084019061089f565b91602081840391015261089f565b9493613b785f94613b6a608095613b869560018060a01b03168a5260a060208b015260a08a019061089f565b9088820360408a015261089f565b90868203606088015261089f565b930152565b906020828203126104235781516001600160401b0381116104235761069d9201613a78565b6001600160a01b03811615613bd557613bd06001600160401b0391611ac9565b541690565b6323d3ad8160e21b5f5260045ffd5b634e487b7160e01b5f52603260045260245ffd5b903590601e198136030182121561042357018035906001600160401b0382116104235760200191813603831361042357565b90821015612af657611b729160051b810190613bf8565b805115612af65760200190565b805160011015612af65760400190565b805160021015612af65760600190565b805160031015612af65760800190565b805160041015612af65760a00190565b8051821015612af65760209160051b010190565b919091613cae836117bf565b613cbb6040519182610601565b838152601f19613cca856117bf565b015f5b818110613d1d57505080935f5b818110613ce75750505050565b80613d01613cfb6134216001948689613c2a565b306153a7565b613d0b8286613c8e565b52613d168185613c8e565b5001613cda565b806060602080938601015201613ccd565b60405190613d3b82610594565b5f6060838281528260208201528260408201520152565b6001906001613d5f613d2e565b925f80516020615e1983398151915254600110613d7a575050565b809293505b613d8e575b61069d9150615689565b805f525f80516020615e3983398151915260205260405f2054613db4575f190181613d7f565b613d84565b90613dc2613d2e565b91600180821015613dd1575050565b5f80516020615e19833981519152548210613dea575050565b809293505b613dfd5761069d9150615689565b805f525f80516020615e3983398151915260205260405f2054613db4575f190181613def565b60405190613e3082610594565b5f6060838181528260208201528260408201520152565b90613e51826117bf565b613e5e6040519182610601565b8281528092613e6f601f19916117bf565b0190602036910137565b9190820391821161075357565b335f9081525f80516020615df983398151915260205260409020547f00000000000000000000000000000000000000000000000000000000000000009060ff161580613fb9575b613fa15750613f5d6080826001600160681b03613f7a9451166007549063ffffffff60681b602084015160681b16906001600160401b0360881b604085015160881b169266ffffffffffffff60c81b16171717600755613f56613f3a60608301516001600160401b031690565b6001600160401b03166001600160401b03196008541617600855565b0151151590565b60ff60401b60085491151560401b169060ff60401b191617600855565b337f19f44771468333d4fb6bcd1e2b860c3dbb5d00a38a1a5a2bd05d6eb6004c9abc5f80a2565b602490604051906333ba055f60e21b82526004820152fd5b505f81815260016020908152604080832033845290915290205460ff1615613ecd565b905f195f80516020615e1983398151915254820101808211610753576001600160401b0360045460a01c161061074157614016818361554d565b61401e61566c565b818103908111610753575f80516020615ed983398151915260605f946040519360038552602085015285604085015260018060a01b031692a461069d61566c565b6001600160a01b03165f9081527f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c476020526040902090919060ff906140a590849061120e565b54169182156140b2575b50565b60ff5f5460a81c166140c15750565b9091506001600160a01b03806140d561357c565b1691161490565b91906140fb60ff5f80516020615ef98339815191525460081c166157a3565b82516001600160401b03811161058f575f80516020615e998339815191529061412d816141288454611912565b6143ca565b602080601f83116001146141aa575090806141629261416996975f9261419f575b50508160011b915f199060031b1c19161790565b905561450b565b61417f60015f80516020615e1983398151915255565b61418761580c565b61418f615829565b61062f61419a61357c565b615350565b015190505f8061414e565b90601f198316966141e85f80516020615e998339815191525f527f933ecf8acb7824b680a8d16f3ff3db8864228d986aa4c2ebab1eeb2703b4beb390565b925f905b89821061422c57505090839291600194614169989910614214575b505050811b01905561450b565b01515f1960f88460031b161c191690555f8080614207565b806001859682949686015181550195019301906141ec565b6004546001600160401b03828116929160a01c1682108015906142d1575b6142bf576004805467ffffffffffffffff60a01b191660a09290921b67ffffffffffffffff60a01b169190911790556040519081527f2913fed19d080c1a117561858eb9911bfe1c9e32b3ed5cd19a455065f568468160203392a2565b6040516314dc7f9360e21b8152600490fd5b505f80516020615e19833981519152545f19018210614262565b906040516142f8816105af565b60e0600382946143078161194a565b84526143596001600160681b0360018301546143436001600160401b0380831660208a01528260401c1660408901906001600160401b03169052565b60801c1660608601906001600160681b03169052565b600281015463ffffffff8082166080870152602082901c811660a087015260409190911c1660c08501520154910152565b9190811015612af65760051b8101359060fe1981360301821215610423570190565b3561069d81610f3e565b3561069d81612f4d565b3561069d81612f5e565b601f81116143d6575050565b5f80516020615e998339815191525f527f933ecf8acb7824b680a8d16f3ff3db8864228d986aa4c2ebab1eeb2703b4beb3906020601f840160051c83019310614439575b601f0160051c01905b81811061442e575050565b5f8155600101614423565b909150819061441a565b601f811161444f575050565b5f80516020615e598339815191525f527f617167b76dcc8247761fd21f427ad8ec3be6b3be203aed34e3aac08b4d31817c906020601f840160051c830193106144b2575b601f0160051c01905b8181106144a7575050565b5f815560010161449c565b9091508190614493565b601f82116144c957505050565b5f5260205f20906020601f840160051c83019310614501575b601f0160051c01905b8181106144f6575050565b5f81556001016144eb565b90915081906144e2565b9081516001600160401b03811161058f575f80516020615e598339815191529061453e816145398454611912565b614443565b602080601f83116001146145735750819061456f9394955f9261419f5750508160011b915f199060031b1c19161790565b9055565b90601f198316956145b15f80516020615e598339815191525f527f617167b76dcc8247761fd21f427ad8ec3be6b3be203aed34e3aac08b4d31817c90565b925f905b8882106145ec575050836001959697106145d4575b505050811b019055565b01515f1960f88460031b161c191690555f80806145ca565b806001859682949686015181550195019301906145b5565b9080518051906001600160401b03821161058f5761462c826146268654611912565b866144bc565b602090816001601f8511146147c257508260e09360039593614662935f9261419f5750508160011b915f199060031b1c19161790565b84555b614729600185016146a061468360208501516001600160401b031690565b825467ffffffffffffffff19166001600160401b03909116178255565b6146e96146b760408501516001600160401b031690565b82546fffffffffffffffff0000000000000000191660409190911b6fffffffffffffffff000000000000000016178255565b60608301516001600160681b031681546cffffffffffffffffffffffffff60801b191660809190911b6cffffffffffffffffffffffffff60801b16179055565b6147bb6002850161475a614744608085015163ffffffff1690565b825463ffffffff191663ffffffff909116178255565b61479061476e60a085015163ffffffff1690565b825467ffffffff00000000191660209190911b67ffffffff0000000016178255565b60c083015163ffffffff165b63ffffffff60401b82549160401b169063ffffffff60401b1916179055565b0151910155565b9190601f1984166147d6875f5260205f2090565b935f905b82821061481a57505092600192859260e0966003989610614803575b505050811b018455614665565b01515f1983881b60f8161c191690555f80806147f6565b806001869782949787015181550196019401906147da565b60028054146148415760028055565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60085460ff8160401c161590816148d1575b816148b8575b816148a7575090565b90506001600160401b034291161190565b60075460881c6001600160401b0316421015915061489e565b60075460881c6001600160401b031615159150614898565b60409061069d93928152816020820152019061089f565b90600754906001600160681b038216917f00000000000000000000000000000000000000000000000000000000000000006149448561493f838761356f565b6135ba565b3403614a53575063ffffffff614959336156ed565b9160681c168015159182614a26575b5050614a1457614978833361554d565b6149898361498461566c565b613e79565b9283926149958261586e565b816040515f80516020615ed98339815191523391806149c7898260405f91939293606081019483825260208201520152565b0390a481516149d7575b50505090565b7fb9490aee663998179ad13f9e1c1eb6189c71ad1a9ec87f33ad2766f98d9a268a60405180614a0930953395836148e9565b0390a4805f806149d1565b604051630882ba5360e21b8152600490fd5b614a4b919250614984866001600160401b03614a4133611ac9565b5460401c1661356f565b115f80614968565b614a648561493f61141b938761356f565b60405163350e0bcf60e11b815260048101919091529081906024820190565b8015610753575f190190565b905f916001908060011115614aa2575050565b5f80516020615e19833981519152548110614abb575050565b90809293505f925b614ad4575b5050600160e01b161590565b909150614ae0826118f8565b549182614af757614af090614a83565b9080614ac3565b614ac8565b62a1148160e81b5f5260045ffd5b632ce44b5f60e11b5f5260045ffd5b633a954ecd60e21b5f5260045ffd5b6368d2bf6b60e11b5f5260045ffd5b636f96cda160e11b5f5260045ffd5b631960ccad60e11b5f5260045ffd5b63b562e8dd60e01b5f5260045ffd5b622e076360e81b5f5260045ffd5b6003546001600160a01b0391821691829082167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a36001600160a01b03191617600355565b6001600160a01b0381165f9081525f80516020615df9833981519152602052604090205460ff16614be75750565b6001600160a01b03165f8181525f80516020615df983398151915260205260408120805460ff191690553391907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b8180a4565b5f8181526001602090815260408083206001600160a01b038616845290915290205460ff16614c67575050565b5f8181526001602090815260408083206001600160a01b03861684529091529020805460ff1916905533916001600160a01b0316907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b5f80a4565b5f8181526001602081815260408084203385529091529091205490919060ff1615614ceb575050565b33614cf4615bb9565b926030614d0085613c41565b536078614d0c85615be5565b536029905b808211614dad5761141b614d78614d9587611d10614d3889614d338a15615c06565b615c51565b614d72604051958694614d72602087016017907f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081520190565b90615a91565b7001034b99036b4b9b9b4b733903937b6329607d1b815260110190565b60405162461bcd60e51b8152918291600483016108c3565b9091600f8116906010821015612af657614deb916f181899199a1a9b1b9c1cb0b131b232b360811b901a614de18588615bf5565b5360041c92614a83565b90614d11565b6001600160a01b0381165f9081525f80516020615df9833981519152602052604090205460ff1615614e205750565b6001600160a01b03165f8181525f80516020615df983398151915260205260408120805460ff191660011790553391907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4565b5f8181526001602090815260408083206001600160a01b038616845290915290205460ff1615614ea4575050565b5f8181526001602090815260408083206001600160a01b03861684529091529020805460ff1916600117905533916001600160a01b0316907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d5f80a4565b5f52600a602052600160405f2001546001600160401b0390818116918215159283614f40575b5082614f3357505090565b909150429160401c161190565b42101592505f614f28565b906040519160208301526020825261062f826105e6565b939194929094600954851161526957614f86613389865f52600a60205260405f2090565b90614fde610d3060e084015195604096614fd188516020810190614fc981611d108c8b3387604091949392606082019560018060a01b0316825260208201520152565b519020614f4b565b6020815191012091615aa3565b61525857615005614ff960608401516001600160681b031690565b6001600160681b031690565b808403615251575b7f00000000000000000000000000000000000000000000000000000000000000009061503d8961493f848461356f565b3403615221575050615062615059608084015163ffffffff1690565b63ffffffff1690565b90818103615219575b50335f908152600b6020526040902061509a9088906150949089905b905f5260205260405f2090565b5461356f565b116152085760a081019063ffffffff91826150b9825163ffffffff1690565b16151591826151cf575b50506151be57335f908152600b6020526040902086939291615127916150ea908890615087565b85815401905561479c6002615107895f52600a60205260405f2090565b0191861661511d835463ffffffff9060401c1690565b0163ffffffff1690565b615131833361554d565b61513a8361586e565b6151468361498461566c565b82516001815260208101829052604081019690965295869533905f80516020615ed983398151915290606090a48251615181575b5050505090565b7fb9490aee663998179ad13f9e1c1eb6189c71ad1a9ec87f33ad2766f98d9a268a9051806151b230953395836148e9565b0390a4805f808061517a565b8251630e5092e960e11b8152600490fd5b6152009192506151f56151ef61505960c061505994015163ffffffff1690565b8a61356f565b925163ffffffff1690565b105f806150c3565b825163a7b32bb160e01b8152600490fd5b90505f61506b565b6152338961493f61141b94899461356f565b905163350e0bcf60e11b815260048101919091529081906024820190565b508261500d565b83516342db872960e11b8152600490fd5b60405163038eae7b60e61b8152600490fd5b60019080600111614b375761528f816118f8565b549182156152ac575b5050600160e01b81161561069d5780614b37565b5f80516020615e1983398151915254821015614b375790815b15615298579091505f19016152d9816118f8565b549182156152f1575050600160e01b8116614b375790565b90816152c5565b6003546001600160a01b0316330361530c57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6001600160a01b0381169081615364575050565b3b61536c5750565b803b15610423575f809160446040518094819363fb2de5d760e01b83523060048401526102d160248401525af1156140af5761062f9061057c565b6040519060608201928284106001600160401b0385111761058f575f809161069d95604052602785527f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c6020860152660819985a5b195960ca1b6040860152602081519101845af4615417613a00565b91615cdb565b90600180927f0000000000000000000000000000000000000000000000000000000000000000935b15615542575b5f918481111561553b5784915b5f80516020615e1983398151915254908315615536576154798483836159fe565b6001600160a01b0381164260a01b6001861460e11b1717615499836118f8565b556154a381611ac9565b80546801000000000000000186020190556001600160a01b0381169586156155315784830195839860015b156154ee575b5f8a8a5f5f80516020615eb98339815191528180a46154ce565b9860010198878a036154d45796615528959399508694906149849397929950615522905f80516020615e1983398151915255565b896159fe565b91939092615445565b614b64565b614b55565b8091615458565b8161544b5750509050565b7f000000000000000000000000000000000000000000000000000000000000000092919060015b15615661575b5f918481111561565a5784915b5f80516020615e1983398151915254908315615536576155a88483836159fe565b6001600160a01b0381164260a01b6001861460e11b17176155c8836118f8565b556155d281611ac9565b80546801000000000000000186020190556001600160a01b0381169586156155315784830195839860015b1561561d575b5f8a8a5f5f80516020615eb98339815191528180a46155fd565b9860010198878a036156035796615651959399508694906149849397929950615522905f80516020615e1983398151915255565b91939092615574565b8091615587565b8161557a5750509050565b5f80516020615e19833981519152545f1981019081116107535790565b615691613d2e565b505f525f80516020615e3983398151915260205260405f20546156b2613d2e565b6001600160a01b038216815260a082901c6001600160401b03166020820152600160e01b82161515604082015260e89190911c606082015290565b6001600160a01b0381165f908152600b60209081526040808320600184529091528082205460028352912054810191908210610753576001600160a01b0381165f908152600b6020526040902061574390612e35565b548201809211610753576001600160a01b0381165f908152600b6020526040902061576d90612e6a565b548201809211610753576001600160a01b03165f908152600b6020526040902061579690612e9f565b5481018091116107535790565b156157aa57565b60405162461bcd60e51b815260206004820152603460248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e7472616374604482015273206973206e6f7420696e697469616c697a696e6760601b6064820152608490fd5b61062f60ff5f80516020615ef98339815191525460081c166157a3565b7fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac604080515f815273721c0078c2328597ca70f5451fff5a7b38d4e9476020820152a1565b60606158bb7f6f8da53cfedb8cc4f7935c3629624e50b63053c93bb2cad246aa4d3a2ba7d4ce927f00000000000000000000000000000000000000000000000000000000000000006135ba565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165f80808085857f0000000000000000000000000000000000000000000000000000000000000000f190615916613a00565b50604051928352602083015215156040820152a1565b90915f5b600190818110156159a657808301808411610753576001600160a01b038681161590861615808061599f575b1561597357604051635cbd944160e01b8152600490fd5b15615981575b505001615930565b1561598d575b80615979565b61599990868633615d6c565b5f615987565b508161595c565b5050505050565b5f5b600190818110156159f8578084018411610753576001600160a01b03831615806159f1575b156159eb57604051635cbd944160e01b8152600490fd5b016159af565b50816159d4565b50505050565b905f5b838110615a0e5750505050565b8082018211610753576001600160a01b038316615a3757604051635cbd944160e01b8152600490fd5b600101615a01565b5f5b600190818110156159a6578085018511610753576001600160a01b03838116159081615a86575b5015615a8057604051635cbd944160e01b8152600490fd5b01615a41565b90508416155f615a68565b805191908290602001825e015f815290565b929091905f915b8451831015615aec57615abd8386613c8e565b519081811015615adb575f52602052600160405f205b920191615aaa565b905f52602052600160405f20615ad3565b915092501490565b90816020910312610423575161069d81610455565b92602091615b51935f60018060a01b0360405180978196829584630a85bd0160e11b9c8d8652336004870152166024850152604484015260806064840152608483019061089f565b0393165af15f9181615b88575b50615b7a57615b6b613a00565b8051156115b357805190602001fd5b6001600160e01b0319161490565b615bab91925060203d602011615bb2575b615ba38183610601565b810190615af4565b905f615b5e565b503d615b99565b60405190606082018281106001600160401b0382111761058f57604052602a8252604082602036910137565b805160011015612af65760210190565b908151811015612af6570160200190565b15615c0d57565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b60405190615c5e82610594565b6042825260603660208401376030615c7583613c41565b536078615c8183615be5565b536041905b60018211615c995761069d915015615c06565b600f8116906010821015612af657615cd5916f181899199a1a9b1b9c1cb0b131b232b360811b901a615ccb8486615bf5565b5360041c91614a83565b90615c86565b91929015615d3d5750815115615cef575090565b3b15615cf85790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015615d505750805190602001fd5b60405162461bcd60e51b815290819061141b90600483016108c3565b9092916001600160a01b039182615d8161357c565b1680615d90575b505050505050565b803314615d8857803b15610423575f948460849481604051998a98899763657711f560e11b895216600488015216602486015216604484015260648301525afa8015611e6857615de5575b8080808080615d88565b80611e5c615df29261057c565b5f615ddb56fea6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb492569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c402569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c442569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c432569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c462569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c42ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef37a74b6f706970809184cf2c4d73c7baca71e081c7e9fd07291f31ba4618d10aee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85fa2646970667358221220e4eab07602f5992995b26dcce9c56eda55a20b51ca0f08a20d4c1bf554517d9764736f6c6343000819003300000000000000000000000000000000000000000000000002c68af0bb14000000000000000000000000000026c8ca628f088d11f37c66c9f87ac0fa87edab05

Deployed Bytecode

0x60806040526004361015610011575f80fd5b5f3560e01c8063014635461461041457806301ffc9a71461040f57806303ee27331461040a5780630608bdf81461040557806306b3f4611461040057806306fdde03146103fb578063081812fc146103f6578063095ea7b3146103f1578063098144d4146103ec5780630d705df6146103e757806310a7eb5d146103e257806313af4035146103dd57806318160ddd146103d857806323b872dd146103d3578063248a9ca3146103ce57806324d7806c146103c95780632a55205a146103c45780632bc350e1146103bf5780632f2ff15d146103ba57806336568abe146103b55780633ccfd60b146103b057806341ef421a146103ab57806342558f55146103a657806342842e0e146103a157806342966c681461039c5780634d27c543146103975780634e44ae5e14610392578063522dd5cd1461038d5780635bbb21771461038857806360e55adf146103835780636221d13c1461037e5780636352211e146103795780636a75944214610374578063703199701461036f57806370a082311461036a57806379502c55146103655780638462151c146103605780638da5cb5b1461035b57806391d148541461035657806395d89b411461035157806399a2557a1461034c5780639e05d24014610347578063a0a8e46014610342578063a217fddf1461033d578063a22cb46514610338578063a3fd2c4414610333578063a9fc664e1461032e578063ac9650d814610329578063b88d4fde14610324578063b8ae5a2c1461031f578063c23dc68f1461031a578063c7b7cae614610315578063c87b56dd14610310578063d445b9781461030b578063d547741f14610306578063da7b7f9f14610301578063e26bd343146102fc578063e58306f9146102f7578063e8a3d485146102f2578063e985e9c5146102ed578063efef39a1146102e8578063f73134d0146102e3578063ff47a7c3146102de5763ff92cd73146102d9575f80fd5b61329f565b613204565b6131ed565b61317e565b613140565b6130cc565b61302b565b612ff1565b612f6c565b612f0d565b612d53565b612c63565b612ba8565b612b45565b6129d0565b612943565b6128c9565b6127ff565b61279f565b6126f8565b6126de565b612699565b612633565b61248e565b6123dc565b61238a565b612362565b6121cf565b612117565b6120e8565b6120c0565b611f26565b611eb4565b611e90565b611c46565b611b76565b611b01565b611a4c565b611836565b61162b565b61144b565b611394565b61131d565b6111d4565b61113e565b61107c565b610fca565b610f0a565b610e68565b610e3b565b610c99565b610c1d565b610bd2565b610b4b565b610b24565b610af8565b610a50565b6109c0565b6108d4565b610882565b61078b565b6106a0565b610467565b610427565b5f91031261042357565b5f80fd5b34610423575f36600319011261042357602060405173721c0078c2328597ca70f5451fff5a7b38d4e9478152f35b6001600160e01b031981160361042357565b34610423576020366003190112610423576104ca60043561048781610455565b63ffffffff60e01b16637965db0b60e01b8114908115610557575b81156104f0575b81156104df575b81156104ce575b5060405190151581529081906020820190565b0390f35b63152a902d60e11b1490505f6104b7565b638da5cb5b60e01b811491506104b0565b9050632b435fdb60e21b81148015610547575b8015610510575b906104a9565b506301ffc9a760e01b81148015610537575b8061050a5750635b5e139f60e01b811461050a565b506380ac58cd60e01b8114610522565b5063503e914d60e11b8114610503565b6301ffc9a760e01b811491506104a2565b634e487b7160e01b5f52604160045260245ffd5b6001600160401b03811161058f57604052565b610568565b608081019081106001600160401b0382111761058f57604052565b61010081019081106001600160401b0382111761058f57604052565b602081019081106001600160401b0382111761058f57604052565b604081019081106001600160401b0382111761058f57604052565b90601f801991011681019081106001600160401b0382111761058f57604052565b6040519061062f82610594565b565b6001600160401b03811161058f57601f01601f191660200190565b92919261065882610631565b916106666040519384610601565b829481845281830111610423578281602093845f960137010152565b9080601f830112156104235781602061069d9335910161064c565b90565b6040366003190112610423576001600160401b03600435602435828111610423576106cf903690600401610682565b916106d8614832565b5f80516020615e198339815191525482015f1901908183116107535760045460a01c161061074157610708614886565b1561072f576104ca9161071a91614900565b60016002556040519081529081906020820190565b60405163f12dcc7f60e01b8152600490fd5b604051630717c51360e41b8152600490fd5b61354d565b6004359061ffff8216820361042357565b60a4359061ffff8216820361042357565b6001600160a01b0381160361042357565b34610423576040366003190112610423576107a4610758565b6024356107b08161077a565b335f9081525f80516020615df9833981519152602052604090205460ff1615610870576113888061ffff84161161085857506004805461ffff60e01b191660e084901b61ffff60e01b16179055600680546001600160a01b0319166001600160a01b039290921691821790556040805161ffff9093168352602083019190915233917f2820bfcf7b1a159978f13dbeb50640bc4abd2dea1eae87236232e3f3305ccc079190a2005b6024906040519063334074c160e11b82526004820152fd5b6040516302bd6bd160e01b8152600490fd5b34610423575f366003190112610423576020600954604051908152f35b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b90602061069d92818152019061089f565b34610423575f366003190112610423576040515f5f80516020615e9983398151915280549061090282611912565b80855291602091600191828116908115610993575060011461093b575b6104ca8661092f81880382610601565b604051918291826108c3565b5f90815293507f933ecf8acb7824b680a8d16f3ff3db8864228d986aa4c2ebab1eeb2703b4beb35b8385106109805750505050810160200161092f826104ca5f61091f565b8054868601840152938201938101610963565b90508695506104ca9693506020925061092f94915060ff191682840152151560051b82010192935f61091f565b34610423576020366003190112610423576004356109dd81614a8f565b15610a0c575f525f80516020615e79833981519152602052602060018060a01b0360405f205416604051908152f35b6333d1c03960e21b5f5260045ffd5b6044359061062f8261077a565b6064359061062f8261077a565b60c4359061062f8261077a565b610144359061062f8261077a565b604036600319011261042357600435610a688161077a565b602435906001600160a01b0380610a7e8461527b565b1690813303610adb575b835f525f80516020615e7983398151915260205260405f20921691826001600160601b0360a01b8254161790557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9255f80a4005b610ae5338361405f565b610a88576367d9dca160e11b5f5260045ffd5b34610423575f366003190112610423576020610b1261357c565b6040516001600160a01b039091168152f35b34610423575f366003190112610423576040805163657711f560e11b815260016020820152f35b3461042357602036600319011261042357600435610b688161077a565b335f9081525f80516020615df9833981519152602052604090205460ff161561087057600580546001600160a01b0319166001600160a01b0392909216918217905533907f70a7ea5c664ab9c21baf3da59bb2f1e1ca33557b08a0031fab4f1707674499515f80a3005b3461042357602036600319011261042357600435610bef8161077a565b335f9081525f80516020615df9833981519152602052604090205460ff161561087057610c1b90614b72565b005b34610423575f366003190112610423575f80516020615e19833981519152547f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c415460405191035f19018152602090f35b606090600319011261042357600435610c858161077a565b90602435610c928161077a565b9060443590565b610ca236610c6d565b906001600160401b0360045460a01c16925f80516020615e19833981519152935f198554011460ff60065460a81c169081610e32575b50610e2057610ce68361527b565b6001600160a01b0391821694818316869003610e1b575f8581525f80516020615e79833981519152602052604090208054610d346001600160a01b03891633908114908314171590565b1590565b610e04575b610d4487878a61592c565b610dfb575b50610d5386611ac9565b80545f19019055610d6384611ac9565b805460010190556001600160a01b0384164260a01b17600160e11b17610d88866118f8565b55600160e11b821615610dc1575b505081168281855f80516020615eb98339815191525f80a415610dbc57610c1b92615a3f565b614b19565b6001850190610dcf826118f8565b5415610ddc575b50610d96565b548103610dea575b80610dd6565b610df3906118f8565b555f80610de4565b5f90555f610d49565b610e11610d30338a61405f565b15610d3957614b0a565b614afc565b60405163a36e58c360e01b8152600490fd5b9050155f610cd8565b34610423576020366003190112610423576004355f5260016020526020600160405f200154604051908152f35b34610423576020366003190112610423576020600435610e878161077a565b5f8080526001835260408082206001600160a01b038416835260205290205460ff16908115610ebc575b506040519015158152f35b7f5ebbf78043a2215b522b1366a193ec74dd1f54e441e841a87b9653246a9c49a65f9081526001845260408082206001600160a01b0390931682526020929092522060ff915054165f610eb1565b34610423576040366003190112610423576040610f286024356135cd565b82516001600160a01b0390921682526020820152f35b6001600160401b0381160361042357565b6084359061062f82610f3e565b9181601f84011215610423578235916001600160401b038311610423576020808501948460051b01011161042357565b6101043590811515820361042357565b6101243590811515820361042357565b60043590811515820361042357565b60843590811515820361042357565b3461042357610160366003190112610423576001600160401b0360043581811161042357610ffc903690600401610682565b60243582811161042357611014903690600401610682565b61101c610a1b565b611024610a28565b61102c610f4f565b90611035610769565b61103d610a35565b9060e43597881161042357611059610c1b983690600401610f5c565b949093611064610f8c565b9661106d610f9c565b98611076610a42565b9a613601565b346104235760403660031901126104235760243560043561109c8261077a565b805f5260016020526110b4600160405f200154614cc2565b5f8181526001602090815260408083206001600160a01b038616845290915290205460ff16156110e057005b5f8181526001602090815260408083206001600160a01b03861684529091529020805460ff1916600117905533916001600160a01b0316907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d5f80a4005b346104235760403660031901126104235760243561115b8161077a565b336001600160a01b0382160361117757610c1b90600435614c3a565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b34610423575f366003190112610423576111ec614832565b5f805260016020524761122a610d30611223335f80516020615df98339815191525b9060018060a01b03165f5260205260405f2090565b5460ff1690565b806112ff575b6112ed575f8080808461125961124d60055460018060a01b031690565b6001600160a01b031690565b7f0000000000000000000000000000000000000000000000000000000000033450f1611283613a00565b50156112db57600554604080519283525f60208401819052908301526001600160a01b03169033907f8a95554e4c9dcaaf33f247387f2ee77390780487d3365e3a804788791a1df50090606090a3610c1b6001600255565b6040516339debd5b60e01b8152600490fd5b604051631dab829b60e01b8152600490fd5b50600554611315906001600160a01b031661124d565b331415611230565b3461042357602036600319011261042357604061135c6004357f00000000000000000000000000000000000000000000000002c68af0bb1400006135ba565b81517f00000000000000000000000026c8ca628f088d11f37c66c9f87ac0fa87edab056001600160a01b031681526020810191909152f35b34610423576020366003190112610423576113ad610fac565b335f9081525f80516020615df983398151915260205260409020547f5ebbf78043a2215b522b1366a193ec74dd1f54e441e841a87b9653246a9c49a69060ff16158061141f575b61140157610c1b82613a2f565b6040516333ba055f60e21b81526004810191909152602490fd5b0390fd5b505f81815260016020908152604080832033845290915290206114469060ff905b54161590565b6113f4565b61145436610c6d565b6001600160401b0360049392935460a01c16905f80516020615e19833981519152915f19835401149160ff60065460a81c16808091611623575b610e20576040519361149f856105cb565b5f8552818061161b575b610e205781611612575b50610e20576114c18261527b565b6001600160a01b0385811692909190818316849003610e1b575f8581525f80516020615e7983398151915260205260409020805461150e6001600160a01b03871633908114908314171590565b6115fb575b61151e878b8861592c565b6115f2575b5061152d84611ac9565b80545f1901905561153d88611ac9565b805460010190556001600160a01b0388164260a01b17600160e11b17611562866118f8565b55600160e11b8216156115b8575b505085168281835f80516020615eb98339815191525f80a415610dbc57818561159892615a3f565b833b6115a057005b6115ad93610d3093615b09565b6115b357005b614b28565b60018501906115c6826118f8565b54156115d3575b50611570565b5481036115e1575b806115cd565b6115ea906118f8565b555f806115db565b5f90555f611523565b611608610d30338861405f565b1561151357614b0a565b9050155f6114b3565b5080156114a9565b50831561148e565b34610423576020366003190112610423576004356116488161527b565b906001600160a01b038216611674825f525f80516020615e7983398151915260205260405f2090815490565b939061168f6001600160a01b03841633908114908714171590565b6117a8575b61170d946116a285856159ad565b61179f575b506116b182611ac9565b80546fffffffffffffffffffffffffffffffff0190556001600160a01b0382164260a01b17600360e01b176116e5846118f8565b55600160e11b81161561175f575b50815f825f80516020615eb98339815191528280a46159ad565b610c1b61173b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c415460010190565b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4155565b6001830161176c816118f8565b5415611779575b506116f3565b5f80516020615e1983398151915254811461177357611797906118f8565b555f80611773565b5f90555f6116a7565b6117b5610d30338561405f565b1561169457614b0a565b6001600160401b03811161058f5760051b60200190565b9080601f830112156104235760209082356117f0816117bf565b936117fe6040519586610601565b81855260208086019260051b82010192831161042357602001905b828210611827575050505090565b81358152908301908301611819565b60a0366003190112610423576001600160401b03602435600435608435838111610423576118689036906004016117d6565b92611871614832565b5f80516020615e198339815191525483015f1901908184116107535760045460a01c1610610741576118a281614f02565b156118e6576104ca926118cc92604051926118bc846105cb565b5f84526064359160443591614f62565b6118d66001600255565b6040519081529081906020820190565b604051634af69e0d60e11b8152600490fd5b5f525f80516020615e3983398151915260205260405f2090565b90600182811c92168015611940575b602083101461192c57565b634e487b7160e01b5f52602260045260245ffd5b91607f1691611921565b9060405191825f825461195c81611912565b908184526020946001916001811690815f146119c8575060011461198a575b50505061062f92500383610601565b5f90815285812095935091905b8183106119b057505061062f93508201015f808061197b565b85548884018501529485019487945091830191611997565b9250505061062f94925060ff191682840152151560051b8201015f808061197b565b94919360e09694611a106001600160681b03939b9a99959b610100808a5289019061089f565b9a6001600160401b03809216602089015216604087015216606085015263ffffffff928380921660808601521660a08401521660c08201520152565b34610423576020366003190112610423576004355f52600a60205260405f20611a748161194a565b6104ca6001830154916001600160401b03936002810154600363ffffffff92015492604051968796848460401c1694808560201c169416926001600160681b038260801c1692808360401c16921690896119ea565b6001600160a01b03165f9081527f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c456020526040902090565b3461042357604036600319011261042357600435611b1e8161077a565b60018060a01b03165f52600b60205260405f206024355f52602052602060405f2054604051908152f35b602060031982011261042357600435906001600160401b03821161042357611b7291600401610f5c565b9091565b3461042357611b8436611b48565b906040519180835260051b906020916020818501016040525b80818015611bc257611bb990601f198091019385010135613db9565b90850152611b9d565b848660405190602082016020835281518091526020604084019201935f5b828110611bed5784840385f35b90919282608082611c376001948a5162ffffff6060809260018060a01b0381511685526001600160401b036020820151166020860152604081015115156040860152015116910152565b01960191019492919094611be0565b346104235760603660031901126104235760048035611c648161077a565b6001600160401b039060243582811161042357611c849036908501610682565b9160443590811161042357611c9c9036908501610682565b335f9081525f80516020615df98339815191526020526040908190205490939192919060ff1615611e8057600480546001600160a01b0319166001600160a01b0390931692909217909155611cfa9060208082518301019101613abe565b90928451611d1e81611d10858760208401613b19565b03601f198101835282610601565b8654611d32906001600160a01b031661124d565b91823b1561042357611d5c925f92838a8a5196879586948593636bbde00160e01b85528401613b19565b03925af18015611e6857611e6d575b508251611dcb575b84547f046c5d913c35948c3e0e44c3599eb14bf33b73f141fa8bb282b300414998b86890611dc69086906001600160a01b03165b90513381526001600160a01b0390911660208201529081906040820190565b0390a1005b8454929392611de2906001600160a01b031661124d565b803b1561042357611e0c945f80948651978895869485936342495a9560e01b8552308d8601613b3e565b03925af18015611e68577f046c5d913c35948c3e0e44c3599eb14bf33b73f141fa8bb282b300414998b86893611dc693611da792611e4f575b5093829350611d73565b80611e5c611e629261057c565b80610419565b5f611e45565b61382e565b80611e5c611e7a9261057c565b5f611d6b565b505050516302bd6bd160e01b8152fd5b34610423575f36600319011261042357602060ff5f5460a81c166040519015158152f35b346104235760203660031901126104235760206001600160a01b03611eda60043561527b565b16604051908152f35b906040600319830112610423576001600160401b036004358181116104235783611f0f91600401610682565b926024359182116104235761069d91600401610682565b3461042357611f3436611ee3565b335f9081525f80516020615df983398151915260205260409081902054909291907f5ebbf78043a2215b522b1366a193ec74dd1f54e441e841a87b9653246a9c49a69060ff16158061209e575b612087575060065460a01c60ff1661207657600454611fa8906001600160a01b031661124d565b835163e8a3d48560e01b8152915f83600481855afa928315611e68575f93612052575b50813b15610423575f8094611ff69651968795869485936342495a9560e01b85523060048601613b3e565b03925af18015611e685761203f575b6006805460ff60a01b1916600160a01b179055337f2a10c355cd3f8130b128e45782d3e92e6c0b4ba2e844d06f49a48ee23f1f21f75f80a2005b80611e5c61204c9261057c565b5f612005565b61206f9193503d805f833e6120678183610601565b810190613b8b565b915f611fcb565b8251635c7fae3560e01b8152600490fd5b6024908451906333ba055f60e21b82526004820152fd5b505f818152600160209081528582203383529052604090205460ff1615611f81565b34610423575f366003190112610423576004546040516001600160a01b039091168152602090f35b3461042357602036600319011261042357602061210f60043561210a8161077a565b613bb0565b604051908152f35b34610423575f3660031901126104235760e060045460ff60018060a01b038060055416906006549161ffff6040519583811687526001600160401b038160a01c166020880152871c166040860152606085015281166080840152818160a01c16151560a084015260a81c16151560c0820152f35b9081518082526020808093019301915f5b8281106121aa575050505090565b83518552938101939281019260010161219c565b90602061069d92818152019061218b565b34610423576020366003190112610423576004356121ec8161077a565b5f80516020615e198339815191525460609060609160019180830361221a575b604051806104ca86826121be565b9091925082936060938281101561235d5761223482613bb0565b958661224d575b50505050506104ca91505f808061220c565b9091929394505f19840186811115612355575b506040926040519560059184890160051b88019889604052612280613d52565b905f91612293610d306040830151151590565b612343575b505f9591959887805b6122c1575b505050505050505050506104ca925081525f8080808061223b565b15612325575b5f966122d284615689565b808b0151156122ef575050875f935b0196888d8b529793976122a1565b939093518061231d575b50848418861b1561230c575b88906122e1565b99880180871b8c018b905299612305565b93505f6122f9565b808314801561233a575b156122c757806122a6565b50818a1461232f565b516001600160a01b031691505f612298565b95505f612260565b614b46565b34610423575f366003190112610423576003546040516001600160a01b039091168152602090f35b3461042357604036600319011261042357602060ff6123d06024356123ae8161077a565b6004355f526001845260405f209060018060a01b03165f5260205260405f2090565b54166040519015158152f35b34610423575f366003190112610423576040515f5f80516020615e5983398151915280549061240a82611912565b808552916020916001918281169081156109935750600114612436576104ca8661092f81880382610601565b5f90815293507f617167b76dcc8247761fd21f427ad8ec3be6b3be203aed34e3aac08b4d31817c5b83851061247b5750505050810160200161092f826104ca5f61091f565b805486860184015293820193810161245e565b346104235760608060031936011261042357600435906124ad8261077a565b6024359060443582936060938281101561235d57600180911061262b575b5f80516020615e198339815191525480841015612623575b506124ed82613bb0565b958381101561261b575b8661250b575b604051806104ca88826121be565b83819293949596500386811115612613575b506040926040519560059184890160051b8801988960405261253e85613db9565b905f91612551610d306040830151151590565b612601575b505f9591959887805b61257f575b505050505050505050506104ca925081525f808080806124fd565b156125e3575b5f9661259084615689565b808b0151156125ad575050875f935b0196888d8b5297939761255f565b93909351806125db575b50848418861b156125ca575b889061259f565b99880180871b8c018b9052996125c3565b93505f6125b7565b80831480156125f8575b156125855780612564565b50818a146125ed565b516001600160a01b031691505f612556565b95505f61251d565b5f96506124f7565b92505f6124e3565b9450846124cb565b34610423576020366003190112610423577f6787c7f9a80aa0f5ceddab2c54f1f5169c0b88e75dd5e19d5e858a64144c7dbc602061266f610fac565b6126776152f8565b15155f5460ff60a81b8260a81b169060ff60a81b1916175f55604051908152a1005b34610423575f366003190112610423576104ca6040516126b8816105e6565b60058152640312e302e360dc1b602082015260405191829160208352602083019061089f565b34610423575f3660031901126104235760206040515f8152f35b34610423576040366003190112610423576004356127158161077a565b6024359081151580920361042357335f9081527f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c476020526040902061275b90829061120e565b60ff1981541660ff841617905560405191825260018060a01b0316907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b34610423575f3660031901126104235760a060075460ff6001600160401b036008549080604051946001600160681b038116865263ffffffff8160681c16602087015260881c1660408501528116606084015260401c1615156080820152f35b346104235760203660031901126104235760043561281c8161077a565b6128246152f8565b6001600160a01b0381161515813b15816128c1575b506128af57807fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac610c1b9261286c61357c565b604080516001600160a01b03928316815292909116602083015290a15f80546001600160a81b031916600883901b610100600160a81b0316176001179055615350565b6040516332483afb60e01b8152600490fd5b90505f612839565b34610423576128e06128da36611b48565b90613ca2565b60405160209160208201926020835281518094526040830193602060408260051b8601019301915f955b8287106129175785850386f35b909192938280612933600193603f198a8203018652885161089f565b960192019601959291909261290a565b60803660031901126104235760043561295b8161077a565b602435906129688261077a565b6001600160401b036044356064358281116104235761298b903690600401610682565b9160045460a01c165f80516020615e19833981519152905f198254011460ff60065460a81c169081809261161b57610e2057816116125750610e20576114c18261527b565b34610423576129de36611b48565b335f9081525f80516020615df98339815191526020908152604091829020546001949293919291907f5ebbf78043a2215b522b1366a193ec74dd1f54e441e841a87b9653246a9c49a69060ff161580612b23575b612b0c57505f80516020615e1983398151915254925f19928285018401808411610753576001600160401b0360045460a01c1610612afb5784838101955b868110612a92576104ca88612a8361566c565b90519081529081906020820190565b8181039085821015612af6575f8a8a5f80516020615ed98339815191526060839660051b890135612ac28161077a565b612acb8161541d565b858d612ad561566c565b865160028152969101868e01528501526001600160a01b031692a401612a70565b613be4565b8551630717c51360e41b8152600490fd5b6024908551906333ba055f60e21b82526004820152fd5b505f818152600160209081528682203383529052604090205460ff1615612a32565b34610423576020366003190112610423576080612b63600435613db9565b612ba6604051809262ffffff6060809260018060a01b0381511685526001600160401b036020820151166020860152604081015115156040860152015116910152565bf35b60c0366003190112610423576001600160401b036004602435813560843584811161042357612bda90369085016117d6565b9260a43585811161042357612bf29036908301610682565b94612bfb614832565b5f80516020615e198339815191525484015f19019081851161075357825460a01c1610612c5457612c2b82614f02565b15612c45576104ca61071a86866064356044358888614f62565b604051634af69e0d60e11b8152fd5b604051630717c51360e41b8152fd5b3461042357602036600319011261042357600435612c8081614a8f565b15612d0857600454612ccc915f916001600160a01b031660065460a01c60ff16604051630180d19360e51b81526004810193909352151560248301529092839190829081906044820190565b03915afa8015611e68576104ca915f91612cee575b50604051918291826108c3565b612d0291503d805f833e6120678183610601565b5f612ce1565b604051630a14c4b560e41b8152600490fd5b6020815260806060612d37845183602086015260a085019061218b565b9360208101516040850152604081015182850152015191015290565b34610423576020366003190112610423576104ca600435612d738161077a565b612d7b613e23565b50612d85336156ed565b612dae7f0000000000000000000000000000000000000000000000000000000000000005613e47565b91612dda612dcc8260018060a01b03165f52600b60205260405f2090565b60015f5260205260405f2090565b54612de484613c41565b526001600160a01b0381165f908152600b60205260409020612e0e9060025f5260205260405f2090565b54612e1884613c4e565b526001600160a01b0381165f908152600b60205260409020612e43905b60035f5260205260405f2090565b54612e4d84613c5e565b526001600160a01b0381165f908152600b60205260409020612e78905b60045f5260205260405f2090565b54612e8284613c6e565b526001600160a01b0381165f908152600b60205260409020612ead905b60055f5260205260405f2090565b54612eb784613c7e565b526001600160401b03612ee1612edb8483612ed186611ac9565b5460401c16613e79565b92611ac9565b5460401c1691612eef610622565b93845260208401526040830152606082015260405191829182612d1a565b3461042357604036600319011261042357610c1b602435600435612f308261077a565b805f526001602052612f48600160405f200154614cc2565b614c3a565b6001600160681b0381160361042357565b63ffffffff81160361042357565b346104235760a03660031901126104235760405160a08101908082106001600160401b0383111761058f57610c1b91604052600435612faa81612f4d565b8152602435612fb881612f5e565b6020820152604435612fc981610f3e565b6040820152606435612fda81610f3e565b6060820152612fe7610fbb565b6080820152613e86565b34610423575f3660031901126104235760206040517f5ebbf78043a2215b522b1366a193ec74dd1f54e441e841a87b9653246a9c49a68152f35b34610423576040366003190112610423576004356130488161077a565b335f9081525f80516020615df983398151915260205260409020547f5ebbf78043a2215b522b1366a193ec74dd1f54e441e841a87b9653246a9c49a69060ff1615806130a2575b611401576104ca6118d660243584613fdc565b505f81815260016020908152604080832033845290915290206130c79060ff90611440565b61308f565b34610423575f366003190112610423576004805460405163e8a3d48560e01b8152915f9183919082906001600160a01b03165afa8015611e68576104ca915f91613126575b5060405191829160208352602083019061089f565b61313a91503d805f833e6120678183610601565b5f613111565b346104235760403660031901126104235760206131746004356131628161077a565b6024359061316f8261077a565b61405f565b6040519015158152f35b602036600319011261042357600435613195614832565b5f80516020615e198339815191525481015f1901808211610753576001600160401b0360045460a01c1610610741576131cc614886565b1561072f576118cc6104ca91604051906131e5826105cb565b5f8252614900565b3461042357610c1b6131fe36611ee3565b906140dc565b346104235760203660031901126104235760043561322181610f3e565b335f9081525f80516020615df983398151915260205260409020547f5ebbf78043a2215b522b1366a193ec74dd1f54e441e841a87b9653246a9c49a69060ff161580613275575b61140157610c1b82614244565b505f818152600160209081526040808320338452909152902061329a9060ff90611440565b613268565b34610423576132ad36611b48565b335f9081525f80516020615df98339815191526020908152604091829020546001949293907f5ebbf78043a2215b522b1366a193ec74dd1f54e441e841a87b9653246a9c49a69060ff16158061352b575b612b0c57507f0000000000000000000000000000000000000000000000000000000000000005811161351a5761333381600955565b5f5b81811061336357337f6d682cb52ae97f85ae4d472de1318858441b30323437caaa4b9a2d923f8f22315f80a2005b806134b46133718893613561565b6134af61338e613389835f52600a60205260405f2090565b6142eb565b9184878b8b898c8801908d6001600160401b0391826133b485516001600160401b031690565b16801515908161350f575b50613508575b6134e3575b506134006133f46133e6866133e08a8a8961438a565b016143ac565b93516001600160401b031690565b6001600160401b031690565b9116116134ba575b61341b915092613421926134289461438a565b80613bf8565b369161064c565b835261345360606134448161343e898c8f61438a565b016143b6565b6001600160681b031690850152565b613479608061346d81613467898c8f61438a565b016143c0565b63ffffffff1690850152565b61348d60a061346d81613467898c8f61438a565b60e08061349b878a8d61438a565b0135908401525f52600a60205260405f2090565b614604565b01613335565b6134da936134cb936133e09261438a565b6001600160401b0316848c0152565b84878b8b613408565b6134f5613502916133e089898861438a565b6001600160401b03168352565b8d6133ca565b505f6133c5565b90504210155f6133bf565b835163194539c360e31b8152600490fd5b505f818152600160209081528682203383529052604090205460ff16156132fe565b634e487b7160e01b5f52601160045260245ffd5b906001820180921161075357565b9190820180921161075357565b5f54600881901c6001600160a01b0316919082156135975750565b60ff16156135a157565b73721c0078c2328597ca70f5451fff5a7b38d4e9479150565b8181029291811591840414171561075357565b6006546001600160a01b0316919082156135fc576135f86127109161ffff60045460e01c16906135ba565b0490565b505f90565b99979593919a98969492909a5f549b60ff8d60b81c1615809d819e613725575b8115613702575b50156136a6575f805460ff60b01b1916600160b01b17905561364e9b8d61368f57613737565b61365457565b5f805460ff60b81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602090a1565b5f805460ff60b81b1916600160b81b179055613737565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b303b15915081613714575b505f613628565b60b01c60ff1660011490505f61370d565b9050600160ff8260b01c161090613621565b9a989694929099979593915f80516020615ef9833981519152549a60ff8c60081c169b8c5f146138255750303b155b156137ba5761377b9b159c8d61379a57613839565b61378157565b5f80516020615ef9833981519152805461ff0019169055565b5f80516020615ef9833981519152805461ffff1916610101179055613839565b60405162461bcd60e51b815260206004820152603760248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e747261637460448201527f20697320616c726561647920696e697469616c697a65640000000000000000006064820152608490fd5b60ff1615613766565b6040513d5f823e3d90fd5b61394c999a9861392d986138ee9461396b9e61386061390f99966138b7969c9b999c6140dc565b61386982614b72565b6001600160a01b039a8b9180831690816139a457505061388b6138a993614df1565b1660018060a01b03166001600160601b0360a01b6005541617600555565b6138b233614df1565b613ca2565b506138c133614bb9565b6004805467ffffffffffffffff60a01b191660a09290921b67ffffffffffffffff60a01b16919091179055565b6004805461ffff60e01b191660e09290921b61ffff60e01b16919091179055565b1660018060a01b03166001600160601b0360a01b6006541617600655565b6006805460ff60a01b191691151560a01b60ff60a01b16919091179055565b6006805460ff60a81b191691151560a81b60ff60a81b16919091179055565b60653b156104235760405163388a0bbd60e11b81525f816004818360655af18015611e68576139975750565b80611e5c61062f9261057c565b6139fb9493506139d592506139b890614df1565b60018060a01b03166001600160601b0360a01b6005541617600555565b7f5ebbf78043a2215b522b1366a193ec74dd1f54e441e841a87b9653246a9c49a6614e76565b6138a9565b3d15613a2a573d90613a1182610631565b91613a1f6040519384610601565b82523d5f602084013e565b606090565b151560065460ff60a81b8260a81b169060ff60a81b1916176006556040519081527f569e33d168bfc35ada8c9257e83cd5fba5d421727e6d3b1bf319b6e82dcb399d60203392a2565b81601f8201121561042357805190613a8f82610631565b92613a9d6040519485610601565b8284526020838301011161042357815f9260208093018386015e8301015290565b9091606082840312610423578151916001600160401b03928381116104235784613ae9918301613a78565b9360208201518481116104235781613b02918401613a78565b9360408301519081116104235761069d9201613a78565b9091613b3061069d9360408452604084019061089f565b91602081840391015261089f565b9493613b785f94613b6a608095613b869560018060a01b03168a5260a060208b015260a08a019061089f565b9088820360408a015261089f565b90868203606088015261089f565b930152565b906020828203126104235781516001600160401b0381116104235761069d9201613a78565b6001600160a01b03811615613bd557613bd06001600160401b0391611ac9565b541690565b6323d3ad8160e21b5f5260045ffd5b634e487b7160e01b5f52603260045260245ffd5b903590601e198136030182121561042357018035906001600160401b0382116104235760200191813603831361042357565b90821015612af657611b729160051b810190613bf8565b805115612af65760200190565b805160011015612af65760400190565b805160021015612af65760600190565b805160031015612af65760800190565b805160041015612af65760a00190565b8051821015612af65760209160051b010190565b919091613cae836117bf565b613cbb6040519182610601565b838152601f19613cca856117bf565b015f5b818110613d1d57505080935f5b818110613ce75750505050565b80613d01613cfb6134216001948689613c2a565b306153a7565b613d0b8286613c8e565b52613d168185613c8e565b5001613cda565b806060602080938601015201613ccd565b60405190613d3b82610594565b5f6060838281528260208201528260408201520152565b6001906001613d5f613d2e565b925f80516020615e1983398151915254600110613d7a575050565b809293505b613d8e575b61069d9150615689565b805f525f80516020615e3983398151915260205260405f2054613db4575f190181613d7f565b613d84565b90613dc2613d2e565b91600180821015613dd1575050565b5f80516020615e19833981519152548210613dea575050565b809293505b613dfd5761069d9150615689565b805f525f80516020615e3983398151915260205260405f2054613db4575f190181613def565b60405190613e3082610594565b5f6060838181528260208201528260408201520152565b90613e51826117bf565b613e5e6040519182610601565b8281528092613e6f601f19916117bf565b0190602036910137565b9190820391821161075357565b335f9081525f80516020615df983398151915260205260409020547f5ebbf78043a2215b522b1366a193ec74dd1f54e441e841a87b9653246a9c49a69060ff161580613fb9575b613fa15750613f5d6080826001600160681b03613f7a9451166007549063ffffffff60681b602084015160681b16906001600160401b0360881b604085015160881b169266ffffffffffffff60c81b16171717600755613f56613f3a60608301516001600160401b031690565b6001600160401b03166001600160401b03196008541617600855565b0151151590565b60ff60401b60085491151560401b169060ff60401b191617600855565b337f19f44771468333d4fb6bcd1e2b860c3dbb5d00a38a1a5a2bd05d6eb6004c9abc5f80a2565b602490604051906333ba055f60e21b82526004820152fd5b505f81815260016020908152604080832033845290915290205460ff1615613ecd565b905f195f80516020615e1983398151915254820101808211610753576001600160401b0360045460a01c161061074157614016818361554d565b61401e61566c565b818103908111610753575f80516020615ed983398151915260605f946040519360038552602085015285604085015260018060a01b031692a461069d61566c565b6001600160a01b03165f9081527f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c476020526040902090919060ff906140a590849061120e565b54169182156140b2575b50565b60ff5f5460a81c166140c15750565b9091506001600160a01b03806140d561357c565b1691161490565b91906140fb60ff5f80516020615ef98339815191525460081c166157a3565b82516001600160401b03811161058f575f80516020615e998339815191529061412d816141288454611912565b6143ca565b602080601f83116001146141aa575090806141629261416996975f9261419f575b50508160011b915f199060031b1c19161790565b905561450b565b61417f60015f80516020615e1983398151915255565b61418761580c565b61418f615829565b61062f61419a61357c565b615350565b015190505f8061414e565b90601f198316966141e85f80516020615e998339815191525f527f933ecf8acb7824b680a8d16f3ff3db8864228d986aa4c2ebab1eeb2703b4beb390565b925f905b89821061422c57505090839291600194614169989910614214575b505050811b01905561450b565b01515f1960f88460031b161c191690555f8080614207565b806001859682949686015181550195019301906141ec565b6004546001600160401b03828116929160a01c1682108015906142d1575b6142bf576004805467ffffffffffffffff60a01b191660a09290921b67ffffffffffffffff60a01b169190911790556040519081527f2913fed19d080c1a117561858eb9911bfe1c9e32b3ed5cd19a455065f568468160203392a2565b6040516314dc7f9360e21b8152600490fd5b505f80516020615e19833981519152545f19018210614262565b906040516142f8816105af565b60e0600382946143078161194a565b84526143596001600160681b0360018301546143436001600160401b0380831660208a01528260401c1660408901906001600160401b03169052565b60801c1660608601906001600160681b03169052565b600281015463ffffffff8082166080870152602082901c811660a087015260409190911c1660c08501520154910152565b9190811015612af65760051b8101359060fe1981360301821215610423570190565b3561069d81610f3e565b3561069d81612f4d565b3561069d81612f5e565b601f81116143d6575050565b5f80516020615e998339815191525f527f933ecf8acb7824b680a8d16f3ff3db8864228d986aa4c2ebab1eeb2703b4beb3906020601f840160051c83019310614439575b601f0160051c01905b81811061442e575050565b5f8155600101614423565b909150819061441a565b601f811161444f575050565b5f80516020615e598339815191525f527f617167b76dcc8247761fd21f427ad8ec3be6b3be203aed34e3aac08b4d31817c906020601f840160051c830193106144b2575b601f0160051c01905b8181106144a7575050565b5f815560010161449c565b9091508190614493565b601f82116144c957505050565b5f5260205f20906020601f840160051c83019310614501575b601f0160051c01905b8181106144f6575050565b5f81556001016144eb565b90915081906144e2565b9081516001600160401b03811161058f575f80516020615e598339815191529061453e816145398454611912565b614443565b602080601f83116001146145735750819061456f9394955f9261419f5750508160011b915f199060031b1c19161790565b9055565b90601f198316956145b15f80516020615e598339815191525f527f617167b76dcc8247761fd21f427ad8ec3be6b3be203aed34e3aac08b4d31817c90565b925f905b8882106145ec575050836001959697106145d4575b505050811b019055565b01515f1960f88460031b161c191690555f80806145ca565b806001859682949686015181550195019301906145b5565b9080518051906001600160401b03821161058f5761462c826146268654611912565b866144bc565b602090816001601f8511146147c257508260e09360039593614662935f9261419f5750508160011b915f199060031b1c19161790565b84555b614729600185016146a061468360208501516001600160401b031690565b825467ffffffffffffffff19166001600160401b03909116178255565b6146e96146b760408501516001600160401b031690565b82546fffffffffffffffff0000000000000000191660409190911b6fffffffffffffffff000000000000000016178255565b60608301516001600160681b031681546cffffffffffffffffffffffffff60801b191660809190911b6cffffffffffffffffffffffffff60801b16179055565b6147bb6002850161475a614744608085015163ffffffff1690565b825463ffffffff191663ffffffff909116178255565b61479061476e60a085015163ffffffff1690565b825467ffffffff00000000191660209190911b67ffffffff0000000016178255565b60c083015163ffffffff165b63ffffffff60401b82549160401b169063ffffffff60401b1916179055565b0151910155565b9190601f1984166147d6875f5260205f2090565b935f905b82821061481a57505092600192859260e0966003989610614803575b505050811b018455614665565b01515f1983881b60f8161c191690555f80806147f6565b806001869782949787015181550196019401906147da565b60028054146148415760028055565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60085460ff8160401c161590816148d1575b816148b8575b816148a7575090565b90506001600160401b034291161190565b60075460881c6001600160401b0316421015915061489e565b60075460881c6001600160401b031615159150614898565b60409061069d93928152816020820152019061089f565b90600754906001600160681b038216917f00000000000000000000000000000000000000000000000002c68af0bb1400006149448561493f838761356f565b6135ba565b3403614a53575063ffffffff614959336156ed565b9160681c168015159182614a26575b5050614a1457614978833361554d565b6149898361498461566c565b613e79565b9283926149958261586e565b816040515f80516020615ed98339815191523391806149c7898260405f91939293606081019483825260208201520152565b0390a481516149d7575b50505090565b7fb9490aee663998179ad13f9e1c1eb6189c71ad1a9ec87f33ad2766f98d9a268a60405180614a0930953395836148e9565b0390a4805f806149d1565b604051630882ba5360e21b8152600490fd5b614a4b919250614984866001600160401b03614a4133611ac9565b5460401c1661356f565b115f80614968565b614a648561493f61141b938761356f565b60405163350e0bcf60e11b815260048101919091529081906024820190565b8015610753575f190190565b905f916001908060011115614aa2575050565b5f80516020615e19833981519152548110614abb575050565b90809293505f925b614ad4575b5050600160e01b161590565b909150614ae0826118f8565b549182614af757614af090614a83565b9080614ac3565b614ac8565b62a1148160e81b5f5260045ffd5b632ce44b5f60e11b5f5260045ffd5b633a954ecd60e21b5f5260045ffd5b6368d2bf6b60e11b5f5260045ffd5b636f96cda160e11b5f5260045ffd5b631960ccad60e11b5f5260045ffd5b63b562e8dd60e01b5f5260045ffd5b622e076360e81b5f5260045ffd5b6003546001600160a01b0391821691829082167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a36001600160a01b03191617600355565b6001600160a01b0381165f9081525f80516020615df9833981519152602052604090205460ff16614be75750565b6001600160a01b03165f8181525f80516020615df983398151915260205260408120805460ff191690553391907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b8180a4565b5f8181526001602090815260408083206001600160a01b038616845290915290205460ff16614c67575050565b5f8181526001602090815260408083206001600160a01b03861684529091529020805460ff1916905533916001600160a01b0316907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b5f80a4565b5f8181526001602081815260408084203385529091529091205490919060ff1615614ceb575050565b33614cf4615bb9565b926030614d0085613c41565b536078614d0c85615be5565b536029905b808211614dad5761141b614d78614d9587611d10614d3889614d338a15615c06565b615c51565b614d72604051958694614d72602087016017907f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081520190565b90615a91565b7001034b99036b4b9b9b4b733903937b6329607d1b815260110190565b60405162461bcd60e51b8152918291600483016108c3565b9091600f8116906010821015612af657614deb916f181899199a1a9b1b9c1cb0b131b232b360811b901a614de18588615bf5565b5360041c92614a83565b90614d11565b6001600160a01b0381165f9081525f80516020615df9833981519152602052604090205460ff1615614e205750565b6001600160a01b03165f8181525f80516020615df983398151915260205260408120805460ff191660011790553391907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4565b5f8181526001602090815260408083206001600160a01b038616845290915290205460ff1615614ea4575050565b5f8181526001602090815260408083206001600160a01b03861684529091529020805460ff1916600117905533916001600160a01b0316907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d5f80a4565b5f52600a602052600160405f2001546001600160401b0390818116918215159283614f40575b5082614f3357505090565b909150429160401c161190565b42101592505f614f28565b906040519160208301526020825261062f826105e6565b939194929094600954851161526957614f86613389865f52600a60205260405f2090565b90614fde610d3060e084015195604096614fd188516020810190614fc981611d108c8b3387604091949392606082019560018060a01b0316825260208201520152565b519020614f4b565b6020815191012091615aa3565b61525857615005614ff960608401516001600160681b031690565b6001600160681b031690565b808403615251575b7f00000000000000000000000000000000000000000000000002c68af0bb1400009061503d8961493f848461356f565b3403615221575050615062615059608084015163ffffffff1690565b63ffffffff1690565b90818103615219575b50335f908152600b6020526040902061509a9088906150949089905b905f5260205260405f2090565b5461356f565b116152085760a081019063ffffffff91826150b9825163ffffffff1690565b16151591826151cf575b50506151be57335f908152600b6020526040902086939291615127916150ea908890615087565b85815401905561479c6002615107895f52600a60205260405f2090565b0191861661511d835463ffffffff9060401c1690565b0163ffffffff1690565b615131833361554d565b61513a8361586e565b6151468361498461566c565b82516001815260208101829052604081019690965295869533905f80516020615ed983398151915290606090a48251615181575b5050505090565b7fb9490aee663998179ad13f9e1c1eb6189c71ad1a9ec87f33ad2766f98d9a268a9051806151b230953395836148e9565b0390a4805f808061517a565b8251630e5092e960e11b8152600490fd5b6152009192506151f56151ef61505960c061505994015163ffffffff1690565b8a61356f565b925163ffffffff1690565b105f806150c3565b825163a7b32bb160e01b8152600490fd5b90505f61506b565b6152338961493f61141b94899461356f565b905163350e0bcf60e11b815260048101919091529081906024820190565b508261500d565b83516342db872960e11b8152600490fd5b60405163038eae7b60e61b8152600490fd5b60019080600111614b375761528f816118f8565b549182156152ac575b5050600160e01b81161561069d5780614b37565b5f80516020615e1983398151915254821015614b375790815b15615298579091505f19016152d9816118f8565b549182156152f1575050600160e01b8116614b375790565b90816152c5565b6003546001600160a01b0316330361530c57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6001600160a01b0381169081615364575050565b3b61536c5750565b803b15610423575f809160446040518094819363fb2de5d760e01b83523060048401526102d160248401525af1156140af5761062f9061057c565b6040519060608201928284106001600160401b0385111761058f575f809161069d95604052602785527f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c6020860152660819985a5b195960ca1b6040860152602081519101845af4615417613a00565b91615cdb565b90600180927f0000000000000000000000000000000000000000000000000000000000000008935b15615542575b5f918481111561553b5784915b5f80516020615e1983398151915254908315615536576154798483836159fe565b6001600160a01b0381164260a01b6001861460e11b1717615499836118f8565b556154a381611ac9565b80546801000000000000000186020190556001600160a01b0381169586156155315784830195839860015b156154ee575b5f8a8a5f5f80516020615eb98339815191528180a46154ce565b9860010198878a036154d45796615528959399508694906149849397929950615522905f80516020615e1983398151915255565b896159fe565b91939092615445565b614b64565b614b55565b8091615458565b8161544b5750509050565b7f000000000000000000000000000000000000000000000000000000000000000892919060015b15615661575b5f918481111561565a5784915b5f80516020615e1983398151915254908315615536576155a88483836159fe565b6001600160a01b0381164260a01b6001861460e11b17176155c8836118f8565b556155d281611ac9565b80546801000000000000000186020190556001600160a01b0381169586156155315784830195839860015b1561561d575b5f8a8a5f5f80516020615eb98339815191528180a46155fd565b9860010198878a036156035796615651959399508694906149849397929950615522905f80516020615e1983398151915255565b91939092615574565b8091615587565b8161557a5750509050565b5f80516020615e19833981519152545f1981019081116107535790565b615691613d2e565b505f525f80516020615e3983398151915260205260405f20546156b2613d2e565b6001600160a01b038216815260a082901c6001600160401b03166020820152600160e01b82161515604082015260e89190911c606082015290565b6001600160a01b0381165f908152600b60209081526040808320600184529091528082205460028352912054810191908210610753576001600160a01b0381165f908152600b6020526040902061574390612e35565b548201809211610753576001600160a01b0381165f908152600b6020526040902061576d90612e6a565b548201809211610753576001600160a01b03165f908152600b6020526040902061579690612e9f565b5481018091116107535790565b156157aa57565b60405162461bcd60e51b815260206004820152603460248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e7472616374604482015273206973206e6f7420696e697469616c697a696e6760601b6064820152608490fd5b61062f60ff5f80516020615ef98339815191525460081c166157a3565b7fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac604080515f815273721c0078c2328597ca70f5451fff5a7b38d4e9476020820152a1565b60606158bb7f6f8da53cfedb8cc4f7935c3629624e50b63053c93bb2cad246aa4d3a2ba7d4ce927f00000000000000000000000000000000000000000000000002c68af0bb1400006135ba565b7f00000000000000000000000026c8ca628f088d11f37c66c9f87ac0fa87edab056001600160a01b03165f80808085857f0000000000000000000000000000000000000000000000000000000000033450f190615916613a00565b50604051928352602083015215156040820152a1565b90915f5b600190818110156159a657808301808411610753576001600160a01b038681161590861615808061599f575b1561597357604051635cbd944160e01b8152600490fd5b15615981575b505001615930565b1561598d575b80615979565b61599990868633615d6c565b5f615987565b508161595c565b5050505050565b5f5b600190818110156159f8578084018411610753576001600160a01b03831615806159f1575b156159eb57604051635cbd944160e01b8152600490fd5b016159af565b50816159d4565b50505050565b905f5b838110615a0e5750505050565b8082018211610753576001600160a01b038316615a3757604051635cbd944160e01b8152600490fd5b600101615a01565b5f5b600190818110156159a6578085018511610753576001600160a01b03838116159081615a86575b5015615a8057604051635cbd944160e01b8152600490fd5b01615a41565b90508416155f615a68565b805191908290602001825e015f815290565b929091905f915b8451831015615aec57615abd8386613c8e565b519081811015615adb575f52602052600160405f205b920191615aaa565b905f52602052600160405f20615ad3565b915092501490565b90816020910312610423575161069d81610455565b92602091615b51935f60018060a01b0360405180978196829584630a85bd0160e11b9c8d8652336004870152166024850152604484015260806064840152608483019061089f565b0393165af15f9181615b88575b50615b7a57615b6b613a00565b8051156115b357805190602001fd5b6001600160e01b0319161490565b615bab91925060203d602011615bb2575b615ba38183610601565b810190615af4565b905f615b5e565b503d615b99565b60405190606082018281106001600160401b0382111761058f57604052602a8252604082602036910137565b805160011015612af65760210190565b908151811015612af6570160200190565b15615c0d57565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b60405190615c5e82610594565b6042825260603660208401376030615c7583613c41565b536078615c8183615be5565b536041905b60018211615c995761069d915015615c06565b600f8116906010821015612af657615cd5916f181899199a1a9b1b9c1cb0b131b232b360811b901a615ccb8486615bf5565b5360041c91614a83565b90615c86565b91929015615d3d5750815115615cef575090565b3b15615cf85790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015615d505750805190602001fd5b60405162461bcd60e51b815290819061141b90600483016108c3565b9092916001600160a01b039182615d8161357c565b1680615d90575b505050505050565b803314615d8857803b15610423575f948460849481604051998a98899763657711f560e11b895216600488015216602486015216604484015260648301525afa8015611e6857615de5575b8080808080615d88565b80611e5c615df29261057c565b5f615ddb56fea6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb492569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c402569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c442569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c432569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c462569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c42ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef37a74b6f706970809184cf2c4d73c7baca71e081c7e9fd07291f31ba4618d10aee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85fa2646970667358221220e4eab07602f5992995b26dcce9c56eda55a20b51ca0f08a20d4c1bf554517d9764736f6c63430008190033

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

00000000000000000000000000000000000000000000000002c68af0bb14000000000000000000000000000026c8ca628f088d11f37c66c9f87ac0fa87edab05

-----Decoded View---------------
Arg [0] : _mintFeeAmount (uint256): 200000000000000000
Arg [1] : _mintFeeRecipient (address): 0x26C8Ca628F088D11F37C66C9F87ac0Fa87edaB05

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000002c68af0bb140000
Arg [1] : 00000000000000000000000026c8ca628f088d11f37c66c9f87ac0fa87edab05


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

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.