ETH Price: $3,386.16 (+0.86%)

Contract

0xFF9Fb4a1ca3558ba61776232C08767539733b541
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Approval For...214005272024-12-14 11:42:1114 days ago1734176531IN
0xFF9Fb4a1...39733b541
0 ETH0.00037998.23969523
Set Approval For...195265882024-03-27 15:40:23276 days ago1711554023IN
0xFF9Fb4a1...39733b541
0 ETH0.0019523542.34404111
Set Approval For...192506952024-02-17 22:58:11314 days ago1708210691IN
0xFF9Fb4a1...39733b541
0 ETH0.0007950417.24339462
Set Approval For...190537132024-01-21 7:21:47342 days ago1705821707IN
0xFF9Fb4a1...39733b541
0 ETH0.000457859.9303149
Set Approval For...189234512024-01-03 1:05:47360 days ago1704243947IN
0xFF9Fb4a1...39733b541
0 ETH0.0007598116.47945053
Set Approval For...188820392023-12-28 5:30:23366 days ago1703741423IN
0xFF9Fb4a1...39733b541
0 ETH0.0012956228.10042459
Public Mint188689622023-12-26 9:25:35368 days ago1703582735IN
0xFF9Fb4a1...39733b541
0.009 ETH0.0005756617.29562476
Safe Transfer Fr...188314882023-12-21 3:11:59373 days ago1703128319IN
0xFF9Fb4a1...39733b541
0 ETH0.0017469139.06250092
Set Approval For...187885422023-12-15 2:28:35379 days ago1702607315IN
0xFF9Fb4a1...39733b541
0 ETH0.0015916434.52071441
Withdraw187611112023-12-11 6:15:23383 days ago1702275323IN
0xFF9Fb4a1...39733b541
0 ETH0.0017099727.54907967
Set Approval For...187604422023-12-11 4:00:23383 days ago1702267223IN
0xFF9Fb4a1...39733b541
0 ETH0.001046622.69954709
Set Approval For...187603482023-12-11 3:41:35383 days ago1702266095IN
0xFF9Fb4a1...39733b541
0 ETH0.0013166528.55648787
Set Approval For...187594312023-12-11 0:36:59383 days ago1702255019IN
0xFF9Fb4a1...39733b541
0 ETH0.0009344320.2667561
Set Approval For...187560562023-12-10 13:17:47384 days ago1702214267IN
0xFF9Fb4a1...39733b541
0 ETH0.0010170122.05781985
Set Approval For...187540332023-12-10 6:30:23384 days ago1702189823IN
0xFF9Fb4a1...39733b541
0 ETH0.0010063721.82705293
Set Approval For...187525292023-12-10 1:27:11384 days ago1702171631IN
0xFF9Fb4a1...39733b541
0 ETH0.0010628923.05288946
Safe Transfer Fr...187523222023-12-10 0:45:35384 days ago1702169135IN
0xFF9Fb4a1...39733b541
0 ETH0.0016166924.1391599
Safe Transfer Fr...187523172023-12-10 0:44:35384 days ago1702169075IN
0xFF9Fb4a1...39733b541
0 ETH0.002156724.05154327
Safe Transfer Fr...187496562023-12-09 15:46:47385 days ago1702136807IN
0xFF9Fb4a1...39733b541
0 ETH0.0032808146.73994121
Safe Transfer Fr...187493352023-12-09 14:41:59385 days ago1702132919IN
0xFF9Fb4a1...39733b541
0 ETH0.0043174248.14150577
Set Approval For...187486892023-12-09 12:32:11385 days ago1702125131IN
0xFF9Fb4a1...39733b541
0 ETH0.0013372729.00379827
Set Approval For...187486232023-12-09 12:18:59385 days ago1702124339IN
0xFF9Fb4a1...39733b541
0 ETH0.0016945336.75226701
Safe Transfer Fr...187465982023-12-09 5:29:47385 days ago1702099787IN
0xFF9Fb4a1...39733b541
0 ETH0.0022752525.37020512
Safe Transfer Fr...187465752023-12-09 5:25:11385 days ago1702099511IN
0xFF9Fb4a1...39733b541
0 ETH0.0023188925.86028544
Set Approval For...187462212023-12-09 4:14:11385 days ago1702095251IN
0xFF9Fb4a1...39733b541
0 ETH0.0012702227.54940984
View all transactions

Latest 8 internal transactions

Advanced mode:
Parent Transaction Hash Block
From
To
187611112023-12-11 6:15:23383 days ago1702275323
0xFF9Fb4a1...39733b541
1.343 ETH
187611112023-12-11 6:15:23383 days ago1702275323
0xFF9Fb4a1...39733b541
1.343 ETH
187611112023-12-11 6:15:23383 days ago1702275323
0xFF9Fb4a1...39733b541
1.343 ETH
187611112023-12-11 6:15:23383 days ago1702275323
0xFF9Fb4a1...39733b541
1.343 ETH
185952602023-11-18 0:46:23406 days ago1700268383
0xFF9Fb4a1...39733b541
0.00175 ETH
185952602023-11-18 0:46:23406 days ago1700268383
0xFF9Fb4a1...39733b541
0.00175 ETH
185952602023-11-18 0:46:23406 days ago1700268383
0xFF9Fb4a1...39733b541
0.00175 ETH
185952602023-11-18 0:46:23406 days ago1700268383
0xFF9Fb4a1...39733b541
0.00175 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
grinpeace

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 22 : grin_peace.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "./ERC721Psi.sol";

