ETH Price: $3,355.36 (-3.41%)

Contract

0x64aa40D6865079379e41cA7CF9A001C5B962B94F
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Initialize153369342022-08-14 1:52:03865 days ago1660441923IN
0x64aa40D6...5B962B94F
0 ETH0.001746667.04662534

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ShellzOrb

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 23 : ShellzOrb.sol
// SPDX-License-Identifier: MIT
// Built for Shellz Orb by Pagzi / NFTApi
pragma solidity ^0.8.16;

import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "erc721psi/contracts/ERC721PsiUpgradeable.sol";
import "./interfaces/ILaunchpadNFT.sol";
import "./ERC721Retreatable.sol";

contract ShellzOrb is
    ILaunchpadNFT,
    ERC2981Upgradeable,
    OwnableUpgradeable,
    ERC721PsiUpgradeable,
    ERC721Retreatable
{
    error Ended();
    error NotStarted();
    error NotEOA();
    error MintTooManyAtOnce();
    error InvalidSignature();
    error ZeroQuantity();
    error ExceedMaxSupply();
    error ExceedAllowedQuantity();
    error NotEnoughETH();
    error TicketUsed();
    error ApprovalNotEnabled();

    mapping(address => uint256) public userMinted;
    mapping(address => bool) public operatorProxies;

    /* within a single storage slot */
    address public launchpad; //1-20
    uint32 public launchpadQuantity; // 21-24
    address public signer; //1-20
    uint256 public saleQuantity; // 21-24
    address public payoutWallet; //1-20
    uint32 constant LAUNCHPAD_MAX_SUPPLY = 1000; // 21-24
    uint256 public publicPrice;

    modifier onlyLaunchpad() {
        require(launchpad != address(0), "launchpad address must set");
        require(msg.sender == launchpad, "must call by launchpad");
        _;
    }

    modifier onlySigner() {
        require(msg.sender == signer, "must call by signer");
        _;
    }

    modifier onlyEOA() {
        if (msg.sender != tx.origin) {
            revert NotEOA();
        }
        _;
    }

    function initialize() public initializer {
        __ERC2981_init();
        __ERC721Psi_init("Shellz Orb", "SHELLZ");
        __Ownable_init();

        _setDefaultRoyalty(
            address(0x4393DC2e19dAa06935deD20376965b667ABA4a6F),
            500
        );

        signer = address(0xDe1736B2F811a1e43EF92f6A707b198B6C09FAa8);
        saleQuantity = 8000;
        publicPrice = 0.089 ether;
        payoutWallet = address(0x3A7606611c643bfBbc75f8BcE0cc9927Dd980Fb5); // Payout wallet
        launchpad = address(0xa2833c0fDeacfD2510243222f6FeA7881e8E6c68); // Launchpad wallet
        launchpadQuantity = LAUNCHPAD_MAX_SUPPLY;
    }

    function _baseURI() internal view virtual override returns (string memory) {
        return "https://shellzorb.nftapi.art/meta/";
    }

    /**
    
        Retreating related functions.

     */
    function setRetreatingEnable(bool enableRetreating) external onlyOwner {
        _setRetreatingEnable(enableRetreating);
    }

    function kickFromRetreat(uint256 tokenId) external onlyOwner {
        _kickRetreating(tokenId);
    }

    function swapRetreatOperator(address operator) external onlyOwner {
        _swapOperator(operator);
    }

    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual override {
        for (
            uint256 tokenId = startTokenId;
            tokenId < startTokenId + quantity;
            tokenId++
        ) {
            _transferCheck(tokenId);
        }
        super._beforeTokenTransfers(from, to, startTokenId, quantity);
    }

    /**
    
        Retreating-based approval control: The users cannot approve their token if it is retreating.

     */

    function approve(address to, uint256 tokenId) public override {
        _transferCheck(tokenId);
        super.approve(to, tokenId);
    }

    /**
    
        Operator control and auto approvals.

     */
    function isApprovedForAll(address _owner, address operator)
        public
        view
        override(ERC721PsiUpgradeable)
        returns (bool)
    {
        if (operatorProxies[operator]) return true;
        return super.isApprovedForAll(_owner, operator);
    }

    function swapOperatorProxies(address _proxyAddress) public onlyOwner {
        operatorProxies[_proxyAddress] = !operatorProxies[_proxyAddress];
    }

    /*

    1000 NFTs are reserved for Binance NFT launchpad with the mintTo function.

     */

    function getMaxLaunchpadSupply() external pure override returns (uint256) {
        return LAUNCHPAD_MAX_SUPPLY;
    }

    function getLaunchpadSupply() external view override returns (uint256) {
        return LAUNCHPAD_MAX_SUPPLY - launchpadQuantity;
    }

    function mintTo(address to, uint256 size) external override onlyLaunchpad {
        require(to != address(0), "can't mint to empty address");
        require(size > 0, "size must greater than zero");
        require(size <= launchpadQuantity, "max supply reached");

        launchpadQuantity -= uint32(size);
        _mint(to, size);
    }

    // devMint for vault and team minting.
    function devMint(address to, uint32 quantity) external onlyOwner {
        if (quantity > saleQuantity) {
            revert ExceedMaxSupply();
        }
        saleQuantity -= quantity;
        _mint(to, quantity);
    }

    /// @param quantity Amount of NFT to be minted.
    /// @param allowedQuantity Maximum allowed NFTs to be minted from a given amount.
    /// @param startTime The start time of the mint.
    /// @param endTime The end time of the mint.
    /// @param signature The NFT can only be minted with the valid signature.
    function mint(
        uint256 quantity,
        uint256 allowedQuantity,
        uint256 startTime,
        uint256 endTime,
        bytes calldata signature
    ) external payable onlyEOA {
        // quantity check
        if (quantity == 0) {
            revert ZeroQuantity();
        }

        if (quantity + userMinted[msg.sender] > allowedQuantity) {
            revert ExceedAllowedQuantity();
        }

        if (quantity > saleQuantity) {
            revert ExceedMaxSupply();
        }

        // timestamp check
        if (block.timestamp < startTime) {
            revert NotStarted();
        }
        if (block.timestamp >= endTime) {
            revert Ended();
        }

        // price check
        if (msg.value < quantity * publicPrice) {
            revert NotEnoughETH();
        }

        // signature check
        // The address of the contract is specified in the signature. This prevents the replay attact accross contracts.
        bytes32 hash = ECDSAUpgradeable.toEthSignedMessageHash(
            keccak256(
                abi.encodePacked(
                    msg.sender,
                    allowedQuantity,
                    startTime,
                    endTime,
                    address(this)
                )
            )
        );

        if (ECDSAUpgradeable.recover(hash, signature) != signer) {
            revert InvalidSignature();
        }

        userMinted[msg.sender] += quantity;
        saleQuantity -= quantity;

        // mint
        _mint(msg.sender, quantity);
    }

    function setLaunchpad(address launchpad_) external onlyOwner {
        launchpad = launchpad_;
    }

    function setPayoutWallet(address _payoutWallet) external onlyOwner {
        payoutWallet = _payoutWallet;
    }

    function setLaunchpadSupply(uint32 launchpad_supply) external onlyOwner {
        launchpadQuantity = launchpad_supply;
    }

    function setSigner(address signer_) external onlyOwner {
        signer = signer_;
    }

    function setMintPrice(uint256 newPrice_) external onlyOwner {
        publicPrice = newPrice_;
    }

    function setDefaultRoyalty(address receiver, uint96 feeNumerator)
        external
        onlyOwner
    {
        _setDefaultRoyalty(receiver, feeNumerator);
    }

    function withdraw() external onlyOwner {
        payable(payoutWallet).transfer(address(this).balance);
    }

    /**
    
        Operator control and auto approvals.

     */
    function getHash(
        address buyer,
        uint256 allowedQuantity,
        uint256 startTime,
        uint256 endTime
    ) external view onlySigner returns (bytes32) {
        // Hash Generation for Backend
        // toEthSignedMessageHash adds Ethereum headers to signed message.
        bytes32 hash = keccak256(
            abi.encodePacked(
                buyer, // 20
                allowedQuantity, // 4
                startTime, // 32
                endTime, // 32
                address(this) // 20
            )
        );
        return hash;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721PsiUpgradeable, ERC2981Upgradeable)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }
}

File 2 of 23 : BitScan.sol
// SPDX-License-Identifier: MIT
/**
   _____       ___     ___ __           ____  _ __      
  / ___/____  / (_)___/ (_) /___  __   / __ )(_) /______
  \__ \/ __ \/ / / __  / / __/ / / /  / __  / / __/ ___/
 ___/ / /_/ / / / /_/ / / /_/ /_/ /  / /_/ / / /_(__  ) 
/____/\____/_/_/\__,_/_/\__/\__, /  /_____/_/\__/____/  
                           /____/                        

- npm: https://www.npmjs.com/package/solidity-bits
- github: https://github.com/estarriolvetch/solidity-bits

 */

pragma solidity ^0.8.0;


library BitScan {
    uint256 constant private DEBRUIJN_256 = 0x818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff;
    bytes constant private LOOKUP_TABLE_256 = hex"0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8";

    /**
        @dev Isolate the least significant set bit.
     */ 
    function isolateLS1B256(uint256 bb) pure internal returns (uint256) {
        require(bb > 0);
        unchecked {
            return bb & (0 - bb);
        }
    } 

    /**
        @dev Isolate the most significant set bit.
     */ 
    function isolateMS1B256(uint256 bb) pure internal returns (uint256) {
        require(bb > 0);
        unchecked {
            bb |= bb >> 128;
            bb |= bb >> 64;
            bb |= bb >> 32;
            bb |= bb >> 16;
            bb |= bb >> 8;
            bb |= bb >> 4;
            bb |= bb >> 2;
            bb |= bb >> 1;
            
            return (bb >> 1) + 1;
        }
    } 

    /**
        @dev Find the index of the lest significant set bit. (trailing zero count)
     */ 
    function bitScanForward256(uint256 bb) pure internal returns (uint8) {
        unchecked {
            return uint8(LOOKUP_TABLE_256[(isolateLS1B256(bb) * DEBRUIJN_256) >> 248]);
        }   
    }

    /**
        @dev Find the index of the most significant set bit.
     */ 
    function bitScanReverse256(uint256 bb) pure internal returns (uint8) {
        unchecked {
            return 255 - uint8(LOOKUP_TABLE_256[((isolateMS1B256(bb) * DEBRUIJN_256) >> 248)]);
        }   
    }

    function log2(uint256 bb) pure internal returns (uint8) {
        unchecked {
            return uint8(LOOKUP_TABLE_256[(isolateMS1B256(bb) * DEBRUIJN_256) >> 248]);
        } 
    }
}

