ETH Price: $3,163.82 (-8.84%)
Gas: 4 Gwei

Token

Mech NFT (MECH)
 

Overview

Max Total Supply

769 MECH

Holders

508

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
1 MECH
0xbff411219284fc7f6e70bad2a70b5eeb6d882e75
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:
MechNFT

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 20 : ERC721Psi.sol
// SPDX-License-Identifier: MIT
/**
  ______ _____   _____ ______ ___  __ _  _  _ 
 |  ____|  __ \ / ____|____  |__ \/_ | || || |
 | |__  | |__) | |        / /   ) || | \| |/ |
 |  __| |  _  /| |       / /   / / | |\_   _/ 
 | |____| | \ \| |____  / /   / /_ | |  | |   
 |______|_|  \_\\_____|/_/   |____||_|  |_|   

 - github: https://github.com/estarriolvetch/ERC721Psi
 - npm: https://www.npmjs.com/package/erc721psi
                                          
 */

pragma solidity ^0.8.0;

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


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

    BitMaps.BitMap private _batchHead;

    string private _name;
    string private _symbol;

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

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

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

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

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

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

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

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

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

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


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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(
            _checkOnERC721Received(from, to, tokenId, 1,_data),
            "ERC721Psi: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return tokenId < _minted;
    }

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

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

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


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


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

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

        _beforeTokenTransfers(from, to, tokenId, 1);

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

        uint256 nextTokenId = tokenId + 1;

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

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

        emit Transfer(from, to, tokenId);

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

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

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

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

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

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

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

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


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

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

File 2 of 20 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

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

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

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

pragma solidity ^0.8.0;

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

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

File 4 of 20 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 5 of 20 : 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 6 of 20 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 7 of 20 : 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 8 of 20 : ERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 9 of 20 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

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

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

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

File 10 of 20 : 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 11 of 20 : StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)

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:
 * ```
 * 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`, and `uint256`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 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
        }
    }
}

File 12 of 20 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

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

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

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

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

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