contract grinpeace is ERC721Psi, ERC2981, Ownable, ReentrancyGuard {
    using Strings for uint256;

    uint256 public maxSupply = 2000;

    uint256 public al1Price = 0.007 ether;
    uint256 public al2Price = 0.008 ether;
    uint256 public publicPrice = 0.009 ether;
    uint256 public piePrice = 0.009 ether;

    bool public freeSaleStart = true;
    bool public al1SaleStart = true;
    bool public al2SaleStart = true;
    bool public pubSaleStart = true;
    bool public pieSaleStart = false;

    uint256 public al1MintLimit = 4;
    uint256 public al2MintLimit = 8;
    uint256 public publicMintLimit = 99;

    mapping(address => uint256) public freeClaimed;
    mapping(address => uint256) public al1Claimed;
    mapping(address => uint256) public al2Claimed;
    mapping(address => uint256) public publicClaimed;

    bytes32 public merkleRoot0 = 0x425590944b09b5c1744672da1d51519233ad8a3ac8e22ab59c3dc57d21d436d6;
    bytes32 public merkleRoot1 = 0x52abd3d3bc73f205ada4beeac1857e65c66ec772860ca47ee4a1441aa4bce177;
    bytes32 public merkleRoot2 = 0x82d3c2a681a6b15d7636e07d7d9c1932fc96ff2e4efc22ba470fd7cbba4dca27;
    
    bool public revealed = false;
    string private _hiddenURI = "https://arweave.net/wiRPTTBykF-1QFh0nxNskEA_ogzwJg3SDYbE_VHk1OM/hidden.json";
    string private _baseTokenURI;

    constructor() ERC721Psi("grin peace", "GP") {
        _safeMint(0xE962587325D6F8f682F93B335483789362917DCe, 1);
        _safeMint(0xBAa98fe972144EF1DE53b801045CEc5A291cB30E, 1);
        _safeMint(0xAD863559C9437205D6c8c68FF5f009A7767001ee, 1);
        _safeMint(0x5c0455464a07F7c715e0b4428EdfCa51DEF5594E, 1);

        _setDefaultRoyalty(address(0xc29b7EB1C7CBc39A06b7f42E9193683375960802), 1000);
    }

    // URI
    function _baseURI() internal view virtual override returns (string memory) {
        return _baseTokenURI;
    }

    function tokenURI(uint256 _tokenId) public view virtual override(ERC721Psi) returns (string memory) {
        if (revealed) {
            return
                string(abi.encodePacked(ERC721Psi.tokenURI(_tokenId), ".json"));
        } else {
            return _hiddenURI;
        }
    }

    // freeMint
    function freeMintCount(address _address, uint256 _count, bytes32[] memory _proof) public view returns (bool) {
        bytes32 _leaf = keccak256(abi.encodePacked(_address, _count));
        for (uint256 i = 0; i < _proof.length; i++) {
            _leaf = _leaf < _proof[i] ? keccak256(abi.encodePacked(_leaf, _proof[i])) : keccak256(abi.encodePacked(_proof[i], _leaf));
        }
        return _leaf == merkleRoot0;
    }

    function freeMint(uint256 _amount, uint256 _count, bytes32[] memory _proof) external virtual nonReentrant {
        require(freeSaleStart, "Free Mint is Paused");
        require(freeMintCount(msg.sender, _count, _proof), "Invalid count");
        require(_count > 0, "You have no FreeMint");
        require(_count >= _amount, "Over max FreeMint per wallet");
        require(_count >= freeClaimed[msg.sender] + _amount, "You have no FreeMint left");
        require((_amount + totalSupply()) <= (maxSupply), "No more NFTs");

        freeClaimed[msg.sender] += _amount;
        _safeMint(msg.sender, _amount);
    }

    // preMintAL1
    function checkMerkleProof1(bytes32[] calldata _merkleProof1) public view returns (bool) {
        bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
        return MerkleProof.verifyCalldata(_merkleProof1, merkleRoot1, leaf);
    }

    function preMint1(uint256 _quantity, bytes32[] calldata _merkleProof1) public payable nonReentrant {
        uint256 supply = totalSupply();
        uint256 cost = al1Price * _quantity;
        require(al1SaleStart, "Before sale begin.");
        require(supply + _quantity <= maxSupply, "Max supply over");
        require(al1Claimed[msg.sender] + _quantity <= al1MintLimit,"Already claimed max");
        require(msg.value >= cost, "Not enough funds");
        require(checkMerkleProof1(_merkleProof1), "Invalid Merkle Proof");
        al1Claimed[msg.sender] += _quantity;
        _safeMint(msg.sender, _quantity);
    }

    // preMintAL2
    function checkMerkleProof2(bytes32[] calldata _merkleProof2) public view returns (bool) {
        bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
        return MerkleProof.verifyCalldata(_merkleProof2, merkleRoot2, leaf);
    }

    function preMint2(uint256 _quantity, bytes32[] calldata _merkleProof2) public payable nonReentrant {
        uint256 supply = totalSupply();
        uint256 cost = al2Price * _quantity;
        require(al2SaleStart, "Before sale begin.");
        require(supply + _quantity <= maxSupply, "Max supply over");
        require(al2Claimed[msg.sender] + _quantity <= al2MintLimit,"Already claimed max");
        require(msg.value >= cost, "Not enough funds");
        require(checkMerkleProof2(_merkleProof2), "Invalid Merkle Proof");
        al2Claimed[msg.sender] += _quantity;
        _safeMint(msg.sender, _quantity);
    }

    // publicMint
    function publicMint(uint256 _quantity) public payable nonReentrant {
        uint256 supply = totalSupply();
        uint256 cost = publicPrice * _quantity;
        require(pubSaleStart, "Before sale begin.");
        require(supply + _quantity <= maxSupply, "Max supply over");
        require(msg.value >= cost, "Not enough funds");
        require(publicClaimed[msg.sender] + _quantity <= publicMintLimit,"Already claimed max");
        publicClaimed[msg.sender] += _quantity;
        _safeMint(msg.sender, _quantity);
    }

    // piementMint
    function piementMint(address _receiver, uint256 _quantity) public payable nonReentrant {
        uint256 supply = totalSupply();
        uint256 cost = piePrice * _quantity;
        require(pieSaleStart, "Before sale begin.");
        require(supply + _quantity <= maxSupply, "Max supply over");
        require(msg.value >= cost, "Not enough funds");
        require(publicClaimed[_receiver] + _quantity <= publicMintLimit, "Already claimed max");
        publicClaimed[_receiver] += _quantity;
        _safeMint(_receiver, _quantity);
    }

    // ownerMint
    function ownerMint(address _address, uint256 _quantity) public onlyOwner {
        uint256 supply = totalSupply();
        require(supply + _quantity <= maxSupply, "Max supply over");
        _safeMint(_address, _quantity);
    }

    // setURI
    function setBaseURI(string calldata _uri) public onlyOwner {
        _baseTokenURI = _uri;
    }

    function setHiddenBaseURI(string memory uri_) public onlyOwner {
        _hiddenURI = uri_;
    }

    // reveal
    function reveal(bool bool_) public onlyOwner {
        revealed = bool_;
    }

    // setMerkleRoot
    function setFreeMintMerkleRoot(bytes32 _merkleRoot) public onlyOwner {
        merkleRoot0 = _merkleRoot;
    }

    function setAL1MerkleRoot(bytes32 _merkleRoot) public onlyOwner {
        merkleRoot1 = _merkleRoot;
    }

    function setAL2MerkleRoot(bytes32 _merkleRoot) public onlyOwner {
        merkleRoot2 = _merkleRoot;
    }

    // setSaleStart
    function setFreeSaleStart(bool _state) public onlyOwner {
        freeSaleStart = _state;
    }

    function setAL1SaleStart(bool _state) public onlyOwner {
        al1SaleStart = _state;
    }

    function setAL2SaleStart(bool _state) public onlyOwner {
        al2SaleStart = _state;
    }

    function setPubSaleStart(bool _state) public onlyOwner {
        pubSaleStart = _state;
    }

    function setPiementSaleStart(bool _state) public onlyOwner {
        pieSaleStart = _state;
    }

    // setLimit
    function setAl1MintLimit(uint256 _quantity) public onlyOwner {
        al1MintLimit = _quantity;
    }

    function setAl2MintLimit(uint256 _quantity) public onlyOwner {
        al2MintLimit = _quantity;
    }

    function setPublicMintLimit(uint256 _quantity) public onlyOwner {
        publicMintLimit = _quantity;
    }

    // setMaxSupply
    function setMaxSupply(uint256 _quantity) public onlyOwner {
        require(totalSupply() <= maxSupply, "Lower than _currentIndex.");
        maxSupply = _quantity;
    }

    // setPrice
    function setAl1Price(uint256 _price) public onlyOwner {
        al1Price = _price;
    }

    function setAl2Price(uint256 _price) public onlyOwner {
        al2Price = _price;
    }

    function setPublicPrice(uint256 _price) public onlyOwner {
        publicPrice = _price;
    }

    function setPiePrice(uint256 _price) public onlyOwner {
        piePrice = _price;
    }

    // royality
    function setRoyalty(address _royaltyAddress, uint96 _feeNumerator) external onlyOwner {
        _setDefaultRoyalty(_royaltyAddress, _feeNumerator);
    }

    function supportsInterface(bytes4 _interfaceId) public view virtual override(ERC721Psi, ERC2981) returns (bool) {
        return
            ERC721Psi.supportsInterface(_interfaceId) ||
            ERC2981.supportsInterface(_interfaceId);
    }

    // withdraw
    function withdraw() external onlyOwner {
        uint256 balance = address(this).balance;
        Address.sendValue(payable(0xE962587325D6F8f682F93B335483789362917DCe), ((balance * 250000) / 1000000));
        Address.sendValue(payable(0x5c0455464a07F7c715e0b4428EdfCa51DEF5594E), ((balance * 250000) / 1000000));
        Address.sendValue(payable(0xAD863559C9437205D6c8c68FF5f009A7767001ee), ((balance * 250000) / 1000000));
        Address.sendValue(payable(0xBAa98fe972144EF1DE53b801045CEc5A291cB30E), ((balance * 250000) / 1000000));
    }
}
// Code by lettuce908

File 2 of 22 : ERC721Psi.sol
// SPDX-License-Identifier: MIT
/**
  ______ _____   _____ ______ ___  __ _  _  _
 |  ____|  __ \ / ____|____  |__ \/_ | || || |
 | |__  | |__) | |        / /   ) || | \| |/ |
 |  __| |  _  /| |       / /   / / | |\_   _/
 | |____| | \ \| |____  / /   / /_ | |  | |
 |______|_|  \_\\_____|/_/   |____||_|  |_|


 */

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/StorageSlot.sol";
import "solidity-bits/contracts/BitMaps.sol";


contract ERC721Psi is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
    using Address for address;
    using Strings 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 = 1;

    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.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165, IERC165)
        returns (bool)
    {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            interfaceId == type(IERC721Enumerable).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 = 1; 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 - 1;
    }

    /**
     * @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 = 1; 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 = 1; 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 3 of 22 : ERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.20;

import {IERC2981} from "../../interfaces/IERC2981.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.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.
 */
abstract contract ERC2981 is IERC2981, ERC165 {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

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

    /**
     * @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1).
     */
    error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator);

    /**
     * @dev The default royalty receiver is invalid.
     */
    error ERC2981InvalidDefaultRoyaltyReceiver(address receiver);

    /**
     * @dev The royalty set for an specific `tokenId` is invalid (eg. (numerator / denominator) >= 1).
     */
    error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator);

    /**
     * @dev The royalty receiver for `tokenId` is invalid.
     */
    error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver);

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

    /**
     * @inheritdoc IERC2981
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual 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 {
        uint256 denominator = _feeDenominator();
        if (feeNumerator > denominator) {
            // Royalty fee will exceed the sale price
            revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator);
        }
        if (receiver == address(0)) {
            revert ERC2981InvalidDefaultRoyaltyReceiver(address(0));
        }

        _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 {
        uint256 denominator = _feeDenominator();
        if (feeNumerator > denominator) {
            // Royalty fee will exceed the sale price
            revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator);
        }
        if (receiver == address(0)) {
            revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0));
        }

        _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];
    }
}

File 4 of 22 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

        if (totalHashes > 0) {
            require(proofPos == proofLen, "MerkleProof: invalid multiproof");
            unchecked {
                return hashes[totalHashes - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

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

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

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

        if (totalHashes > 0) {
            require(proofPos == proofLen, "MerkleProof: invalid multiproof");
            unchecked {
                return hashes[totalHashes - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

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

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

File 6 of 22 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

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

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

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

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

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

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

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 8 of 22 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

    /**
     * @dev 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. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

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

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

File 9 of 22 : 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";
import "./Popcount.sol";

/**
 * @dev This Library is a modified version of Openzeppelin's BitMaps library with extra features.
 *
 * 1. 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.
 * 2. Setting and unsetting the bitmap consecutively.
 * 3. Accounting number of set bits within a given range.   
 *
*/