File 3 of 23 : BitMaps.sol
// SPDX-License-Identifier: MIT
/**
   _____       ___     ___ __           ____  _ __      
  / ___/____  / (_)___/ (_) /___  __   / __ )(_) /______
  \__ \/ __ \/ / / __  / / __/ / / /  / __  / / __/ ___/
 ___/ / /_/ / / / /_/ / / /_/ /_/ /  / /_/ / / /_(__  ) 
/____/\____/_/_/\__,_/_/\__/\__, /  /_____/_/\__/____/  
                           /____/                        

- npm: https://www.npmjs.com/package/solidity-bits
- github: https://github.com/estarriolvetch/solidity-bits

 */
pragma solidity ^0.8.0;

import "./BitScan.sol";

/**
 * @dev This Library is a modified version of Openzeppelin's BitMaps library.
 * Functions of finding the index of the closest set bit from a given index are added.
 * The indexing of each bucket is modifed to count from the MSB to the LSB instead of from the LSB to the MSB.
 * The modification of indexing makes finding the closest previous set bit more efficient in gas usage.
*/

/**
 * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential.
 * Largelly inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
 */

library BitMaps {
    using BitScan for uint256;
    uint256 private constant MASK_INDEX_ZERO = (1 << 255);
    uint256 private constant MASK_FULL = type(uint256).max;

    struct BitMap {
        mapping(uint256 => uint256) _data;
    }

    /**
     * @dev Returns whether the bit at `index` is set.
     */
    function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {
        uint256 bucket = index >> 8;
        uint256 mask = MASK_INDEX_ZERO >> (index & 0xff);
        return bitmap._data[bucket] & mask != 0;
    }

    /**
     * @dev Sets the bit at `index` to the boolean `value`.
     */
    function setTo(
        BitMap storage bitmap,
        uint256 index,
        bool value
    ) internal {
        if (value) {
            set(bitmap, index);
        } else {
            unset(bitmap, index);
        }
    }

    /**
     * @dev Sets the bit at `index`.
     */
    function set(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = MASK_INDEX_ZERO >> (index & 0xff);
        bitmap._data[bucket] |= mask;
    }

    /**
     * @dev Unsets the bit at `index`.
     */
    function unset(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = MASK_INDEX_ZERO >> (index & 0xff);
        bitmap._data[bucket] &= ~mask;
    }


    /**
     * @dev Consecutively sets `amount` of bits starting from the bit at `startIndex`.
     */    
    function setBatch(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal {
        uint256 bucket = startIndex >> 8;

        uint256 bucketStartIndex = (startIndex & 0xff);

        unchecked {
            if(bucketStartIndex + amount < 256) {
                bitmap._data[bucket] |= MASK_FULL << (256 - amount) >> bucketStartIndex;
            } else {
                bitmap._data[bucket] |= MASK_FULL >> bucketStartIndex;
                amount -= (256 - bucketStartIndex);
                bucket++;

                while(amount > 256) {
                    bitmap._data[bucket] = MASK_FULL;
                    amount -= 256;
                    bucket++;
                }

                bitmap._data[bucket] |= MASK_FULL << (256 - amount);
            }
        }
    }


    /**
     * @dev Consecutively unsets `amount` of bits starting from the bit at `startIndex`.
     */    
    function unsetBatch(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal {
        uint256 bucket = startIndex >> 8;

        uint256 bucketStartIndex = (startIndex & 0xff);

        unchecked {
            if(bucketStartIndex + amount < 256) {
                bitmap._data[bucket] &= ~(MASK_FULL << (256 - amount) >> bucketStartIndex);
            } else {
                bitmap._data[bucket] &= ~(MASK_FULL >> bucketStartIndex);
                amount -= (256 - bucketStartIndex);
                bucket++;

                while(amount > 256) {
                    bitmap._data[bucket] = 0;
                    amount -= 256;
                    bucket++;
                }

                bitmap._data[bucket] &= ~(MASK_FULL << (256 - amount));
            }
        }
    }


    /**
     * @dev Find the closest index of the set bit before `index`.
     */
    function scanForward(BitMap storage bitmap, uint256 index) internal view returns (uint256 setBitIndex) {
        uint256 bucket = index >> 8;

        // index within the bucket
        uint256 bucketIndex = (index & 0xff);

        // load a bitboard from the bitmap.
        uint256 bb = bitmap._data[bucket];

        // offset the bitboard to scan from `bucketIndex`.
        bb = bb >> (0xff ^ bucketIndex); // bb >> (255 - bucketIndex)
        
        if(bb > 0) {
            unchecked {
                setBitIndex = (bucket << 8) | (bucketIndex -  bb.bitScanForward256());    
            }
        } else {
            while(true) {
                require(bucket > 0, "BitMaps: The set bit before the index doesn't exist.");
                unchecked {
                    bucket--;
                }
                // No offset. Always scan from the least significiant bit now.
                bb = bitmap._data[bucket];
                
                if(bb > 0) {
                    unchecked {
                        setBitIndex = (bucket << 8) | (255 -  bb.bitScanForward256());
                        break;
                    }
                } 
            }
        }
    }

    function getBucket(BitMap storage bitmap, uint256 bucket) internal view returns (uint256) {
        return bitmap._data[bucket];
    }
}

File 4 of 23 : ILaunchpadNFT.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.16;

interface ILaunchpadNFT {
    // return max supply config for launchpad, if no reserved will be collection's max supply
    function getMaxLaunchpadSupply() external view returns (uint256);

    // return current launchpad supply
    function getLaunchpadSupply() external view returns (uint256);

    // this function need to restrict mint permission to launchpad contract
    function mintTo(address to, uint256 size) external;
}

File 5 of 23 : ERC721Retreatable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

contract ERC721Retreatable {
    /// @dev The Retreating base contract is implemented with the diamond storage pattern to prevent
    /// data overlapping, so it can be added and removed during upgrades without affecting other data.
    bytes32 private constant storagePosition =
        keccak256("diamond.storage.ERC721Retreatable");

    error AlreadyInRetreating();
    error NotInRetreating();
    error RetreatingDisabled();
    error NotAllowed();
    error NotAuthorized();

    struct ERC721RetreatableStorage {
        mapping(uint256 => TokenParameter) tokenParam;
        bool enableRetreating;
        mapping(address => bool) operatorAddress;
    }

    /// @dev pack token related parameters into a single storage slot to reduce gas consumption.
    struct TokenParameter {
        uint64 retreatingStartTime;
        uint64 totalRetreatingTime;
    }

    modifier onlyTokenOwner(uint256 tokenId) {
        if (IERC721(address(this)).ownerOf(tokenId) != msg.sender) {
            revert NotAuthorized();
        }
        _;
    }

    modifier onlyTokensOwner(uint256[] memory tokenId) {
        for (uint256 i; i < tokenId.length; i++) {
            if (IERC721(address(this)).ownerOf(tokenId[i]) != msg.sender) {
                revert NotAuthorized();
            }
        }
        _;
    }

    modifier onlyOperator() {
        if (_retriveOperator(msg.sender) != true) {
            revert NotAuthorized();
        }
        _;
    }

    function _retriveERC721Storage()
        private
        pure
        returns (ERC721RetreatableStorage storage ds)
    {
        bytes32 storagePosition_ = storagePosition;
        assembly {
            ds.slot := storagePosition_
        }
    }

    function _retriveTokenParam(uint256 tokenId)
        private
        view
        returns (TokenParameter storage)
    {
        return _retriveERC721Storage().tokenParam[tokenId];
    }

    function _retriveOperator(address operator) private view returns (bool) {
        return _retriveERC721Storage().operatorAddress[operator];
    }

    function isRetreating(uint256 tokenId) public view returns (bool) {
        return _retriveTokenParam(tokenId).retreatingStartTime > 0;
    }

    function retreatingTime(uint256 tokenId) public view returns (uint256 t) {
        t = _retriveTokenParam(tokenId).totalRetreatingTime;
        if (isRetreating(tokenId)) {
            t +=
                uint64(block.timestamp) -
                _retriveTokenParam(tokenId).retreatingStartTime;
        }
    }

    function enterRetreating(uint256 tokenId) external onlyTokenOwner(tokenId) {
        _enterRetreating(tokenId);
    }

    function exitRetreating(uint256 tokenId) external onlyTokenOwner(tokenId) {
        _exitRetreating(tokenId);
    }

    function enterRetreatingMulti(uint256[] calldata tokenId)
        external
        onlyTokensOwner(tokenId)
    {
        for (uint256 i; i < tokenId.length; i++) {
            _enterRetreating(tokenId[i]);
        }
    }

    function exitRetreatingMulti(uint256[] calldata tokenId)
        external
        onlyTokensOwner(tokenId)
    {
        for (uint256 i; i < tokenId.length; i++) {
            _exitRetreating(tokenId[i]);
        }
    }

    function _enterRetreating(uint256 tokenId) internal {
        if (isRetreating(tokenId)) {
            revert AlreadyInRetreating();
        }

        if (!_retriveERC721Storage().enableRetreating) {
            revert RetreatingDisabled();
        }

        _retriveTokenParam(tokenId).retreatingStartTime = uint64(
            block.timestamp
        );
    }

    function _exitRetreating(uint256 tokenId) internal {
        if (!isRetreating(tokenId)) {
            revert NotInRetreating();
        }

        _retriveTokenParam(tokenId).totalRetreatingTime +=
            uint64(block.timestamp) -
            _retriveTokenParam(tokenId).retreatingStartTime;
        _retriveTokenParam(tokenId).retreatingStartTime = 0;
    }

    function _setRetreatingEnable(bool enableRetreating) internal {
        _retriveERC721Storage().enableRetreating = enableRetreating;
    }

    function _swapOperator(address operator) internal {
        _retriveERC721Storage().operatorAddress[
            operator
        ] = !_retriveERC721Storage().operatorAddress[operator];
    }

    function _kickRetreating(uint256 tokenId) internal onlyOperator {
        _exitRetreating(tokenId);
    }

    function isRetreatingEnabled() public view returns (bool) {
        return _retriveERC721Storage().enableRetreating;
    }

    /// @dev Insert this fuctions to the token transfer hook
    function _transferCheck(uint256 tokenId) internal view {
        if (isRetreating(tokenId)) {
            revert NotAllowed();
        }
    }
}

File 6 of 23 : ERC721PsiUpgradeable.sol
// SPDX-License-Identifier: MIT
/**
  ______ _____   _____ ______ ___  __ _  _  _ 
 |  ____|  __ \ / ____|____  |__ \/_ | || || |
 | |__  | |__) | |        / /   ) || | \| |/ |
 |  __| |  _  /| |       / /   / / | |\_   _/ 
 | |____| | \ \| |____  / /   / /_ | |  | |   
 |______|_|  \_\\_____|/_/   |____||_|  |_|   
                                              
                                            
 */

pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "solidity-bits/contracts/BitMaps.sol";


contract ERC721PsiUpgradeable is Initializable, ContextUpgradeable, 
    ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable, IERC721EnumerableUpgradeable {
    
    using AddressUpgradeable for address;
    using StringsUpgradeable for uint256;
    using BitMaps for BitMaps.BitMap;

    BitMaps.BitMap private _batchHead;

    string private _name;
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) internal _owners;
    uint256 internal _minted;

    mapping(uint256 => address) private _tokenApprovals;
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    function __ERC721Psi_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC721Psi_init_unchained(name_, symbol_);
    }

    function __ERC721Psi_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) 
        public 
        view 
        virtual 
        override 
        returns (uint) 
    {
        require(owner != address(0), "ERC721Psi: balance query for the zero address");

        uint count;
        for( uint i; i < _minted; ++i ){
            if(_exists(i)){
                if( owner == ownerOf(i)){
                    ++count;
                }
            }
        }
        return count;
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId)
        public
        view
        virtual
        override
        returns (address)
    {
        (address owner, ) = _ownerAndBatchHeadOf(tokenId);
        return owner;
    }

    function _ownerAndBatchHeadOf(uint256 tokenId) internal view returns (address owner, uint256 tokenIdBatchHead){
        require(_exists(tokenId), "ERC721Psi: owner query for nonexistent token");
        tokenIdBatchHead = _getBatchHead(tokenId);
        owner = _owners[tokenIdBatchHead];
    }

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Psi: URI query for nonexistent token");

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

    /**
     * @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, can be overriden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }


    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ownerOf(tokenId);
        require(to != owner, "ERC721Psi: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721Psi: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId)
        public
        view
        virtual
        override
        returns (address)
    {
        require(
            _exists(tokenId),
            "ERC721Psi: approved query for nonexistent token"
        );

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved)
        public
        virtual
        override
    {
        require(operator != _msgSender(), "ERC721Psi: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(
            _isApprovedOrOwner(_msgSender(), tokenId),
            "ERC721Psi: transfer caller is not owner nor approved"
        );

        _transfer(from, to, tokenId);
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(
            _isApprovedOrOwner(_msgSender(), tokenId),
            "ERC721Psi: transfer caller is not owner nor approved"
        );
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @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.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(
            _checkOnERC721Received(from, to, tokenId, 1,_data),
            "ERC721Psi: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @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 (`_mint`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return tokenId < _minted;
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId)
        internal
        view
        virtual
        returns (bool)
    {
        require(
            _exists(tokenId),
            "ERC721Psi: operator query for nonexistent token"
        );
        address owner = ownerOf(tokenId);
        return (spender == owner ||
            getApproved(tokenId) == spender ||
            isApprovedForAll(owner, spender));
    }

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

    
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal virtual {
        uint256 startTokenId = _minted;
        _mint(to, quantity);
        require(
            _checkOnERC721Received(address(0), to, startTokenId, quantity, _data),
            "ERC721Psi: transfer to non ERC721Receiver implementer"
        );
    }


    function _mint(
        address to,
        uint256 quantity
    ) internal virtual {
        uint256 tokenIdBatchHead = _minted;
        
        require(quantity > 0, "ERC721Psi: quantity must be greater 0");
        require(to != address(0), "ERC721Psi: mint to the zero address");
        
        _beforeTokenTransfers(address(0), to, tokenIdBatchHead, quantity);
        _minted += quantity;
        _owners[tokenIdBatchHead] = to;
        _batchHead.set(tokenIdBatchHead);
        _afterTokenTransfers(address(0), to, tokenIdBatchHead, quantity);
        
        // Emit events
        for(uint256 tokenId=tokenIdBatchHead;tokenId < tokenIdBatchHead + quantity; tokenId++){
            emit Transfer(address(0), to, tokenId);
        } 
    }


    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        (address owner, uint256 tokenIdBatchHead) = _ownerAndBatchHeadOf(tokenId);

        require(
            owner == from,
            "ERC721Psi: transfer of token that is not own"
        );
        require(to != address(0), "ERC721Psi: transfer to the zero address");

        _beforeTokenTransfers(from, to, tokenId, 1);

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

        uint256 nextTokenId = tokenId + 1;

        if(!_batchHead.get(nextTokenId) &&  
            nextTokenId < _minted
        ) {
            _owners[nextTokenId] = from;
            _batchHead.set(nextTokenId);
        }

        _owners[tokenId] = to;
        if(tokenId != tokenIdBatchHead) {
            _batchHead.set(tokenId);
        }

        emit Transfer(from, to, tokenId);

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

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

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param startTokenId uint256 the first ID of the tokens to be transferred
     * @param quantity uint256 amount of the tokens to be transfered.
     * @param _data bytes optional data to send along with the call
     * @return r bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity,
        bytes memory _data
    ) private returns (bool r) {
        if (to.isContract()) {
            r = true;
            for(uint256 tokenId = startTokenId; tokenId < startTokenId + quantity; tokenId++){
                try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                    r = r && retval == IERC721Receiver.onERC721Received.selector;
                } catch (bytes memory reason) {
                    if (reason.length == 0) {
                        revert("ERC721Psi: transfer to non ERC721Receiver implementer");
                    } else {
                        assembly {
                            revert(add(32, reason), mload(reason))
                        }
                    }
                }
            }
            return r;
        } else {
            return true;
        }
    }

    function _getBatchHead(uint256 tokenId) internal view returns (uint256 tokenIdBatchHead) {
        tokenIdBatchHead = _batchHead.scanForward(tokenId); 
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _minted;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256 tokenId) {
        require(index < totalSupply(), "ERC721Psi: global index out of bounds");
        
        uint count;
        for(uint i; i < _minted; i++){
            if(_exists(i)){
                if(count == index) return i;
                else count++;
            }
        }
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256 tokenId) {
        uint count;
        for(uint i; i < _minted; i++){
            if(_exists(i) && owner == ownerOf(i)){
                if(count == index) return i;
                else count++;
            }
        }

        revert("ERC721Psi: owner index out of bounds");
    }


    /**
     * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
     *
     * 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`.
     */
    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.
     *
     * 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` and `to` are never both zero.
     */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}
}

File 7 of 23 : 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 8 of 23 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

File 9 of 23 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 10 of 23 : IERC165Upgradeable.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 IERC165Upgradeable {
    /**
     * @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 11 of 23 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 12 of 23 : ECDSAUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../StringsUpgradeable.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSAUpgradeable {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 13 of 23 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _HEX_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) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

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

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

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

    /**
     * @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 14 of 23 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 15 of 23 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 16 of 23 : ERC2981Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.0;

import "../../interfaces/IERC2981Upgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
 *
 * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
 * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
 *
 * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
 * fee is specified in basis points by default.
 *
 * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
 * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
 * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
 *
 * _Available since v4.5._
 */
abstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable {
    function __ERC2981_init() internal onlyInitializing {
    }

    function __ERC2981_init_unchained() internal onlyInitializing {
    }
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

    RoyaltyInfo private _defaultRoyaltyInfo;
    mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;

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

    /**
     * @inheritdoc IERC2981Upgradeable
     */
    function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
        RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];

        if (royalty.receiver == address(0)) {
            royalty = _defaultRoyaltyInfo;
        }

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

        return (royalty.receiver, royaltyAmount);
    }

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

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

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

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

    /**
     * @dev Sets the royalty information for a specific token id, overriding the global default.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setTokenRoyalty(
        uint256 tokenId,
        address receiver,
        uint96 feeNumerator
    ) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: Invalid parameters");

        _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Resets royalty information for the token id back to the global default.
     */
    function _resetTokenRoyalty(uint256 tokenId) internal virtual {
        delete _tokenRoyaltyInfo[tokenId];
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[48] private __gap;
}

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

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

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

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

File 18 of 23 : IERC721EnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721EnumerableUpgradeable is IERC721Upgradeable {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 19 of 23 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 20 of 23 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ReentrancyGuardUpgradeable is Initializable {
    // 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;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _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() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 21 of 23 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (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. Equivalent to `reinitializer(1)`.
     */
    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.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so 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.
     *
     * 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.
     */
    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.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }
}

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

pragma solidity ^0.8.0;

import "../utils/introspection/IERC165Upgradeable.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 IERC2981Upgradeable is IERC165Upgradeable {
    /**
     * @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 23 of 23 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"AlreadyInRetreating","type":"error"},{"inputs":[],"name":"ApprovalNotEnabled","type":"error"},{"inputs":[],"name":"Ended","type":"error"},{"inputs":[],"name":"ExceedAllowedQuantity","type":"error"},{"inputs":[],"name":"ExceedMaxSupply","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"MintTooManyAtOnce","type":"error"},{"inputs":[],"name":"NotAllowed","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"inputs":[],"name":"NotEOA","type":"error"},{"inputs":[],"name":"NotEnoughETH","type":"error"},{"inputs":[],"name":"NotInRetreating","type":"error"},{"inputs":[],"name":"NotStarted","type":"error"},{"inputs":[],"name":"RetreatingDisabled","type":"error"},{"inputs":[],"name":"TicketUsed","type":"error"},{"inputs":[],"name":"ZeroQuantity","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":"uint8","name":"version","type":"uint8"}],"name":"Initialized","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":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint32","name":"quantity","type":"uint32"}],"name":"devMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"enterRetreating","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenId","type":"uint256[]"}],"name":"enterRetreatingMulti","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"exitRetreating","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenId","type":"uint256[]"}],"name":"exitRetreatingMulti","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"buyer","type":"address"},{"internalType":"uint256","name":"allowedQuantity","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"getHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLaunchpadSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxLaunchpadSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isRetreating","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isRetreatingEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"kickFromRetreat","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"launchpad","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"launchpadQuantity","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"allowedQuantity","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"size","type":"uint256"}],"name":"mintTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"operatorProxies","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[],"name":"payoutWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"retreatingTime","outputs":[{"internalType":"uint256","name":"t","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"saleQuantity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"launchpad_","type":"address"}],"name":"setLaunchpad","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"launchpad_supply","type":"uint32"}],"name":"setLaunchpadSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPrice_","type":"uint256"}],"name":"setMintPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_payoutWallet","type":"address"}],"name":"setPayoutWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enableRetreating","type":"bool"}],"name":"setRetreatingEnable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer_","type":"address"}],"name":"setSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_proxyAddress","type":"address"}],"name":"swapOperatorProxies","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"swapRetreatOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50613c8d806100206000396000f3fe60806040526004361061031a5760003560e01c80637c17678f116101ab578063c87b56dd116100f7578063eebb28b211610095578063f8ea8f161161006f578063f8ea8f1614610969578063fbf0dfc01461097c578063fbf7b5a41461099c578063fe9877a1146109d557600080fd5b8063eebb28b214610914578063f2fde38b14610929578063f4a0a5281461094957600080fd5b8063e88d60b2116100d1578063e88d60b214610884578063e8f09055146108a4578063e985e9c5146108d4578063ed5a6ea4146108f457600080fd5b8063c87b56dd14610818578063d3ff4a9114610838578063e336e01d1461086e57600080fd5b80639a308a5c11610164578063a945bf801161013e578063a945bf80146107a2578063b68fc0dc146107b8578063b88d4fde146107d8578063bf95f476146107f857600080fd5b80639a308a5c14610742578063a22cb46514610762578063a553e45b1461078257600080fd5b80637c17678f1461069a5780638129fc1c146106ba5780638488bb4e146106cf5780638da5cb5b146106ef5780638ebac11b1461070d57806395d89b411461072d57600080fd5b80632f745c591161026a5780634f6ccce7116102235780636b8f9c43116101fd5780636b8f9c43146106255780636c19e7831461064557806370a0823114610665578063715018a61461068557600080fd5b80634f6ccce7146105d05780635b43bba1146105f05780636352211e1461060557600080fd5b80632f745c591461051b5780632fdf37091461053b57806336f4c0eb1461055b5780633ccfd60b1461057b57806342842e0e14610590578063449a52f8146105b057600080fd5b8063095ea7b3116102d75780631aa5e872116102b15780631aa5e8721461046f578063238ac9331461049c57806323b872dd146104bc5780632a55205a146104dc57600080fd5b8063095ea7b31461041057806317a5aced1461043057806318160ddd1461045057600080fd5b806301ffc9a71461031f57806302669b521461035457806304634d8d1461038c578063064dd737146103ae57806306fdde03146103ce578063081812fc146103f0575b600080fd5b34801561032b57600080fd5b5061033f61033a366004613220565b6109f5565b60405190151581526020015b60405180910390f35b34801561036057600080fd5b5060d254610374906001600160a01b031681565b6040516001600160a01b03909116815260200161034b565b34801561039857600080fd5b506103ac6103a7366004613252565b610a06565b005b3480156103ba57600080fd5b506103ac6103c9366004613297565b610a1c565b3480156103da57600080fd5b506103e3610b69565b60405161034b919061335b565b3480156103fc57600080fd5b5061037461040b36600461336e565b610bfb565b34801561041c57600080fd5b506103ac61042b366004613387565b610c8d565b34801561043c57600080fd5b506103ac61044b3660046133c7565b610ca0565b34801561045c57600080fd5b5060cd545b60405190815260200161034b565b34801561047b57600080fd5b5061046161048a3660046133fc565b60d06020526000908152604090205481565b3480156104a857600080fd5b5060d354610374906001600160a01b031681565b3480156104c857600080fd5b506103ac6104d7366004613419565b610cff565b3480156104e857600080fd5b506104fc6104f736600461345a565b610d35565b604080516001600160a01b03909316835260208301919091520161034b565b34801561052757600080fd5b50610461610536366004613387565b610de3565b34801561054757600080fd5b506103ac61055636600461336e565b610ead565b34801561056757600080fd5b506103ac6105763660046133fc565b610f41565b34801561058757600080fd5b506103ac610f6b565b34801561059c57600080fd5b506103ac6105ab366004613419565b610faf565b3480156105bc57600080fd5b506103ac6105cb366004613387565b610fca565b3480156105dc57600080fd5b506104616105eb36600461336e565b6111b8565b3480156105fc57600080fd5b506103e8610461565b34801561061157600080fd5b5061037461062036600461336e565b611272565b34801561063157600080fd5b506103ac6106403660046133fc565b611286565b34801561065157600080fd5b506103ac6106603660046133fc565b6112b0565b34801561067157600080fd5b506104616106803660046133fc565b6112da565b34801561069157600080fd5b506103ac6113aa565b3480156106a657600080fd5b506103ac6106b5366004613297565b6113be565b3480156106c657600080fd5b506103ac611505565b3480156106db57600080fd5b5060d554610374906001600160a01b031681565b3480156106fb57600080fd5b506097546001600160a01b0316610374565b34801561071957600080fd5b5061046161072836600461347c565b61170b565b34801561073957600080fd5b506103e361179b565b34801561074e57600080fd5b506103ac61075d36600461336e565b6117aa565b34801561076e57600080fd5b506103ac61077d3660046134c7565b61183e565b34801561078e57600080fd5b506103ac61079d3660046134f3565b611902565b3480156107ae57600080fd5b5061046160d65481565b3480156107c457600080fd5b506103ac6107d336600461336e565b611939565b3480156107e457600080fd5b506103ac6107f3366004613524565b61194a565b34801561080457600080fd5b506103ac610813366004613603565b61197c565b34801561082457600080fd5b506103e361083336600461336e565b6119aa565b34801561084457600080fd5b507e189a975947f9bb7cf5ddec70fbf14b37d6256f2ca73d67bee9dd73b16210885460ff1661033f565b34801561087a57600080fd5b5061046160d45481565b34801561089057600080fd5b506103ac61089f3660046133fc565b611a72565b3480156108b057600080fd5b5061033f6108bf3660046133fc565b60d16020526000908152604090205460ff1681565b3480156108e057600080fd5b5061033f6108ef36600461361e565b611ac5565b34801561090057600080fd5b506103ac61090f3660046133fc565b611b1c565b34801561092057600080fd5b50610461611b4d565b34801561093557600080fd5b506103ac6109443660046133fc565b611b77565b34801561095557600080fd5b506103ac61096436600461336e565b611bed565b6103ac61097736600461364c565b611bfa565b34801561098857600080fd5b5061046161099736600461336e565b611e4f565b3480156109a857600080fd5b5060d2546109c090600160a01b900463ffffffff1681565b60405163ffffffff909116815260200161034b565b3480156109e157600080fd5b5061033f6109f036600461336e565b611eb0565b6000610a0082611ecd565b92915050565b610a0e611f28565b610a188282611f82565b5050565b8181808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250925050505b8151811015610b2457336001600160a01b0316306001600160a01b0316636352211e848481518110610a8457610a846136e3565b60200260200101516040518263ffffffff1660e01b8152600401610aaa91815260200190565b602060405180830381865afa158015610ac7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aeb91906136f9565b6001600160a01b031614610b125760405163ea8e4eb560e01b815260040160405180910390fd5b80610b1c8161372c565b915050610a50565b5060005b82811015610b6357610b51848483818110610b4557610b456136e3565b9050602002013561207f565b80610b5b8161372c565b915050610b28565b50505050565b606060ca8054610b7890613745565b80601f0160208091040260200160405190810160405280929190818152602001828054610ba490613745565b8015610bf15780601f10610bc657610100808354040283529160200191610bf1565b820191906000526020600020905b815481529060010190602001808311610bd457829003601f168201915b5050505050905090565b6000610c088260cd541190565b610c715760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b50600090815260ce60205260409020546001600160a01b031690565b610c968161213c565b610a188282612163565b610ca8611f28565b60d4548163ffffffff161115610cd157604051630f0c37b960e11b815260040160405180910390fd5b8063ffffffff1660d46000828254610ce9919061377f565b90915550610a1890508263ffffffff8316612275565b610d0933826123e8565b610d255760405162461bcd60e51b8152600401610c6890613792565b610d308383836124b7565b505050565b60008281526066602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610daa5750604080518082019091526065546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610dc9906001600160601b0316876137e6565b610dd3919061381b565b91519350909150505b9250929050565b60008060005b60cd54811015610e5857610dfe8160cd541190565b8015610e235750610e0e81611272565b6001600160a01b0316856001600160a01b0316145b15610e4657838203610e38579150610a009050565b81610e428161372c565b9250505b80610e508161372c565b915050610de9565b5060405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a206f776e657220696e646578206f7574206f6620626f604482015263756e647360e01b6064820152608401610c68565b6040516331a9108f60e11b815260048101829052819033903090636352211e90602401602060405180830381865afa158015610eed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1191906136f9565b6001600160a01b031614610f385760405163ea8e4eb560e01b815260040160405180910390fd5b610a188261207f565b610f49611f28565b60d280546001600160a01b0319166001600160a01b0392909216919091179055565b610f73611f28565b60d5546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015610fac573d6000803e3d6000fd5b50565b610d308383836040518060200160405280600081525061194a565b60d2546001600160a01b03166110225760405162461bcd60e51b815260206004820152601a60248201527f6c61756e63687061642061646472657373206d757374207365740000000000006044820152606401610c68565b60d2546001600160a01b031633146110755760405162461bcd60e51b81526020600482015260166024820152751b5d5cdd0818d85b1b08189e481b185d5b98da1c185960521b6044820152606401610c68565b6001600160a01b0382166110cb5760405162461bcd60e51b815260206004820152601b60248201527f63616e2774206d696e7420746f20656d707479206164647265737300000000006044820152606401610c68565b6000811161111b5760405162461bcd60e51b815260206004820152601b60248201527f73697a65206d7573742067726561746572207468616e207a65726f00000000006044820152606401610c68565b60d254600160a01b900463ffffffff1681111561116f5760405162461bcd60e51b81526020600482015260126024820152711b585e081cdd5c1c1b1e481c995858da195960721b6044820152606401610c68565b8060d260148282829054906101000a900463ffffffff16611190919061382f565b92506101000a81548163ffffffff021916908363ffffffff160217905550610a188282612275565b60006111c360cd5490565b821061121f5760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a20676c6f62616c20696e646578206f7574206f6620626044820152646f756e647360d81b6064820152608401610c68565b6000805b60cd5481101561126b576112388160cd541190565b156112595783820361124b579392505050565b816112558161372c565b9250505b806112638161372c565b915050611223565b5050919050565b60008061127e836126b2565b509392505050565b61128e611f28565b60d580546001600160a01b0319166001600160a01b0392909216919091179055565b6112b8611f28565b60d380546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160a01b0382166113485760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401610c68565b6000805b60cd548110156113a3576113618160cd541190565b156113935761136f81611272565b6001600160a01b0316846001600160a01b031603611393576113908261372c565b91505b61139c8161372c565b905061134c565b5092915050565b6113b2611f28565b6113bc600061274b565b565b8181808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250925050505b81518110156114c657336001600160a01b0316306001600160a01b0316636352211e848481518110611426576114266136e3565b60200260200101516040518263ffffffff1660e01b815260040161144c91815260200190565b602060405180830381865afa158015611469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148d91906136f9565b6001600160a01b0316146114b45760405163ea8e4eb560e01b815260040160405180910390fd5b806114be8161372c565b9150506113f2565b5060005b82811015610b63576114f38484838181106114e7576114e76136e3565b9050602002013561279d565b806114fd8161372c565b9150506114ca565b600054610100900460ff16158080156115255750600054600160ff909116105b8061153f5750303b15801561153f575060005460ff166001145b6115a25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c68565b6000805460ff1916600117905580156115c5576000805461ff0019166101001790555b6115cd61280f565b6116176040518060400160405280600a81526020016929b432b6363d1027b93160b11b8152506040518060400160405280600681526020016529a422a6262d60d11b815250612836565b61161f612867565b61163f734393dc2e19daa06935ded20376965b667aba4a6f6101f4611f82565b60d380546001600160a01b031990811673de1736b2f811a1e43ef92f6a707b198b6c09faa817909155611f4060d45567013c31074902800060d65560d58054909116733a7606611c643bfbbc75f8bce0cc9927dd980fb517905560d280547503e8a2833c0fdeacfd2510243222f6fea7881e8e6c686001600160c01b03199091161790558015610fac576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b60d3546000906001600160a01b0316331461175e5760405162461bcd60e51b815260206004820152601360248201527236bab9ba1031b0b63610313c9039b4b3b732b960691b6044820152606401610c68565b6000858585853060405160200161177995949392919061384c565b60408051808303601f1901815291905280516020909101209695505050505050565b606060cb8054610b7890613745565b6040516331a9108f60e11b815260048101829052819033903090636352211e90602401602060405180830381865afa1580156117ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180e91906136f9565b6001600160a01b0316146118355760405163ea8e4eb560e01b815260040160405180910390fd5b610a188261279d565b336001600160a01b038316036118965760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606401610c68565b33600081815260cf602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61190a611f28565b7e189a975947f9bb7cf5ddec70fbf14b37d6256f2ca73d67bee9dd73b1621088805460ff191682151517905550565b611941611f28565b610fac81612896565b61195433836123e8565b6119705760405162461bcd60e51b8152600401610c6890613792565b610b63848484846128f2565b611984611f28565b60d2805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b60606119b78260cd541190565b611a165760405162461bcd60e51b815260206004820152602a60248201527f4552433732315073693a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608401610c68565b6000611a20612927565b90506000815111611a405760405180602001604052806000815250611a6b565b80611a4a84612947565b604051602001611a5b92919061388a565b6040516020818303038152906040525b9392505050565b611a7a611f28565b610fac816001600160a01b031660009081527e189a975947f9bb7cf5ddec70fbf14b37d6256f2ca73d67bee9dd73b162108960205260409020805460ff19811660ff90911615179055565b6001600160a01b038116600090815260d1602052604081205460ff1615611aee57506001610a00565b6001600160a01b03808416600090815260cf602090815260408083209386168352929052205460ff16611a6b565b611b24611f28565b6001600160a01b0316600090815260d160205260409020805460ff19811660ff90911615179055565b60d254600090611b6c90600160a01b900463ffffffff166103e861382f565b63ffffffff16905090565b611b7f611f28565b6001600160a01b038116611be45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c68565b610fac8161274b565b611bf5611f28565b60d655565b333214611c1a57604051635d04968b60e11b815260040160405180910390fd5b85600003611c3b5760405163f4f5b73360e01b815260040160405180910390fd5b33600090815260d060205260409020548590611c5790886138b9565b1115611c76576040516359b5807560e11b815260040160405180910390fd5b60d454861115611c9957604051630f0c37b960e11b815260040160405180910390fd5b83421015611cba57604051636f312cbd60e01b815260040160405180910390fd5b824210611cda5760405163477383f360e01b815260040160405180910390fd5b60d654611ce790876137e6565b341015611d0757604051632c1d501360e11b815260040160405180910390fd5b6000611d853387878730604051602001611d2595949392919061384c565b60408051601f1981840301815282825280516020918201207f19457468657265756d205369676e6564204d6573736167653a0a33320000000084830152603c8085019190915282518085039091018152605c909301909152815191012090565b60d354604080516020601f87018190048102820181019092528581529293506001600160a01b0390911691611dd7918491908790879081908401838280828437600092019190915250612a4792505050565b6001600160a01b031614611dfe57604051638baa579f60e01b815260040160405180910390fd5b33600090815260d0602052604081208054899290611e1d9084906138b9565b925050819055508660d46000828254611e36919061377f565b90915550611e4690503388612275565b50505050505050565b6000611e5a82612a63565b54600160401b90046001600160401b03169050611e7682611eb0565b15611eab57611e8482612a63565b54611e98906001600160401b0316426138cc565b610a00906001600160401b0316826138b9565b919050565b600080611ebc83612a63565b546001600160401b03161192915050565b60006001600160e01b031982166380ac58cd60e01b1480611efe57506001600160e01b03198216635b5e139f60e01b145b80611f1957506001600160e01b0319821663780e9d6360e01b145b80610a005750610a0082612a92565b6097546001600160a01b031633146113bc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c68565b6127106001600160601b0382161115611ff05760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610c68565b6001600160a01b0382166120465760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610c68565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217606555565b61208881611eb0565b6120a5576040516301e4846960e11b815260040160405180910390fd5b6120ae81612a63565b546120c2906001600160401b0316426138cc565b6120cb82612a63565b80546008906120eb908490600160401b90046001600160401b03166138ec565b92506101000a8154816001600160401b0302191690836001600160401b03160217905550600061211a82612a63565b805467ffffffffffffffff19166001600160401b039290921691909117905550565b61214581611eb0565b15610fac57604051631eb49d6d60e11b815260040160405180910390fd5b600061216e82611272565b9050806001600160a01b0316836001600160a01b0316036121dd5760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401610c68565b336001600160a01b03821614806121f957506121f98133611ac5565b61226b5760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608401610c68565b610d308383612ac7565b60cd54816122d35760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401610c68565b6001600160a01b0383166123355760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610c68565b6123426000848385612b35565b8160cd600082825461235491906138b9565b9091555050600081815260cc6020526040902080546001600160a01b0319166001600160a01b03851617905561238b60c982612b69565b805b61239783836138b9565b811015610b635760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4806123e08161372c565b91505061238d565b60006123f58260cd541190565b6124595760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610c68565b600061246483611272565b9050806001600160a01b0316846001600160a01b0316148061249f5750836001600160a01b031661249484610bfb565b6001600160a01b0316145b806124af57506124af8185611ac5565b949350505050565b6000806124c3836126b2565b91509150846001600160a01b0316826001600160a01b03161461253d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401610c68565b6001600160a01b0384166125a35760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401610c68565b6125b08585856001612b35565b6125bb600084612ac7565b60006125c88460016138b9565b600881901c600090815260c96020526040902054909150600160ff1b60ff83161c161580156125f8575060cd5481105b1561262f57600081815260cc6020526040902080546001600160a01b0319166001600160a01b03881617905561262f60c982612b69565b600084815260cc6020526040902080546001600160a01b0319166001600160a01b0387161790558184146126685761266860c985612b69565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b6000806126c08360cd541190565b6127215760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c68565b61272a83612b95565b600081815260cc60205260409020546001600160a01b031694909350915050565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127a681611eb0565b156127c4576040516360c8091960e11b815260040160405180910390fd5b7e189a975947f9bb7cf5ddec70fbf14b37d6256f2ca73d67bee9dd73b16210885460ff1661280557604051635174aee160e01b815260040160405180910390fd5b4261211a82612a63565b600054610100900460ff166113bc5760405162461bcd60e51b8152600401610c689061390c565b600054610100900460ff1661285d5760405162461bcd60e51b8152600401610c689061390c565b610a188282612ba2565b600054610100900460ff1661288e5760405162461bcd60e51b8152600401610c689061390c565b6113bc612be2565b3360009081527e189a975947f9bb7cf5ddec70fbf14b37d6256f2ca73d67bee9dd73b1621089602052604090205460ff1615156001146128e95760405163ea8e4eb560e01b815260040160405180910390fd5b610fac8161207f565b6128fd8484846124b7565b61290b848484600185612c12565b610b635760405162461bcd60e51b8152600401610c6890613957565b6060604051806060016040528060228152602001613b3660229139905090565b60608160000361296e5750506040805180820190915260018152600360fc1b602082015290565b8160005b811561299857806129828161372c565b91506129919050600a8361381b565b9150612972565b6000816001600160401b038111156129b2576129b261350e565b6040519080825280601f01601f1916602001820160405280156129dc576020820181803683370190505b5090505b84156124af576129f160018361377f565b91506129fe600a866139ac565b612a099060306138b9565b60f81b818381518110612a1e57612a1e6136e3565b60200101906001600160f81b031916908160001a905350612a40600a8661381b565b94506129e0565b6000806000612a568585612d49565b9150915061127e81612db4565b60009081527e189a975947f9bb7cf5ddec70fbf14b37d6256f2ca73d67bee9dd73b16210876020526040902090565b60006001600160e01b0319821663152a902d60e11b1480610a0057506301ffc9a760e01b6001600160e01b0319831614610a00565b600081815260ce6020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612afc82611272565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b815b612b4182846138b9565b811015612b6357612b518161213c565b80612b5b8161372c565b915050612b37565b50610b63565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6000610a0060c983612f6a565b600054610100900460ff16612bc95760405162461bcd60e51b8152600401610c689061390c565b60ca612bd58382613a06565b5060cb610d308282613a06565b600054610100900460ff16612c095760405162461bcd60e51b8152600401610c689061390c565b6113bc3361274b565b60006001600160a01b0385163b15612d3c57506001835b612c3384866138b9565b811015612d3657604051630a85bd0160e11b81526001600160a01b0387169063150b7a0290612c6c9033908b9086908990600401613ac5565b6020604051808303816000875af1925050508015612ca7575060408051601f3d908101601f19168201909252612ca491810190613b02565b60015b612d04573d808015612cd5576040519150601f19603f3d011682016040523d82523d6000602084013e612cda565b606091505b508051600003612cfc5760405162461bcd60e51b8152600401610c6890613957565b805181602001fd5b828015612d2157506001600160e01b03198116630a85bd0160e11b145b92505080612d2e8161372c565b915050612c29565b50612d40565b5060015b95945050505050565b6000808251604103612d7f5760208301516040840151606085015160001a612d7387828585613062565b94509450505050610ddc565b8251604003612da85760208301516040840151612d9d86838361314f565b935093505050610ddc565b50600090506002610ddc565b6000816004811115612dc857612dc8613b1f565b03612dd05750565b6001816004811115612de457612de4613b1f565b03612e315760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610c68565b6002816004811115612e4557612e45613b1f565b03612e925760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610c68565b6003816004811115612ea657612ea6613b1f565b03612efe5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610c68565b6004816004811115612f1257612f12613b1f565b03610fac5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610c68565b600881901c60008181526020849052604081205490919060ff808516919082181c8015612fac57612f9a81613188565b60ff168203600884901b179350613059565b600083116130195760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401610c68565b5060001990910160008181526020869052604090205490919080156130545761304181613188565b60ff0360ff16600884901b179350613059565b612fac565b50505092915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156130995750600090506003613146565b8460ff16601b141580156130b157508460ff16601c14155b156130c25750600090506004613146565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613116573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661313f57600060019250925050613146565b9150600090505b94509492505050565b6000806001600160ff1b0383168161316c60ff86901c601b6138b9565b905061317a87828885613062565b935093505050935093915050565b60006040518061012001604052806101008152602001613b58610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff6131d1856131f2565b02901c815181106131e4576131e46136e3565b016020015160f81c92915050565b600080821161320057600080fd5b5060008190031690565b6001600160e01b031981168114610fac57600080fd5b60006020828403121561323257600080fd5b8135611a6b8161320a565b6001600160a01b0381168114610fac57600080fd5b6000806040838503121561326557600080fd5b82356132708161323d565b915060208301356001600160601b038116811461328c57600080fd5b809150509250929050565b600080602083850312156132aa57600080fd5b82356001600160401b03808211156132c157600080fd5b818501915085601f8301126132d557600080fd5b8135818111156132e457600080fd5b8660208260051b85010111156132f957600080fd5b60209290920196919550909350505050565b60005b8381101561332657818101518382015260200161330e565b50506000910152565b6000815180845261334781602086016020860161330b565b601f01601f19169290920160200192915050565b602081526000611a6b602083018461332f565b60006020828403121561338057600080fd5b5035919050565b6000806040838503121561339a57600080fd5b82356133a58161323d565b946020939093013593505050565b803563ffffffff81168114611eab57600080fd5b600080604083850312156133da57600080fd5b82356133e58161323d565b91506133f3602084016133b3565b90509250929050565b60006020828403121561340e57600080fd5b8135611a6b8161323d565b60008060006060848603121561342e57600080fd5b83356134398161323d565b925060208401356134498161323d565b929592945050506040919091013590565b6000806040838503121561346d57600080fd5b50508035926020909101359150565b6000806000806080858703121561349257600080fd5b843561349d8161323d565b966020860135965060408601359560600135945092505050565b80358015158114611eab57600080fd5b600080604083850312156134da57600080fd5b82356134e58161323d565b91506133f3602084016134b7565b60006020828403121561350557600080fd5b611a6b826134b7565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561353a57600080fd5b84356135458161323d565b935060208501356135558161323d565b92506040850135915060608501356001600160401b038082111561357857600080fd5b818701915087601f83011261358c57600080fd5b81358181111561359e5761359e61350e565b604051601f8201601f19908116603f011681019083821181831017156135c6576135c661350e565b816040528281528a60208487010111156135df57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60006020828403121561361557600080fd5b611a6b826133b3565b6000806040838503121561363157600080fd5b823561363c8161323d565b9150602083013561328c8161323d565b60008060008060008060a0878903121561366557600080fd5b8635955060208701359450604087013593506060870135925060808701356001600160401b038082111561369857600080fd5b818901915089601f8301126136ac57600080fd5b8135818111156136bb57600080fd5b8a60208285010111156136cd57600080fd5b6020830194508093505050509295509295509295565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561370b57600080fd5b8151611a6b8161323d565b634e487b7160e01b600052601160045260246000fd5b60006001820161373e5761373e613716565b5060010190565b600181811c9082168061375957607f821691505b60208210810361377957634e487b7160e01b600052602260045260246000fd5b50919050565b81810381811115610a0057610a00613716565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b600081600019048311821515161561380057613800613716565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261382a5761382a613805565b500490565b63ffffffff8281168282160390808211156113a3576113a3613716565b6bffffffffffffffffffffffff19606096871b8116825260148201959095526034810193909352605483019190915290921b16607482015260880190565b6000835161389c81846020880161330b565b8351908301906138b081836020880161330b565b01949350505050565b80820180821115610a0057610a00613716565b6001600160401b038281168282160390808211156113a3576113a3613716565b6001600160401b038181168382160190808211156113a3576113a3613716565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b6000826139bb576139bb613805565b500690565b601f821115610d3057600081815260208120601f850160051c810160208610156139e75750805b601f850160051c820191505b818110156126aa578281556001016139f3565b81516001600160401b03811115613a1f57613a1f61350e565b613a3381613a2d8454613745565b846139c0565b602080601f831160018114613a685760008415613a505750858301515b600019600386901b1c1916600185901b1785556126aa565b600085815260208120601f198616915b82811015613a9757888601518255948401946001909101908401613a78565b5085821015613ab55787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613af89083018461332f565b9695505050505050565b600060208284031215613b1457600080fd5b8151611a6b8161320a565b634e487b7160e01b600052602160045260246000fdfe68747470733a2f2f7368656c6c7a6f72622e6e66746170692e6172742f6d6574612f0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a2646970667358221220d22a2ceb195d54236141db8d92bbf8f45e90ede1608e6aa9cce977ef7ce29e7464736f6c63430008100033

Deployed Bytecode

0x60806040526004361061031a5760003560e01c80637c17678f116101ab578063c87b56dd116100f7578063eebb28b211610095578063f8ea8f161161006f578063f8ea8f1614610969578063fbf0dfc01461097c578063fbf7b5a41461099c578063fe9877a1146109d557600080fd5b8063eebb28b214610914578063f2fde38b14610929578063f4a0a5281461094957600080fd5b8063e88d60b2116100d1578063e88d60b214610884578063e8f09055146108a4578063e985e9c5146108d4578063ed5a6ea4146108f457600080fd5b8063c87b56dd14610818578063d3ff4a9114610838578063e336e01d1461086e57600080fd5b80639a308a5c11610164578063a945bf801161013e578063a945bf80146107a2578063b68fc0dc146107b8578063b88d4fde146107d8578063bf95f476146107f857600080fd5b80639a308a5c14610742578063a22cb46514610762578063a553e45b1461078257600080fd5b80637c17678f1461069a5780638129fc1c146106ba5780638488bb4e146106cf5780638da5cb5b146106ef5780638ebac11b1461070d57806395d89b411461072d57600080fd5b80632f745c591161026a5780634f6ccce7116102235780636b8f9c43116101fd5780636b8f9c43146106255780636c19e7831461064557806370a0823114610665578063715018a61461068557600080fd5b80634f6ccce7146105d05780635b43bba1146105f05780636352211e1461060557600080fd5b80632f745c591461051b5780632fdf37091461053b57806336f4c0eb1461055b5780633ccfd60b1461057b57806342842e0e14610590578063449a52f8146105b057600080fd5b8063095ea7b3116102d75780631aa5e872116102b15780631aa5e8721461046f578063238ac9331461049c57806323b872dd146104bc5780632a55205a146104dc57600080fd5b8063095ea7b31461041057806317a5aced1461043057806318160ddd1461045057600080fd5b806301ffc9a71461031f57806302669b521461035457806304634d8d1461038c578063064dd737146103ae57806306fdde03146103ce578063081812fc146103f0575b600080fd5b34801561032b57600080fd5b5061033f61033a366004613220565b6109f5565b60405190151581526020015b60405180910390f35b34801561036057600080fd5b5060d254610374906001600160a01b031681565b6040516001600160a01b03909116815260200161034b565b34801561039857600080fd5b506103ac6103a7366004613252565b610a06565b005b3480156103ba57600080fd5b506103ac6103c9366004613297565b610a1c565b3480156103da57600080fd5b506103e3610b69565b60405161034b919061335b565b3480156103fc57600080fd5b5061037461040b36600461336e565b610bfb565b34801561041c57600080fd5b506103ac61042b366004613387565b610c8d565b34801561043c57600080fd5b506103ac61044b3660046133c7565b610ca0565b34801561045c57600080fd5b5060cd545b60405190815260200161034b565b34801561047b57600080fd5b5061046161048a3660046133fc565b60d06020526000908152604090205481565b3480156104a857600080fd5b5060d354610374906001600160a01b031681565b3480156104c857600080fd5b506103ac6104d7366004613419565b610cff565b3480156104e857600080fd5b506104fc6104f736600461345a565b610d35565b604080516001600160a01b03909316835260208301919091520161034b565b34801561052757600080fd5b50610461610536366004613387565b610de3565b34801561054757600080fd5b506103ac61055636600461336e565b610ead565b34801561056757600080fd5b506103ac6105763660046133fc565b610f41565b34801561058757600080fd5b506103ac610f6b565b34801561059c57600080fd5b506103ac6105ab366004613419565b610faf565b3480156105bc57600080fd5b506103ac6105cb366004613387565b610fca565b3480156105dc57600080fd5b506104616105eb36600461336e565b6111b8565b3480156105fc57600080fd5b506103e8610461565b34801561061157600080fd5b5061037461062036600461336e565b611272565b34801561063157600080fd5b506103ac6106403660046133fc565b611286565b34801561065157600080fd5b506103ac6106603660046133fc565b6112b0565b34801561067157600080fd5b506104616106803660046133fc565b6112da565b34801561069157600080fd5b506103ac6113aa565b3480156106a657600080fd5b506103ac6106b5366004613297565b6113be565b3480156106c657600080fd5b506103ac611505565b3480156106db57600080fd5b5060d554610374906001600160a01b031681565b3480156106fb57600080fd5b506097546001600160a01b0316610374565b34801561071957600080fd5b5061046161072836600461347c565b61170b565b34801561073957600080fd5b506103e361179b565b34801561074e57600080fd5b506103ac61075d36600461336e565b6117aa565b34801561076e57600080fd5b506103ac61077d3660046134c7565b61183e565b34801561078e57600080fd5b506103ac61079d3660046134f3565b611902565b3480156107ae57600080fd5b5061046160d65481565b3480156107c457600080fd5b506103ac6107d336600461336e565b611939565b3480156107e457600080fd5b506103ac6107f3366004613524565b61194a565b34801561080457600080fd5b506103ac610813366004613603565b61197c565b34801561082457600080fd5b506103e361083336600461336e565b6119aa565b34801561084457600080fd5b507e189a975947f9bb7cf5ddec70fbf14b37d6256f2ca73d67bee9dd73b16210885460ff1661033f565b34801561087a57600080fd5b5061046160d45481565b34801561089057600080fd5b506103ac61089f3660046133fc565b611a72565b3480156108b057600080fd5b5061033f6108bf3660046133fc565b60d16020526000908152604090205460ff1681565b3480156108e057600080fd5b5061033f6108ef36600461361e565b611ac5565b34801561090057600080fd5b506103ac61090f3660046133fc565b611b1c565b34801561092057600080fd5b50610461611b4d565b34801561093557600080fd5b506103ac6109443660046133fc565b611b77565b34801561095557600080fd5b506103ac61096436600461336e565b611bed565b6103ac61097736600461364c565b611bfa565b34801561098857600080fd5b5061046161099736600461336e565b611e4f565b3480156109a857600080fd5b5060d2546109c090600160a01b900463ffffffff1681565b60405163ffffffff909116815260200161034b565b3480156109e157600080fd5b5061033f6109f036600461336e565b611eb0565b6000610a0082611ecd565b92915050565b610a0e611f28565b610a188282611f82565b5050565b8181808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250925050505b8151811015610b2457336001600160a01b0316306001600160a01b0316636352211e848481518110610a8457610a846136e3565b60200260200101516040518263ffffffff1660e01b8152600401610aaa91815260200190565b602060405180830381865afa158015610ac7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aeb91906136f9565b6001600160a01b031614610b125760405163ea8e4eb560e01b815260040160405180910390fd5b80610b1c8161372c565b915050610a50565b5060005b82811015610b6357610b51848483818110610b4557610b456136e3565b9050602002013561207f565b80610b5b8161372c565b915050610b28565b50505050565b606060ca8054610b7890613745565b80601f0160208091040260200160405190810160405280929190818152602001828054610ba490613745565b8015610bf15780601f10610bc657610100808354040283529160200191610bf1565b820191906000526020600020905b815481529060010190602001808311610bd457829003601f168201915b5050505050905090565b6000610c088260cd541190565b610c715760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b50600090815260ce60205260409020546001600160a01b031690565b610c968161213c565b610a188282612163565b610ca8611f28565b60d4548163ffffffff161115610cd157604051630f0c37b960e11b815260040160405180910390fd5b8063ffffffff1660d46000828254610ce9919061377f565b90915550610a1890508263ffffffff8316612275565b610d0933826123e8565b610d255760405162461bcd60e51b8152600401610c6890613792565b610d308383836124b7565b505050565b60008281526066602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610daa5750604080518082019091526065546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610dc9906001600160601b0316876137e6565b610dd3919061381b565b91519350909150505b9250929050565b60008060005b60cd54811015610e5857610dfe8160cd541190565b8015610e235750610e0e81611272565b6001600160a01b0316856001600160a01b0316145b15610e4657838203610e38579150610a009050565b81610e428161372c565b9250505b80610e508161372c565b915050610de9565b5060405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a206f776e657220696e646578206f7574206f6620626f604482015263756e647360e01b6064820152608401610c68565b6040516331a9108f60e11b815260048101829052819033903090636352211e90602401602060405180830381865afa158015610eed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1191906136f9565b6001600160a01b031614610f385760405163ea8e4eb560e01b815260040160405180910390fd5b610a188261207f565b610f49611f28565b60d280546001600160a01b0319166001600160a01b0392909216919091179055565b610f73611f28565b60d5546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015610fac573d6000803e3d6000fd5b50565b610d308383836040518060200160405280600081525061194a565b60d2546001600160a01b03166110225760405162461bcd60e51b815260206004820152601a60248201527f6c61756e63687061642061646472657373206d757374207365740000000000006044820152606401610c68565b60d2546001600160a01b031633146110755760405162461bcd60e51b81526020600482015260166024820152751b5d5cdd0818d85b1b08189e481b185d5b98da1c185960521b6044820152606401610c68565b6001600160a01b0382166110cb5760405162461bcd60e51b815260206004820152601b60248201527f63616e2774206d696e7420746f20656d707479206164647265737300000000006044820152606401610c68565b6000811161111b5760405162461bcd60e51b815260206004820152601b60248201527f73697a65206d7573742067726561746572207468616e207a65726f00000000006044820152606401610c68565b60d254600160a01b900463ffffffff1681111561116f5760405162461bcd60e51b81526020600482015260126024820152711b585e081cdd5c1c1b1e481c995858da195960721b6044820152606401610c68565b8060d260148282829054906101000a900463ffffffff16611190919061382f565b92506101000a81548163ffffffff021916908363ffffffff160217905550610a188282612275565b60006111c360cd5490565b821061121f5760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a20676c6f62616c20696e646578206f7574206f6620626044820152646f756e647360d81b6064820152608401610c68565b6000805b60cd5481101561126b576112388160cd541190565b156112595783820361124b579392505050565b816112558161372c565b9250505b806112638161372c565b915050611223565b5050919050565b60008061127e836126b2565b509392505050565b61128e611f28565b60d580546001600160a01b0319166001600160a01b0392909216919091179055565b6112b8611f28565b60d380546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160a01b0382166113485760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401610c68565b6000805b60cd548110156113a3576113618160cd541190565b156113935761136f81611272565b6001600160a01b0316846001600160a01b031603611393576113908261372c565b91505b61139c8161372c565b905061134c565b5092915050565b6113b2611f28565b6113bc600061274b565b565b8181808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250925050505b81518110156114c657336001600160a01b0316306001600160a01b0316636352211e848481518110611426576114266136e3565b60200260200101516040518263ffffffff1660e01b815260040161144c91815260200190565b602060405180830381865afa158015611469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148d91906136f9565b6001600160a01b0316146114b45760405163ea8e4eb560e01b815260040160405180910390fd5b806114be8161372c565b9150506113f2565b5060005b82811015610b63576114f38484838181106114e7576114e76136e3565b9050602002013561279d565b806114fd8161372c565b9150506114ca565b600054610100900460ff16158080156115255750600054600160ff909116105b8061153f5750303b15801561153f575060005460ff166001145b6115a25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c68565b6000805460ff1916600117905580156115c5576000805461ff0019166101001790555b6115cd61280f565b6116176040518060400160405280600a81526020016929b432b6363d1027b93160b11b8152506040518060400160405280600681526020016529a422a6262d60d11b815250612836565b61161f612867565b61163f734393dc2e19daa06935ded20376965b667aba4a6f6101f4611f82565b60d380546001600160a01b031990811673de1736b2f811a1e43ef92f6a707b198b6c09faa817909155611f4060d45567013c31074902800060d65560d58054909116733a7606611c643bfbbc75f8bce0cc9927dd980fb517905560d280547503e8a2833c0fdeacfd2510243222f6fea7881e8e6c686001600160c01b03199091161790558015610fac576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b60d3546000906001600160a01b0316331461175e5760405162461bcd60e51b815260206004820152601360248201527236bab9ba1031b0b63610313c9039b4b3b732b960691b6044820152606401610c68565b6000858585853060405160200161177995949392919061384c565b60408051808303601f1901815291905280516020909101209695505050505050565b606060cb8054610b7890613745565b6040516331a9108f60e11b815260048101829052819033903090636352211e90602401602060405180830381865afa1580156117ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180e91906136f9565b6001600160a01b0316146118355760405163ea8e4eb560e01b815260040160405180910390fd5b610a188261279d565b336001600160a01b038316036118965760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606401610c68565b33600081815260cf602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61190a611f28565b7e189a975947f9bb7cf5ddec70fbf14b37d6256f2ca73d67bee9dd73b1621088805460ff191682151517905550565b611941611f28565b610fac81612896565b61195433836123e8565b6119705760405162461bcd60e51b8152600401610c6890613792565b610b63848484846128f2565b611984611f28565b60d2805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b60606119b78260cd541190565b611a165760405162461bcd60e51b815260206004820152602a60248201527f4552433732315073693a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608401610c68565b6000611a20612927565b90506000815111611a405760405180602001604052806000815250611a6b565b80611a4a84612947565b604051602001611a5b92919061388a565b6040516020818303038152906040525b9392505050565b611a7a611f28565b610fac816001600160a01b031660009081527e189a975947f9bb7cf5ddec70fbf14b37d6256f2ca73d67bee9dd73b162108960205260409020805460ff19811660ff90911615179055565b6001600160a01b038116600090815260d1602052604081205460ff1615611aee57506001610a00565b6001600160a01b03808416600090815260cf602090815260408083209386168352929052205460ff16611a6b565b611b24611f28565b6001600160a01b0316600090815260d160205260409020805460ff19811660ff90911615179055565b60d254600090611b6c90600160a01b900463ffffffff166103e861382f565b63ffffffff16905090565b611b7f611f28565b6001600160a01b038116611be45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c68565b610fac8161274b565b611bf5611f28565b60d655565b333214611c1a57604051635d04968b60e11b815260040160405180910390fd5b85600003611c3b5760405163f4f5b73360e01b815260040160405180910390fd5b33600090815260d060205260409020548590611c5790886138b9565b1115611c76576040516359b5807560e11b815260040160405180910390fd5b60d454861115611c9957604051630f0c37b960e11b815260040160405180910390fd5b83421015611cba57604051636f312cbd60e01b815260040160405180910390fd5b824210611cda5760405163477383f360e01b815260040160405180910390fd5b60d654611ce790876137e6565b341015611d0757604051632c1d501360e11b815260040160405180910390fd5b6000611d853387878730604051602001611d2595949392919061384c565b60408051601f1981840301815282825280516020918201207f19457468657265756d205369676e6564204d6573736167653a0a33320000000084830152603c8085019190915282518085039091018152605c909301909152815191012090565b60d354604080516020601f87018190048102820181019092528581529293506001600160a01b0390911691611dd7918491908790879081908401838280828437600092019190915250612a4792505050565b6001600160a01b031614611dfe57604051638baa579f60e01b815260040160405180910390fd5b33600090815260d0602052604081208054899290611e1d9084906138b9565b925050819055508660d46000828254611e36919061377f565b90915550611e4690503388612275565b50505050505050565b6000611e5a82612a63565b54600160401b90046001600160401b03169050611e7682611eb0565b15611eab57611e8482612a63565b54611e98906001600160401b0316426138cc565b610a00906001600160401b0316826138b9565b919050565b600080611ebc83612a63565b546001600160401b03161192915050565b60006001600160e01b031982166380ac58cd60e01b1480611efe57506001600160e01b03198216635b5e139f60e01b145b80611f1957506001600160e01b0319821663780e9d6360e01b145b80610a005750610a0082612a92565b6097546001600160a01b031633146113bc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c68565b6127106001600160601b0382161115611ff05760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610c68565b6001600160a01b0382166120465760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610c68565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217606555565b61208881611eb0565b6120a5576040516301e4846960e11b815260040160405180910390fd5b6120ae81612a63565b546120c2906001600160401b0316426138cc565b6120cb82612a63565b80546008906120eb908490600160401b90046001600160401b03166138ec565b92506101000a8154816001600160401b0302191690836001600160401b03160217905550600061211a82612a63565b805467ffffffffffffffff19166001600160401b039290921691909117905550565b61214581611eb0565b15610fac57604051631eb49d6d60e11b815260040160405180910390fd5b600061216e82611272565b9050806001600160a01b0316836001600160a01b0316036121dd5760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401610c68565b336001600160a01b03821614806121f957506121f98133611ac5565b61226b5760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608401610c68565b610d308383612ac7565b60cd54816122d35760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401610c68565b6001600160a01b0383166123355760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610c68565b6123426000848385612b35565b8160cd600082825461235491906138b9565b9091555050600081815260cc6020526040902080546001600160a01b0319166001600160a01b03851617905561238b60c982612b69565b805b61239783836138b9565b811015610b635760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4806123e08161372c565b91505061238d565b60006123f58260cd541190565b6124595760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610c68565b600061246483611272565b9050806001600160a01b0316846001600160a01b0316148061249f5750836001600160a01b031661249484610bfb565b6001600160a01b0316145b806124af57506124af8185611ac5565b949350505050565b6000806124c3836126b2565b91509150846001600160a01b0316826001600160a01b03161461253d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401610c68565b6001600160a01b0384166125a35760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401610c68565b6125b08585856001612b35565b6125bb600084612ac7565b60006125c88460016138b9565b600881901c600090815260c96020526040902054909150600160ff1b60ff83161c161580156125f8575060cd5481105b1561262f57600081815260cc6020526040902080546001600160a01b0319166001600160a01b03881617905561262f60c982612b69565b600084815260cc6020526040902080546001600160a01b0319166001600160a01b0387161790558184146126685761266860c985612b69565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b6000806126c08360cd541190565b6127215760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c68565b61272a83612b95565b600081815260cc60205260409020546001600160a01b031694909350915050565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127a681611eb0565b156127c4576040516360c8091960e11b815260040160405180910390fd5b7e189a975947f9bb7cf5ddec70fbf14b37d6256f2ca73d67bee9dd73b16210885460ff1661280557604051635174aee160e01b815260040160405180910390fd5b4261211a82612a63565b600054610100900460ff166113bc5760405162461bcd60e51b8152600401610c689061390c565b600054610100900460ff1661285d5760405162461bcd60e51b8152600401610c689061390c565b610a188282612ba2565b600054610100900460ff1661288e5760405162461bcd60e51b8152600401610c689061390c565b6113bc612be2565b3360009081527e189a975947f9bb7cf5ddec70fbf14b37d6256f2ca73d67bee9dd73b1621089602052604090205460ff1615156001146128e95760405163ea8e4eb560e01b815260040160405180910390fd5b610fac8161207f565b6128fd8484846124b7565b61290b848484600185612c12565b610b635760405162461bcd60e51b8152600401610c6890613957565b6060604051806060016040528060228152602001613b3660229139905090565b60608160000361296e5750506040805180820190915260018152600360fc1b602082015290565b8160005b811561299857806129828161372c565b91506129919050600a8361381b565b9150612972565b6000816001600160401b038111156129b2576129b261350e565b6040519080825280601f01601f1916602001820160405280156129dc576020820181803683370190505b5090505b84156124af576129f160018361377f565b91506129fe600a866139ac565b612a099060306138b9565b60f81b818381518110612a1e57612a1e6136e3565b60200101906001600160f81b031916908160001a905350612a40600a8661381b565b94506129e0565b6000806000612a568585612d49565b9150915061127e81612db4565b60009081527e189a975947f9bb7cf5ddec70fbf14b37d6256f2ca73d67bee9dd73b16210876020526040902090565b60006001600160e01b0319821663152a902d60e11b1480610a0057506301ffc9a760e01b6001600160e01b0319831614610a00565b600081815260ce6020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612afc82611272565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b815b612b4182846138b9565b811015612b6357612b518161213c565b80612b5b8161372c565b915050612b37565b50610b63565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6000610a0060c983612f6a565b600054610100900460ff16612bc95760405162461bcd60e51b8152600401610c689061390c565b60ca612bd58382613a06565b5060cb610d308282613a06565b600054610100900460ff16612c095760405162461bcd60e51b8152600401610c689061390c565b6113bc3361274b565b60006001600160a01b0385163b15612d3c57506001835b612c3384866138b9565b811015612d3657604051630a85bd0160e11b81526001600160a01b0387169063150b7a0290612c6c9033908b9086908990600401613ac5565b6020604051808303816000875af1925050508015612ca7575060408051601f3d908101601f19168201909252612ca491810190613b02565b60015b612d04573d808015612cd5576040519150601f19603f3d011682016040523d82523d6000602084013e612cda565b606091505b508051600003612cfc5760405162461bcd60e51b8152600401610c6890613957565b805181602001fd5b828015612d2157506001600160e01b03198116630a85bd0160e11b145b92505080612d2e8161372c565b915050612c29565b50612d40565b5060015b95945050505050565b6000808251604103612d7f5760208301516040840151606085015160001a612d7387828585613062565b94509450505050610ddc565b8251604003612da85760208301516040840151612d9d86838361314f565b935093505050610ddc565b50600090506002610ddc565b6000816004811115612dc857612dc8613b1f565b03612dd05750565b6001816004811115612de457612de4613b1f565b03612e315760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610c68565b6002816004811115612e4557612e45613b1f565b03612e925760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610c68565b6003816004811115612ea657612ea6613b1f565b03612efe5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610c68565b6004816004811115612f1257612f12613b1f565b03610fac5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610c68565b600881901c60008181526020849052604081205490919060ff808516919082181c8015612fac57612f9a81613188565b60ff168203600884901b179350613059565b600083116130195760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401610c68565b5060001990910160008181526020869052604090205490919080156130545761304181613188565b60ff0360ff16600884901b179350613059565b612fac565b50505092915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156130995750600090506003613146565b8460ff16601b141580156130b157508460ff16601c14155b156130c25750600090506004613146565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613116573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661313f57600060019250925050613146565b9150600090505b94509492505050565b6000806001600160ff1b0383168161316c60ff86901c601b6138b9565b905061317a87828885613062565b935093505050935093915050565b60006040518061012001604052806101008152602001613b58610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff6131d1856131f2565b02901c815181106131e4576131e46136e3565b016020015160f81c92915050565b600080821161320057600080fd5b5060008190031690565b6001600160e01b031981168114610fac57600080fd5b60006020828403121561323257600080fd5b8135611a6b8161320a565b6001600160a01b0381168114610fac57600080fd5b6000806040838503121561326557600080fd5b82356132708161323d565b915060208301356001600160601b038116811461328c57600080fd5b809150509250929050565b600080602083850312156132aa57600080fd5b82356001600160401b03808211156132c157600080fd5b818501915085601f8301126132d557600080fd5b8135818111156132e457600080fd5b8660208260051b85010111156132f957600080fd5b60209290920196919550909350505050565b60005b8381101561332657818101518382015260200161330e565b50506000910152565b6000815180845261334781602086016020860161330b565b601f01601f19169290920160200192915050565b602081526000611a6b602083018461332f565b60006020828403121561338057600080fd5b5035919050565b6000806040838503121561339a57600080fd5b82356133a58161323d565b946020939093013593505050565b803563ffffffff81168114611eab57600080fd5b600080604083850312156133da57600080fd5b82356133e58161323d565b91506133f3602084016133b3565b90509250929050565b60006020828403121561340e57600080fd5b8135611a6b8161323d565b60008060006060848603121561342e57600080fd5b83356134398161323d565b925060208401356134498161323d565b929592945050506040919091013590565b6000806040838503121561346d57600080fd5b50508035926020909101359150565b6000806000806080858703121561349257600080fd5b843561349d8161323d565b966020860135965060408601359560600135945092505050565b80358015158114611eab57600080fd5b600080604083850312156134da57600080fd5b82356134e58161323d565b91506133f3602084016134b7565b60006020828403121561350557600080fd5b611a6b826134b7565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561353a57600080fd5b84356135458161323d565b935060208501356135558161323d565b92506040850135915060608501356001600160401b038082111561357857600080fd5b818701915087601f83011261358c57600080fd5b81358181111561359e5761359e61350e565b604051601f8201601f19908116603f011681019083821181831017156135c6576135c661350e565b816040528281528a60208487010111156135df57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60006020828403121561361557600080fd5b611a6b826133b3565b6000806040838503121561363157600080fd5b823561363c8161323d565b9150602083013561328c8161323d565b60008060008060008060a0878903121561366557600080fd5b8635955060208701359450604087013593506060870135925060808701356001600160401b038082111561369857600080fd5b818901915089601f8301126136ac57600080fd5b8135818111156136bb57600080fd5b8a60208285010111156136cd57600080fd5b6020830194508093505050509295509295509295565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561370b57600080fd5b8151611a6b8161323d565b634e487b7160e01b600052601160045260246000fd5b60006001820161373e5761373e613716565b5060010190565b600181811c9082168061375957607f821691505b60208210810361377957634e487b7160e01b600052602260045260246000fd5b50919050565b81810381811115610a0057610a00613716565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b600081600019048311821515161561380057613800613716565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261382a5761382a613805565b500490565b63ffffffff8281168282160390808211156113a3576113a3613716565b6bffffffffffffffffffffffff19606096871b8116825260148201959095526034810193909352605483019190915290921b16607482015260880190565b6000835161389c81846020880161330b565b8351908301906138b081836020880161330b565b01949350505050565b80820180821115610a0057610a00613716565b6001600160401b038281168282160390808211156113a3576113a3613716565b6001600160401b038181168382160190808211156113a3576113a3613716565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b6000826139bb576139bb613805565b500690565b601f821115610d3057600081815260208120601f850160051c810160208610156139e75750805b601f850160051c820191505b818110156126aa578281556001016139f3565b81516001600160401b03811115613a1f57613a1f61350e565b613a3381613a2d8454613745565b846139c0565b602080601f831160018114613a685760008415613a505750858301515b600019600386901b1c1916600185901b1785556126aa565b600085815260208120601f198616915b82811015613a9757888601518255948401946001909101908401613a78565b5085821015613ab55787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613af89083018461332f565b9695505050505050565b600060208284031215613b1457600080fd5b8151611a6b8161320a565b634e487b7160e01b600052602160045260246000fdfe68747470733a2f2f7368656c6c7a6f72622e6e66746170692e6172742f6d6574612f0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a2646970667358221220d22a2ceb195d54236141db8d92bbf8f45e90ede1608e6aa9cce977ef7ce29e7464736f6c63430008100033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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