File 13 of 20 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 17 of 20 : 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] << bucketStartIndex >> (256 - amount)
                );
            } else {
                count += Popcount.popcount256A(
                    bitmap._data[bucket] << bucketStartIndex
                );
                amount -= (256 - bucketStartIndex);
                bucket++;

                while(amount > 256) {
                    count += Popcount.popcount256A(bitmap._data[bucket]);
                    amount -= 256;
                    bucket++;
                }
                count += Popcount.popcount256A(
                    bitmap._data[bucket] >> (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] << bucketStartIndex >> (256 - amount)
                );
            } else {
                count += Popcount.popcount256B(
                    bitmap._data[bucket] << bucketStartIndex
                );
                amount -= (256 - bucketStartIndex);
                bucket++;

                while(amount > 256) {
                    count += Popcount.popcount256B(bitmap._data[bucket]);
                    amount -= 256;
                    bucket++;
                }
                count += Popcount.popcount256B(
                    bitmap._data[bucket] >> (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 18 of 20 : 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 19 of 20 : Popcount.sol
// SPDX-License-Identifier: MIT
/**
   _____       ___     ___ __           ____  _ __      
  / ___/____  / (_)___/ (_) /___  __   / __ )(_) /______
  \__ \/ __ \/ / / __  / / __/ / / /  / __  / / __/ ___/
 ___/ / /_/ / / / /_/ / / /_/ /_/ /  / /_/ / / /_(__  ) 
/____/\____/_/_/\__,_/_/\__/\__, /  /_____/_/\__/____/  
                           /____/                        

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

 */

/// @dev reference: https://en.wikichip.org/wiki/population_count

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 20 of 20 : MechNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;

import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "erc721psi/contracts/ERC721Psi.sol";

contract MechNFT is ERC721Psi, ERC2981, Ownable {
    enum MintStage {
        Whitelist,
        Public
    }

    using ECDSA for bytes32;
    using Strings for uint256;

    string public tokenBaseURI;
    uint256 public collectionSize;
    address public signerAddress;
    address public payoutAddress;

    mapping(uint256 => string) ipfsMetadataMapping;

    struct MintRoundConfig {
        uint256 startTime;
        uint256 endTime;
        uint256 price;
        uint64 roundLimit;
        uint64 mintLimitAmount;
        MintStage stage;
        mapping(address => uint256) mintAmount;
    }
    mapping(uint256 => MintRoundConfig) public mintConfigs;
    uint256 public mintConfigCount = 0;
    uint8 public currentRoundIndex;

    constructor(
        string memory _tokenBaseURI,
        uint256 _collectionSize,
        address _signerAddress,
        address _payoutAddress,
        address _feeAddress,
        uint96 _feeNumerator
    ) ERC721Psi("Mech NFT", "MECH") {
        tokenBaseURI = _tokenBaseURI;
        collectionSize = _collectionSize;
        signerAddress = _signerAddress;
        payoutAddress = _payoutAddress;
        currentRoundIndex = 0;

        _setDefaultRoyalty(_feeAddress, _feeNumerator);
    }

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

    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        require(_exists(tokenId), "URI query for nonexistent token");

        string memory baseURI = _baseURI();
        string memory ipfsMetadataURI = ipfsMetadataMapping[tokenId];
        return
            bytes(ipfsMetadataURI).length != 0
                ? ipfsMetadataURI
                : string(abi.encodePacked(baseURI, tokenId.toString()));
    }

    modifier checkMintConstraint(MintStage stage, uint256 quantity) {
        proceedMintRound();

        require(tx.origin == msg.sender, "Non human user");

        MintRoundConfig storage mintRound = mintConfigs[currentRoundIndex];
        require(mintRound.stage == stage, "Incorrect mint stage");

        uint256 currentMintAmount = mintRound.mintAmount[msg.sender];
        require(
            currentMintAmount + quantity <= mintRound.mintLimitAmount,
            "Exceed mint amount"
        );
        require(
            totalSupply() + quantity <= collectionSize,
            "Exceed total supply"
        );
        require(
            totalSupply() + quantity <= mintRound.roundLimit,
            "Exceed round limit"
        );
        require(msg.value >= mintRound.price * quantity, "price not enough");
        require(
            block.timestamp >= mintRound.startTime &&
                block.timestamp <= mintRound.endTime,
            "Mint stage is not started"
        );

        _;
    }

    function whitelistMint(
        uint8 quantity,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external payable checkMintConstraint(MintStage.Whitelist, quantity) {
        require(isAuthorized(msg.sender, v, r, s), "Invalid signature");

        mintCallback(quantity, currentRoundIndex);
        _safeMint(msg.sender, quantity);

        if (msg.value > 0) {
            payable(payoutAddress).transfer(msg.value);
        }
    }

    function mint(uint8 quantity)
        external
        payable
        checkMintConstraint(MintStage.Public, quantity)
    {
        mintCallback(quantity, currentRoundIndex);
        _safeMint(msg.sender, quantity);

        if (msg.value > 0) {
            payable(payoutAddress).transfer(msg.value);
        }
    }

    function mintForAirdrop(address[] memory addresses, uint256 quantity)
        external
        onlyOwner
    {
        for (uint256 i = 0; i < addresses.length; i++) {
            _safeMint(addresses[i], quantity);
        }
    }

    function getCurrentRoundIndex(uint256 currentTime)
        public
        view
        returns (uint8)
    {
        uint8 roundIndex = currentRoundIndex;
        while (mintConfigCount > roundIndex + 1) {
            uint256 endTime = mintConfigs[roundIndex].endTime;
            uint256 nextStageEndTime = endTime;

            if (currentTime >= nextStageEndTime) {
                roundIndex += 1;
            } else {
                return roundIndex;
            }
        }

        return roundIndex;
    }

    function proceedMintRound() private {
        uint8 roundIndex = getCurrentRoundIndex(block.timestamp);
        if (currentRoundIndex != roundIndex) {
            currentRoundIndex = roundIndex;
        }
    }

    function setCurrentRoundIndex(uint8 _currentRoundIndex) external onlyOwner {
        currentRoundIndex = _currentRoundIndex;
    }

    function setMintConfig(
        uint256 roundIndex,
        uint256 startTime,
        uint256 endTime,
        uint256 price,
        uint64 roundLimit,
        uint64 mintLimitAmount,
        MintStage stage
    ) external onlyOwner {
        if (roundIndex >= mintConfigCount) {
            mintConfigCount++;
        }

        MintRoundConfig storage config = mintConfigs[roundIndex];
        config.startTime = startTime;
        config.endTime = endTime;
        config.price = price;
        config.roundLimit = roundLimit;
        config.mintLimitAmount = mintLimitAmount;
        config.stage = stage;
    }

    function mintCallback(uint256 quantity, uint256 roundIndex) private {
        MintRoundConfig storage config = mintConfigs[roundIndex];
        config.mintAmount[msg.sender] += quantity;
    }

    function setIpfsMetadata(uint256 tokenId, string memory ipfsURI)
        external
        onlyOwner
    {
        ipfsMetadataMapping[tokenId] = ipfsURI;
    }

    function getCurrentMintAmount(uint256 timestamp)
        external
        view
        returns (uint256)
    {
        uint256 _currentRoundIndex = getCurrentRoundIndex(timestamp);
        MintRoundConfig storage mintRound = mintConfigs[_currentRoundIndex];

        return mintRound.mintAmount[msg.sender];
    }

    function isAuthorized(
        address sender,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public view returns (bool) {
        bytes32 hash = keccak256(abi.encodePacked(sender));
        bytes32 signedHash = keccak256(
            abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)
        );

        return signerAddress == ecrecover(signedHash, v, r, s);
    }

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

Settings
{
  "remappings": [
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "ERC721Psi/=lib/ERC721Psi/contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "erc721psi/=lib/ERC721Psi/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
    "solidity-bits/=lib/solidity-bits/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"_tokenBaseURI","type":"string"},{"internalType":"uint256","name":"_collectionSize","type":"uint256"},{"internalType":"address","name":"_signerAddress","type":"address"},{"internalType":"address","name":"_payoutAddress","type":"address"},{"internalType":"address","name":"_feeAddress","type":"address"},{"internalType":"uint96","name":"_feeNumerator","type":"uint96"}],"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":[{"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":"collectionSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentRoundIndex","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"getCurrentMintAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"currentTime","type":"uint256"}],"name":"getCurrentRoundIndex","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"isAuthorized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"quantity","type":"uint8"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintConfigCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"mintConfigs","outputs":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint64","name":"roundLimit","type":"uint64"},{"internalType":"uint64","name":"mintLimitAmount","type":"uint64"},{"internalType":"enum MechNFT.MintStage","name":"stage","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"mintForAirdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"payoutAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_currentRoundIndex","type":"uint8"}],"name":"setCurrentRoundIndex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"ipfsURI","type":"string"}],"name":"setIpfsMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"roundIndex","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint64","name":"roundLimit","type":"uint64"},{"internalType":"uint64","name":"mintLimitAmount","type":"uint64"},{"internalType":"enum MechNFT.MintStage","name":"stage","type":"uint8"}],"name":"setMintConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenBaseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"quantity","type":"uint8"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"whitelistMint","outputs":[],"stateMutability":"payable","type":"function"}]

608060405260006010553480156200001657600080fd5b506040516200349f3803806200349f8339810160408190526200003991620002c0565b60405180604001604052806008815260200167135958da0813919560c21b8152506040518060400160405280600481526020016309a8a86960e31b815250816001908162000088919062000481565b50600262000097828262000481565b505050620000b4620000ae6200011a60201b60201c565b6200011e565b600a620000c2878262000481565b50600b859055600c80546001600160a01b038087166001600160a01b031992831617909255600d8054928616929091169190911790556011805460ff191690556200010e828262000170565b5050505050506200054d565b3390565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127106001600160601b0382161115620001e45760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084015b60405180910390fd5b6001600160a01b0382166200023c5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401620001db565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600755565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b0381168114620002a357600080fd5b919050565b80516001600160601b0381168114620002a357600080fd5b60008060008060008060c08789031215620002da57600080fd5b86516001600160401b0380821115620002f257600080fd5b818901915089601f8301126200030757600080fd5b8151818111156200031c576200031c62000275565b604051601f8201601f19908116603f0116810190838211818310171562000347576200034762000275565b81604052828152602093508c848487010111156200036457600080fd5b600091505b8282101562000388578482018401518183018501529083019062000369565b828211156200039a5760008484830101525b809a505050508089015196505050620003b6604088016200028b565b9350620003c6606088016200028b565b9250620003d6608088016200028b565b9150620003e660a08801620002a8565b90509295509295509295565b600181811c908216806200040757607f821691505b6020821081036200042857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200047c57600081815260208120601f850160051c81016020861015620004575750805b601f850160051c820191505b81811015620004785782815560010162000463565b5050505b505050565b81516001600160401b038111156200049d576200049d62000275565b620004b581620004ae8454620003f2565b846200042e565b602080601f831160018114620004ed5760008415620004d45750858301515b600019600386901b1c1916600185901b17855562000478565b600085815260208120601f198616915b828110156200051e57888601518255948401946001909101908401620004fd565b50858210156200053d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b612f42806200055d6000396000f3fe60806040526004361061020f5760003560e01c80636352211e116101185780638da5cb5b116100a0578063c87b56dd1161006f578063c87b56dd146105fe578063daea6db41461061e578063e985e9c51461063e578063ec69a4b714610687578063f2fde38b146106fc57600080fd5b80638da5cb5b1461058b57806395d89b41146105a9578063a22cb465146105be578063b88d4fde146105de57600080fd5b80636ecd2306116100e75780636ecd2306146105035780636f8aa0411461051657806370a0823114610536578063715018a61461055657806383592fe71461056b57600080fd5b80636352211e1461048157806363cd42e7146104a157806366177c64146104c15780636896ef4b146104d757600080fd5b80632f745c591161019b5780634e99b8001161016a5780634e99b800146103ec5780634f6ccce7146104015780635149e681146104215780635b7633d0146104415780635b8d02d71461046157600080fd5b80632f745c591461038357806330933e73146103a357806342842e0e146103b657806345c0f533146103d657600080fd5b80631243cebe116101e25780631243cebe146102c557806316140d7b146102e557806318160ddd1461030557806323b872dd146103245780632a55205a1461034457600080fd5b806301ffc9a71461021457806306fdde0314610249578063081812fc1461026b578063095ea7b3146102a3575b600080fd5b34801561022057600080fd5b5061023461022f366004612557565b61071c565b60405190151581526020015b60405180910390f35b34801561025557600080fd5b5061025e61072d565b60405161024091906125d3565b34801561027757600080fd5b5061028b6102863660046125e6565b6107bf565b6040516001600160a01b039091168152602001610240565b3480156102af57600080fd5b506102c36102be36600461261b565b610851565b005b3480156102d157600080fd5b506102c36102e0366004612656565b610968565b3480156102f157600080fd5b506102c361030036600461270e565b610986565b34801561031157600080fd5b506004545b604051908152602001610240565b34801561033057600080fd5b506102c361033f366004612768565b6109a6565b34801561035057600080fd5b5061036461035f3660046127a4565b6109d7565b604080516001600160a01b039093168352602083019190915201610240565b34801561038f57600080fd5b5061031661039e36600461261b565b610a83565b6102c36103b13660046127c6565b610b4d565b3480156103c257600080fd5b506102c36103d1366004612768565b610ebf565b3480156103e257600080fd5b50610316600b5481565b3480156103f857600080fd5b5061025e610eda565b34801561040d57600080fd5b5061031661041c3660046125e6565b610f68565b34801561042d57600080fd5b5061023461043c366004612808565b611022565b34801561044d57600080fd5b50600c5461028b906001600160a01b031681565b34801561046d57600080fd5b50600d5461028b906001600160a01b031681565b34801561048d57600080fd5b5061028b61049c3660046125e6565b611120565b3480156104ad57600080fd5b506102c36104bc36600461283e565b611134565b3480156104cd57600080fd5b5061031660105481565b3480156104e357600080fd5b506011546104f19060ff1681565b60405160ff9091168152602001610240565b6102c3610511366004612656565b6111e1565b34801561052257600080fd5b506102c36105313660046128b0565b611504565b34801561054257600080fd5b50610316610551366004612962565b61154d565b34801561056257600080fd5b506102c361161d565b34801561057757600080fd5b506103166105863660046125e6565b611631565b34801561059757600080fd5b506009546001600160a01b031661028b565b3480156105b557600080fd5b5061025e611664565b3480156105ca57600080fd5b506102c36105d936600461297d565b611673565b3480156105ea57600080fd5b506102c36105f93660046129b9565b611737565b34801561060a57600080fd5b5061025e6106193660046125e6565b61176f565b34801561062a57600080fd5b506104f16106393660046125e6565b6118b2565b34801561064a57600080fd5b50610234610659366004612a34565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b34801561069357600080fd5b506106ea6106a23660046125e6565b600f602052600090815260409020805460018201546002830154600390930154919290916001600160401b0380821691600160401b810490911690600160801b900460ff1686565b60405161024096959493929190612a7d565b34801561070857600080fd5b506102c3610717366004612962565b611913565b60006107278261198c565b92915050565b60606001805461073c90612ad8565b80601f016020809104026020016040519081016040528092919081815260200182805461076890612ad8565b80156107b55780601f1061078a576101008083540402835291602001916107b5565b820191906000526020600020905b81548152906001019060200180831161079857829003601f168201915b5050505050905090565b60006107cc826004541190565b6108355760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152600560205260409020546001600160a01b031690565b600061085c82611120565b9050806001600160a01b0316836001600160a01b0316036108cb5760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b606482015260840161082c565b336001600160a01b03821614806108e757506108e78133610659565b6109595760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c0000000000606482015260840161082c565b61096383836119b1565b505050565b610970611a1f565b6011805460ff191660ff92909216919091179055565b61098e611a1f565b6000828152600e602052604090206109638282612b58565b6109b03382611a79565b6109cc5760405162461bcd60e51b815260040161082c90612c17565b610963838383611b64565b60008281526008602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610a4c5750604080518082019091526007546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610a6b906001600160601b031687612c81565b610a759190612ca0565b915196919550909350505050565b60008060005b600454811015610af857610a9e816004541190565b8015610ac35750610aae81611120565b6001600160a01b0316856001600160a01b0316145b15610ae657838203610ad85791506107279050565b81610ae281612cc2565b9250505b80610af081612cc2565b915050610a89565b5060405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a206f776e657220696e646578206f7574206f6620626f604482015263756e647360e01b606482015260840161082c565b60008460ff16610b5b611d4d565b323314610b9b5760405162461bcd60e51b815260206004820152600e60248201526d2737b710343ab6b0b7103ab9b2b960911b604482015260640161082c565b60115460ff166000908152600f60205260409020826001811115610bc157610bc1612a67565b6003820154600160801b900460ff166001811115610be157610be1612a67565b14610c255760405162461bcd60e51b8152602060048201526014602482015273496e636f7272656374206d696e7420737461676560601b604482015260640161082c565b3360009081526004820160205260409020546003820154600160401b90046001600160401b0316610c568483612cdb565b1115610c995760405162461bcd60e51b8152602060048201526012602482015271115e18d95959081b5a5b9d08185b5bdd5b9d60721b604482015260640161082c565b600b5483610ca660045490565b610cb09190612cdb565b1115610cf45760405162461bcd60e51b815260206004820152601360248201527245786365656420746f74616c20737570706c7960681b604482015260640161082c565b60038201546001600160401b031683610d0c60045490565b610d169190612cdb565b1115610d595760405162461bcd60e51b8152602060048201526012602482015271115e18d95959081c9bdd5b99081b1a5b5a5d60721b604482015260640161082c565b828260020154610d699190612c81565b341015610dab5760405162461bcd60e51b815260206004820152601060248201526f0e0e4d2c6ca40dcdee840cadcdeeaced60831b604482015260640161082c565b81544210801590610dc0575081600101544211155b610e085760405162461bcd60e51b8152602060048201526019602482015278135a5b9d081cdd1859d9481a5cc81b9bdd081cdd185c9d1959603a1b604482015260640161082c565b610e1433888888611022565b610e545760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b604482015260640161082c565b601154610e679060ff808b169116611d7e565b610e74338960ff16611db6565b3415610eb557600d546040516001600160a01b03909116903480156108fc02916000818181858888f19350505050158015610eb3573d6000803e3d6000fd5b505b5050505050505050565b61096383838360405180602001604052806000815250611737565b600a8054610ee790612ad8565b80601f0160208091040260200160405190810160405280929190818152602001828054610f1390612ad8565b8015610f605780601f10610f3557610100808354040283529160200191610f60565b820191906000526020600020905b815481529060010190602001808311610f4357829003601f168201915b505050505081565b6000610f7360045490565b8210610fcf5760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a20676c6f62616c20696e646578206f7574206f6620626044820152646f756e647360d81b606482015260840161082c565b6000805b60045481101561101b57610fe8816004541190565b1561100957838203610ffb579392505050565b8161100581612cc2565b9250505b8061101381612cc2565b915050610fd3565b5050919050565b60408051606086901b6bffffffffffffffffffffffff1916602080830191909152825160148184030181526034830190935282519201919091207f19457468657265756d205369676e6564204d6573736167653a0a333200000000605483015260708201819052600091829060900160408051601f1981840301815282825280516020918201206000845290830180835281905260ff8916918301919091526060820187905260808201869052915060019060a0016020604051602081039080840390855afa1580156110f9573d6000803e3d6000fd5b5050604051601f190151600c546001600160a01b0391821691161498975050505050505050565b60008061112c83611dd4565b509392505050565b61113c611a1f565b601054871061115b576010805490600061115583612cc2565b91905055505b6000878152600f602052604090208681556001808201879055600282018690556003820180546001600160401b03868116600160401b026fffffffffffffffffffffffffffffffff199092169088161717808255849260ff60801b1990911690600160801b9084908111156111d2576111d2612a67565b02179055505050505050505050565b60018160ff166111ef611d4d565b32331461122f5760405162461bcd60e51b815260206004820152600e60248201526d2737b710343ab6b0b7103ab9b2b960911b604482015260640161082c565b60115460ff166000908152600f6020526040902082600181111561125557611255612a67565b6003820154600160801b900460ff16600181111561127557611275612a67565b146112b95760405162461bcd60e51b8152602060048201526014602482015273496e636f7272656374206d696e7420737461676560601b604482015260640161082c565b3360009081526004820160205260409020546003820154600160401b90046001600160401b03166112ea8483612cdb565b111561132d5760405162461bcd60e51b8152602060048201526012602482015271115e18d95959081b5a5b9d08185b5bdd5b9d60721b604482015260640161082c565b600b548361133a60045490565b6113449190612cdb565b11156113885760405162461bcd60e51b815260206004820152601360248201527245786365656420746f74616c20737570706c7960681b604482015260640161082c565b60038201546001600160401b0316836113a060045490565b6113aa9190612cdb565b11156113ed5760405162461bcd60e51b8152602060048201526012602482015271115e18d95959081c9bdd5b99081b1a5b5a5d60721b604482015260640161082c565b8282600201546113fd9190612c81565b34101561143f5760405162461bcd60e51b815260206004820152601060248201526f0e0e4d2c6ca40dcdee840cadcdeeaced60831b604482015260640161082c565b81544210801590611454575081600101544211155b61149c5760405162461bcd60e51b8152602060048201526019602482015278135a5b9d081cdd1859d9481a5cc81b9bdd081cdd185c9d1959603a1b604482015260640161082c565b6011546114af9060ff8088169116611d7e565b6114bc338660ff16611db6565b34156114fd57600d546040516001600160a01b03909116903480156108fc02916000818181858888f193505050501580156114fb573d6000803e3d6000fd5b505b5050505050565b61150c611a1f565b60005b82518110156109635761153b83828151811061152d5761152d612cf3565b602002602001015183611db6565b8061154581612cc2565b91505061150f565b60006001600160a01b0382166115bb5760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b606482015260840161082c565b6000805b600454811015611616576115d4816004541190565b15611606576115e281611120565b6001600160a01b0316846001600160a01b0316036116065761160382612cc2565b91505b61160f81612cc2565b90506115bf565b5092915050565b611625611a1f565b61162f6000611e6d565b565b60008061163d836118b2565b60ff166000908152600f602090815260408083203384526004019091529020549392505050565b60606002805461073c90612ad8565b336001600160a01b038316036116cb5760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c657200000000604482015260640161082c565b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6117413383611a79565b61175d5760405162461bcd60e51b815260040161082c90612c17565b61176984848484611ebf565b50505050565b606061177c826004541190565b6117c85760405162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e00604482015260640161082c565b60006117d2611ef4565b6000848152600e60205260408120805492935090916117f090612ad8565b80601f016020809104026020016040519081016040528092919081815260200182805461181c90612ad8565b80156118695780601f1061183e57610100808354040283529160200191611869565b820191906000526020600020905b81548152906001019060200180831161184c57829003601f168201915b5050505050905080516000036118a8578161188385611f03565b604051602001611894929190612d09565b6040516020818303038152906040526118aa565b805b949350505050565b60115460009060ff165b6118c7816001612d38565b60ff1660105411156107275760ff81166000908152600f602052604090206001015480808510611903576118fc600184612d38565b925061190c565b50909392505050565b50506118bc565b61191b611a1f565b6001600160a01b0381166119805760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161082c565b61198981611e6d565b50565b60006001600160e01b0319821663152a902d60e11b1480610727575061072782611f95565b600081815260056020526040902080546001600160a01b0319166001600160a01b03841690811790915581906119e682611120565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6009546001600160a01b0316331461162f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161082c565b6000611a86826004541190565b611aea5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161082c565b6000611af583611120565b9050806001600160a01b0316846001600160a01b03161480611b305750836001600160a01b0316611b25846107bf565b6001600160a01b0316145b806118aa57506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff166118aa565b600080611b7083611dd4565b91509150846001600160a01b0316826001600160a01b031614611bea5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b606482015260840161082c565b6001600160a01b038416611c505760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b606482015260840161082c565b611c5b6000846119b1565b6000611c68846001612cdb565b600881901c600090815260208190526040902054909150600160ff1b60ff83161c16158015611c98575060045481105b15611cce57600081815260036020526040812080546001600160a01b0319166001600160a01b038916179055611cce9082612000565b600084815260036020526040902080546001600160a01b0319166001600160a01b038716179055818414611d0757611d07600085612000565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46114fb565b6000611d58426118b2565b60115490915060ff808316911614611989576011805460ff831660ff1990911617905550565b6000818152600f60209081526040808320338452600481019092528220805491928592611dac908490612cdb565b9091555050505050565b611dd082826040518060200160405280600081525061202c565b5050565b600080611de2836004541190565b611e435760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161082c565b611e4c83612047565b6000818152600360205260409020546001600160a01b031694909350915050565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611eca848484611b64565b611ed8848484600185612053565b6117695760405162461bcd60e51b815260040161082c90612d5d565b6060600a805461073c90612ad8565b60606000611f108361218a565b60010190506000816001600160401b03811115611f2f57611f2f612671565b6040519080825280601f01601f191660200182016040528015611f59576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611f6357509392505050565b60006001600160e01b031982166380ac58cd60e01b1480611fc657506001600160e01b03198216635b5e139f60e01b145b80611fe157506001600160e01b0319821663780e9d6360e01b145b8061072757506301ffc9a760e01b6001600160e01b0319831614610727565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6004546120398484612262565b611ed8600085838686612053565b600061072781836123c7565b60006001600160a01b0385163b1561217d57506001835b6120748486612cdb565b81101561217757604051630a85bd0160e11b81526001600160a01b0387169063150b7a02906120ad9033908b9086908990600401612db2565b6020604051808303816000875af19250505080156120e8575060408051601f3d908101601f191682019092526120e591810190612def565b60015b612145573d808015612116576040519150601f19603f3d011682016040523d82523d6000602084013e61211b565b606091505b50805160000361213d5760405162461bcd60e51b815260040161082c90612d5d565b805181602001fd5b82801561216257506001600160e01b03198116630a85bd0160e11b145b9250508061216f81612cc2565b91505061206a565b50612181565b5060015b95945050505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106121c95772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106121f5576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061221357662386f26fc10000830492506010015b6305f5e100831061222b576305f5e100830492506008015b612710831061223f57612710830492506004015b60648310612251576064830492506002015b600a83106107275760010192915050565b600454816122c05760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b606482015260840161082c565b6001600160a01b0383166123225760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b606482015260840161082c565b81600460008282546123349190612cdb565b9091555050600081815260036020526040812080546001600160a01b0319166001600160a01b03861617905561236a9082612000565b805b6123768383612cdb565b8110156117695760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4806123bf81612cc2565b91505061236c565b600881901c60008181526020849052604081205490919060ff808516919082181c8015612409576123f7816124bf565b60ff168203600884901b1793506124b6565b600083116124765760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b606482015260840161082c565b5060001990910160008181526020869052604090205490919080156124b15761249e816124bf565b60ff0360ff16600884901b1793506124b6565b612409565b50505092915050565b60006040518061012001604052806101008152602001612e0d610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff61250885612529565b02901c8151811061251b5761251b612cf3565b016020015160f81c92915050565b600080821161253757600080fd5b5060008190031690565b6001600160e01b03198116811461198957600080fd5b60006020828403121561256957600080fd5b813561257481612541565b9392505050565b60005b8381101561259657818101518382015260200161257e565b838111156117695750506000910152565b600081518084526125bf81602086016020860161257b565b601f01601f19169290920160200192915050565b60208152600061257460208301846125a7565b6000602082840312156125f857600080fd5b5035919050565b80356001600160a01b038116811461261657600080fd5b919050565b6000806040838503121561262e57600080fd5b612637836125ff565b946020939093013593505050565b803560ff8116811461261657600080fd5b60006020828403121561266857600080fd5b61257482612645565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156126af576126af612671565b604052919050565b60006001600160401b038311156126d0576126d0612671565b6126e3601f8401601f1916602001612687565b90508281528383830111156126f757600080fd5b828260208301376000602084830101529392505050565b6000806040838503121561272157600080fd5b8235915060208301356001600160401b0381111561273e57600080fd5b8301601f8101851361274f57600080fd5b61275e858235602084016126b7565b9150509250929050565b60008060006060848603121561277d57600080fd5b612786846125ff565b9250612794602085016125ff565b9150604084013590509250925092565b600080604083850312156127b757600080fd5b50508035926020909101359150565b600080600080608085870312156127dc57600080fd5b6127e585612645565b93506127f360208601612645565b93969395505050506040820135916060013590565b6000806000806080858703121561281e57600080fd5b6127e5856125ff565b80356001600160401b038116811461261657600080fd5b600080600080600080600060e0888a03121561285957600080fd5b8735965060208801359550604088013594506060880135935061287e60808901612827565b925061288c60a08901612827565b915060c0880135600281106128a057600080fd5b8091505092959891949750929550565b600080604083850312156128c357600080fd5b82356001600160401b03808211156128da57600080fd5b818501915085601f8301126128ee57600080fd5b813560208282111561290257612902612671565b8160051b9250612913818401612687565b828152928401810192818101908985111561292d57600080fd5b948201945b8486101561295257612943866125ff565b82529482019490820190612932565b9997909101359750505050505050565b60006020828403121561297457600080fd5b612574826125ff565b6000806040838503121561299057600080fd5b612999836125ff565b9150602083013580151581146129ae57600080fd5b809150509250929050565b600080600080608085870312156129cf57600080fd5b6129d8856125ff565b93506129e6602086016125ff565b92506040850135915060608501356001600160401b03811115612a0857600080fd5b8501601f81018713612a1957600080fd5b612a28878235602084016126b7565b91505092959194509250565b60008060408385031215612a4757600080fd5b612a50836125ff565b9150612a5e602084016125ff565b90509250929050565b634e487b7160e01b600052602160045260246000fd5b86815260208101869052604081018590526001600160401b0384811660608301528316608082015260c0810160028310612ac757634e487b7160e01b600052602160045260246000fd5b8260a0830152979650505050505050565b600181811c90821680612aec57607f821691505b602082108103612b0c57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561096357600081815260208120601f850160051c81016020861015612b395750805b601f850160051c820191505b818110156114fb57828155600101612b45565b81516001600160401b03811115612b7157612b71612671565b612b8581612b7f8454612ad8565b84612b12565b602080601f831160018114612bba5760008415612ba25750858301515b600019600386901b1c1916600185901b1785556114fb565b600085815260208120601f198616915b82811015612be957888601518255948401946001909101908401612bca565b5085821015612c075787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612c9b57612c9b612c6b565b500290565b600082612cbd57634e487b7160e01b600052601260045260246000fd5b500490565b600060018201612cd457612cd4612c6b565b5060010190565b60008219821115612cee57612cee612c6b565b500190565b634e487b7160e01b600052603260045260246000fd5b60008351612d1b81846020880161257b565b835190830190612d2f81836020880161257b565b01949350505050565b600060ff821660ff84168060ff03821115612d5557612d55612c6b565b019392505050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612de5908301846125a7565b9695505050505050565b600060208284031215612e0157600080fd5b81516125748161254156fe0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a26469706673582212204455334e956dd0fad647dbcfef598259541c7e8ce70c8c8c926e6668e3bea89764736f6c634300080f003300000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000002710000000000000000000000000c413df5737b95d07bc7d114e98184608d9c4bb080000000000000000000000008532a496336a52a6cd9e60a0d85e7402fa448b3e000000000000000000000000ce36a78ac4d2dee7cb8a41254d708397e33c319500000000000000000000000000000000000000000000000000000000000002ee000000000000000000000000000000000000000000000000000000000000002168747470733a2f2f6170692e726d77776f726c642e696f2f6d657461646174612f00000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x60806040526004361061020f5760003560e01c80636352211e116101185780638da5cb5b116100a0578063c87b56dd1161006f578063c87b56dd146105fe578063daea6db41461061e578063e985e9c51461063e578063ec69a4b714610687578063f2fde38b146106fc57600080fd5b80638da5cb5b1461058b57806395d89b41146105a9578063a22cb465146105be578063b88d4fde146105de57600080fd5b80636ecd2306116100e75780636ecd2306146105035780636f8aa0411461051657806370a0823114610536578063715018a61461055657806383592fe71461056b57600080fd5b80636352211e1461048157806363cd42e7146104a157806366177c64146104c15780636896ef4b146104d757600080fd5b80632f745c591161019b5780634e99b8001161016a5780634e99b800146103ec5780634f6ccce7146104015780635149e681146104215780635b7633d0146104415780635b8d02d71461046157600080fd5b80632f745c591461038357806330933e73146103a357806342842e0e146103b657806345c0f533146103d657600080fd5b80631243cebe116101e25780631243cebe146102c557806316140d7b146102e557806318160ddd1461030557806323b872dd146103245780632a55205a1461034457600080fd5b806301ffc9a71461021457806306fdde0314610249578063081812fc1461026b578063095ea7b3146102a3575b600080fd5b34801561022057600080fd5b5061023461022f366004612557565b61071c565b60405190151581526020015b60405180910390f35b34801561025557600080fd5b5061025e61072d565b60405161024091906125d3565b34801561027757600080fd5b5061028b6102863660046125e6565b6107bf565b6040516001600160a01b039091168152602001610240565b3480156102af57600080fd5b506102c36102be36600461261b565b610851565b005b3480156102d157600080fd5b506102c36102e0366004612656565b610968565b3480156102f157600080fd5b506102c361030036600461270e565b610986565b34801561031157600080fd5b506004545b604051908152602001610240565b34801561033057600080fd5b506102c361033f366004612768565b6109a6565b34801561035057600080fd5b5061036461035f3660046127a4565b6109d7565b604080516001600160a01b039093168352602083019190915201610240565b34801561038f57600080fd5b5061031661039e36600461261b565b610a83565b6102c36103b13660046127c6565b610b4d565b3480156103c257600080fd5b506102c36103d1366004612768565b610ebf565b3480156103e257600080fd5b50610316600b5481565b3480156103f857600080fd5b5061025e610eda565b34801561040d57600080fd5b5061031661041c3660046125e6565b610f68565b34801561042d57600080fd5b5061023461043c366004612808565b611022565b34801561044d57600080fd5b50600c5461028b906001600160a01b031681565b34801561046d57600080fd5b50600d5461028b906001600160a01b031681565b34801561048d57600080fd5b5061028b61049c3660046125e6565b611120565b3480156104ad57600080fd5b506102c36104bc36600461283e565b611134565b3480156104cd57600080fd5b5061031660105481565b3480156104e357600080fd5b506011546104f19060ff1681565b60405160ff9091168152602001610240565b6102c3610511366004612656565b6111e1565b34801561052257600080fd5b506102c36105313660046128b0565b611504565b34801561054257600080fd5b50610316610551366004612962565b61154d565b34801561056257600080fd5b506102c361161d565b34801561057757600080fd5b506103166105863660046125e6565b611631565b34801561059757600080fd5b506009546001600160a01b031661028b565b3480156105b557600080fd5b5061025e611664565b3480156105ca57600080fd5b506102c36105d936600461297d565b611673565b3480156105ea57600080fd5b506102c36105f93660046129b9565b611737565b34801561060a57600080fd5b5061025e6106193660046125e6565b61176f565b34801561062a57600080fd5b506104f16106393660046125e6565b6118b2565b34801561064a57600080fd5b50610234610659366004612a34565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b34801561069357600080fd5b506106ea6106a23660046125e6565b600f602052600090815260409020805460018201546002830154600390930154919290916001600160401b0380821691600160401b810490911690600160801b900460ff1686565b60405161024096959493929190612a7d565b34801561070857600080fd5b506102c3610717366004612962565b611913565b60006107278261198c565b92915050565b60606001805461073c90612ad8565b80601f016020809104026020016040519081016040528092919081815260200182805461076890612ad8565b80156107b55780601f1061078a576101008083540402835291602001916107b5565b820191906000526020600020905b81548152906001019060200180831161079857829003601f168201915b5050505050905090565b60006107cc826004541190565b6108355760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152600560205260409020546001600160a01b031690565b600061085c82611120565b9050806001600160a01b0316836001600160a01b0316036108cb5760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b606482015260840161082c565b336001600160a01b03821614806108e757506108e78133610659565b6109595760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c0000000000606482015260840161082c565b61096383836119b1565b505050565b610970611a1f565b6011805460ff191660ff92909216919091179055565b61098e611a1f565b6000828152600e602052604090206109638282612b58565b6109b03382611a79565b6109cc5760405162461bcd60e51b815260040161082c90612c17565b610963838383611b64565b60008281526008602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610a4c5750604080518082019091526007546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610a6b906001600160601b031687612c81565b610a759190612ca0565b915196919550909350505050565b60008060005b600454811015610af857610a9e816004541190565b8015610ac35750610aae81611120565b6001600160a01b0316856001600160a01b0316145b15610ae657838203610ad85791506107279050565b81610ae281612cc2565b9250505b80610af081612cc2565b915050610a89565b5060405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a206f776e657220696e646578206f7574206f6620626f604482015263756e647360e01b606482015260840161082c565b60008460ff16610b5b611d4d565b323314610b9b5760405162461bcd60e51b815260206004820152600e60248201526d2737b710343ab6b0b7103ab9b2b960911b604482015260640161082c565b60115460ff166000908152600f60205260409020826001811115610bc157610bc1612a67565b6003820154600160801b900460ff166001811115610be157610be1612a67565b14610c255760405162461bcd60e51b8152602060048201526014602482015273496e636f7272656374206d696e7420737461676560601b604482015260640161082c565b3360009081526004820160205260409020546003820154600160401b90046001600160401b0316610c568483612cdb565b1115610c995760405162461bcd60e51b8152602060048201526012602482015271115e18d95959081b5a5b9d08185b5bdd5b9d60721b604482015260640161082c565b600b5483610ca660045490565b610cb09190612cdb565b1115610cf45760405162461bcd60e51b815260206004820152601360248201527245786365656420746f74616c20737570706c7960681b604482015260640161082c565b60038201546001600160401b031683610d0c60045490565b610d169190612cdb565b1115610d595760405162461bcd60e51b8152602060048201526012602482015271115e18d95959081c9bdd5b99081b1a5b5a5d60721b604482015260640161082c565b828260020154610d699190612c81565b341015610dab5760405162461bcd60e51b815260206004820152601060248201526f0e0e4d2c6ca40dcdee840cadcdeeaced60831b604482015260640161082c565b81544210801590610dc0575081600101544211155b610e085760405162461bcd60e51b8152602060048201526019602482015278135a5b9d081cdd1859d9481a5cc81b9bdd081cdd185c9d1959603a1b604482015260640161082c565b610e1433888888611022565b610e545760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b604482015260640161082c565b601154610e679060ff808b169116611d7e565b610e74338960ff16611db6565b3415610eb557600d546040516001600160a01b03909116903480156108fc02916000818181858888f19350505050158015610eb3573d6000803e3d6000fd5b505b5050505050505050565b61096383838360405180602001604052806000815250611737565b600a8054610ee790612ad8565b80601f0160208091040260200160405190810160405280929190818152602001828054610f1390612ad8565b8015610f605780601f10610f3557610100808354040283529160200191610f60565b820191906000526020600020905b815481529060010190602001808311610f4357829003601f168201915b505050505081565b6000610f7360045490565b8210610fcf5760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a20676c6f62616c20696e646578206f7574206f6620626044820152646f756e647360d81b606482015260840161082c565b6000805b60045481101561101b57610fe8816004541190565b1561100957838203610ffb579392505050565b8161100581612cc2565b9250505b8061101381612cc2565b915050610fd3565b5050919050565b60408051606086901b6bffffffffffffffffffffffff1916602080830191909152825160148184030181526034830190935282519201919091207f19457468657265756d205369676e6564204d6573736167653a0a333200000000605483015260708201819052600091829060900160408051601f1981840301815282825280516020918201206000845290830180835281905260ff8916918301919091526060820187905260808201869052915060019060a0016020604051602081039080840390855afa1580156110f9573d6000803e3d6000fd5b5050604051601f190151600c546001600160a01b0391821691161498975050505050505050565b60008061112c83611dd4565b509392505050565b61113c611a1f565b601054871061115b576010805490600061115583612cc2565b91905055505b6000878152600f602052604090208681556001808201879055600282018690556003820180546001600160401b03868116600160401b026fffffffffffffffffffffffffffffffff199092169088161717808255849260ff60801b1990911690600160801b9084908111156111d2576111d2612a67565b02179055505050505050505050565b60018160ff166111ef611d4d565b32331461122f5760405162461bcd60e51b815260206004820152600e60248201526d2737b710343ab6b0b7103ab9b2b960911b604482015260640161082c565b60115460ff166000908152600f6020526040902082600181111561125557611255612a67565b6003820154600160801b900460ff16600181111561127557611275612a67565b146112b95760405162461bcd60e51b8152602060048201526014602482015273496e636f7272656374206d696e7420737461676560601b604482015260640161082c565b3360009081526004820160205260409020546003820154600160401b90046001600160401b03166112ea8483612cdb565b111561132d5760405162461bcd60e51b8152602060048201526012602482015271115e18d95959081b5a5b9d08185b5bdd5b9d60721b604482015260640161082c565b600b548361133a60045490565b6113449190612cdb565b11156113885760405162461bcd60e51b815260206004820152601360248201527245786365656420746f74616c20737570706c7960681b604482015260640161082c565b60038201546001600160401b0316836113a060045490565b6113aa9190612cdb565b11156113ed5760405162461bcd60e51b8152602060048201526012602482015271115e18d95959081c9bdd5b99081b1a5b5a5d60721b604482015260640161082c565b8282600201546113fd9190612c81565b34101561143f5760405162461bcd60e51b815260206004820152601060248201526f0e0e4d2c6ca40dcdee840cadcdeeaced60831b604482015260640161082c565b81544210801590611454575081600101544211155b61149c5760405162461bcd60e51b8152602060048201526019602482015278135a5b9d081cdd1859d9481a5cc81b9bdd081cdd185c9d1959603a1b604482015260640161082c565b6011546114af9060ff8088169116611d7e565b6114bc338660ff16611db6565b34156114fd57600d546040516001600160a01b03909116903480156108fc02916000818181858888f193505050501580156114fb573d6000803e3d6000fd5b505b5050505050565b61150c611a1f565b60005b82518110156109635761153b83828151811061152d5761152d612cf3565b602002602001015183611db6565b8061154581612cc2565b91505061150f565b60006001600160a01b0382166115bb5760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b606482015260840161082c565b6000805b600454811015611616576115d4816004541190565b15611606576115e281611120565b6001600160a01b0316846001600160a01b0316036116065761160382612cc2565b91505b61160f81612cc2565b90506115bf565b5092915050565b611625611a1f565b61162f6000611e6d565b565b60008061163d836118b2565b60ff166000908152600f602090815260408083203384526004019091529020549392505050565b60606002805461073c90612ad8565b336001600160a01b038316036116cb5760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c657200000000604482015260640161082c565b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6117413383611a79565b61175d5760405162461bcd60e51b815260040161082c90612c17565b61176984848484611ebf565b50505050565b606061177c826004541190565b6117c85760405162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e00604482015260640161082c565b60006117d2611ef4565b6000848152600e60205260408120805492935090916117f090612ad8565b80601f016020809104026020016040519081016040528092919081815260200182805461181c90612ad8565b80156118695780601f1061183e57610100808354040283529160200191611869565b820191906000526020600020905b81548152906001019060200180831161184c57829003601f168201915b5050505050905080516000036118a8578161188385611f03565b604051602001611894929190612d09565b6040516020818303038152906040526118aa565b805b949350505050565b60115460009060ff165b6118c7816001612d38565b60ff1660105411156107275760ff81166000908152600f602052604090206001015480808510611903576118fc600184612d38565b925061190c565b50909392505050565b50506118bc565b61191b611a1f565b6001600160a01b0381166119805760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161082c565b61198981611e6d565b50565b60006001600160e01b0319821663152a902d60e11b1480610727575061072782611f95565b600081815260056020526040902080546001600160a01b0319166001600160a01b03841690811790915581906119e682611120565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6009546001600160a01b0316331461162f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161082c565b6000611a86826004541190565b611aea5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161082c565b6000611af583611120565b9050806001600160a01b0316846001600160a01b03161480611b305750836001600160a01b0316611b25846107bf565b6001600160a01b0316145b806118aa57506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff166118aa565b600080611b7083611dd4565b91509150846001600160a01b0316826001600160a01b031614611bea5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b606482015260840161082c565b6001600160a01b038416611c505760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b606482015260840161082c565b611c5b6000846119b1565b6000611c68846001612cdb565b600881901c600090815260208190526040902054909150600160ff1b60ff83161c16158015611c98575060045481105b15611cce57600081815260036020526040812080546001600160a01b0319166001600160a01b038916179055611cce9082612000565b600084815260036020526040902080546001600160a01b0319166001600160a01b038716179055818414611d0757611d07600085612000565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46114fb565b6000611d58426118b2565b60115490915060ff808316911614611989576011805460ff831660ff1990911617905550565b6000818152600f60209081526040808320338452600481019092528220805491928592611dac908490612cdb565b9091555050505050565b611dd082826040518060200160405280600081525061202c565b5050565b600080611de2836004541190565b611e435760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161082c565b611e4c83612047565b6000818152600360205260409020546001600160a01b031694909350915050565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611eca848484611b64565b611ed8848484600185612053565b6117695760405162461bcd60e51b815260040161082c90612d5d565b6060600a805461073c90612ad8565b60606000611f108361218a565b60010190506000816001600160401b03811115611f2f57611f2f612671565b6040519080825280601f01601f191660200182016040528015611f59576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611f6357509392505050565b60006001600160e01b031982166380ac58cd60e01b1480611fc657506001600160e01b03198216635b5e139f60e01b145b80611fe157506001600160e01b0319821663780e9d6360e01b145b8061072757506301ffc9a760e01b6001600160e01b0319831614610727565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6004546120398484612262565b611ed8600085838686612053565b600061072781836123c7565b60006001600160a01b0385163b1561217d57506001835b6120748486612cdb565b81101561217757604051630a85bd0160e11b81526001600160a01b0387169063150b7a02906120ad9033908b9086908990600401612db2565b6020604051808303816000875af19250505080156120e8575060408051601f3d908101601f191682019092526120e591810190612def565b60015b612145573d808015612116576040519150601f19603f3d011682016040523d82523d6000602084013e61211b565b606091505b50805160000361213d5760405162461bcd60e51b815260040161082c90612d5d565b805181602001fd5b82801561216257506001600160e01b03198116630a85bd0160e11b145b9250508061216f81612cc2565b91505061206a565b50612181565b5060015b95945050505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106121c95772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106121f5576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061221357662386f26fc10000830492506010015b6305f5e100831061222b576305f5e100830492506008015b612710831061223f57612710830492506004015b60648310612251576064830492506002015b600a83106107275760010192915050565b600454816122c05760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b606482015260840161082c565b6001600160a01b0383166123225760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b606482015260840161082c565b81600460008282546123349190612cdb565b9091555050600081815260036020526040812080546001600160a01b0319166001600160a01b03861617905561236a9082612000565b805b6123768383612cdb565b8110156117695760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4806123bf81612cc2565b91505061236c565b600881901c60008181526020849052604081205490919060ff808516919082181c8015612409576123f7816124bf565b60ff168203600884901b1793506124b6565b600083116124765760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b606482015260840161082c565b5060001990910160008181526020869052604090205490919080156124b15761249e816124bf565b60ff0360ff16600884901b1793506124b6565b612409565b50505092915050565b60006040518061012001604052806101008152602001612e0d610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff61250885612529565b02901c8151811061251b5761251b612cf3565b016020015160f81c92915050565b600080821161253757600080fd5b5060008190031690565b6001600160e01b03198116811461198957600080fd5b60006020828403121561256957600080fd5b813561257481612541565b9392505050565b60005b8381101561259657818101518382015260200161257e565b838111156117695750506000910152565b600081518084526125bf81602086016020860161257b565b601f01601f19169290920160200192915050565b60208152600061257460208301846125a7565b6000602082840312156125f857600080fd5b5035919050565b80356001600160a01b038116811461261657600080fd5b919050565b6000806040838503121561262e57600080fd5b612637836125ff565b946020939093013593505050565b803560ff8116811461261657600080fd5b60006020828403121561266857600080fd5b61257482612645565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156126af576126af612671565b604052919050565b60006001600160401b038311156126d0576126d0612671565b6126e3601f8401601f1916602001612687565b90508281528383830111156126f757600080fd5b828260208301376000602084830101529392505050565b6000806040838503121561272157600080fd5b8235915060208301356001600160401b0381111561273e57600080fd5b8301601f8101851361274f57600080fd5b61275e858235602084016126b7565b9150509250929050565b60008060006060848603121561277d57600080fd5b612786846125ff565b9250612794602085016125ff565b9150604084013590509250925092565b600080604083850312156127b757600080fd5b50508035926020909101359150565b600080600080608085870312156127dc57600080fd5b6127e585612645565b93506127f360208601612645565b93969395505050506040820135916060013590565b6000806000806080858703121561281e57600080fd5b6127e5856125ff565b80356001600160401b038116811461261657600080fd5b600080600080600080600060e0888a03121561285957600080fd5b8735965060208801359550604088013594506060880135935061287e60808901612827565b925061288c60a08901612827565b915060c0880135600281106128a057600080fd5b8091505092959891949750929550565b600080604083850312156128c357600080fd5b82356001600160401b03808211156128da57600080fd5b818501915085601f8301126128ee57600080fd5b813560208282111561290257612902612671565b8160051b9250612913818401612687565b828152928401810192818101908985111561292d57600080fd5b948201945b8486101561295257612943866125ff565b82529482019490820190612932565b9997909101359750505050505050565b60006020828403121561297457600080fd5b612574826125ff565b6000806040838503121561299057600080fd5b612999836125ff565b9150602083013580151581146129ae57600080fd5b809150509250929050565b600080600080608085870312156129cf57600080fd5b6129d8856125ff565b93506129e6602086016125ff565b92506040850135915060608501356001600160401b03811115612a0857600080fd5b8501601f81018713612a1957600080fd5b612a28878235602084016126b7565b91505092959194509250565b60008060408385031215612a4757600080fd5b612a50836125ff565b9150612a5e602084016125ff565b90509250929050565b634e487b7160e01b600052602160045260246000fd5b86815260208101869052604081018590526001600160401b0384811660608301528316608082015260c0810160028310612ac757634e487b7160e01b600052602160045260246000fd5b8260a0830152979650505050505050565b600181811c90821680612aec57607f821691505b602082108103612b0c57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561096357600081815260208120601f850160051c81016020861015612b395750805b601f850160051c820191505b818110156114fb57828155600101612b45565b81516001600160401b03811115612b7157612b71612671565b612b8581612b7f8454612ad8565b84612b12565b602080601f831160018114612bba5760008415612ba25750858301515b600019600386901b1c1916600185901b1785556114fb565b600085815260208120601f198616915b82811015612be957888601518255948401946001909101908401612bca565b5085821015612c075787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612c9b57612c9b612c6b565b500290565b600082612cbd57634e487b7160e01b600052601260045260246000fd5b500490565b600060018201612cd457612cd4612c6b565b5060010190565b60008219821115612cee57612cee612c6b565b500190565b634e487b7160e01b600052603260045260246000fd5b60008351612d1b81846020880161257b565b835190830190612d2f81836020880161257b565b01949350505050565b600060ff821660ff84168060ff03821115612d5557612d55612c6b565b019392505050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612de5908301846125a7565b9695505050505050565b600060208284031215612e0157600080fd5b81516125748161254156fe0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a26469706673582212204455334e956dd0fad647dbcfef598259541c7e8ce70c8c8c926e6668e3bea89764736f6c634300080f0033

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

00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000002710000000000000000000000000c413df5737b95d07bc7d114e98184608d9c4bb080000000000000000000000008532a496336a52a6cd9e60a0d85e7402fa448b3e000000000000000000000000ce36a78ac4d2dee7cb8a41254d708397e33c319500000000000000000000000000000000000000000000000000000000000002ee000000000000000000000000000000000000000000000000000000000000002168747470733a2f2f6170692e726d77776f726c642e696f2f6d657461646174612f00000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _tokenBaseURI (string): https://api.rmwworld.io/metadata/
Arg [1] : _collectionSize (uint256): 10000
Arg [2] : _signerAddress (address): 0xc413df5737B95d07BC7d114E98184608d9C4bb08
Arg [3] : _payoutAddress (address): 0x8532a496336A52A6cD9e60A0D85E7402fA448B3e
Arg [4] : _feeAddress (address): 0xCE36A78ac4d2DEe7CB8a41254d708397E33C3195
Arg [5] : _feeNumerator (uint96): 750

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000002710
Arg [2] : 000000000000000000000000c413df5737b95d07bc7d114e98184608d9c4bb08
Arg [3] : 0000000000000000000000008532a496336a52a6cd9e60a0d85e7402fa448b3e
Arg [4] : 000000000000000000000000ce36a78ac4d2dee7cb8a41254d708397e33c3195
Arg [5] : 00000000000000000000000000000000000000000000000000000000000002ee
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000021
Arg [7] : 68747470733a2f2f6170692e726d77776f726c642e696f2f6d65746164617461
Arg [8] : 2f00000000000000000000000000000000000000000000000000000000000000


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.