/**
 * @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 Returns number of set bits within a range.
     */
    function popcountA(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal view returns(uint256 count) {
        uint256 bucket = startIndex >> 8;

        uint256 bucketStartIndex = (startIndex & 0xff);

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

                while(amount > 256) {
                    count += Popcount.popcount256A(bitmap._data[bucket]);
                    amount -= 256;
                    bucket++;
                }
                count += Popcount.popcount256A(
                    bitmap._data[bucket] & (MASK_FULL << (256 - amount))
                );
            }
        }
    }

    /**
     * @dev Returns number of set bits within a range.
     */
    function popcountB(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal view returns(uint256 count) {
        uint256 bucket = startIndex >> 8;

        uint256 bucketStartIndex = (startIndex & 0xff);

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

                while(amount > 256) {
                    count += Popcount.popcount256B(bitmap._data[bucket]);
                    amount -= 256;
                    bucket++;
                }
                count += Popcount.popcount256B(
                    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 10 of 22 : StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
 * _Available since v4.9 for `string`, `bytes`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @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 14 of 22 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 15 of 22 : 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 16 of 22 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * 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 17 of 22 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 18 of 22 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 19 of 22 : IERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

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

File 20 of 22 : Popcount.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 Popcount {
    uint256 private constant m1 = 0x5555555555555555555555555555555555555555555555555555555555555555;
    uint256 private constant m2 = 0x3333333333333333333333333333333333333333333333333333333333333333;
    uint256 private constant m4 = 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f;
    uint256 private constant h01 = 0x0101010101010101010101010101010101010101010101010101010101010101;

    function popcount256A(uint256 x) internal pure returns (uint256 count) {
        unchecked{
            for (count=0; x!=0; count++)
                x &= x - 1;
        }
    }

    function popcount256B(uint256 x) internal pure returns (uint256) {
        if (x == type(uint256).max) {
            return 256;
        }
        unchecked {
            x -= (x >> 1) & m1;             //put count of each 2 bits into those 2 bits
            x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits 
            x = (x + (x >> 4)) & m4;        //put count of each 8 bits into those 8 bits 
            x = (x * h01) >> 248;  //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) + ... 
        }
        return x;
    }
}

File 21 of 22 : 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 22 of 22 : 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);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidDefaultRoyalty","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidDefaultRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidTokenRoyalty","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidTokenRoyaltyReceiver","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"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":"","type":"address"}],"name":"al1Claimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"al1MintLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"al1Price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"al1SaleStart","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"al2Claimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"al2MintLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"al2Price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"al2SaleStart","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_merkleProof1","type":"bytes32[]"}],"name":"checkMerkleProof1","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_merkleProof2","type":"bytes32[]"}],"name":"checkMerkleProof2","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"freeClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_count","type":"uint256"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"}],"name":"freeMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"uint256","name":"_count","type":"uint256"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"}],"name":"freeMintCount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"freeSaleStart","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot0","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot1","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot2","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"ownerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"piePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pieSaleStart","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"piementMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"bytes32[]","name":"_merkleProof1","type":"bytes32[]"}],"name":"preMint1","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"bytes32[]","name":"_merkleProof2","type":"bytes32[]"}],"name":"preMint2","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"pubSaleStart","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"publicClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"publicMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"publicMintLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"bool","name":"bool_","type":"bool"}],"name":"reveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setAL1MerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setAL1SaleStart","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setAL2MerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setAL2SaleStart","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"setAl1MintLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setAl1Price","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"setAl2MintLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setAl2Price","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setFreeMintMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setFreeSaleStart","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri_","type":"string"}],"name":"setHiddenBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setPiePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setPiementSaleStart","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setPubSaleStart","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"setPublicMintLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setPublicPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_royaltyAddress","type":"address"},{"internalType":"uint96","name":"_feeNumerator","type":"uint96"}],"name":"setRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"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":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

