ETH Price: $3,403.60 (+1.12%)

Token

Grid Haus (GHAUS)
 

Overview

Max Total Supply

368 GHAUS

Holders

189

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Balance
0 GHAUS
0x56cb3032ce7cc02663fc074310fc93cbb6f1e7a6
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
GridHaus

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 23 : GridHaus.sol
// SPDX-License-Identifier: MIT
/**
  ____      _     _   _   _                 
 / ___|_ __(_) __| | | | | | __ _ _   _ ___ 
| |  _| '__| |/ _` | | |_| |/ _` | | | / __|
| |_| | |  | | (_| | |  _  | (_| | |_| \__ \
 \____|_|  |_|\__,_| |_| |_|\__,_|\__,_|___/     

 */

pragma solidity ^0.8.13;

import "erc721psi/contracts/ERC721Psi.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import "erc721psi/contracts/extension/ERC721PsiBurnable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";

contract GridHaus is ERC721Psi, Ownable, ERC721PsiBurnable, ReentrancyGuard {
    uint256 public MINT_PRICE = 0.005 ether;
    uint256 public MAX_MINT_PER_WALLET = 3;
    bytes32 public root;
    bool _mintEnabled = false;
    bool _burnEnabled = false;
    mapping(address => uint256) public tokensMinted;

    constructor() ERC721Psi() {}

    function setMerkleRoot(bytes32 p_root) external onlyOwner nonReentrant {
        root = p_root;
    }

    function setGeneratedId(uint256 p_tokenId) external onlyOwner nonReentrant {
        _generatedId = p_tokenId;
    }

    function ownerMint(uint256 _amount) external onlyOwner nonReentrant {
        _safeMint(msg.sender, _amount);
    }

    function gridListMint(uint256 p_amount, bytes32[] memory p_proof)
        external
        payable
        nonReentrant
    {
        require(
            isValid(p_proof, keccak256(abi.encodePacked(msg.sender))),
            "Wallet Address is not Grid Listed."
        );
        require(_mintEnabled == true, "Grid Haus: Mint disabled.");
        require(
            tokensMinted[msg.sender] + p_amount <= MAX_MINT_PER_WALLET,
            "Grid Haus: Minting more than allowed per wallet"
        );
        require(
            (MINT_PRICE * p_amount) -
                (tokensMinted[msg.sender] < 1 ? 0.005 ether : 0) <=
                msg.value,
            "Grid Haus: Not enough ETH sent"
        );
        _safeMint(msg.sender, p_amount);
        tokensMinted[msg.sender] += p_amount;
    }

    function mint(uint256 p_amount) external payable nonReentrant {
        require(_mintEnabled == true, "Grid Haus: Mint disabled.");
        require(
            tokensMinted[msg.sender] + p_amount <= MAX_MINT_PER_WALLET,
            "Grid Haus: Minting more than allowed per wallet"
        );
        require(
            (MINT_PRICE * p_amount) <= msg.value,
            "Grid Haus: Not enough ETH sent"
        );
        _safeMint(msg.sender, p_amount);
        tokensMinted[msg.sender] += p_amount;
    }

    function dyeArtPiece(uint256 p_artPieceToDye, uint256 p_artPieceToBurn)
        external
        nonReentrant
    {
        require(_burnEnabled == true, "Grid Haus: Burn is disabled.");
        require(
            ownerOf(p_artPieceToDye) == msg.sender,
            "Grid Haus: You do not own the art piece to dye"
        );
        require(
            ownerOf(p_artPieceToBurn) == msg.sender,
            "Grid Haus: You do not own the dye art piece"
        );

        if (getWalletAddress(p_artPieceToDye) != msg.sender) {
            _originalAddress[_currentIndex] = getWalletAddress(p_artPieceToDye);
        }
        _seeds[_currentIndex] = generateSeed(p_artPieceToDye);
        _colors[_currentIndex] = getColorPalette(p_artPieceToBurn);
        _safeMint(msg.sender, 1);
        _burn(p_artPieceToBurn);
        _burn(p_artPieceToDye);
    }

    function transformArtPiece(
        uint256 p_artPieceToTransform,
        uint256 p_artPieceToBurn1,
        uint256 p_artPieceToBurn2
    ) external nonReentrant {
        require(_burnEnabled == true, "Grid Haus: Burn is disabled.");
        require(
            ownerOf(p_artPieceToTransform) == msg.sender,
            "Grid Haus: You do not own the art piece to transform"
        );
        require(
            ownerOf(p_artPieceToBurn1) == msg.sender,
            "Grid Haus: You do not own the first art piece to burn"
        );
        require(
            ownerOf(p_artPieceToBurn2) == msg.sender,
            "Grid Haus: You do not own the second art piece to burn"
        );

        _colors[_currentIndex] = getColorPalette(p_artPieceToTransform);
        _safeMint(msg.sender, 1);
        _burn(p_artPieceToTransform);
        _burn(p_artPieceToBurn1);
        _burn(p_artPieceToBurn2);
    }

    function enableMint() public onlyOwner nonReentrant {
        _mintEnabled = true;
    }

    function disableMint() public onlyOwner nonReentrant {
        _mintEnabled = false;
    }

    function enableBurn() public onlyOwner nonReentrant {
        _burnEnabled = true;
    }

    function disableBurn() public onlyOwner nonReentrant {
        _burnEnabled = false;
    }

    function setBaseURI(string memory p_baseURI) public onlyOwner nonReentrant {
        _baseTokenURI = p_baseURI;
    }

    function withdraw() public onlyOwner nonReentrant {
        require(address(this).balance > 0, "Balance is zero.");
        payable(owner()).transfer(address(this).balance);
    }

    function isValid(bytes32[] memory p_proof, bytes32 p_leaf)
        public
        view
        returns (bool)
    {
        return MerkleProof.verify(p_proof, root, p_leaf);
    }

    function totalSupply()
        public
        view
        override(ERC721Psi, ERC721PsiBurnable)
        returns (uint256)
    {
        return super.totalSupply();
    }

    function _exists(uint256 tokenId)
        internal
        view
        override(ERC721Psi, ERC721PsiBurnable)
        returns (bool)
    {
        return super._exists(tokenId);
    }
}

File 2 of 23 : 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 3 of 23 : 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 4 of 23 : ERC721PsiBurnable.sol
// SPDX-License-Identifier: MIT
/**
  ______ _____   _____ ______ ___  __ _  _  _ 
 |  ____|  __ \ / ____|____  |__ \/_ | || || |
 | |__  | |__) | |        / /   ) || | \| |/ |
 |  __| |  _  /| |       / /   / / | |\_   _/ 
 | |____| | \ \| |____  / /   / /_ | |  | |   
 |______|_|  \_\\_____|/_/   |____||_|  |_|   
                                              
                                            
 */
pragma solidity ^0.8.0;

import "solidity-bits/contracts/BitMaps.sol";
import "../ERC721Psi.sol";


abstract contract ERC721PsiBurnable is ERC721Psi {
    using BitMaps for BitMaps.BitMap;
    BitMaps.BitMap private _burnedToken;

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address from = ownerOf(tokenId);
        _beforeTokenTransfers(from, address(0), tokenId, 1);
        _burnedToken.set(tokenId);
        
        emit Transfer(from, address(0), tokenId);

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

    /**
     * @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`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view override virtual returns (bool){
        if(_burnedToken.get(tokenId)) {
            return false;
        } 
        return super._exists(tokenId);
    }

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

    /**
     * @dev Returns number of token burned.
     */
    function _burned() internal view returns (uint256 burned){
        uint256 startBucket = _startTokenId() >> 8;
        uint256 lastBucket = (_nextTokenId() >> 8) + 1;

        for(uint256 i=startBucket; i < lastBucket; i++) {
            uint256 bucket = _burnedToken.getBucket(i);
            burned += _popcount(bucket);
        }
    }

    /**
     * @dev Returns number of set bits.
     */
    function _popcount(uint256 x) private pure returns (uint256 count) {
        unchecked{
            for (count=0; x!=0; count++)
                x &= x - 1;
        }
    }
}

File 5 of 23 : 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 6 of 23 : ERC721Psi.sol
// SPDX-License-Identifier: MIT
/**
  ______ _____   _____ ______ ___  __ _  _  _ 
 |  ____|  __ \ / ____|____  |__ \/_ | || || |
 | |__  | |__) | |        / /   ) || | \| |/ |
 |  __| |  _  /| |       / /   / / | |\_   _/ 
 | |____| | \ \| |____  / /   / /_ | |  | |   
 |______|_|  \_\\_____|/_/   |____||_|  |_|   

 - github: https://github.com/estarriolvetch/ERC721Psi
 - npm: https://www.npmjs.com/package/erc721psi
                                          
 */
pragma solidity ^0.8.13;

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/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";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "@openzeppelin/contracts/utils/Base64.sol";