600160049081556107d0600b556618de76816d8000600c55661c6bf526340000600d55661ff973cafa8000600e819055600f556010805464ffffffffff19166301010101179055601155600860125560636013557f425590944b09b5c1744672da1d51519233ad8a3ac8e22ab59c3dc57d21d436d66018557f52abd3d3bc73f205ada4beeac1857e65c66ec772860ca47ee4a1441aa4bce1776019557f82d3c2a681a6b15d7636e07d7d9c1932fc96ff2e4efc22ba470fd7cbba4dca27601a55601b805460ff19169055610100604052604b6080818152906200438160a039601c90620000ed908262000780565b50348015620000fa575f80fd5b506040518060400160405280600a8152602001696772696e20706561636560b01b81525060405180604001604052806002815260200161047560f41b81525081600190816200014a919062000780565b50600262000159828262000780565b50505062000176620001706200022960201b60201c565b6200022d565b6001600a8190556200019e9073e962587325d6f8f682f93b335483789362917dce906200027e565b620001bf73baa98fe972144ef1de53b801045cec5a291cb30e60016200027e565b620001e073ad863559c9437205d6c8c68ff5f009a7767001ee60016200027e565b62000201735c0455464a07f7c715e0b4428edfca51def5594e60016200027e565b6200022373c29b7eb1c7cbc39a06b7f42e91936833759608026103e8620002a3565b62000933565b3390565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6200029f828260405180602001604052805f8152506200034d60201b60201c565b5050565b6127106001600160601b038216811015620002e857604051636f483d0960e01b81526001600160601b0383166004820152602481018290526044015b60405180910390fd5b6001600160a01b0383166200031357604051635b6cc80560e11b81525f6004820152602401620002df565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600755565b6004546200035c8484620003d3565b6200036b5f8583868662000556565b620003cd5760405162461bcd60e51b815260206004820152603560248201525f805160206200436183398151915260448201527f31526563656976657220696d706c656d656e74657200000000000000000000006064820152608401620002df565b50505050565b60045481620004335760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401620002df565b6001600160a01b038316620004975760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401620002df565b8160045f828254620004aa91906200085c565b90915550505f81815260036020908152604080832080546001600160a01b0319166001600160a01b038816179055600884901c83529082905290208054600160ff1b60ff84161c179055805b6200050283836200085c565b811015620003cd5760405181906001600160a01b038616905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4806200054d8162000878565b915050620004f6565b5f6001600160a01b0385163b15620006d357506001835b6200057984866200085c565b811015620006cc57604051630a85bd0160e11b81526001600160a01b0387169063150b7a0290620005b59033908b908690899060040162000893565b6020604051808303815f875af1925050508015620005f2575060408051601f3d908101601f19168201909252620005ef9181019062000903565b60015b62000696573d80801562000622576040519150601f19603f3d011682016040523d82523d5f602084013e62000627565b606091505b5080515f036200068e5760405162461bcd60e51b815260206004820152603560248201525f805160206200436183398151915260448201527f31526563656976657220696d706c656d656e74657200000000000000000000006064820152608401620002df565b805181602001fd5b828015620006b457506001600160e01b03198116630a85bd0160e11b145b92505080620006c38162000878565b9150506200056d565b50620006d7565b5060015b95945050505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806200070957607f821691505b6020821081036200072857634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156200077b575f81815260208120601f850160051c81016020861015620007565750805b601f850160051c820191505b81811015620007775782815560010162000762565b5050505b505050565b81516001600160401b038111156200079c576200079c620006e0565b620007b481620007ad8454620006f4565b846200072e565b602080601f831160018114620007ea575f8415620007d25750858301515b5f19600386901b1c1916600185901b17855562000777565b5f85815260208120601f198616915b828110156200081a57888601518255948401946001909101908401620007f9565b50858210156200083857878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52601160045260245ffd5b8082018082111562000872576200087262000848565b92915050565b5f600182016200088c576200088c62000848565b5060010190565b5f60018060a01b03808716835260208187168185015285604085015260806060850152845191508160808501525f5b82811015620008e05785810182015185820160a001528101620008c2565b50505f60a0828501015260a0601f19601f83011684010191505095945050505050565b5f6020828403121562000914575f80fd5b81516001600160e01b0319811681146200092c575f80fd5b9392505050565b613a2080620009415f395ff3fe608060405260043610610400575f3560e01c8063715018a611610215578063b5b1cd7c1161011e578063d6a35d20116100a8578063ef3e067c11610078578063ef3e067c14610bf4578063f2fde38b14610c13578063f6eae78d14610c32578063fb4177ec14610c47578063fe10f71114610c5c575f80fd5b8063d6a35d2014610b5a578063dde44b8914610b79578063e64710e614610b98578063e985e9c514610bad575f80fd5b8063c6275255116100ee578063c627525514610ad2578063c87b56dd14610af1578063ca34adf014610b10578063cfd9480b14610b25578063d5abeb0114610b45575f80fd5b8063b5b1cd7c14610a54578063b88d4fde14610a7f578063bb485b8814610a9e578063bf5a0be014610ab3575f80fd5b806397d14e631161019f578063a22cb4651161016f578063a22cb465146109b7578063a945bf80146109d6578063a9a4445c146109eb578063aeb8666514610a0a578063b1d8d08414610a29575f80fd5b806397d14e631461093c5780639a1148241461095b5780639aa289ce146109795780639b23484f14610998575f80fd5b80638e924901116101e55780638e924901146108b65780638f2fc60b146108d55780638f3ec31a146108f4578063940cd05b1461090957806395d89b4114610928575f80fd5b8063715018a61461085f5780637f7062cd1461087357806380451ec0146108865780638da5cb5b14610899575f80fd5b8063484b973c1161031757806361c0b6a0116102a15780636355336f116102715780636355336f146107d457806366d97230146107f3578063684c70e71461080c5780636f8b44b01461082157806370a0823114610840575f80fd5b806361c0b6a01461074c5780636231935e1461077757806362e5041c146107965780636352211e146107b5575f80fd5b80634f6ccce7116102e75780634f6ccce7146106c15780634fcb6f92146106e057806351830227146106f557806355f804b31461070e5780635a6512e31461072d575f80fd5b8063484b973c14610651578063497e0ec0146106705780634d791938146106835780634eaa9c62146106a2575f80fd5b806320ac6850116103985780632f745c59116103685780632f745c59146105cb5780632fb65558146105ea5780633ccfd60b146105ff5780633f8c05951461061357806342842e0e14610632575f80fd5b806320ac68501461053c57806323b872dd1461055b5780632a55205a1461057a5780632db11544146105b8575f80fd5b806311bf2047116103d357806311bf2047146104b157806318160ddd146104ea5780631b0ebf37146104fe5780631e95044d1461051d575f80fd5b806301ffc9a71461040457806306fdde0314610438578063081812fc14610459578063095ea7b314610490575b5f80fd5b34801561040f575f80fd5b5061042361041e366004612ed2565b610c7d565b60405190151581526020015b60405180910390f35b348015610443575f80fd5b5061044c610c9c565b60405161042f9190612f3a565b348015610464575f80fd5b50610478610473366004612f4c565b610d2c565b6040516001600160a01b03909116815260200161042f565b34801561049b575f80fd5b506104af6104aa366004612f79565b610dbc565b005b3480156104bc575f80fd5b506104dc6104cb366004612fa1565b60166020525f908152604090205481565b60405190815260200161042f565b3480156104f5575f80fd5b506104dc610ed2565b348015610509575f80fd5b50610423610518366004612ffa565b610ee7565b348015610528575f80fd5b506104af610537366004613047565b610f32565b348015610547575f80fd5b506104af6105563660046130f8565b610f5a565b348015610566575f80fd5b506104af61057536600461313c565b610f72565b348015610585575f80fd5b50610599610594366004613175565b610fa3565b604080516001600160a01b03909316835260208301919091520161042f565b6104af6105c6366004612f4c565b61104f565b3480156105d6575f80fd5b506104dc6105e5366004612f79565b611160565b3480156105f5575f80fd5b506104dc600f5481565b34801561060a575f80fd5b506104af611229565b34801561061e575f80fd5b5061042361062d366004612ffa565b6112e5565b34801561063d575f80fd5b506104af61064c36600461313c565b611328565b34801561065c575f80fd5b506104af61066b366004612f79565b611342565b6104af61067e366004613195565b61138b565b34801561068e575f80fd5b506104af61069d366004613047565b6114e5565b3480156106ad575f80fd5b506104af6106bc366004612f4c565b61150b565b3480156106cc575f80fd5b506104dc6106db366004612f4c565b611518565b3480156106eb575f80fd5b506104dc60185481565b348015610700575f80fd5b50601b546104239060ff1681565b348015610719575f80fd5b506104af6107283660046131dc565b6115d0565b348015610738575f80fd5b506104af610747366004613047565b6115e5565b348015610757575f80fd5b506104dc610766366004612fa1565b60146020525f908152604090205481565b348015610782575f80fd5b506104af610791366004613047565b611609565b3480156107a1575f80fd5b506104af6107b0366004612f4c565b611624565b3480156107c0575f80fd5b506104786107cf366004612f4c565b611631565b3480156107df575f80fd5b506104af6107ee366004612f4c565b611644565b3480156107fe575f80fd5b506010546104239060ff1681565b348015610817575f80fd5b506104dc60115481565b34801561082c575f80fd5b506104af61083b366004612f4c565b611651565b34801561084b575f80fd5b506104dc61085a366004612fa1565b6116b7565b34801561086a575f80fd5b506104af611786565b6104af610881366004612f79565b611799565b6104af610894366004613195565b6118ba565b3480156108a4575f80fd5b506009546001600160a01b0316610478565b3480156108c1575f80fd5b506104af6108d0366004612f4c565b6119f7565b3480156108e0575f80fd5b506104af6108ef366004613247565b611a04565b3480156108ff575f80fd5b506104dc60125481565b348015610914575f80fd5b506104af610923366004613047565b611a16565b348015610933575f80fd5b5061044c611a31565b348015610947575f80fd5b506010546104239062010000900460ff1681565b348015610966575f80fd5b5060105461042390610100900460ff1681565b348015610984575f80fd5b506104af610993366004613303565b611a40565b3480156109a3575f80fd5b506104af6109b2366004612f4c565b611c60565b3480156109c2575f80fd5b506104af6109d136600461334e565b611c6d565b3480156109e1575f80fd5b506104dc600e5481565b3480156109f6575f80fd5b506104af610a05366004612f4c565b611d30565b348015610a15575f80fd5b50610423610a2436600461337f565b611d3d565b348015610a34575f80fd5b506104dc610a43366004612fa1565b60156020525f908152604090205481565b348015610a5f575f80fd5b506104dc610a6e366004612fa1565b60176020525f908152604090205481565b348015610a8a575f80fd5b506104af610a993660046133bb565b611e62565b348015610aa9575f80fd5b506104dc60135481565b348015610abe575f80fd5b506104af610acd366004613047565b611e9a565b348015610add575f80fd5b506104af610aec366004612f4c565b611ebc565b348015610afc575f80fd5b5061044c610b0b366004612f4c565b611ec9565b348015610b1b575f80fd5b506104dc601a5481565b348015610b30575f80fd5b50601054610423906301000000900460ff1681565b348015610b50575f80fd5b506104dc600b5481565b348015610b65575f80fd5b506104af610b74366004612f4c565b611f9b565b348015610b84575f80fd5b506104af610b93366004612f4c565b611fa8565b348015610ba3575f80fd5b506104dc60195481565b348015610bb8575f80fd5b50610423610bc7366004613431565b6001600160a01b039182165f90815260066020908152604080832093909416825291909152205460ff1690565b348015610bff575f80fd5b506104af610c0e366004612f4c565b611fb5565b348015610c1e575f80fd5b506104af610c2d366004612fa1565b611fc2565b348015610c3d575f80fd5b506104dc600c5481565b348015610c52575f80fd5b506104dc600d5481565b348015610c67575f80fd5b5060105461042390640100000000900460ff1681565b5f610c8782612038565b80610c965750610c96826120a2565b92915050565b606060018054610cab90613459565b80601f0160208091040260200160405190810160405280929190818152602001828054610cd790613459565b8015610d225780601f10610cf957610100808354040283529160200191610d22565b820191905f5260205f20905b815481529060010190602001808311610d0557829003601f168201915b5050505050905090565b5f610d38826004541190565b610da15760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b505f908152600560205260409020546001600160a01b031690565b5f610dc682611631565b9050806001600160a01b0316836001600160a01b031603610e355760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401610d98565b336001600160a01b0382161480610e515750610e518133610bc7565b610ec35760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608401610d98565b610ecd83836120c6565b505050565b5f6001600454610ee291906134a5565b905090565b6040516001600160601b03193360601b1660208201525f908190603401604051602081830303815290604052805190602001209050610f2a848460195484612133565b949350505050565b610f3a61214a565b601080549115156401000000000264ff0000000019909216919091179055565b610f6261214a565b601c610f6e82826134fd565b5050565b610f7c33826121a4565b610f985760405162461bcd60e51b8152600401610d98906135b8565b610ecd83838361228c565b5f8281526008602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916110175750604080518082019091526007546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101515f9061271090611035906001600160601b03168761360c565b61103f9190613623565b91519350909150505b9250929050565b611057612472565b5f611060610ed2565b90505f82600e54611071919061360c565b6010549091506301000000900460ff1661109d5760405162461bcd60e51b8152600401610d9890613642565b600b546110aa848461366e565b11156110c85760405162461bcd60e51b8152600401610d9890613681565b803410156110e85760405162461bcd60e51b8152600401610d98906136aa565b601354335f9081526017602052604090205461110590859061366e565b11156111235760405162461bcd60e51b8152600401610d98906136d4565b335f908152601760205260408120805485929061114190849061366e565b90915550611151905033846124cb565b505061115d6001600a55565b50565b5f8060015b6004548110156111d45761117a816004541190565b801561119f575061118a81611631565b6001600160a01b0316856001600160a01b0316145b156111c2578382036111b4579150610c969050565b816111be81613701565b9250505b806111cc81613701565b915050611165565b5060405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a206f776e657220696e646578206f7574206f6620626f604482015263756e647360e01b6064820152608401610d98565b61123161214a565b4761126a73e962587325d6f8f682f93b335483789362917dce620f424061125b846203d09061360c565b6112659190613623565b6124e4565b611293735c0455464a07f7c715e0b4428edfca51def5594e620f424061125b846203d09061360c565b6112bc73ad863559c9437205d6c8c68ff5f009a7767001ee620f424061125b846203d09061360c565b61115d73baa98fe972144ef1de53b801045cec5a291cb30e620f424061125b846203d09061360c565b6040516001600160601b03193360601b1660208201525f908190603401604051602081830303815290604052805190602001209050610f2a8484601a5484612133565b610ecd83838360405180602001604052805f815250611e62565b61134a61214a565b5f611353610ed2565b600b54909150611363838361366e565b11156113815760405162461bcd60e51b8152600401610d9890613681565b610ecd83836124cb565b611393612472565b5f61139c610ed2565b90505f84600d546113ad919061360c565b60105490915062010000900460ff166113d85760405162461bcd60e51b8152600401610d9890613642565b600b546113e5868461366e565b11156114035760405162461bcd60e51b8152600401610d9890613681565b601254335f9081526016602052604090205461142090879061366e565b111561143e5760405162461bcd60e51b8152600401610d98906136d4565b8034101561145e5760405162461bcd60e51b8152600401610d98906136aa565b61146884846112e5565b6114ab5760405162461bcd60e51b815260206004820152601460248201527324b73b30b634b21026b2b935b63290283937b7b360611b6044820152606401610d98565b335f90815260166020526040812080548792906114c990849061366e565b909155506114d9905033866124cb565b5050610ecd6001600a55565b6114ed61214a565b6010805491151563010000000263ff00000019909216919091179055565b61151361214a565b601255565b5f611521610ed2565b821061157d5760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a20676c6f62616c20696e646578206f7574206f6620626044820152646f756e647360d81b6064820152608401610d98565b5f60015b6004548110156115c957611596816004541190565b156115b7578382036115a9579392505050565b816115b381613701565b9250505b806115c181613701565b915050611581565b5050919050565b6115d861214a565b601d610ecd828483613719565b6115ed61214a565b60108054911515620100000262ff000019909216919091179055565b61161161214a565b6010805460ff1916911515919091179055565b61162c61214a565b601955565b5f8061163c836125f9565b509392505050565b61164c61214a565b601a55565b61165961214a565b600b54611664610ed2565b11156116b25760405162461bcd60e51b815260206004820152601960248201527f4c6f776572207468616e205f63757272656e74496e6465782e000000000000006044820152606401610d98565b600b55565b5f6001600160a01b0382166117245760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401610d98565b5f60015b60045481101561177f5761173d816004541190565b1561176f5761174b81611631565b6001600160a01b0316846001600160a01b03160361176f5761176c82613701565b91505b61177881613701565b9050611728565b5092915050565b61178e61214a565b6117975f612690565b565b6117a1612472565b5f6117aa610ed2565b90505f82600f546117bb919061360c565b601054909150640100000000900460ff166117e85760405162461bcd60e51b8152600401610d9890613642565b600b546117f5848461366e565b11156118135760405162461bcd60e51b8152600401610d9890613681565b803410156118335760405162461bcd60e51b8152600401610d98906136aa565b6013546001600160a01b0385165f9081526017602052604090205461185990859061366e565b11156118775760405162461bcd60e51b8152600401610d98906136d4565b6001600160a01b0384165f908152601760205260408120805485929061189e90849061366e565b909155506118ae905084846124cb565b5050610f6e6001600a55565b6118c2612472565b5f6118cb610ed2565b90505f84600c546118dc919061360c565b601054909150610100900460ff166119065760405162461bcd60e51b8152600401610d9890613642565b600b54611913868461366e565b11156119315760405162461bcd60e51b8152600401610d9890613681565b601154335f9081526015602052604090205461194e90879061366e565b111561196c5760405162461bcd60e51b8152600401610d98906136d4565b8034101561198c5760405162461bcd60e51b8152600401610d98906136aa565b6119968484610ee7565b6119d95760405162461bcd60e51b815260206004820152601460248201527324b73b30b634b21026b2b935b63290283937b7b360611b6044820152606401610d98565b335f90815260156020526040812080548792906114c990849061366e565b6119ff61214a565b601155565b611a0c61214a565b610f6e82826126e1565b611a1e61214a565b601b805460ff1916911515919091179055565b606060028054610cab90613459565b611a48612472565b60105460ff16611a905760405162461bcd60e51b8152602060048201526013602482015272119c995948135a5b9d081a5cc814185d5cd959606a1b6044820152606401610d98565b611a9b338383611d3d565b611ad75760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a590818dbdd5b9d609a1b6044820152606401610d98565b5f8211611b1d5760405162461bcd60e51b8152602060048201526014602482015273165bdd481a185d99481b9bc8119c9959535a5b9d60621b6044820152606401610d98565b82821015611b6d5760405162461bcd60e51b815260206004820152601c60248201527f4f766572206d617820467265654d696e74207065722077616c6c6574000000006044820152606401610d98565b335f90815260146020526040902054611b8790849061366e565b821015611bd65760405162461bcd60e51b815260206004820152601960248201527f596f752068617665206e6f20467265654d696e74206c656674000000000000006044820152606401610d98565b600b54611be1610ed2565b611beb908561366e565b1115611c285760405162461bcd60e51b815260206004820152600c60248201526b4e6f206d6f7265204e46547360a01b6044820152606401610d98565b335f9081526014602052604081208054859290611c4690849061366e565b90915550611c56905033846124cb565b610ecd6001600a55565b611c6861214a565b600c55565b336001600160a01b03831603611cc55760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606401610d98565b335f8181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611d3861214a565b600d55565b6040516001600160601b0319606085901b166020820152603481018390525f9081906054016040516020818303038152906040528051906020012090505f5b8351811015611e5557838181518110611d9757611d976137d4565b60200260200101518210611df557838181518110611db757611db76137d4565b602002602001015182604051602001611dda929190918252602082015260400190565b60405160208183030381529060405280519060200120611e41565b81848281518110611e0857611e086137d4565b6020026020010151604051602001611e2a929190918252602082015260400190565b604051602081830303815290604052805190602001205b915080611e4d81613701565b915050611d7c565b5060185414949350505050565b611e6c33836121a4565b611e885760405162461bcd60e51b8152600401610d98906135b8565b611e9484848484612783565b50505050565b611ea261214a565b601080549115156101000261ff0019909216919091179055565b611ec461214a565b600e55565b601b5460609060ff1615611f0657611ee0826127b8565b604051602001611ef091906137e8565b6040516020818303038152906040529050919050565b601c8054611f1390613459565b80601f0160208091040260200160405190810160405280929190818152602001828054611f3f90613459565b8015611f8a5780601f10611f6157610100808354040283529160200191611f8a565b820191905f5260205f20905b815481529060010190602001808311611f6d57829003601f168201915b50505050509050919050565b919050565b611fa361214a565b600f55565b611fb061214a565b601855565b611fbd61214a565b601355565b611fca61214a565b6001600160a01b03811661202f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d98565b61115d81612690565b5f6001600160e01b031982166380ac58cd60e01b148061206857506001600160e01b03198216635b5e139f60e01b145b8061208357506001600160e01b0319821663780e9d6360e01b145b80610c9657506301ffc9a760e01b6001600160e01b0319831614610c96565b5f6001600160e01b0319821663152a902d60e11b1480610c965750610c9682612038565b5f81815260056020526040902080546001600160a01b0319166001600160a01b03841690811790915581906120fa82611631565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b5f8261214086868561287d565b1495945050505050565b6009546001600160a01b031633146117975760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d98565b5f6121b0826004541190565b6122145760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610d98565b5f61221e83611631565b9050806001600160a01b0316846001600160a01b031614806122595750836001600160a01b031661224e84610d2c565b6001600160a01b0316145b80610f2a57506001600160a01b038082165f9081526006602090815260408083209388168352929052205460ff16610f2a565b5f80612297836125f9565b91509150846001600160a01b0316826001600160a01b0316146123115760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401610d98565b6001600160a01b0384166123775760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401610d98565b6123815f846120c6565b5f61238d84600161366e565b600881901c5f90815260208190526040902054909150600160ff1b60ff83161c161580156123bc575060045481105b156123f1575f81815260036020526040812080546001600160a01b0319166001600160a01b0389161790556123f190826128c8565b5f84815260036020526040902080546001600160a01b0319166001600160a01b038716179055818414612428576124285f856128c8565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b6002600a54036124c45760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d98565b6002600a55565b610f6e828260405180602001604052805f8152506128f3565b804710156125345760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610d98565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f811461257d576040519150601f19603f3d011682016040523d82523d5f602084013e612582565b606091505b5050905080610ecd5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610d98565b5f80612606836004541190565b6126675760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610d98565b6126708361290d565b5f818152600360205260409020546001600160a01b031694909350915050565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6127106001600160601b03821681101561272057604051636f483d0960e01b81526001600160601b038316600482015260248101829052604401610d98565b6001600160a01b03831661274957604051635b6cc80560e11b81525f6004820152602401610d98565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600755565b61278e84848461228c565b61279c848484600185612918565b611e945760405162461bcd60e51b8152600401610d9890613810565b60606127c5826004541190565b6128245760405162461bcd60e51b815260206004820152602a60248201527f4552433732315073693a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608401610d98565b5f61282d612a4b565b90505f81511161284b5760405180602001604052805f815250612876565b8061285584612a5a565b604051602001612866929190613865565b6040516020818303038152906040525b9392505050565b5f81815b848110156128bf576128ab8287878481811061289f5761289f6137d4565b90506020020135612ae9565b9150806128b781613701565b915050612881565b50949350505050565b600881901c5f90815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6004546129008484612b12565b61279c5f85838686612918565b5f610c968183612c74565b5f6001600160a01b0385163b15612a3e57506001835b612938848661366e565b811015612a3857604051630a85bd0160e11b81526001600160a01b0387169063150b7a02906129719033908b9086908990600401613893565b6020604051808303815f875af19250505080156129ab575060408051601f3d908101601f191682019092526129a8918101906138cf565b60015b612a06573d8080156129d8576040519150601f19603f3d011682016040523d82523d5f602084013e6129dd565b606091505b5080515f036129fe5760405162461bcd60e51b8152600401610d9890613810565b805181602001fd5b828015612a2357506001600160e01b03198116630a85bd0160e11b145b92505080612a3081613701565b91505061292e565b50612a42565b5060015b95945050505050565b6060601d8054610cab90613459565b60605f612a6683612d68565b60010190505f816001600160401b03811115612a8457612a84613060565b6040519080825280601f01601f191660200182016040528015612aae576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612ab857509392505050565b5f818310612b03575f828152602084905260409020612876565b505f9182526020526040902090565b60045481612b705760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401610d98565b6001600160a01b038316612bd25760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610d98565b8160045f828254612be3919061366e565b90915550505f81815260036020526040812080546001600160a01b0319166001600160a01b038616179055612c1890826128c8565b805b612c24838361366e565b811015611e945760405181906001600160a01b038616905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480612c6c81613701565b915050612c1a565b600881901c5f8181526020849052604081205490919060ff808516919082181c8015612cb557612ca381612e3f565b60ff168203600884901b179350612d5f565b5f8311612d215760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401610d98565b505f199091015f818152602086905260409020549091908015612d5a57612d4781612e3f565b60ff0360ff16600884901b179350612d5f565b612cb5565b50505092915050565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310612da65772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612dd2576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310612df057662386f26fc10000830492506010015b6305f5e1008310612e08576305f5e100830492506008015b6127108310612e1c57612710830492506004015b60648310612e2e576064830492506002015b600a8310610c965760010192915050565b5f60405180610120016040528061010081526020016138eb610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff612e8785612ea8565b02901c81518110612e9a57612e9a6137d4565b016020015160f81c92915050565b5f808211612eb4575f80fd5b505f8190031690565b6001600160e01b03198116811461115d575f80fd5b5f60208284031215612ee2575f80fd5b813561287681612ebd565b5f5b83811015612f07578181015183820152602001612eef565b50505f910152565b5f8151808452612f26816020860160208601612eed565b601f01601f19169290920160200192915050565b602081525f6128766020830184612f0f565b5f60208284031215612f5c575f80fd5b5035919050565b80356001600160a01b0381168114611f96575f80fd5b5f8060408385031215612f8a575f80fd5b612f9383612f63565b946020939093013593505050565b5f60208284031215612fb1575f80fd5b61287682612f63565b5f8083601f840112612fca575f80fd5b5081356001600160401b03811115612fe0575f80fd5b6020830191508360208260051b8501011115611048575f80fd5b5f806020838503121561300b575f80fd5b82356001600160401b03811115613020575f80fd5b61302c85828601612fba565b90969095509350505050565b80358015158114611f96575f80fd5b5f60208284031215613057575f80fd5b61287682613038565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b038111828210171561309c5761309c613060565b604052919050565b5f6001600160401b038311156130bc576130bc613060565b6130cf601f8401601f1916602001613074565b90508281528383830111156130e2575f80fd5b828260208301375f602084830101529392505050565b5f60208284031215613108575f80fd5b81356001600160401b0381111561311d575f80fd5b8201601f8101841361312d575f80fd5b610f2a848235602084016130a4565b5f805f6060848603121561314e575f80fd5b61315784612f63565b925061316560208501612f63565b9150604084013590509250925092565b5f8060408385031215613186575f80fd5b50508035926020909101359150565b5f805f604084860312156131a7575f80fd5b8335925060208401356001600160401b038111156131c3575f80fd5b6131cf86828701612fba565b9497909650939450505050565b5f80602083850312156131ed575f80fd5b82356001600160401b0380821115613203575f80fd5b818501915085601f830112613216575f80fd5b813581811115613224575f80fd5b866020828501011115613235575f80fd5b60209290920196919550909350505050565b5f8060408385031215613258575f80fd5b61326183612f63565b915060208301356001600160601b038116811461327c575f80fd5b809150509250929050565b5f82601f830112613296575f80fd5b813560206001600160401b038211156132b1576132b1613060565b8160051b6132c0828201613074565b92835284810182019282810190878511156132d9575f80fd5b83870192505b848310156132f8578235825291830191908301906132df565b979650505050505050565b5f805f60608486031215613315575f80fd5b833592506020840135915060408401356001600160401b03811115613338575f80fd5b61334486828701613287565b9150509250925092565b5f806040838503121561335f575f80fd5b61336883612f63565b915061337660208401613038565b90509250929050565b5f805f60608486031215613391575f80fd5b61339a84612f63565b92506020840135915060408401356001600160401b03811115613338575f80fd5b5f805f80608085870312156133ce575f80fd5b6133d785612f63565b93506133e560208601612f63565b92506040850135915060608501356001600160401b03811115613406575f80fd5b8501601f81018713613416575f80fd5b613425878235602084016130a4565b91505092959194509250565b5f8060408385031215613442575f80fd5b61344b83612f63565b915061337660208401612f63565b600181811c9082168061346d57607f821691505b60208210810361348b57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610c9657610c96613491565b601f821115610ecd575f81815260208120601f850160051c810160208610156134de5750805b601f850160051c820191505b8181101561246a578281556001016134ea565b81516001600160401b0381111561351657613516613060565b61352a816135248454613459565b846134b8565b602080601f83116001811461355d575f84156135465750858301515b5f19600386901b1c1916600185901b17855561246a565b5f85815260208120601f198616915b8281101561358b5788860151825594840194600190910190840161356c565b50858210156135a857878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b8082028115828204841417610c9657610c96613491565b5f8261363d57634e487b7160e01b5f52601260045260245ffd5b500490565b6020808252601290820152712132b337b9329039b0b632903132b3b4b71760711b604082015260600190565b80820180821115610c9657610c96613491565b6020808252600f908201526e26b0bc1039bab838363c9037bb32b960891b604082015260600190565b60208082526010908201526f4e6f7420656e6f7567682066756e647360801b604082015260600190565b602080825260139082015272082d8e4cac2c8f240c6d8c2d2dacac840dac2f606b1b604082015260600190565b5f6001820161371257613712613491565b5060010190565b6001600160401b0383111561373057613730613060565b6137448361373e8354613459565b836134b8565b5f601f841160018114613775575f851561375e5750838201355b5f19600387901b1c1916600186901b1783556137cd565b5f83815260209020601f19861690835b828110156137a55786850135825560209485019460019092019101613785565b50868210156137c1575f1960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b634e487b7160e01b5f52603260045260245ffd5b5f82516137f9818460208701612eed565b64173539b7b760d91b920191825250600501919050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b5f8351613876818460208801612eed565b83519083019061388a818360208801612eed565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f906138c590830184612f0f565b9695505050505050565b5f602082840312156138df575f80fd5b815161287681612ebd56fe0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a2646970667358221220f4c4d75ba2dd3a436e4be5f83e518bc984556a016cfd8f242082e2ac46334ef364736f6c634300081400334552433732315073693a207472616e7366657220746f206e6f6e20455243373268747470733a2f2f617277656176652e6e65742f77695250545442796b462d31514668306e784e736b45415f6f677a774a673353445962455f56486b314f4d2f68696464656e2e6a736f6e

Deployed Bytecode

0x608060405260043610610400575f3560e01c8063715018a611610215578063b5b1cd7c1161011e578063d6a35d20116100a8578063ef3e067c11610078578063ef3e067c14610bf4578063f2fde38b14610c13578063f6eae78d14610c32578063fb4177ec14610c47578063fe10f71114610c5c575f80fd5b8063d6a35d2014610b5a578063dde44b8914610b79578063e64710e614610b98578063e985e9c514610bad575f80fd5b8063c6275255116100ee578063c627525514610ad2578063c87b56dd14610af1578063ca34adf014610b10578063cfd9480b14610b25578063d5abeb0114610b45575f80fd5b8063b5b1cd7c14610a54578063b88d4fde14610a7f578063bb485b8814610a9e578063bf5a0be014610ab3575f80fd5b806397d14e631161019f578063a22cb4651161016f578063a22cb465146109b7578063a945bf80146109d6578063a9a4445c146109eb578063aeb8666514610a0a578063b1d8d08414610a29575f80fd5b806397d14e631461093c5780639a1148241461095b5780639aa289ce146109795780639b23484f14610998575f80fd5b80638e924901116101e55780638e924901146108b65780638f2fc60b146108d55780638f3ec31a146108f4578063940cd05b1461090957806395d89b4114610928575f80fd5b8063715018a61461085f5780637f7062cd1461087357806380451ec0146108865780638da5cb5b14610899575f80fd5b8063484b973c1161031757806361c0b6a0116102a15780636355336f116102715780636355336f146107d457806366d97230146107f3578063684c70e71461080c5780636f8b44b01461082157806370a0823114610840575f80fd5b806361c0b6a01461074c5780636231935e1461077757806362e5041c146107965780636352211e146107b5575f80fd5b80634f6ccce7116102e75780634f6ccce7146106c15780634fcb6f92146106e057806351830227146106f557806355f804b31461070e5780635a6512e31461072d575f80fd5b8063484b973c14610651578063497e0ec0146106705780634d791938146106835780634eaa9c62146106a2575f80fd5b806320ac6850116103985780632f745c59116103685780632f745c59146105cb5780632fb65558146105ea5780633ccfd60b146105ff5780633f8c05951461061357806342842e0e14610632575f80fd5b806320ac68501461053c57806323b872dd1461055b5780632a55205a1461057a5780632db11544146105b8575f80fd5b806311bf2047116103d357806311bf2047146104b157806318160ddd146104ea5780631b0ebf37146104fe5780631e95044d1461051d575f80fd5b806301ffc9a71461040457806306fdde0314610438578063081812fc14610459578063095ea7b314610490575b5f80fd5b34801561040f575f80fd5b5061042361041e366004612ed2565b610c7d565b60405190151581526020015b60405180910390f35b348015610443575f80fd5b5061044c610c9c565b60405161042f9190612f3a565b348015610464575f80fd5b50610478610473366004612f4c565b610d2c565b6040516001600160a01b03909116815260200161042f565b34801561049b575f80fd5b506104af6104aa366004612f79565b610dbc565b005b3480156104bc575f80fd5b506104dc6104cb366004612fa1565b60166020525f908152604090205481565b60405190815260200161042f565b3480156104f5575f80fd5b506104dc610ed2565b348015610509575f80fd5b50610423610518366004612ffa565b610ee7565b348015610528575f80fd5b506104af610537366004613047565b610f32565b348015610547575f80fd5b506104af6105563660046130f8565b610f5a565b348015610566575f80fd5b506104af61057536600461313c565b610f72565b348015610585575f80fd5b50610599610594366004613175565b610fa3565b604080516001600160a01b03909316835260208301919091520161042f565b6104af6105c6366004612f4c565b61104f565b3480156105d6575f80fd5b506104dc6105e5366004612f79565b611160565b3480156105f5575f80fd5b506104dc600f5481565b34801561060a575f80fd5b506104af611229565b34801561061e575f80fd5b5061042361062d366004612ffa565b6112e5565b34801561063d575f80fd5b506104af61064c36600461313c565b611328565b34801561065c575f80fd5b506104af61066b366004612f79565b611342565b6104af61067e366004613195565b61138b565b34801561068e575f80fd5b506104af61069d366004613047565b6114e5565b3480156106ad575f80fd5b506104af6106bc366004612f4c565b61150b565b3480156106cc575f80fd5b506104dc6106db366004612f4c565b611518565b3480156106eb575f80fd5b506104dc60185481565b348015610700575f80fd5b50601b546104239060ff1681565b348015610719575f80fd5b506104af6107283660046131dc565b6115d0565b348015610738575f80fd5b506104af610747366004613047565b6115e5565b348015610757575f80fd5b506104dc610766366004612fa1565b60146020525f908152604090205481565b348015610782575f80fd5b506104af610791366004613047565b611609565b3480156107a1575f80fd5b506104af6107b0366004612f4c565b611624565b3480156107c0575f80fd5b506104786107cf366004612f4c565b611631565b3480156107df575f80fd5b506104af6107ee366004612f4c565b611644565b3480156107fe575f80fd5b506010546104239060ff1681565b348015610817575f80fd5b506104dc60115481565b34801561082c575f80fd5b506104af61083b366004612f4c565b611651565b34801561084b575f80fd5b506104dc61085a366004612fa1565b6116b7565b34801561086a575f80fd5b506104af611786565b6104af610881366004612f79565b611799565b6104af610894366004613195565b6118ba565b3480156108a4575f80fd5b506009546001600160a01b0316610478565b3480156108c1575f80fd5b506104af6108d0366004612f4c565b6119f7565b3480156108e0575f80fd5b506104af6108ef366004613247565b611a04565b3480156108ff575f80fd5b506104dc60125481565b348015610914575f80fd5b506104af610923366004613047565b611a16565b348015610933575f80fd5b5061044c611a31565b348015610947575f80fd5b506010546104239062010000900460ff1681565b348015610966575f80fd5b5060105461042390610100900460ff1681565b348015610984575f80fd5b506104af610993366004613303565b611a40565b3480156109a3575f80fd5b506104af6109b2366004612f4c565b611c60565b3480156109c2575f80fd5b506104af6109d136600461334e565b611c6d565b3480156109e1575f80fd5b506104dc600e5481565b3480156109f6575f80fd5b506104af610a05366004612f4c565b611d30565b348015610a15575f80fd5b50610423610a2436600461337f565b611d3d565b348015610a34575f80fd5b506104dc610a43366004612fa1565b60156020525f908152604090205481565b348015610a5f575f80fd5b506104dc610a6e366004612fa1565b60176020525f908152604090205481565b348015610a8a575f80fd5b506104af610a993660046133bb565b611e62565b348015610aa9575f80fd5b506104dc60135481565b348015610abe575f80fd5b506104af610acd366004613047565b611e9a565b348015610add575f80fd5b506104af610aec366004612f4c565b611ebc565b348015610afc575f80fd5b5061044c610b0b366004612f4c565b611ec9565b348015610b1b575f80fd5b506104dc601a5481565b348015610b30575f80fd5b50601054610423906301000000900460ff1681565b348015610b50575f80fd5b506104dc600b5481565b348015610b65575f80fd5b506104af610b74366004612f4c565b611f9b565b348015610b84575f80fd5b506104af610b93366004612f4c565b611fa8565b348015610ba3575f80fd5b506104dc60195481565b348015610bb8575f80fd5b50610423610bc7366004613431565b6001600160a01b039182165f90815260066020908152604080832093909416825291909152205460ff1690565b348015610bff575f80fd5b506104af610c0e366004612f4c565b611fb5565b348015610c1e575f80fd5b506104af610c2d366004612fa1565b611fc2565b348015610c3d575f80fd5b506104dc600c5481565b348015610c52575f80fd5b506104dc600d5481565b348015610c67575f80fd5b5060105461042390640100000000900460ff1681565b5f610c8782612038565b80610c965750610c96826120a2565b92915050565b606060018054610cab90613459565b80601f0160208091040260200160405190810160405280929190818152602001828054610cd790613459565b8015610d225780601f10610cf957610100808354040283529160200191610d22565b820191905f5260205f20905b815481529060010190602001808311610d0557829003601f168201915b5050505050905090565b5f610d38826004541190565b610da15760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b505f908152600560205260409020546001600160a01b031690565b5f610dc682611631565b9050806001600160a01b0316836001600160a01b031603610e355760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401610d98565b336001600160a01b0382161480610e515750610e518133610bc7565b610ec35760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608401610d98565b610ecd83836120c6565b505050565b5f6001600454610ee291906134a5565b905090565b6040516001600160601b03193360601b1660208201525f908190603401604051602081830303815290604052805190602001209050610f2a848460195484612133565b949350505050565b610f3a61214a565b601080549115156401000000000264ff0000000019909216919091179055565b610f6261214a565b601c610f6e82826134fd565b5050565b610f7c33826121a4565b610f985760405162461bcd60e51b8152600401610d98906135b8565b610ecd83838361228c565b5f8281526008602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916110175750604080518082019091526007546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101515f9061271090611035906001600160601b03168761360c565b61103f9190613623565b91519350909150505b9250929050565b611057612472565b5f611060610ed2565b90505f82600e54611071919061360c565b6010549091506301000000900460ff1661109d5760405162461bcd60e51b8152600401610d9890613642565b600b546110aa848461366e565b11156110c85760405162461bcd60e51b8152600401610d9890613681565b803410156110e85760405162461bcd60e51b8152600401610d98906136aa565b601354335f9081526017602052604090205461110590859061366e565b11156111235760405162461bcd60e51b8152600401610d98906136d4565b335f908152601760205260408120805485929061114190849061366e565b90915550611151905033846124cb565b505061115d6001600a55565b50565b5f8060015b6004548110156111d45761117a816004541190565b801561119f575061118a81611631565b6001600160a01b0316856001600160a01b0316145b156111c2578382036111b4579150610c969050565b816111be81613701565b9250505b806111cc81613701565b915050611165565b5060405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a206f776e657220696e646578206f7574206f6620626f604482015263756e647360e01b6064820152608401610d98565b61123161214a565b4761126a73e962587325d6f8f682f93b335483789362917dce620f424061125b846203d09061360c565b6112659190613623565b6124e4565b611293735c0455464a07f7c715e0b4428edfca51def5594e620f424061125b846203d09061360c565b6112bc73ad863559c9437205d6c8c68ff5f009a7767001ee620f424061125b846203d09061360c565b61115d73baa98fe972144ef1de53b801045cec5a291cb30e620f424061125b846203d09061360c565b6040516001600160601b03193360601b1660208201525f908190603401604051602081830303815290604052805190602001209050610f2a8484601a5484612133565b610ecd83838360405180602001604052805f815250611e62565b61134a61214a565b5f611353610ed2565b600b54909150611363838361366e565b11156113815760405162461bcd60e51b8152600401610d9890613681565b610ecd83836124cb565b611393612472565b5f61139c610ed2565b90505f84600d546113ad919061360c565b60105490915062010000900460ff166113d85760405162461bcd60e51b8152600401610d9890613642565b600b546113e5868461366e565b11156114035760405162461bcd60e51b8152600401610d9890613681565b601254335f9081526016602052604090205461142090879061366e565b111561143e5760405162461bcd60e51b8152600401610d98906136d4565b8034101561145e5760405162461bcd60e51b8152600401610d98906136aa565b61146884846112e5565b6114ab5760405162461bcd60e51b815260206004820152601460248201527324b73b30b634b21026b2b935b63290283937b7b360611b6044820152606401610d98565b335f90815260166020526040812080548792906114c990849061366e565b909155506114d9905033866124cb565b5050610ecd6001600a55565b6114ed61214a565b6010805491151563010000000263ff00000019909216919091179055565b61151361214a565b601255565b5f611521610ed2565b821061157d5760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a20676c6f62616c20696e646578206f7574206f6620626044820152646f756e647360d81b6064820152608401610d98565b5f60015b6004548110156115c957611596816004541190565b156115b7578382036115a9579392505050565b816115b381613701565b9250505b806115c181613701565b915050611581565b5050919050565b6115d861214a565b601d610ecd828483613719565b6115ed61214a565b60108054911515620100000262ff000019909216919091179055565b61161161214a565b6010805460ff1916911515919091179055565b61162c61214a565b601955565b5f8061163c836125f9565b509392505050565b61164c61214a565b601a55565b61165961214a565b600b54611664610ed2565b11156116b25760405162461bcd60e51b815260206004820152601960248201527f4c6f776572207468616e205f63757272656e74496e6465782e000000000000006044820152606401610d98565b600b55565b5f6001600160a01b0382166117245760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401610d98565b5f60015b60045481101561177f5761173d816004541190565b1561176f5761174b81611631565b6001600160a01b0316846001600160a01b03160361176f5761176c82613701565b91505b61177881613701565b9050611728565b5092915050565b61178e61214a565b6117975f612690565b565b6117a1612472565b5f6117aa610ed2565b90505f82600f546117bb919061360c565b601054909150640100000000900460ff166117e85760405162461bcd60e51b8152600401610d9890613642565b600b546117f5848461366e565b11156118135760405162461bcd60e51b8152600401610d9890613681565b803410156118335760405162461bcd60e51b8152600401610d98906136aa565b6013546001600160a01b0385165f9081526017602052604090205461185990859061366e565b11156118775760405162461bcd60e51b8152600401610d98906136d4565b6001600160a01b0384165f908152601760205260408120805485929061189e90849061366e565b909155506118ae905084846124cb565b5050610f6e6001600a55565b6118c2612472565b5f6118cb610ed2565b90505f84600c546118dc919061360c565b601054909150610100900460ff166119065760405162461bcd60e51b8152600401610d9890613642565b600b54611913868461366e565b11156119315760405162461bcd60e51b8152600401610d9890613681565b601154335f9081526015602052604090205461194e90879061366e565b111561196c5760405162461bcd60e51b8152600401610d98906136d4565b8034101561198c5760405162461bcd60e51b8152600401610d98906136aa565b6119968484610ee7565b6119d95760405162461bcd60e51b815260206004820152601460248201527324b73b30b634b21026b2b935b63290283937b7b360611b6044820152606401610d98565b335f90815260156020526040812080548792906114c990849061366e565b6119ff61214a565b601155565b611a0c61214a565b610f6e82826126e1565b611a1e61214a565b601b805460ff1916911515919091179055565b606060028054610cab90613459565b611a48612472565b60105460ff16611a905760405162461bcd60e51b8152602060048201526013602482015272119c995948135a5b9d081a5cc814185d5cd959606a1b6044820152606401610d98565b611a9b338383611d3d565b611ad75760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a590818dbdd5b9d609a1b6044820152606401610d98565b5f8211611b1d5760405162461bcd60e51b8152602060048201526014602482015273165bdd481a185d99481b9bc8119c9959535a5b9d60621b6044820152606401610d98565b82821015611b6d5760405162461bcd60e51b815260206004820152601c60248201527f4f766572206d617820467265654d696e74207065722077616c6c6574000000006044820152606401610d98565b335f90815260146020526040902054611b8790849061366e565b821015611bd65760405162461bcd60e51b815260206004820152601960248201527f596f752068617665206e6f20467265654d696e74206c656674000000000000006044820152606401610d98565b600b54611be1610ed2565b611beb908561366e565b1115611c285760405162461bcd60e51b815260206004820152600c60248201526b4e6f206d6f7265204e46547360a01b6044820152606401610d98565b335f9081526014602052604081208054859290611c4690849061366e565b90915550611c56905033846124cb565b610ecd6001600a55565b611c6861214a565b600c55565b336001600160a01b03831603611cc55760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606401610d98565b335f8181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611d3861214a565b600d55565b6040516001600160601b0319606085901b166020820152603481018390525f9081906054016040516020818303038152906040528051906020012090505f5b8351811015611e5557838181518110611d9757611d976137d4565b60200260200101518210611df557838181518110611db757611db76137d4565b602002602001015182604051602001611dda929190918252602082015260400190565b60405160208183030381529060405280519060200120611e41565b81848281518110611e0857611e086137d4565b6020026020010151604051602001611e2a929190918252602082015260400190565b604051602081830303815290604052805190602001205b915080611e4d81613701565b915050611d7c565b5060185414949350505050565b611e6c33836121a4565b611e885760405162461bcd60e51b8152600401610d98906135b8565b611e9484848484612783565b50505050565b611ea261214a565b601080549115156101000261ff0019909216919091179055565b611ec461214a565b600e55565b601b5460609060ff1615611f0657611ee0826127b8565b604051602001611ef091906137e8565b6040516020818303038152906040529050919050565b601c8054611f1390613459565b80601f0160208091040260200160405190810160405280929190818152602001828054611f3f90613459565b8015611f8a5780601f10611f6157610100808354040283529160200191611f8a565b820191905f5260205f20905b815481529060010190602001808311611f6d57829003601f168201915b50505050509050919050565b919050565b611fa361214a565b600f55565b611fb061214a565b601855565b611fbd61214a565b601355565b611fca61214a565b6001600160a01b03811661202f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d98565b61115d81612690565b5f6001600160e01b031982166380ac58cd60e01b148061206857506001600160e01b03198216635b5e139f60e01b145b8061208357506001600160e01b0319821663780e9d6360e01b145b80610c9657506301ffc9a760e01b6001600160e01b0319831614610c96565b5f6001600160e01b0319821663152a902d60e11b1480610c965750610c9682612038565b5f81815260056020526040902080546001600160a01b0319166001600160a01b03841690811790915581906120fa82611631565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b5f8261214086868561287d565b1495945050505050565b6009546001600160a01b031633146117975760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d98565b5f6121b0826004541190565b6122145760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610d98565b5f61221e83611631565b9050806001600160a01b0316846001600160a01b031614806122595750836001600160a01b031661224e84610d2c565b6001600160a01b0316145b80610f2a57506001600160a01b038082165f9081526006602090815260408083209388168352929052205460ff16610f2a565b5f80612297836125f9565b91509150846001600160a01b0316826001600160a01b0316146123115760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401610d98565b6001600160a01b0384166123775760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401610d98565b6123815f846120c6565b5f61238d84600161366e565b600881901c5f90815260208190526040902054909150600160ff1b60ff83161c161580156123bc575060045481105b156123f1575f81815260036020526040812080546001600160a01b0319166001600160a01b0389161790556123f190826128c8565b5f84815260036020526040902080546001600160a01b0319166001600160a01b038716179055818414612428576124285f856128c8565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b6002600a54036124c45760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d98565b6002600a55565b610f6e828260405180602001604052805f8152506128f3565b804710156125345760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610d98565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f811461257d576040519150601f19603f3d011682016040523d82523d5f602084013e612582565b606091505b5050905080610ecd5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610d98565b5f80612606836004541190565b6126675760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610d98565b6126708361290d565b5f818152600360205260409020546001600160a01b031694909350915050565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6127106001600160601b03821681101561272057604051636f483d0960e01b81526001600160601b038316600482015260248101829052604401610d98565b6001600160a01b03831661274957604051635b6cc80560e11b81525f6004820152602401610d98565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600755565b61278e84848461228c565b61279c848484600185612918565b611e945760405162461bcd60e51b8152600401610d9890613810565b60606127c5826004541190565b6128245760405162461bcd60e51b815260206004820152602a60248201527f4552433732315073693a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608401610d98565b5f61282d612a4b565b90505f81511161284b5760405180602001604052805f815250612876565b8061285584612a5a565b604051602001612866929190613865565b6040516020818303038152906040525b9392505050565b5f81815b848110156128bf576128ab8287878481811061289f5761289f6137d4565b90506020020135612ae9565b9150806128b781613701565b915050612881565b50949350505050565b600881901c5f90815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6004546129008484612b12565b61279c5f85838686612918565b5f610c968183612c74565b5f6001600160a01b0385163b15612a3e57506001835b612938848661366e565b811015612a3857604051630a85bd0160e11b81526001600160a01b0387169063150b7a02906129719033908b9086908990600401613893565b6020604051808303815f875af19250505080156129ab575060408051601f3d908101601f191682019092526129a8918101906138cf565b60015b612a06573d8080156129d8576040519150601f19603f3d011682016040523d82523d5f602084013e6129dd565b606091505b5080515f036129fe5760405162461bcd60e51b8152600401610d9890613810565b805181602001fd5b828015612a2357506001600160e01b03198116630a85bd0160e11b145b92505080612a3081613701565b91505061292e565b50612a42565b5060015b95945050505050565b6060601d8054610cab90613459565b60605f612a6683612d68565b60010190505f816001600160401b03811115612a8457612a84613060565b6040519080825280601f01601f191660200182016040528015612aae576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612ab857509392505050565b5f818310612b03575f828152602084905260409020612876565b505f9182526020526040902090565b60045481612b705760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401610d98565b6001600160a01b038316612bd25760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610d98565b8160045f828254612be3919061366e565b90915550505f81815260036020526040812080546001600160a01b0319166001600160a01b038616179055612c1890826128c8565b805b612c24838361366e565b811015611e945760405181906001600160a01b038616905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480612c6c81613701565b915050612c1a565b600881901c5f8181526020849052604081205490919060ff808516919082181c8015612cb557612ca381612e3f565b60ff168203600884901b179350612d5f565b5f8311612d215760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401610d98565b505f199091015f818152602086905260409020549091908015612d5a57612d4781612e3f565b60ff0360ff16600884901b179350612d5f565b612cb5565b50505092915050565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310612da65772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612dd2576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310612df057662386f26fc10000830492506010015b6305f5e1008310612e08576305f5e100830492506008015b6127108310612e1c57612710830492506004015b60648310612e2e576064830492506002015b600a8310610c965760010192915050565b5f60405180610120016040528061010081526020016138eb610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff612e8785612ea8565b02901c81518110612e9a57612e9a6137d4565b016020015160f81c92915050565b5f808211612eb4575f80fd5b505f8190031690565b6001600160e01b03198116811461115d575f80fd5b5f60208284031215612ee2575f80fd5b813561287681612ebd565b5f5b83811015612f07578181015183820152602001612eef565b50505f910152565b5f8151808452612f26816020860160208601612eed565b601f01601f19169290920160200192915050565b602081525f6128766020830184612f0f565b5f60208284031215612f5c575f80fd5b5035919050565b80356001600160a01b0381168114611f96575f80fd5b5f8060408385031215612f8a575f80fd5b612f9383612f63565b946020939093013593505050565b5f60208284031215612fb1575f80fd5b61287682612f63565b5f8083601f840112612fca575f80fd5b5081356001600160401b03811115612fe0575f80fd5b6020830191508360208260051b8501011115611048575f80fd5b5f806020838503121561300b575f80fd5b82356001600160401b03811115613020575f80fd5b61302c85828601612fba565b90969095509350505050565b80358015158114611f96575f80fd5b5f60208284031215613057575f80fd5b61287682613038565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b038111828210171561309c5761309c613060565b604052919050565b5f6001600160401b038311156130bc576130bc613060565b6130cf601f8401601f1916602001613074565b90508281528383830111156130e2575f80fd5b828260208301375f602084830101529392505050565b5f60208284031215613108575f80fd5b81356001600160401b0381111561311d575f80fd5b8201601f8101841361312d575f80fd5b610f2a848235602084016130a4565b5f805f6060848603121561314e575f80fd5b61315784612f63565b925061316560208501612f63565b9150604084013590509250925092565b5f8060408385031215613186575f80fd5b50508035926020909101359150565b5f805f604084860312156131a7575f80fd5b8335925060208401356001600160401b038111156131c3575f80fd5b6131cf86828701612fba565b9497909650939450505050565b5f80602083850312156131ed575f80fd5b82356001600160401b0380821115613203575f80fd5b818501915085601f830112613216575f80fd5b813581811115613224575f80fd5b866020828501011115613235575f80fd5b60209290920196919550909350505050565b5f8060408385031215613258575f80fd5b61326183612f63565b915060208301356001600160601b038116811461327c575f80fd5b809150509250929050565b5f82601f830112613296575f80fd5b813560206001600160401b038211156132b1576132b1613060565b8160051b6132c0828201613074565b92835284810182019282810190878511156132d9575f80fd5b83870192505b848310156132f8578235825291830191908301906132df565b979650505050505050565b5f805f60608486031215613315575f80fd5b833592506020840135915060408401356001600160401b03811115613338575f80fd5b61334486828701613287565b9150509250925092565b5f806040838503121561335f575f80fd5b61336883612f63565b915061337660208401613038565b90509250929050565b5f805f60608486031215613391575f80fd5b61339a84612f63565b92506020840135915060408401356001600160401b03811115613338575f80fd5b5f805f80608085870312156133ce575f80fd5b6133d785612f63565b93506133e560208601612f63565b92506040850135915060608501356001600160401b03811115613406575f80fd5b8501601f81018713613416575f80fd5b613425878235602084016130a4565b91505092959194509250565b5f8060408385031215613442575f80fd5b61344b83612f63565b915061337660208401612f63565b600181811c9082168061346d57607f821691505b60208210810361348b57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610c9657610c96613491565b601f821115610ecd575f81815260208120601f850160051c810160208610156134de5750805b601f850160051c820191505b8181101561246a578281556001016134ea565b81516001600160401b0381111561351657613516613060565b61352a816135248454613459565b846134b8565b602080601f83116001811461355d575f84156135465750858301515b5f19600386901b1c1916600185901b17855561246a565b5f85815260208120601f198616915b8281101561358b5788860151825594840194600190910190840161356c565b50858210156135a857878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b8082028115828204841417610c9657610c96613491565b5f8261363d57634e487b7160e01b5f52601260045260245ffd5b500490565b6020808252601290820152712132b337b9329039b0b632903132b3b4b71760711b604082015260600190565b80820180821115610c9657610c96613491565b6020808252600f908201526e26b0bc1039bab838363c9037bb32b960891b604082015260600190565b60208082526010908201526f4e6f7420656e6f7567682066756e647360801b604082015260600190565b602080825260139082015272082d8e4cac2c8f240c6d8c2d2dacac840dac2f606b1b604082015260600190565b5f6001820161371257613712613491565b5060010190565b6001600160401b0383111561373057613730613060565b6137448361373e8354613459565b836134b8565b5f601f841160018114613775575f851561375e5750838201355b5f19600387901b1c1916600186901b1783556137cd565b5f83815260209020601f19861690835b828110156137a55786850135825560209485019460019092019101613785565b50868210156137c1575f1960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b634e487b7160e01b5f52603260045260245ffd5b5f82516137f9818460208701612eed565b64173539b7b760d91b920191825250600501919050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b5f8351613876818460208801612eed565b83519083019061388a818360208801612eed565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f906138c590830184612f0f565b9695505050505050565b5f602082840312156138df575f80fd5b815161287681612ebd56fe0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a2646970667358221220f4c4d75ba2dd3a436e4be5f83e518bc984556a016cfd8f242082e2ac46334ef364736f6c63430008140033

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  ]
[ 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.