contract ERC721Psi is Context, ERC165, IERC721, IERC721Metadata, ERC2981 {
    using Address for address;
    using Strings for uint256;
    using Strings for address;
    using BitMaps for BitMaps.BitMap;

    BitMaps.BitMap private _batchHead;
    BitMaps.BitMap private _mintBatchHead;
    string private _name;
    string private _symbol;
    mapping(uint256 => address) private _minters;
    mapping(uint256 => uint256) internal _seeds;
    mapping(uint256 => uint256) internal _colors;
    mapping(uint256 => address) internal _originalAddress;
    string internal _baseTokenURI = "";
    // Mapping from token ID to owner address
    mapping(uint256 => address) internal _owners;
    uint256 internal _currentIndex;
    mapping(uint256 => address) private _tokenApprovals;
    mapping(address => mapping(address => bool)) private _operatorApprovals;
    uint256 internal _generatedId;

    struct Traits {
        string colorPalette;
        string walletAddress;
        string seed;
    }

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor() {
        _name = "Grid Haus";
        _symbol = "GHAUS";
        _currentIndex = _startTokenId();
    }

    /**
     * @dev Returns the starting token ID.
     * To change the starting token ID, please override this function.
     */
    function _startTokenId() internal pure returns (uint256) {
        // It will become modifiable in the future versions
        return 1;
    }

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

    /**
     * @dev Returns the total amount of tokens minted in the contract.
     */
    function _totalMinted() internal view virtual returns (uint256) {
        return _currentIndex - _startTokenId();
    }

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

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

        uint256 count;
        for (uint256 i = _startTokenId(); i < _nextTokenId(); ++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;
    }

    function minterOf(uint256 tokenId) public view virtual returns (address) {
        (address minter, ) = _minterAndBatchHeadOf(tokenId);
        return minter;
    }

    function _minterAndBatchHeadOf(uint256 tokenId)
        internal
        view
        returns (address minter, uint256 tokenIdBatchHead)
    {
        require(
            _exists(tokenId),
            "ERC721Psi: owner query for nonexistent token"
        );
        tokenIdBatchHead = _getMintBatchHead(tokenId);
        minter = _minters[tokenIdBatchHead];
    }

    function _getMintBatchHead(uint256 tokenId)
        internal
        view
        returns (uint256 tokenIdBatchHead)
    {
        tokenIdBatchHead = _mintBatchHead.scanForward(tokenId);
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */

    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        require(_exists(tokenId), "ERC721Psi: URI query for nonexistent token");
        if (bytes(_baseURI()).length > 0) {
            return
                string(
                    abi.encodePacked(_baseURI(), tokenId.toString(), ".json")
                );
        } else if (tokenId <= _generatedId) {
            return getStorageURI(tokenId);
        } else {
            Traits memory traits = getTraits(tokenId);
            string memory json = string(
                abi.encodePacked(
                    '{"name":"Grid Haus #',
                    tokenId.toString(),
                    '", "description":"description", "image":"https://storage.googleapis.com/grid_haus_data/logo_',
                    traits.colorPalette,
                    '.jpeg", "animation_url":"https://storage.googleapis.com/grid_haus_data/grid_haus.html?address=',
                    traits.walletAddress,
                    "&colorPalette=",
                    traits.colorPalette,
                    "&seed=",
                    traits.seed,
                    '", "attributes":[{"trait_type":"Color Palette","value":',
                    traits.colorPalette,
                    "}]}"
                )
            );

            return
                string(
                    abi.encodePacked(
                        "data:application/json;base64,",
                        Base64.encode(bytes(json))
                    )
                );
        }
    }

    function getStorageURI(uint256 tokenId)
        internal
        pure
        returns (string memory)
    {
        return
            string(
                abi.encodePacked(
                    "https://storage.googleapis.com/grid_haus_data/",
                    tokenId.toString(),
                    ".json"
                )
            );
    }

    function getWalletAddress(uint256 p_tokenId)
        internal
        view
        returns (address)
    {
        if (_originalAddress[p_tokenId] != address(0)) {
            return _originalAddress[p_tokenId];
        } else {
            return minterOf(p_tokenId);
        }
    }

    function getColorPalette(uint256 p_tokenId)
        internal
        view
        returns (uint256)
    {
        if (_colors[p_tokenId] != 0) {
            return _colors[p_tokenId];
        } else {
            uint256 additive = (uint256(
                keccak256(abi.encodePacked(minterOf(p_tokenId)))
            ) % 9) + 1;
            return ((p_tokenId * additive) % 31) + 1;
        }
    }

    function getTraits(uint256 p_tokenId) public view returns (Traits memory) {
        Traits memory traits = Traits({
            colorPalette: getColorPalette(p_tokenId).toString(),
            walletAddress: getWalletAddress(p_tokenId).toHexString(),
            seed: generateSeed(p_tokenId).toString()
        });
        return traits;
    }

    function generateSeed(uint256 p_tokenId) internal view returns (uint256) {
        if (_seeds[p_tokenId] != 0) {
            return _seeds[p_tokenId];
        } else {
            return
                uint256(
                    keccak256(abi.encodePacked(minterOf(p_tokenId), p_tokenId))
                );
        }
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overriden in child contracts.
     */

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

    /**
     * @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 < _nextTokenId() && _startTokenId() <= tokenId;
    }

    /**
     * @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 nextTokenId = _nextTokenId();
        _mint(to, quantity);
        require(
            _checkOnERC721Received(
                address(0),
                to,
                nextTokenId,
                quantity,
                _data
            ),
            "ERC721Psi: transfer to non ERC721Receiver implementer"
        );
    }

    function _mint(address to, uint256 quantity) internal virtual {
        uint256 nextTokenId = _nextTokenId();

        require(quantity > 0, "ERC721Psi: quantity must be greater 0");
        require(to != address(0), "ERC721Psi: mint to the zero address");

        _beforeTokenTransfers(address(0), to, nextTokenId, quantity);
        _currentIndex += quantity;
        _owners[nextTokenId] = to;
        _minters[nextTokenId] = to;
        _batchHead.set(nextTokenId);
        _mintBatchHead.set(nextTokenId);
        _afterTokenTransfers(address(0), to, nextTokenId, quantity);

        // Emit events
        for (
            uint256 tokenId = nextTokenId;
            tokenId < nextTokenId + 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 subsequentTokenId = tokenId + 1;

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

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

    function totalSupply() public view virtual returns (uint256) {
        return _totalMinted();
    }

    /**
     * @dev Returns an array of token IDs owned by `owner`.
     *
     * This function scans the ownership mapping and is O(`totalSupply`) in complexity.
     * It is meant to be called off-chain.
     *
     * This function is compatiable with ERC721AQueryable.
     */
    function tokensOfOwner(address owner)
        external
        view
        virtual
        returns (uint256[] memory)
    {
        unchecked {
            uint256 tokenIdsIdx;
            uint256 tokenIdsLength = balanceOf(owner);
            uint256[] memory tokenIds = new uint256[](tokenIdsLength);
            for (
                uint256 i = _startTokenId();
                tokenIdsIdx != tokenIdsLength;
                ++i
            ) {
                if (_exists(i)) {
                    if (ownerOf(i) == owner) {
                        tokenIds[tokenIdsIdx++] = i;
                    }
                }
            }
            return tokenIds;
        }
    }

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

    /**
     * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
     * minting.
     *
     * startTokenId - the first token id to be transferred
     * quantity - the amount to be transferred
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}
}

File 7 of 23 : 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 8 of 23 : Base64.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides a set of functions to operate with Base64 strings.
 *
 * _Available since v4.5._
 */
library Base64 {
    /**
     * @dev Base64 Encoding/Decoding Table
     */
    string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /**
     * @dev Converts a `bytes` to its Bytes64 `string` representation.
     */
    function encode(bytes memory data) internal pure returns (string memory) {
        /**
         * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
         * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
         */
        if (data.length == 0) return "";

        // Loads the table into memory
        string memory table = _TABLE;

        // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter
        // and split into 4 numbers of 6 bits.
        // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up
        // - `data.length + 2`  -> Round up
        // - `/ 3`              -> Number of 3-bytes chunks
        // - `4 *`              -> 4 characters for each chunk
        string memory result = new string(4 * ((data.length + 2) / 3));

        /// @solidity memory-safe-assembly
        assembly {
            // Prepare the lookup table (skip the first "length" byte)
            let tablePtr := add(table, 1)

            // Prepare result pointer, jump over length
            let resultPtr := add(result, 32)

            // Run over the input, 3 bytes at a time
            for {
                let dataPtr := data
                let endPtr := add(data, mload(data))
            } lt(dataPtr, endPtr) {

            } {
                // Advance 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                // To write each character, shift the 3 bytes (18 bits) chunk
                // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
                // and apply logical AND with 0x3F which is the number of
                // the previous character in the ASCII table prior to the Base64 Table
                // The result is then added to the table to get the character to write,
                // and finally write it in the result pointer but with a left shift
                // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits

                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance
            }

            // When data `bytes` is not exactly 3 bytes long
            // it is padded with `=` characters at the end
            switch mod(mload(data), 3)
            case 1 {
                mstore8(sub(resultPtr, 1), 0x3d)
                mstore8(sub(resultPtr, 2), 0x3d)
            }
            case 2 {
                mstore8(sub(resultPtr, 1), 0x3d)
            }
        }

        return result;
    }
}

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

pragma solidity ^0.8.0;

import "../../interfaces/IERC2981.sol";
import "../../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.
 *
 * _Available since v4.5._
 */
abstract contract ERC2981 is IERC2981, ERC165 {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

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

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

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

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

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

        return (royalty.receiver, royaltyAmount);
    }

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

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

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

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

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

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

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

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

pragma solidity ^0.8.0;

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

File 17 of 23 : 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 18 of 23 : 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 19 of 23 : BitScan.sol
// SPDX-License-Identifier: MIT
/**
   _____       ___     ___ __           ____  _ __      
  / ___/____  / (_)___/ (_) /___  __   / __ )(_) /______
  \__ \/ __ \/ / / __  / / __/ / / /  / __  / / __/ ___/
 ___/ / /_/ / / / /_/ / / /_/ /_/ /  / /_/ / / /_(__  ) 
/____/\____/_/_/\__,_/_/\__/\__, /  /_____/_/\__/____/  
                           /____/                        

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

 */

pragma solidity ^0.8.0;


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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

File 21 of 23 : 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 22 of 23 : 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 23 of 23 : IERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

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

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

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"},{"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":[],"name":"MAX_MINT_PER_WALLET","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"disableBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disableMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"p_artPieceToDye","type":"uint256"},{"internalType":"uint256","name":"p_artPieceToBurn","type":"uint256"}],"name":"dyeArtPiece","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"p_tokenId","type":"uint256"}],"name":"getTraits","outputs":[{"components":[{"internalType":"string","name":"colorPalette","type":"string"},{"internalType":"string","name":"walletAddress","type":"string"},{"internalType":"string","name":"seed","type":"string"}],"internalType":"struct ERC721Psi.Traits","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"p_amount","type":"uint256"},{"internalType":"bytes32[]","name":"p_proof","type":"bytes32[]"}],"name":"gridListMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"p_proof","type":"bytes32[]"},{"internalType":"bytes32","name":"p_leaf","type":"bytes32"}],"name":"isValid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"p_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"minterOf","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"uint256","name":"_amount","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":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"root","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"p_baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"p_tokenId","type":"uint256"}],"name":"setGeneratedId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"p_root","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokensMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"p_artPieceToTransform","type":"uint256"},{"internalType":"uint256","name":"p_artPieceToBurn1","type":"uint256"},{"internalType":"uint256","name":"p_artPieceToBurn2","type":"uint256"}],"name":"transformArtPiece","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a060405260006080908152600a906200001a9082620001b1565b506611c37937e0800060135560036014556016805461ffff191690553480156200004357600080fd5b5060408051808201909152600981526847726964204861757360b81b6020820152600490620000739082620001b1565b5060408051808201909152600580825264474841555360d81b6020830152906200009e9082620001b1565b506001600c55620000af33620000ba565b60016012556200027d565b601080546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200013757607f821691505b6020821081036200015857634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001ac57600081815260208120601f850160051c81016020861015620001875750805b601f850160051c820191505b81811015620001a85782815560010162000193565b5050505b505050565b81516001600160401b03811115620001cd57620001cd6200010c565b620001e581620001de845462000122565b846200015e565b602080601f8311600181146200021d5760008415620002045750858301515b600019600386901b1c1916600185901b178555620001a8565b600085815260208120601f198616915b828110156200024e578886015182559484019460019091019084016200022d565b50858210156200026d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b613829806200028d6000396000f3fe6080604052600436106102305760003560e01c8063715018a61161012e578063b88d4fde116100ab578063e1dc07611161006f578063e1dc076114610665578063e985e9c514610692578063ebf0c717146106db578063f19e75d4146106f1578063f2fde38b1461071157600080fd5b8063b88d4fde146105cf578063b8a20ed0146105ef578063c002d23d1461060f578063c87b56dd14610625578063d69f807e1461064557600080fd5b80639e942ace116100f25780639e942ace14610546578063a0712d6814610566578063a22cb46514610579578063aa843e5114610599578063b19960e6146105b957600080fd5b8063715018a6146104b15780637cb64759146104c65780638462151c146104e65780638da5cb5b1461051357806395d89b411461053157600080fd5b80633b37d1d6116101bc57806355f804b31161018057806355f804b31461041e57806361a250d71461043e5780636352211e14610451578063695582591461047157806370a082311461049157600080fd5b80633b37d1d6146103925780633ccfd60b146103a757806342842e0e146103bc57806344b28d59146103dc57806354610481146103f157600080fd5b806318160ddd1161020357806318160ddd146102e657806323b872dd146103095780632403c08e146103295780632a55205a1461033e57806334452f381461037d57600080fd5b806301ffc9a71461023557806306fdde031461026a578063081812fc1461028c578063095ea7b3146102c4575b600080fd5b34801561024157600080fd5b50610255610250366004612afe565b610731565b60405190151581526020015b60405180910390f35b34801561027657600080fd5b5061027f610777565b6040516102619190612b6b565b34801561029857600080fd5b506102ac6102a7366004612b7e565b610809565b6040516001600160a01b039091168152602001610261565b3480156102d057600080fd5b506102e46102df366004612bae565b610899565b005b3480156102f257600080fd5b506102fb6109b0565b604051908152602001610261565b34801561031557600080fd5b506102e4610324366004612bd8565b6109bf565b34801561033557600080fd5b506102e46109f0565b34801561034a57600080fd5b5061035e610359366004612c14565b610a17565b604080516001600160a01b039093168352602083019190915201610261565b34801561038957600080fd5b506102e4610ac3565b34801561039e57600080fd5b506102e4610ae7565b3480156103b357600080fd5b506102e4610b10565b3480156103c857600080fd5b506102e46103d7366004612bd8565b610ba7565b3480156103e857600080fd5b506102e4610bc2565b3480156103fd57600080fd5b506102fb61040c366004612c36565b60176020526000908152604090205481565b34801561042a57600080fd5b506102e4610439366004612cf0565b610be9565b6102e461044c366004612db9565b610c13565b34801561045d57600080fd5b506102ac61046c366004612b7e565b610e0e565b34801561047d57600080fd5b506102e461048c366004612c14565b610e22565b34801561049d57600080fd5b506102fb6104ac366004612c36565b611020565b3480156104bd57600080fd5b506102e46110ef565b3480156104d257600080fd5b506102e46104e1366004612b7e565b611101565b3480156104f257600080fd5b50610506610501366004612c36565b611120565b6040516102619190612e00565b34801561051f57600080fd5b506010546001600160a01b03166102ac565b34801561053d57600080fd5b5061027f6111e7565b34801561055257600080fd5b506102ac610561366004612b7e565b6111f6565b6102e4610574366004612b7e565b611202565b34801561058557600080fd5b506102e4610594366004612e44565b61132c565b3480156105a557600080fd5b506102e46105b4366004612b7e565b6113f0565b3480156105c557600080fd5b506102fb60145481565b3480156105db57600080fd5b506102e46105ea366004612e80565b61140f565b3480156105fb57600080fd5b5061025561060a366004612efc565b611447565b34801561061b57600080fd5b506102fb60135481565b34801561063157600080fd5b5061027f610640366004612b7e565b61145d565b34801561065157600080fd5b506102e4610660366004612f41565b6115a2565b34801561067157600080fd5b50610685610680366004612b7e565b6117cc565b6040516102619190612f6d565b34801561069e57600080fd5b506102556106ad366004612fc5565b6001600160a01b039182166000908152600e6020908152604080832093909416825291909152205460ff1690565b3480156106e757600080fd5b506102fb60155481565b3480156106fd57600080fd5b506102e461070c366004612b7e565b611847565b34801561071d57600080fd5b506102e461072c366004612c36565b61186b565b60006001600160e01b031982166380ac58cd60e01b148061076257506001600160e01b03198216635b5e139f60e01b145b806107715750610771826118e1565b92915050565b60606004805461078690612ff8565b80601f01602080910402602001604051908101604052809291908181526020018280546107b290612ff8565b80156107ff5780601f106107d4576101008083540402835291602001916107ff565b820191906000526020600020905b8154815290600101906020018083116107e257829003601f168201915b5050505050905090565b600061081482611916565b61087d5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152600d60205260409020546001600160a01b031690565b60006108a482610e0e565b9050806001600160a01b0316836001600160a01b0316036109135760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401610874565b336001600160a01b038216148061092f575061092f81336106ad565b6109a15760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608401610874565b6109ab8383611921565b505050565b60006109ba61198f565b905090565b6109c933826119ab565b6109e55760405162461bcd60e51b815260040161087490613032565b6109ab838383611a98565b6109f8611c86565b610a00611ce0565b6016805461ff0019169055610a156001601255565b565b60008281526001602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610a8c5750604080518082019091526000546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610aab906001600160601b03168761309c565b610ab591906130c9565b915196919550909350505050565b610acb611c86565b610ad3611ce0565b6016805460ff19169055610a156001601255565b610aef611c86565b610af7611ce0565b6016805461ff001916610100179055610a156001601255565b610b18611c86565b610b20611ce0565b60004711610b635760405162461bcd60e51b815260206004820152601060248201526f2130b630b731b29034b9903d32b9379760811b6044820152606401610874565b6010546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015610b9c573d6000803e3d6000fd5b50610a156001601255565b6109ab8383836040518060200160405280600081525061140f565b610bca611c86565b610bd2611ce0565b6016805460ff19166001179055610a156001601255565b610bf1611c86565b610bf9611ce0565b600a610c058282613123565b50610c106001601255565b50565b610c1b611ce0565b6040516001600160601b03193360601b166020820152610c5590829060340160405160208183030381529060405280519060200120611447565b610cac5760405162461bcd60e51b815260206004820152602260248201527f57616c6c65742041646472657373206973206e6f742047726964204c69737465604482015261321760f11b6064820152608401610874565b60165460ff161515600114610cff5760405162461bcd60e51b815260206004820152601960248201527823b934b2102430bab99d1026b4b73a103234b9b0b13632b21760391b6044820152606401610874565b60145433600090815260176020526040902054610d1d9084906131e3565b1115610d3b5760405162461bcd60e51b8152600401610874906131f6565b336000908152601760205260409020543490600111610d5b576000610d64565b6611c37937e080005b66ffffffffffffff1683601354610d7b919061309c565b610d859190613245565b1115610dd35760405162461bcd60e51b815260206004820152601e60248201527f4772696420486175733a204e6f7420656e6f756768204554482073656e7400006044820152606401610874565b610ddd3383611d39565b3360009081526017602052604081208054849290610dfc9084906131e3565b909155505060016012555050565b5050565b600080610e1a83611d53565b509392505050565b610e2a611ce0565b60165460ff610100909104161515600114610e875760405162461bcd60e51b815260206004820152601c60248201527f4772696420486175733a204275726e2069732064697361626c65642e000000006044820152606401610874565b33610e9183610e0e565b6001600160a01b031614610efe5760405162461bcd60e51b815260206004820152602e60248201527f4772696420486175733a20596f7520646f206e6f74206f776e2074686520617260448201526d7420706965636520746f2064796560901b6064820152608401610874565b33610f0882610e0e565b6001600160a01b031614610f725760405162461bcd60e51b815260206004820152602b60248201527f4772696420486175733a20596f7520646f206e6f74206f776e2074686520647960448201526a652061727420706965636560a81b6064820152608401610874565b33610f7c83611da5565b6001600160a01b031614610fc357610f9382611da5565b600c54600090815260096020526040902080546001600160a01b0319166001600160a01b03929092169190911790555b610fcc82611de7565b600c54600090815260076020526040902055610fe781611e5f565b600c54600090815260086020526040902055611004336001611d39565b61100d81611f07565b61101682611f07565b610e0a6001601255565b60006001600160a01b03821661108e5760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401610874565b600060015b600c548110156110e8576110a681611916565b156110d8576110b481610e0e565b6001600160a01b0316846001600160a01b0316036110d8576110d582613258565b91505b6110e181613258565b9050611093565b5092915050565b6110f7611c86565b610a156000611f5b565b611109611c86565b611111611ce0565b6015819055610c106001601255565b606060008061112e84611020565b905060008167ffffffffffffffff81111561114b5761114b612c51565b604051908082528060200260200182016040528015611174578160200160208202803683370190505b50905060015b8284146111de5761118a81611916565b156111d657856001600160a01b03166111a282610e0e565b6001600160a01b0316036111d657808285806001019650815181106111c9576111c9613271565b6020026020010181815250505b60010161117a565b50949350505050565b60606005805461078690612ff8565b600080610e1a83611fad565b61120a611ce0565b60165460ff16151560011461125d5760405162461bcd60e51b815260206004820152601960248201527823b934b2102430bab99d1026b4b73a103234b9b0b13632b21760391b6044820152606401610874565b6014543360009081526017602052604090205461127b9083906131e3565b11156112995760405162461bcd60e51b8152600401610874906131f6565b34816013546112a8919061309c565b11156112f65760405162461bcd60e51b815260206004820152601e60248201527f4772696420486175733a204e6f7420656e6f756768204554482073656e7400006044820152606401610874565b6113003382611d39565b336000908152601760205260408120805483929061131f9084906131e3565b9091555050600160125550565b336001600160a01b038316036113845760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606401610874565b336000818152600e602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6113f8611c86565b611400611ce0565b600f819055610c106001601255565b61141933836119ab565b6114355760405162461bcd60e51b815260040161087490613032565b61144184848484611fff565b50505050565b60006114568360155484612034565b9392505050565b606061146882611916565b6114c75760405162461bcd60e51b815260206004820152602a60248201527f4552433732315073693a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608401610874565b60006114d161204a565b511115611510576114e061204a565b6114e983612059565b6040516020016114fa9291906132a3565b6040516020818303038152906040529050919050565b600f54821161152257610771826120ec565b600061152d836117cc565b9050600061153a84612059565b8251602080850151604080870151905161155b9594938492918391016132e2565b604051602081830303815290604052905061157581612107565b60405160200161158591906134dd565b60405160208183030381529060405292505050919050565b919050565b6115aa611ce0565b60165460ff6101009091041615156001146116075760405162461bcd60e51b815260206004820152601c60248201527f4772696420486175733a204275726e2069732064697361626c65642e000000006044820152606401610874565b3361161184610e0e565b6001600160a01b0316146116845760405162461bcd60e51b815260206004820152603460248201527f4772696420486175733a20596f7520646f206e6f74206f776e207468652061726044820152737420706965636520746f207472616e73666f726d60601b6064820152608401610874565b3361168e83610e0e565b6001600160a01b0316146117025760405162461bcd60e51b815260206004820152603560248201527f4772696420486175733a20596f7520646f206e6f74206f776e207468652066696044820152743939ba1030b93a103834b2b1b2903a3790313ab93760591b6064820152608401610874565b3361170c82610e0e565b6001600160a01b0316146117815760405162461bcd60e51b815260206004820152603660248201527f4772696420486175733a20596f7520646f206e6f74206f776e2074686520736560448201527531b7b7321030b93a103834b2b1b2903a3790313ab93760511b6064820152608401610874565b61178a83611e5f565b600c546000908152600860205260409020556117a7336001611d39565b6117b083611f07565b6117b982611f07565b6117c281611f07565b6109ab6001601255565b6117f060405180606001604052806060815260200160608152602001606081525090565b6000604051806060016040528061180e61180986611e5f565b612059565b815260200161182d61181f86611da5565b6001600160a01b031661225a565b815260200161183e61180986611de7565b90529392505050565b61184f611c86565b611857611ce0565b6118613382611d39565b610c106001601255565b611873611c86565b6001600160a01b0381166118d85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610874565b610c1081611f5b565b60006001600160e01b0319821663152a902d60e11b148061077157506301ffc9a760e01b6001600160e01b0319831614610771565b600061077182612270565b6000818152600d6020526040902080546001600160a01b0319166001600160a01b038416908117909155819061195682610e0e565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006119996122a5565b6119a1612307565b6109ba9190613245565b60006119b682611916565b611a1a5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610874565b6000611a2583610e0e565b9050806001600160a01b0316846001600160a01b03161480611a605750836001600160a01b0316611a5584610809565b6001600160a01b0316145b80611a9057506001600160a01b038082166000908152600e602090815260408083209388168352929052205460ff165b949350505050565b600080611aa483611d53565b91509150846001600160a01b0316826001600160a01b031614611b1e5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401610874565b6001600160a01b038416611b845760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401610874565b611b8f600084611921565b6000611b9c8460016131e3565b600881901c600090815260026020526040902054909150600160ff1b60ff83161c16158015611bcc5750600c5481105b15611c03576000818152600b6020526040902080546001600160a01b0319166001600160a01b038816179055611c03600282612318565b6000848152600b6020526040902080546001600160a01b0319166001600160a01b038716179055818414611c3c57611c3c600285612318565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b6010546001600160a01b03163314610a155760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610874565b600260125403611d325760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610874565b6002601255565b610e0a828260405180602001604052806000815250612344565b600080611d5f83611916565b611d7b5760405162461bcd60e51b815260040161087490613522565b611d8483612369565b6000818152600b60205260409020546001600160a01b031694909350915050565b6000818152600960205260408120546001600160a01b031615611dde57506000908152600960205260409020546001600160a01b031690565b610771826111f6565b60008181526007602052604081205415611e0e575060009081526007602052604090205490565b611e17826111f6565b82604051602001611e4192919060609290921b6001600160601b0319168252601482015260340190565b60408051601f19818403018152919052805160209091012092915050565b60008181526008602052604081205415611e86575060009081526008602052604090205490565b60006009611e93846111f6565b604051602001611eb6919060609190911b6001600160601b031916815260140190565b6040516020818303038152906040528051906020012060001c611ed9919061356e565b611ee49060016131e3565b9050601f611ef2828561309c565b611efc919061356e565b6114569060016131e3565b6000611f1282610e0e565b9050611f1f601183612318565b60405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b601080546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600080611fb983611916565b611fd55760405162461bcd60e51b815260040161087490613522565b611fde83612376565b6000818152600660205260409020546001600160a01b031694909350915050565b61200a848484611a98565b612018848484600185612383565b6114415760405162461bcd60e51b815260040161087490613582565b60008261204185846124ba565b14949350505050565b6060600a805461078690612ff8565b60606000612066836124ff565b600101905060008167ffffffffffffffff81111561208657612086612c51565b6040519080825280601f01601f1916602001820160405280156120b0576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846120ba57509392505050565b60606120f782612059565b6040516020016114fa91906135d7565b6060815160000361212657505060408051602081019091526000815290565b60006040518060600160405280604081526020016136b4604091399050600060038451600261215591906131e3565b61215f91906130c9565b61216a90600461309c565b67ffffffffffffffff81111561218257612182612c51565b6040519080825280601f01601f1916602001820160405280156121ac576020820181803683370190505b509050600182016020820185865187015b80821015612218576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f81168501518453506001830192506121bd565b505060038651066001811461223457600281146122475761224f565b603d6001830353603d600283035361224f565b603d60018303535b509195945050505050565b60606107716001600160a01b03831660146125d7565b600881901c600090815260116020526040812054600160ff1b60ff84161c161561229c57506000919050565b61077182612773565b600c54600090819081906122bd9060081c60016131e3565b9050815b81811015612301576000818152601160205260409020546122e18161278f565b6122eb90866131e3565b94505080806122f990613258565b9150506122c1565b50505090565b60006001600c546109ba9190613245565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b600061234f600c5490565b905061235b84846127a9565b612018600085838686612383565b600061077160028361293f565b600061077160038361293f565b60006001600160a01b0385163b156124ad57506001835b6123a484866131e3565b8110156124a757604051630a85bd0160e11b81526001600160a01b0387169063150b7a02906123dd9033908b9086908990600401613642565b6020604051808303816000875af1925050508015612418575060408051601f3d908101601f191682019092526124159181019061367f565b60015b612475573d808015612446576040519150601f19603f3d011682016040523d82523d6000602084013e61244b565b606091505b50805160000361246d5760405162461bcd60e51b815260040161087490613582565b805181602001fd5b82801561249257506001600160e01b03198116630a85bd0160e11b145b9250508061249f81613258565b91505061239a565b506124b1565b5060015b95945050505050565b600081815b8451811015610e1a576124eb828683815181106124de576124de613271565b6020026020010151612a37565b9150806124f781613258565b9150506124bf565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061253e5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061256a576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061258857662386f26fc10000830492506010015b6305f5e10083106125a0576305f5e100830492506008015b61271083106125b457612710830492506004015b606483106125c6576064830492506002015b600a83106107715760010192915050565b606060006125e683600261309c565b6125f19060026131e3565b67ffffffffffffffff81111561260957612609612c51565b6040519080825280601f01601f191660200182016040528015612633576020820181803683370190505b509050600360fc1b8160008151811061264e5761264e613271565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061267d5761267d613271565b60200101906001600160f81b031916908160001a90535060006126a184600261309c565b6126ac9060016131e3565b90505b6001811115612724576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106126e0576126e0613271565b1a60f81b8282815181106126f6576126f6613271565b60200101906001600160f81b031916908160001a90535060049490941c9361271d8161369c565b90506126af565b5083156114565760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610874565b600061277e600c5490565b821080156107715750506001111590565b60005b811561159d57600019820190911690600101612792565b60006127b4600c5490565b9050600082116128145760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401610874565b6001600160a01b0383166128765760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610874565b81600c600082825461288891906131e3565b90915550506000818152600b6020908152604080832080546001600160a01b0388166001600160a01b0319918216811790925560069093529220805490911690911790556128d7600282612318565b6128e2600382612318565b805b6128ee83836131e3565b8110156114415760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a48061293781613258565b9150506128e4565b600881901c60008181526020849052604081205490919060ff808516919082181c80156129815761296f81612a66565b60ff168203600884901b179350612a2e565b600083116129ee5760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401610874565b506000199091016000818152602086905260409020549091908015612a2957612a1681612a66565b60ff0360ff16600884901b179350612a2e565b612981565b50505092915050565b6000818310612a53576000828152602084905260409020611456565b6000838152602083905260409020611456565b600060405180610120016040528061010081526020016136f4610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff612aaf85612ad0565b02901c81518110612ac257612ac2613271565b016020015160f81c92915050565b6000808211612ade57600080fd5b5060008190031690565b6001600160e01b031981168114610c1057600080fd5b600060208284031215612b1057600080fd5b813561145681612ae8565b60005b83811015612b36578181015183820152602001612b1e565b50506000910152565b60008151808452612b57816020860160208601612b1b565b601f01601f19169290920160200192915050565b6020815260006114566020830184612b3f565b600060208284031215612b9057600080fd5b5035919050565b80356001600160a01b038116811461159d57600080fd5b60008060408385031215612bc157600080fd5b612bca83612b97565b946020939093013593505050565b600080600060608486031215612bed57600080fd5b612bf684612b97565b9250612c0460208501612b97565b9150604084013590509250925092565b60008060408385031215612c2757600080fd5b50508035926020909101359150565b600060208284031215612c4857600080fd5b61145682612b97565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612c9057612c90612c51565b604052919050565b600067ffffffffffffffff831115612cb257612cb2612c51565b612cc5601f8401601f1916602001612c67565b9050828152838383011115612cd957600080fd5b828260208301376000602084830101529392505050565b600060208284031215612d0257600080fd5b813567ffffffffffffffff811115612d1957600080fd5b8201601f81018413612d2a57600080fd5b611a9084823560208401612c98565b600082601f830112612d4a57600080fd5b8135602067ffffffffffffffff821115612d6657612d66612c51565b8160051b612d75828201612c67565b9283528481018201928281019087851115612d8f57600080fd5b83870192505b84831015612dae57823582529183019190830190612d95565b979650505050505050565b60008060408385031215612dcc57600080fd5b82359150602083013567ffffffffffffffff811115612dea57600080fd5b612df685828601612d39565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015612e3857835183529284019291840191600101612e1c565b50909695505050505050565b60008060408385031215612e5757600080fd5b612e6083612b97565b915060208301358015158114612e7557600080fd5b809150509250929050565b60008060008060808587031215612e9657600080fd5b612e9f85612b97565b9350612ead60208601612b97565b925060408501359150606085013567ffffffffffffffff811115612ed057600080fd5b8501601f81018713612ee157600080fd5b612ef087823560208401612c98565b91505092959194509250565b60008060408385031215612f0f57600080fd5b823567ffffffffffffffff811115612f2657600080fd5b612f3285828601612d39565b95602094909401359450505050565b600080600060608486031215612f5657600080fd5b505081359360208301359350604090920135919050565b602081526000825160606020840152612f896080840182612b3f565b90506020840151601f1980858403016040860152612fa78383612b3f565b92506040860151915080858403016060860152506124b18282612b3f565b60008060408385031215612fd857600080fd5b612fe183612b97565b9150612fef60208401612b97565b90509250929050565b600181811c9082168061300c57607f821691505b60208210810361302c57634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761077157610771613086565b634e487b7160e01b600052601260045260246000fd5b6000826130d8576130d86130b3565b500490565b601f8211156109ab57600081815260208120601f850160051c810160208610156131045750805b601f850160051c820191505b81811015611c7e57828155600101613110565b815167ffffffffffffffff81111561313d5761313d612c51565b6131518161314b8454612ff8565b846130dd565b602080601f831160018114613186576000841561316e5750858301515b600019600386901b1c1916600185901b178555611c7e565b600085815260208120601f198616915b828110156131b557888601518255948401946001909101908401613196565b50858210156131d35787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8082018082111561077157610771613086565b6020808252602f908201527f4772696420486175733a204d696e74696e67206d6f7265207468616e20616c6c60408201526e1bddd959081c195c881dd85b1b195d608a1b606082015260800190565b8181038181111561077157610771613086565b60006001820161326a5761326a613086565b5060010190565b634e487b7160e01b600052603260045260246000fd5b60008151613299818560208601612b1b565b9290920192915050565b600083516132b5818460208801612b1b565b8351908301906132c9818360208801612b1b565b64173539b7b760d91b9101908152600501949350505050565b737b226e616d65223a22477269642048617573202360601b81528651600090613312816014850160208c01612b1b565b7f222c20226465736372697074696f6e223a226465736372697074696f6e222c206014918401918201527f22696d616765223a2268747470733a2f2f73746f726167652e676f6f676c656160348201527f7069732e636f6d2f677269645f686175735f646174612f6c6f676f5f000000006054820152875161339b816070840160208c01612b1b565b7f2e6a706567222c2022616e696d6174696f6e5f75726c223a2268747470733a2f607092909101918201527f2f73746f726167652e676f6f676c65617069732e636f6d2f677269645f68617560908201527f735f646174612f677269645f686175732e68746d6c3f616464726573733d000060b08201526134d06134c16134bb61346c61346661345461344e61343460ce89018f613287565b6d26636f6c6f7250616c657474653d60901b8152600e0190565b8c613287565b6526736565643d60d01b815260060190565b89613287565b7f222c202261747472696275746573223a5b7b2274726169745f74797065223a2281527f436f6c6f722050616c65747465222c2276616c7565223a000000000000000000602082015260370190565b86613287565b627d5d7d60e81b815260030190565b9998505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161351581601d850160208701612b1b565b91909101601d0192915050565b6020808252602c908201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b60008261357d5761357d6130b3565b500690565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b7f68747470733a2f2f73746f726167652e676f6f676c65617069732e636f6d2f6781526d7269645f686175735f646174612f60901b60208201526000825161362681602e850160208701612b1b565b64173539b7b760d91b602e939091019283015250603301919050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061367590830184612b3f565b9695505050505050565b60006020828403121561369157600080fd5b815161145681612ae8565b6000816136ab576136ab613086565b50600019019056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a2646970667358221220ea5a296c8c63affd6862e7cb481e7dbeb0f7173d5c4390371f2a8a9e67260f3264736f6c63430008120033

Deployed Bytecode

0x6080604052600436106102305760003560e01c8063715018a61161012e578063b88d4fde116100ab578063e1dc07611161006f578063e1dc076114610665578063e985e9c514610692578063ebf0c717146106db578063f19e75d4146106f1578063f2fde38b1461071157600080fd5b8063b88d4fde146105cf578063b8a20ed0146105ef578063c002d23d1461060f578063c87b56dd14610625578063d69f807e1461064557600080fd5b80639e942ace116100f25780639e942ace14610546578063a0712d6814610566578063a22cb46514610579578063aa843e5114610599578063b19960e6146105b957600080fd5b8063715018a6146104b15780637cb64759146104c65780638462151c146104e65780638da5cb5b1461051357806395d89b411461053157600080fd5b80633b37d1d6116101bc57806355f804b31161018057806355f804b31461041e57806361a250d71461043e5780636352211e14610451578063695582591461047157806370a082311461049157600080fd5b80633b37d1d6146103925780633ccfd60b146103a757806342842e0e146103bc57806344b28d59146103dc57806354610481146103f157600080fd5b806318160ddd1161020357806318160ddd146102e657806323b872dd146103095780632403c08e146103295780632a55205a1461033e57806334452f381461037d57600080fd5b806301ffc9a71461023557806306fdde031461026a578063081812fc1461028c578063095ea7b3146102c4575b600080fd5b34801561024157600080fd5b50610255610250366004612afe565b610731565b60405190151581526020015b60405180910390f35b34801561027657600080fd5b5061027f610777565b6040516102619190612b6b565b34801561029857600080fd5b506102ac6102a7366004612b7e565b610809565b6040516001600160a01b039091168152602001610261565b3480156102d057600080fd5b506102e46102df366004612bae565b610899565b005b3480156102f257600080fd5b506102fb6109b0565b604051908152602001610261565b34801561031557600080fd5b506102e4610324366004612bd8565b6109bf565b34801561033557600080fd5b506102e46109f0565b34801561034a57600080fd5b5061035e610359366004612c14565b610a17565b604080516001600160a01b039093168352602083019190915201610261565b34801561038957600080fd5b506102e4610ac3565b34801561039e57600080fd5b506102e4610ae7565b3480156103b357600080fd5b506102e4610b10565b3480156103c857600080fd5b506102e46103d7366004612bd8565b610ba7565b3480156103e857600080fd5b506102e4610bc2565b3480156103fd57600080fd5b506102fb61040c366004612c36565b60176020526000908152604090205481565b34801561042a57600080fd5b506102e4610439366004612cf0565b610be9565b6102e461044c366004612db9565b610c13565b34801561045d57600080fd5b506102ac61046c366004612b7e565b610e0e565b34801561047d57600080fd5b506102e461048c366004612c14565b610e22565b34801561049d57600080fd5b506102fb6104ac366004612c36565b611020565b3480156104bd57600080fd5b506102e46110ef565b3480156104d257600080fd5b506102e46104e1366004612b7e565b611101565b3480156104f257600080fd5b50610506610501366004612c36565b611120565b6040516102619190612e00565b34801561051f57600080fd5b506010546001600160a01b03166102ac565b34801561053d57600080fd5b5061027f6111e7565b34801561055257600080fd5b506102ac610561366004612b7e565b6111f6565b6102e4610574366004612b7e565b611202565b34801561058557600080fd5b506102e4610594366004612e44565b61132c565b3480156105a557600080fd5b506102e46105b4366004612b7e565b6113f0565b3480156105c557600080fd5b506102fb60145481565b3480156105db57600080fd5b506102e46105ea366004612e80565b61140f565b3480156105fb57600080fd5b5061025561060a366004612efc565b611447565b34801561061b57600080fd5b506102fb60135481565b34801561063157600080fd5b5061027f610640366004612b7e565b61145d565b34801561065157600080fd5b506102e4610660366004612f41565b6115a2565b34801561067157600080fd5b50610685610680366004612b7e565b6117cc565b6040516102619190612f6d565b34801561069e57600080fd5b506102556106ad366004612fc5565b6001600160a01b039182166000908152600e6020908152604080832093909416825291909152205460ff1690565b3480156106e757600080fd5b506102fb60155481565b3480156106fd57600080fd5b506102e461070c366004612b7e565b611847565b34801561071d57600080fd5b506102e461072c366004612c36565b61186b565b60006001600160e01b031982166380ac58cd60e01b148061076257506001600160e01b03198216635b5e139f60e01b145b806107715750610771826118e1565b92915050565b60606004805461078690612ff8565b80601f01602080910402602001604051908101604052809291908181526020018280546107b290612ff8565b80156107ff5780601f106107d4576101008083540402835291602001916107ff565b820191906000526020600020905b8154815290600101906020018083116107e257829003601f168201915b5050505050905090565b600061081482611916565b61087d5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152600d60205260409020546001600160a01b031690565b60006108a482610e0e565b9050806001600160a01b0316836001600160a01b0316036109135760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401610874565b336001600160a01b038216148061092f575061092f81336106ad565b6109a15760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608401610874565b6109ab8383611921565b505050565b60006109ba61198f565b905090565b6109c933826119ab565b6109e55760405162461bcd60e51b815260040161087490613032565b6109ab838383611a98565b6109f8611c86565b610a00611ce0565b6016805461ff0019169055610a156001601255565b565b60008281526001602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610a8c5750604080518082019091526000546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610aab906001600160601b03168761309c565b610ab591906130c9565b915196919550909350505050565b610acb611c86565b610ad3611ce0565b6016805460ff19169055610a156001601255565b610aef611c86565b610af7611ce0565b6016805461ff001916610100179055610a156001601255565b610b18611c86565b610b20611ce0565b60004711610b635760405162461bcd60e51b815260206004820152601060248201526f2130b630b731b29034b9903d32b9379760811b6044820152606401610874565b6010546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015610b9c573d6000803e3d6000fd5b50610a156001601255565b6109ab8383836040518060200160405280600081525061140f565b610bca611c86565b610bd2611ce0565b6016805460ff19166001179055610a156001601255565b610bf1611c86565b610bf9611ce0565b600a610c058282613123565b50610c106001601255565b50565b610c1b611ce0565b6040516001600160601b03193360601b166020820152610c5590829060340160405160208183030381529060405280519060200120611447565b610cac5760405162461bcd60e51b815260206004820152602260248201527f57616c6c65742041646472657373206973206e6f742047726964204c69737465604482015261321760f11b6064820152608401610874565b60165460ff161515600114610cff5760405162461bcd60e51b815260206004820152601960248201527823b934b2102430bab99d1026b4b73a103234b9b0b13632b21760391b6044820152606401610874565b60145433600090815260176020526040902054610d1d9084906131e3565b1115610d3b5760405162461bcd60e51b8152600401610874906131f6565b336000908152601760205260409020543490600111610d5b576000610d64565b6611c37937e080005b66ffffffffffffff1683601354610d7b919061309c565b610d859190613245565b1115610dd35760405162461bcd60e51b815260206004820152601e60248201527f4772696420486175733a204e6f7420656e6f756768204554482073656e7400006044820152606401610874565b610ddd3383611d39565b3360009081526017602052604081208054849290610dfc9084906131e3565b909155505060016012555050565b5050565b600080610e1a83611d53565b509392505050565b610e2a611ce0565b60165460ff610100909104161515600114610e875760405162461bcd60e51b815260206004820152601c60248201527f4772696420486175733a204275726e2069732064697361626c65642e000000006044820152606401610874565b33610e9183610e0e565b6001600160a01b031614610efe5760405162461bcd60e51b815260206004820152602e60248201527f4772696420486175733a20596f7520646f206e6f74206f776e2074686520617260448201526d7420706965636520746f2064796560901b6064820152608401610874565b33610f0882610e0e565b6001600160a01b031614610f725760405162461bcd60e51b815260206004820152602b60248201527f4772696420486175733a20596f7520646f206e6f74206f776e2074686520647960448201526a652061727420706965636560a81b6064820152608401610874565b33610f7c83611da5565b6001600160a01b031614610fc357610f9382611da5565b600c54600090815260096020526040902080546001600160a01b0319166001600160a01b03929092169190911790555b610fcc82611de7565b600c54600090815260076020526040902055610fe781611e5f565b600c54600090815260086020526040902055611004336001611d39565b61100d81611f07565b61101682611f07565b610e0a6001601255565b60006001600160a01b03821661108e5760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401610874565b600060015b600c548110156110e8576110a681611916565b156110d8576110b481610e0e565b6001600160a01b0316846001600160a01b0316036110d8576110d582613258565b91505b6110e181613258565b9050611093565b5092915050565b6110f7611c86565b610a156000611f5b565b611109611c86565b611111611ce0565b6015819055610c106001601255565b606060008061112e84611020565b905060008167ffffffffffffffff81111561114b5761114b612c51565b604051908082528060200260200182016040528015611174578160200160208202803683370190505b50905060015b8284146111de5761118a81611916565b156111d657856001600160a01b03166111a282610e0e565b6001600160a01b0316036111d657808285806001019650815181106111c9576111c9613271565b6020026020010181815250505b60010161117a565b50949350505050565b60606005805461078690612ff8565b600080610e1a83611fad565b61120a611ce0565b60165460ff16151560011461125d5760405162461bcd60e51b815260206004820152601960248201527823b934b2102430bab99d1026b4b73a103234b9b0b13632b21760391b6044820152606401610874565b6014543360009081526017602052604090205461127b9083906131e3565b11156112995760405162461bcd60e51b8152600401610874906131f6565b34816013546112a8919061309c565b11156112f65760405162461bcd60e51b815260206004820152601e60248201527f4772696420486175733a204e6f7420656e6f756768204554482073656e7400006044820152606401610874565b6113003382611d39565b336000908152601760205260408120805483929061131f9084906131e3565b9091555050600160125550565b336001600160a01b038316036113845760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606401610874565b336000818152600e602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6113f8611c86565b611400611ce0565b600f819055610c106001601255565b61141933836119ab565b6114355760405162461bcd60e51b815260040161087490613032565b61144184848484611fff565b50505050565b60006114568360155484612034565b9392505050565b606061146882611916565b6114c75760405162461bcd60e51b815260206004820152602a60248201527f4552433732315073693a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608401610874565b60006114d161204a565b511115611510576114e061204a565b6114e983612059565b6040516020016114fa9291906132a3565b6040516020818303038152906040529050919050565b600f54821161152257610771826120ec565b600061152d836117cc565b9050600061153a84612059565b8251602080850151604080870151905161155b9594938492918391016132e2565b604051602081830303815290604052905061157581612107565b60405160200161158591906134dd565b60405160208183030381529060405292505050919050565b919050565b6115aa611ce0565b60165460ff6101009091041615156001146116075760405162461bcd60e51b815260206004820152601c60248201527f4772696420486175733a204275726e2069732064697361626c65642e000000006044820152606401610874565b3361161184610e0e565b6001600160a01b0316146116845760405162461bcd60e51b815260206004820152603460248201527f4772696420486175733a20596f7520646f206e6f74206f776e207468652061726044820152737420706965636520746f207472616e73666f726d60601b6064820152608401610874565b3361168e83610e0e565b6001600160a01b0316146117025760405162461bcd60e51b815260206004820152603560248201527f4772696420486175733a20596f7520646f206e6f74206f776e207468652066696044820152743939ba1030b93a103834b2b1b2903a3790313ab93760591b6064820152608401610874565b3361170c82610e0e565b6001600160a01b0316146117815760405162461bcd60e51b815260206004820152603660248201527f4772696420486175733a20596f7520646f206e6f74206f776e2074686520736560448201527531b7b7321030b93a103834b2b1b2903a3790313ab93760511b6064820152608401610874565b61178a83611e5f565b600c546000908152600860205260409020556117a7336001611d39565b6117b083611f07565b6117b982611f07565b6117c281611f07565b6109ab6001601255565b6117f060405180606001604052806060815260200160608152602001606081525090565b6000604051806060016040528061180e61180986611e5f565b612059565b815260200161182d61181f86611da5565b6001600160a01b031661225a565b815260200161183e61180986611de7565b90529392505050565b61184f611c86565b611857611ce0565b6118613382611d39565b610c106001601255565b611873611c86565b6001600160a01b0381166118d85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610874565b610c1081611f5b565b60006001600160e01b0319821663152a902d60e11b148061077157506301ffc9a760e01b6001600160e01b0319831614610771565b600061077182612270565b6000818152600d6020526040902080546001600160a01b0319166001600160a01b038416908117909155819061195682610e0e565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006119996122a5565b6119a1612307565b6109ba9190613245565b60006119b682611916565b611a1a5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610874565b6000611a2583610e0e565b9050806001600160a01b0316846001600160a01b03161480611a605750836001600160a01b0316611a5584610809565b6001600160a01b0316145b80611a9057506001600160a01b038082166000908152600e602090815260408083209388168352929052205460ff165b949350505050565b600080611aa483611d53565b91509150846001600160a01b0316826001600160a01b031614611b1e5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401610874565b6001600160a01b038416611b845760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401610874565b611b8f600084611921565b6000611b9c8460016131e3565b600881901c600090815260026020526040902054909150600160ff1b60ff83161c16158015611bcc5750600c5481105b15611c03576000818152600b6020526040902080546001600160a01b0319166001600160a01b038816179055611c03600282612318565b6000848152600b6020526040902080546001600160a01b0319166001600160a01b038716179055818414611c3c57611c3c600285612318565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b6010546001600160a01b03163314610a155760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610874565b600260125403611d325760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610874565b6002601255565b610e0a828260405180602001604052806000815250612344565b600080611d5f83611916565b611d7b5760405162461bcd60e51b815260040161087490613522565b611d8483612369565b6000818152600b60205260409020546001600160a01b031694909350915050565b6000818152600960205260408120546001600160a01b031615611dde57506000908152600960205260409020546001600160a01b031690565b610771826111f6565b60008181526007602052604081205415611e0e575060009081526007602052604090205490565b611e17826111f6565b82604051602001611e4192919060609290921b6001600160601b0319168252601482015260340190565b60408051601f19818403018152919052805160209091012092915050565b60008181526008602052604081205415611e86575060009081526008602052604090205490565b60006009611e93846111f6565b604051602001611eb6919060609190911b6001600160601b031916815260140190565b6040516020818303038152906040528051906020012060001c611ed9919061356e565b611ee49060016131e3565b9050601f611ef2828561309c565b611efc919061356e565b6114569060016131e3565b6000611f1282610e0e565b9050611f1f601183612318565b60405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b601080546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600080611fb983611916565b611fd55760405162461bcd60e51b815260040161087490613522565b611fde83612376565b6000818152600660205260409020546001600160a01b031694909350915050565b61200a848484611a98565b612018848484600185612383565b6114415760405162461bcd60e51b815260040161087490613582565b60008261204185846124ba565b14949350505050565b6060600a805461078690612ff8565b60606000612066836124ff565b600101905060008167ffffffffffffffff81111561208657612086612c51565b6040519080825280601f01601f1916602001820160405280156120b0576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846120ba57509392505050565b60606120f782612059565b6040516020016114fa91906135d7565b6060815160000361212657505060408051602081019091526000815290565b60006040518060600160405280604081526020016136b4604091399050600060038451600261215591906131e3565b61215f91906130c9565b61216a90600461309c565b67ffffffffffffffff81111561218257612182612c51565b6040519080825280601f01601f1916602001820160405280156121ac576020820181803683370190505b509050600182016020820185865187015b80821015612218576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f81168501518453506001830192506121bd565b505060038651066001811461223457600281146122475761224f565b603d6001830353603d600283035361224f565b603d60018303535b509195945050505050565b60606107716001600160a01b03831660146125d7565b600881901c600090815260116020526040812054600160ff1b60ff84161c161561229c57506000919050565b61077182612773565b600c54600090819081906122bd9060081c60016131e3565b9050815b81811015612301576000818152601160205260409020546122e18161278f565b6122eb90866131e3565b94505080806122f990613258565b9150506122c1565b50505090565b60006001600c546109ba9190613245565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b600061234f600c5490565b905061235b84846127a9565b612018600085838686612383565b600061077160028361293f565b600061077160038361293f565b60006001600160a01b0385163b156124ad57506001835b6123a484866131e3565b8110156124a757604051630a85bd0160e11b81526001600160a01b0387169063150b7a02906123dd9033908b9086908990600401613642565b6020604051808303816000875af1925050508015612418575060408051601f3d908101601f191682019092526124159181019061367f565b60015b612475573d808015612446576040519150601f19603f3d011682016040523d82523d6000602084013e61244b565b606091505b50805160000361246d5760405162461bcd60e51b815260040161087490613582565b805181602001fd5b82801561249257506001600160e01b03198116630a85bd0160e11b145b9250508061249f81613258565b91505061239a565b506124b1565b5060015b95945050505050565b600081815b8451811015610e1a576124eb828683815181106124de576124de613271565b6020026020010151612a37565b9150806124f781613258565b9150506124bf565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061253e5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061256a576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061258857662386f26fc10000830492506010015b6305f5e10083106125a0576305f5e100830492506008015b61271083106125b457612710830492506004015b606483106125c6576064830492506002015b600a83106107715760010192915050565b606060006125e683600261309c565b6125f19060026131e3565b67ffffffffffffffff81111561260957612609612c51565b6040519080825280601f01601f191660200182016040528015612633576020820181803683370190505b509050600360fc1b8160008151811061264e5761264e613271565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061267d5761267d613271565b60200101906001600160f81b031916908160001a90535060006126a184600261309c565b6126ac9060016131e3565b90505b6001811115612724576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106126e0576126e0613271565b1a60f81b8282815181106126f6576126f6613271565b60200101906001600160f81b031916908160001a90535060049490941c9361271d8161369c565b90506126af565b5083156114565760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610874565b600061277e600c5490565b821080156107715750506001111590565b60005b811561159d57600019820190911690600101612792565b60006127b4600c5490565b9050600082116128145760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401610874565b6001600160a01b0383166128765760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610874565b81600c600082825461288891906131e3565b90915550506000818152600b6020908152604080832080546001600160a01b0388166001600160a01b0319918216811790925560069093529220805490911690911790556128d7600282612318565b6128e2600382612318565b805b6128ee83836131e3565b8110156114415760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a48061293781613258565b9150506128e4565b600881901c60008181526020849052604081205490919060ff808516919082181c80156129815761296f81612a66565b60ff168203600884901b179350612a2e565b600083116129ee5760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401610874565b506000199091016000818152602086905260409020549091908015612a2957612a1681612a66565b60ff0360ff16600884901b179350612a2e565b612981565b50505092915050565b6000818310612a53576000828152602084905260409020611456565b6000838152602083905260409020611456565b600060405180610120016040528061010081526020016136f4610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff612aaf85612ad0565b02901c81518110612ac257612ac2613271565b016020015160f81c92915050565b6000808211612ade57600080fd5b5060008190031690565b6001600160e01b031981168114610c1057600080fd5b600060208284031215612b1057600080fd5b813561145681612ae8565b60005b83811015612b36578181015183820152602001612b1e565b50506000910152565b60008151808452612b57816020860160208601612b1b565b601f01601f19169290920160200192915050565b6020815260006114566020830184612b3f565b600060208284031215612b9057600080fd5b5035919050565b80356001600160a01b038116811461159d57600080fd5b60008060408385031215612bc157600080fd5b612bca83612b97565b946020939093013593505050565b600080600060608486031215612bed57600080fd5b612bf684612b97565b9250612c0460208501612b97565b9150604084013590509250925092565b60008060408385031215612c2757600080fd5b50508035926020909101359150565b600060208284031215612c4857600080fd5b61145682612b97565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612c9057612c90612c51565b604052919050565b600067ffffffffffffffff831115612cb257612cb2612c51565b612cc5601f8401601f1916602001612c67565b9050828152838383011115612cd957600080fd5b828260208301376000602084830101529392505050565b600060208284031215612d0257600080fd5b813567ffffffffffffffff811115612d1957600080fd5b8201601f81018413612d2a57600080fd5b611a9084823560208401612c98565b600082601f830112612d4a57600080fd5b8135602067ffffffffffffffff821115612d6657612d66612c51565b8160051b612d75828201612c67565b9283528481018201928281019087851115612d8f57600080fd5b83870192505b84831015612dae57823582529183019190830190612d95565b979650505050505050565b60008060408385031215612dcc57600080fd5b82359150602083013567ffffffffffffffff811115612dea57600080fd5b612df685828601612d39565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015612e3857835183529284019291840191600101612e1c565b50909695505050505050565b60008060408385031215612e5757600080fd5b612e6083612b97565b915060208301358015158114612e7557600080fd5b809150509250929050565b60008060008060808587031215612e9657600080fd5b612e9f85612b97565b9350612ead60208601612b97565b925060408501359150606085013567ffffffffffffffff811115612ed057600080fd5b8501601f81018713612ee157600080fd5b612ef087823560208401612c98565b91505092959194509250565b60008060408385031215612f0f57600080fd5b823567ffffffffffffffff811115612f2657600080fd5b612f3285828601612d39565b95602094909401359450505050565b600080600060608486031215612f5657600080fd5b505081359360208301359350604090920135919050565b602081526000825160606020840152612f896080840182612b3f565b90506020840151601f1980858403016040860152612fa78383612b3f565b92506040860151915080858403016060860152506124b18282612b3f565b60008060408385031215612fd857600080fd5b612fe183612b97565b9150612fef60208401612b97565b90509250929050565b600181811c9082168061300c57607f821691505b60208210810361302c57634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761077157610771613086565b634e487b7160e01b600052601260045260246000fd5b6000826130d8576130d86130b3565b500490565b601f8211156109ab57600081815260208120601f850160051c810160208610156131045750805b601f850160051c820191505b81811015611c7e57828155600101613110565b815167ffffffffffffffff81111561313d5761313d612c51565b6131518161314b8454612ff8565b846130dd565b602080601f831160018114613186576000841561316e5750858301515b600019600386901b1c1916600185901b178555611c7e565b600085815260208120601f198616915b828110156131b557888601518255948401946001909101908401613196565b50858210156131d35787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8082018082111561077157610771613086565b6020808252602f908201527f4772696420486175733a204d696e74696e67206d6f7265207468616e20616c6c60408201526e1bddd959081c195c881dd85b1b195d608a1b606082015260800190565b8181038181111561077157610771613086565b60006001820161326a5761326a613086565b5060010190565b634e487b7160e01b600052603260045260246000fd5b60008151613299818560208601612b1b565b9290920192915050565b600083516132b5818460208801612b1b565b8351908301906132c9818360208801612b1b565b64173539b7b760d91b9101908152600501949350505050565b737b226e616d65223a22477269642048617573202360601b81528651600090613312816014850160208c01612b1b565b7f222c20226465736372697074696f6e223a226465736372697074696f6e222c206014918401918201527f22696d616765223a2268747470733a2f2f73746f726167652e676f6f676c656160348201527f7069732e636f6d2f677269645f686175735f646174612f6c6f676f5f000000006054820152875161339b816070840160208c01612b1b565b7f2e6a706567222c2022616e696d6174696f6e5f75726c223a2268747470733a2f607092909101918201527f2f73746f726167652e676f6f676c65617069732e636f6d2f677269645f68617560908201527f735f646174612f677269645f686175732e68746d6c3f616464726573733d000060b08201526134d06134c16134bb61346c61346661345461344e61343460ce89018f613287565b6d26636f6c6f7250616c657474653d60901b8152600e0190565b8c613287565b6526736565643d60d01b815260060190565b89613287565b7f222c202261747472696275746573223a5b7b2274726169745f74797065223a2281527f436f6c6f722050616c65747465222c2276616c7565223a000000000000000000602082015260370190565b86613287565b627d5d7d60e81b815260030190565b9998505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161351581601d850160208701612b1b565b91909101601d0192915050565b6020808252602c908201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b60008261357d5761357d6130b3565b500690565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b7f68747470733a2f2f73746f726167652e676f6f676c65617069732e636f6d2f6781526d7269645f686175735f646174612f60901b60208201526000825161362681602e850160208701612b1b565b64173539b7b760d91b602e939091019283015250603301919050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061367590830184612b3f565b9695505050505050565b60006020828403121561369157600080fd5b815161145681612ae8565b6000816136ab576136ab613086565b50600019019056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a2646970667358221220ea5a296c8c63affd6862e7cb481e7dbeb0f7173d5c4390371f2a8a9e67260f3264736f6c63430008120033

Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.