ETH Price: $3,422.78 (+3.34%)

Token

DigiDaigakuMaskedVillains (DIDMV)
 

Overview

Max Total Supply

0 DIDMV

Holders

1,471

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Filtered by Token Holder
schaum.eth
Balance
1 DIDMV
0xfe7aC4a1CB0C61792e414Ea234a09014f7485e26
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

DigiDaigaku Masked Villains is a collection of unique characters developed by Limit Break.

# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
DigiDaigakuMaskedVillains

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 1500 runs

Other Settings:
default evmVersion
File 1 of 42 : DigiDaigakuMaskedVillains.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "limit-break-contracts/contracts/presets/BlacklistedTransferAdventureNFT.sol";
import "limit-break-contracts/contracts/utils/tokens/ClaimableHolderMint.sol";
import "limit-break-contracts/contracts/utils/tokens/MerkleWhitelistMint.sol";
import "limit-break-contracts/contracts/utils/tokens/SignedApprovalMint.sol";

contract DigiDaigakuMaskedVillains is BlacklistedTransferAdventureNFT, ClaimableHolderMint, MerkleWhitelistMint, SignedApprovalMint {

    constructor(address royaltyReceiver_, uint96 royaltyFeeNumerator_) ERC721("", "") EIP712("DigiDaigakuMaskedVillains", "1")  {
        initializeERC721("DigiDaigakuMaskedVillains", "DIDMV");
        initializeURI("https://digidaigaku.com/masked-villains/metadata/", ".json");
        initializeAdventureERC721(100);
        initializeRoyalties(royaltyReceiver_, royaltyFeeNumerator_);
        initializeOperatorFilterer(address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6), true);
    }

    function supportsInterface(bytes4 interfaceId) public view virtual override(AdventureNFT, IERC165) returns (bool) {
        return
        interfaceId == type(ISignedApprovalInitializer).interfaceId ||
        interfaceId == type(IRootCollectionInitializer).interfaceId ||
        interfaceId == type(IMerkleRootInitializer).interfaceId ||
        super.supportsInterface(interfaceId);
    }

    function _safeMintToken(address to, uint256 tokenId) internal virtual override(ClaimableHolderMint, MerkleWhitelistMint, SignedApprovalMint) {
        _safeMint(to, tokenId);
    }
}

File 2 of 42 : 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 3 of 42 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 4 of 42 : 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 5 of 42 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    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 ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: address zero is not a valid owner");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }

    /**
     * @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) {
        _requireMinted(tokenId);

        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 overridden 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 = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

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

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_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), "ERC721: caller is not token 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), "ERC721: caller is not token 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, data), "ERC721: 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`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

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

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId);
    }

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

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), 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 {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

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

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

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

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

    /**
     * @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 tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

File 6 of 42 : 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 7 of 42 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 8 of 42 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev 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) {
        require(isContract(target), "Address: delegate call to non-contract");

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

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

File 10 of 42 : 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 42 : draft-EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)

pragma solidity ^0.8.0;

import "./ECDSA.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;
    address private immutable _CACHED_THIS;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        bytes32 typeHash = keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
        _CACHED_CHAIN_ID = block.chainid;
        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
        _CACHED_THIS = address(this);
        _TYPE_HASH = typeHash;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
            return _CACHED_DOMAIN_SEPARATOR;
        } else {
            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
        }
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }
}

File 12 of 42 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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
    }

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", 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 13 of 42 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

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

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

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

    /**
     * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * _Available since v4.7._
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProof(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Calldata version of {multiProofVerify}
     *
     * _Available since v4.7._
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`,
     * consuming from one or the other at each step according to the instructions given by
     * `proofFlags`.
     *
     * _Available since v4.7._
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 totalHashes = proofFlags.length;

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

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

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

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

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

File 17 of 42 : AdventureERC721.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "./IAdventurous.sol";
import "./AdventureWhitelist.sol";
import "../initializable/IAdventureERC721Initializer.sol";
import "../utils/tokens/InitializableERC721.sol";

error AdventureApprovalToCaller();
error AlreadyInitializedAdventureERC721();
error AlreadyOnQuest();
error AnActiveQuestIsPreventingTransfers();
error CallerNotApprovedForAdventure();
error CallerNotTokenOwner();
error MaxSimultaneousQuestsCannotBeZero();
error MaxSimultaneousQuestsExceeded();
error NotOnQuest();
error QuestIdOutOfRange();
error TooManyActiveQuests();

/**
 * @title AdventureERC721
 * @author Limit Break, Inc.
 * @notice Implements the {IAdventurous} token standard for ERC721-compliant tokens.
 * Includes a user approval mechanism specific to {IAdventurous} functionality.
 * @dev Inherits {InitializableERC721} to provide the option to support EIP-1167.
 */
abstract contract AdventureERC721 is InitializableERC721, AdventureWhitelist, IAdventurous, IAdventureERC721Initializer {

    /// @notice Specifies an upper bound for the maximum number of simultaneous quests per adventure.
    uint256 private constant MAX_CONCURRENT_QUESTS = 100;

    /// @dev A value denoting a transfer originating from transferFrom or safeTransferFrom
    uint256 internal constant TRANSFERRING_VIA_ERC721 = 1;

    /// @dev A value denoting a transfer originating from adventureTransferFrom or adventureSafeTransferFrom
    uint256 internal constant TRANSFERRING_VIA_ADVENTURE = 2;

    /// @notice Specifies whether or not the contract is initialized
    bool private initializedAdventureERC721;

    /// @dev Specifies the type of transfer that is actively being used
    uint256 internal transferType;

    /// @dev The most simultaneous quests the token may participate in at a time
    uint256 private _maxSimultaneousQuests;

    /// @dev Maps each token id to the number of blocking quests it is currently entered into
    mapping (uint256 => uint256) internal blockingQuestCounts;

    /// @dev Mapping from owner to operator approvals for special gameplay behavior
    mapping (address => mapping (address => bool)) private operatorAdventureApprovals;

    /// @dev Maps each token id to a mapping that can enumerate all active quests within an adventure
    mapping (uint256 => mapping (address => uint32[])) public activeQuestList;

    /// @dev Maps each token id to a mapping from adventure address to a mapping of quest ids to quest details
    mapping (uint256 => mapping (address => mapping (uint32 => Quest))) public activeQuestLookup;

    /// @dev Initializes parameters of AdventureERC721 tokens.
    /// These cannot be set in the constructor because this contract is optionally compatible with EIP-1167.
    function initializeAdventureERC721(uint256 maxSimultaneousQuests_) public override onlyOwner {
        if(initializedAdventureERC721) {
            revert AlreadyInitializedAdventureERC721();
        }

        _validateMaxSimultaneousQuests(maxSimultaneousQuests_);
        _maxSimultaneousQuests = maxSimultaneousQuests_;

        initializedAdventureERC721 = true;
        transferType = TRANSFERRING_VIA_ERC721;
    }

    /// @dev ERC-165 interface support
    function supportsInterface(bytes4 interfaceId) public view virtual override (InitializableERC721, IERC165) returns (bool) {
        return 
        interfaceId == type(IAdventurous).interfaceId || 
        interfaceId == type(IAdventureERC721Initializer).interfaceId ||
        super.supportsInterface(interfaceId);
    }

    /// @notice Transfers a player's token if they have opted into an authorized, whitelisted adventure.
    function adventureTransferFrom(address from, address to, uint256 tokenId) external override {
        _requireCallerIsWhitelistedAdventure();
        _requireCallerApprovedForAdventure(tokenId);
        transferType = TRANSFERRING_VIA_ADVENTURE;
        _transfer(from, to, tokenId);
        transferType = TRANSFERRING_VIA_ERC721;
    }

    /// @notice Safe transfers a player's token if they have opted into an authorized, whitelisted adventure.
    function adventureSafeTransferFrom(address from, address to, uint256 tokenId) external override {
        _requireCallerIsWhitelistedAdventure();
        _requireCallerApprovedForAdventure(tokenId);
        transferType = TRANSFERRING_VIA_ADVENTURE;
        _safeTransfer(from, to, tokenId, "");
        transferType = TRANSFERRING_VIA_ERC721;
    }

    /// @notice Burns a player's token if they have opted into an authorized, whitelisted adventure.
    function adventureBurn(uint256 tokenId) external override {
        _requireCallerIsWhitelistedAdventure();
        _requireCallerApprovedForAdventure(tokenId);
        transferType = TRANSFERRING_VIA_ADVENTURE;
        _burn(tokenId);
        transferType = TRANSFERRING_VIA_ERC721;
    }

    /// @notice Enters a player's token into a quest if they have opted into an authorized, whitelisted adventure.
    function enterQuest(uint256 tokenId, uint256 questId) external override {
        _requireCallerIsWhitelistedAdventure();
        _requireCallerApprovedForAdventure(tokenId);
        _enterQuest(tokenId, _msgSender(), questId);
    }

    /// @notice Exits a player's token from a quest if they have opted into an authorized, whitelisted adventure.
    /// For developers of adventure contracts that perform adventure burns, be aware that the adventure must exitQuest
    /// before the adventure burn occurs, as _exitQuest emits the owner of the token, which would revert after burning.
    function exitQuest(uint256 tokenId, uint256 questId) external override {
        _requireCallerIsWhitelistedAdventure();
        _requireCallerApprovedForAdventure(tokenId);
        _exitQuest(tokenId, _msgSender(), questId);
    }

    /// @notice Admin-only ability to boot a token from all quests on an adventure.
    /// This ability is only unlocked in the event that an adventure has been unwhitelisted, as early exiting
    /// from quests can cause out of sync state between the ERC721 token contract and the adventure/quest.
    function bootFromAllQuests(uint256 tokenId, address adventure) external onlyOwner {
        _requireAdventureRemovedFromWhitelist(adventure);
        _exitAllQuests(tokenId, adventure, true);
    }

    /// @notice Gives the player the ability to exit a quest without interacting directly with the approved, whitelisted adventure
    /// This ability is only unlocked in the event that an adventure has been unwhitelisted, as early exiting
    /// from quests can cause out of sync state between the ERC721 token contract and the adventure/quest.
    function userExitQuest(uint256 tokenId, address adventure, uint256 questId) external {
        _requireAdventureRemovedFromWhitelist(adventure);
        _requireCallerOwnsToken(tokenId);
        _exitQuest(tokenId, adventure, questId);
    }

    /// @notice Gives the player the ability to exit all quests on an adventure without interacting directly with the approved, whitelisted adventure
    /// This ability is only unlocked in the event that an adventure has been unwhitelisted, as early exiting
    /// from quests can cause out of sync state between the ERC721 token contract and the adventure/quest.
    function userExitAllQuests(uint256 tokenId, address adventure) external {
        _requireAdventureRemovedFromWhitelist(adventure);
        _requireCallerOwnsToken(tokenId);
        _exitAllQuests(tokenId, adventure, false);
    }

    /// @notice Similar to {IERC721-setApprovalForAll}, but for special in-game adventures only
    function setAdventuresApprovedForAll(address operator, bool approved) external {
        address tokenOwner = _msgSender();

        if(tokenOwner == operator) {
            revert AdventureApprovalToCaller();
        }
        operatorAdventureApprovals[tokenOwner][operator] = approved;
        emit AdventureApprovalForAll(tokenOwner, operator, approved);
    }

    /// @notice Similar to {IERC721-isApprovedForAll}, but for special in-game adventures only
    function areAdventuresApprovedForAll(address owner, address operator) public view returns (bool) {
        return operatorAdventureApprovals[owner][operator];
    }    
    
    /// @notice Returns the number of quests a token is actively participating in for a specified adventure
    function getQuestCount(uint256 tokenId, address adventure) public override view returns (uint256) {
        return activeQuestList[tokenId][adventure].length;
    }

    /// @notice Returns the amount of time a token has been participating in the specified quest
    function getTimeOnQuest(uint256 tokenId, address adventure, uint256 questId) public override view returns (uint256) {
        (bool participatingInQuest, uint256 startTimestamp,) = isParticipatingInQuest(tokenId, adventure, questId);
        return participatingInQuest ? (block.timestamp - startTimestamp) : 0;
    } 

    /// @notice Returns whether or not a token is currently participating in the specified quest as well as the time it was started and the quest index
    function isParticipatingInQuest(uint256 tokenId, address adventure, uint256 questId) public override view returns (bool participatingInQuest, uint256 startTimestamp, uint256 index) {
        if(questId > type(uint32).max) {
            revert QuestIdOutOfRange();
        }

        Quest storage quest = activeQuestLookup[tokenId][adventure][uint32(questId)];
        participatingInQuest = quest.isActive;
        startTimestamp = quest.startTimestamp;
        index = quest.arrayIndex;
        return (participatingInQuest, startTimestamp, index);
    }

    /// @notice Returns a list of all active quests for the specified token id and adventure
    function getActiveQuests(uint256 tokenId, address adventure) public override view returns (Quest[] memory activeQuests) {
        uint256 questCount = getQuestCount(tokenId, adventure);
        activeQuests = new Quest[](questCount);
        uint32[] memory activeQuestIdList = activeQuestList[tokenId][adventure];

        for(uint256 i = 0; i < questCount; ++i) {
            activeQuests[i] = activeQuestLookup[tokenId][adventure][activeQuestIdList[i]];
        }

        return activeQuests;
    }

    /// @notice Returns the maximum number of simultaneous quests the token can be in per adventure.
    function maxSimultaneousQuests() public view returns (uint256) {
        return _maxSimultaneousQuests;
    }

    /// @dev Enters the specified quest for a token id.
    /// Throws if the token is already participating in the specified quest.
    /// Throws if the number of active quests exceeds the max allowable for the given adventure.
    /// Emits a QuestUpdated event for off-chain processing.
    function _enterQuest(uint256 tokenId, address adventure, uint256 questId) internal {
        (bool participatingInQuest,,) = isParticipatingInQuest(tokenId, adventure, questId);
        if(participatingInQuest) {
            revert AlreadyOnQuest();
        }

        uint256 currentQuestCount = getQuestCount(tokenId, adventure);
        if(currentQuestCount >= _maxSimultaneousQuests) {
            revert TooManyActiveQuests();
        }

        uint32 castedQuestId = uint32(questId);
        activeQuestList[tokenId][adventure].push(castedQuestId);
        activeQuestLookup[tokenId][adventure][castedQuestId].isActive = true;
        activeQuestLookup[tokenId][adventure][castedQuestId].startTimestamp = uint64(block.timestamp);
        activeQuestLookup[tokenId][adventure][castedQuestId].questId = castedQuestId;
        activeQuestLookup[tokenId][adventure][castedQuestId].arrayIndex = uint32(currentQuestCount);

        address ownerOfToken = ownerOf(tokenId);
        emit QuestUpdated(tokenId, ownerOfToken, adventure, questId, true, false);

        if(IAdventure(adventure).questsLockTokens()) {
            unchecked {
                ++blockingQuestCounts[tokenId];
            }
        }

        // Invoke callback to the adventure to facilitate state synchronization as needed
        IAdventure(adventure).onQuestEntered(ownerOfToken, tokenId, questId);
    }

    /// @dev Exits the specified quest for a token id.
    /// Throws if the token is not currently participating on the specified quest.
    /// Emits a QuestUpdated event for off-chain processing.
    function _exitQuest(uint256 tokenId, address adventure, uint256 questId) internal {
        (bool participatingInQuest, uint256 startTimestamp, uint256 index) = isParticipatingInQuest(tokenId, adventure, questId);
        if(!participatingInQuest) {
            revert NotOnQuest();
        }

        uint32 castedQuestId = uint32(questId);
        uint256 lastArrayIndex = getQuestCount(tokenId, adventure) - 1;
        if(index != lastArrayIndex) {
            activeQuestList[tokenId][adventure][index] = activeQuestList[tokenId][adventure][lastArrayIndex];
            activeQuestLookup[tokenId][adventure][activeQuestList[tokenId][adventure][lastArrayIndex]].arrayIndex = uint32(index);
        }

        activeQuestList[tokenId][adventure].pop();
        delete activeQuestLookup[tokenId][adventure][castedQuestId];

        address ownerOfToken = ownerOf(tokenId);
        emit QuestUpdated(tokenId, ownerOfToken, adventure, questId, false, false);

        if(IAdventure(adventure).questsLockTokens()) {
            --blockingQuestCounts[tokenId];
        }

        // Invoke callback to the adventure to facilitate state synchronization as needed
        IAdventure(adventure).onQuestExited(ownerOfToken, tokenId, questId, startTimestamp);
    }

    /// @dev Removes the specified token id from all quests on the specified adventure
    function _exitAllQuests(uint256 tokenId, address adventure, bool booted) internal {
        address tokenOwner = ownerOf(tokenId);
        uint256 questCount = getQuestCount(tokenId, adventure);

        if(IAdventure(adventure).questsLockTokens()) {
            blockingQuestCounts[tokenId] -= questCount;
        }

        for(uint256 i = 0; i < questCount;) {
            uint32 questId = activeQuestList[tokenId][adventure][i];

            Quest memory quest = activeQuestLookup[tokenId][adventure][questId];
            uint256 startTimestamp = quest.startTimestamp;

            emit QuestUpdated(tokenId, tokenOwner, adventure, questId, false, booted);
            delete activeQuestLookup[tokenId][adventure][questId];
            
            // Invoke callback to the adventure to facilitate state synchronization as needed
            IAdventure(adventure).onQuestExited(tokenOwner, tokenId, questId, startTimestamp);

            unchecked {
                ++i;
            }
        }

        delete activeQuestList[tokenId][adventure];
    }

    /// @dev By default, tokens that are participating in quests are transferrable.  However, if a token is participating
    /// in a quest on an adventure that was designated as a token locker, the transfer will revert and keep the token
    /// locked.
    function _beforeTokenTransfer(address /*from*/, address /*to*/, uint256 tokenId) internal virtual override {
        if(blockingQuestCounts[tokenId] > 0) {
            revert AnActiveQuestIsPreventingTransfers();
        }
    }

    /// @dev Validates that the caller is approved for adventure on the specified token id
    /// Throws when the caller has not been approved by the user.
    function _requireCallerApprovedForAdventure(uint256 tokenId) internal view {
        if(!areAdventuresApprovedForAll(ownerOf(tokenId), _msgSender())) {
            revert CallerNotApprovedForAdventure();
        }
    }

    /// @dev Validates that the caller owns the specified token
    /// Throws when the caller does not own the specified token.
    function _requireCallerOwnsToken(uint256 tokenId) internal view {
        if(ownerOf(tokenId) != _msgSender()) {
            revert CallerNotTokenOwner();
        }
    }

    /// @dev Validates that the specified value of max simultaneous quests is in range [1-MAX_CONCURRENT_QUESTS]
    /// Throws when `maxSimultaneousQuests_` is zero.
    /// Throws when `maxSimultaneousQuests_` is more than MAX_CONCURRENT_QUESTS.
    function _validateMaxSimultaneousQuests(uint256 maxSimultaneousQuests_) internal pure {
        if(maxSimultaneousQuests_ == 0) {
            revert MaxSimultaneousQuestsCannotBeZero();
        }

        if(maxSimultaneousQuests_ > MAX_CONCURRENT_QUESTS) {
            revert MaxSimultaneousQuestsExceeded();
        }
    }
}

File 18 of 42 : AdventureNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "./AdventureERC721.sol";
import "../initializable/IRoyaltiesInitializer.sol";
import "../initializable/IURIInitializer.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";

error AlreadyInitializedRoyalties();
error AlreadyInitializedURI();
error ExceedsMaxRoyaltyFee();
error NonexistentToken();

/**
 * @title AdventureNFT
 * @author Limit Break, Inc.
 * @notice Standardizes commonly shared boilerplate code that adds base/suffix URI and EIP-2981 royalties to {AdventureERC721} contracts.
 */
abstract contract AdventureNFT is AdventureERC721, ERC2981, IRoyaltiesInitializer, IURIInitializer {
    using Strings for uint256;

    /// @dev The maximum allowable royalty fee is 100%
    uint96 private constant MAX_ROYALTY_FEE_NUMERATOR = 10000;

    /// @notice Specifies whether or not the contract is initialized
    bool private initializedRoyalties;

    /// @notice Specifies whether or not the contract is initialized
    bool private initializedURI;

    /// @dev Base token uri
    string public baseTokenURI;

    /// @dev Token uri suffix/extension
    string public suffixURI = ".json";

    /// @dev Emitted when base URI is set.
    event BaseURISet(string baseTokenURI);

    /// @dev Emitted when suffix URI is set.
    event SuffixURISet(string suffixURI);

    /// @dev Emitted when royalty is set.
    event RoyaltySet(address receiver, uint96 feeNumerator);

    /// @dev Initializes parameters of tokens with royalties.
    /// These cannot be set in the constructor because this contract is optionally compatible with EIP-1167.
    function initializeRoyalties(address receiver, uint96 feeNumerator) public override onlyOwner {
        if(initializedRoyalties) {
            revert AlreadyInitializedRoyalties();
        }

        setRoyaltyInfo(receiver, feeNumerator);

        initializedRoyalties = true;
    }

    /// @dev Initializes parameters of tokens with uri values.
    /// These cannot be set in the constructor because this contract is optionally compatible with EIP-1167.
    function initializeURI(string memory baseURI_, string memory suffixURI_) public override onlyOwner {
        if(initializedURI) {
            revert AlreadyInitializedURI();
        }

        setBaseURI(baseURI_);
        setSuffixURI(suffixURI_);

        initializedURI = true;
    }

    /// @dev Required to return baseTokenURI for tokenURI
    function _baseURI() internal view virtual override returns (string memory) {
        return baseTokenURI;
    }

    /// @notice Sets base URI
    function setBaseURI(string memory baseTokenURI_) public onlyOwner {
        baseTokenURI = baseTokenURI_;

        emit BaseURISet(baseTokenURI_);
    }

    /// @notice Sets suffix URI
    function setSuffixURI(string memory suffixURI_) public onlyOwner {
        suffixURI = suffixURI_;

        emit SuffixURISet(suffixURI_);
    }

    /// @notice Sets royalty information
    function setRoyaltyInfo(address receiver, uint96 feeNumerator) public onlyOwner {
        if(feeNumerator > MAX_ROYALTY_FEE_NUMERATOR) {
            revert ExceedsMaxRoyaltyFee();
        }
        _setDefaultRoyalty(receiver, feeNumerator);

        emit RoyaltySet(receiver, feeNumerator);
    }

    /// @notice Returns tokenURI if baseURI is set
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        if(!_exists(tokenId)) {
            revert NonexistentToken();
        }

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

    function supportsInterface(bytes4 interfaceId) public view virtual override (AdventureERC721, ERC2981, IERC165) returns (bool) {
        return
        interfaceId == type(IRoyaltiesInitializer).interfaceId ||
        interfaceId == type(IURIInitializer).interfaceId ||
        super.supportsInterface(interfaceId);
    }
}

File 19 of 42 : AdventureWhitelist.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "./IAdventure.sol";
import "../utils/access/InitializableOwnable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

error AdventureIsStillWhitelisted();
error AlreadyWhitelisted();
error ArrayIndexOverflowsUint128();
error CallerNotAWhitelistedAdventure();
error InvalidAdventureContract();
error NotWhitelisted();

/**
 * @title AdventureWhitelist
 * @author Limit Break, Inc.
 * @notice Implements the basic security features of the {IAdventurous} token standard for ERC721-compliant tokens.
 * This includes a whitelist for trusted Adventure contracts designed to interoperate with this token.
 */
abstract contract AdventureWhitelist is InitializableOwnable {

    struct AdventureDetails {
        bool isWhitelisted;
        uint128 arrayIndex;
    }

    /// @dev Emitted when the adventure whitelist is updated
    event AdventureWhitelistUpdated(address indexed adventure, bool whitelisted);
    
    /// @dev Whitelist array for iteration
    address[] public whitelistedAdventureList;

    /// @dev Whitelist mapping
    mapping (address => AdventureDetails) public whitelistedAdventures;

    /// @notice Returns whether the specified account is a whitelisted adventure
    function isAdventureWhitelisted(address account) public view returns (bool) {
        return whitelistedAdventures[account].isWhitelisted;
    }

    /// @notice Whitelists an adventure and specifies whether or not the quests in that adventure lock token transfers
    /// Throws when the adventure is already in the whitelist.
    /// Throws when the specified address does not implement the IAdventure interface.
    ///
    /// Postconditions:
    /// The specified adventure contract is in the whitelist.
    /// An `AdventureWhitelistUpdate` event has been emitted.
    function whitelistAdventure(address adventure) external onlyOwner {
        if(isAdventureWhitelisted(adventure)) {
            revert AlreadyWhitelisted();
        }

        if(!IERC165(adventure).supportsInterface(type(IAdventure).interfaceId)) {
            revert InvalidAdventureContract();
        }

        uint256 arrayIndex = whitelistedAdventureList.length;
        if(arrayIndex > type(uint128).max) {
            revert ArrayIndexOverflowsUint128();
        }

        whitelistedAdventures[adventure].isWhitelisted = true;
        whitelistedAdventures[adventure].arrayIndex = uint128(arrayIndex);
        whitelistedAdventureList.push(adventure);

        emit AdventureWhitelistUpdated(adventure, true);
    }

    /// @notice Removes an adventure from the whitelist
    /// Throws when the adventure is not in the whitelist.
    ///
    /// Postconditions:
    /// The specified adventure contract is no longer in the whitelist.
    /// An `AdventureWhitelistUpdate` event has been emitted.
    function unwhitelistAdventure(address adventure) external onlyOwner {
        if(!isAdventureWhitelisted(adventure)) {
            revert NotWhitelisted();
        }
        
        uint128 itemPositionToDelete = whitelistedAdventures[adventure].arrayIndex;
        uint256 arrayEndIndex = whitelistedAdventureList.length - 1;
        if(itemPositionToDelete != arrayEndIndex) {
            whitelistedAdventureList[itemPositionToDelete] = whitelistedAdventureList[arrayEndIndex];
            whitelistedAdventures[whitelistedAdventureList[itemPositionToDelete]].arrayIndex = itemPositionToDelete;
        }

        whitelistedAdventureList.pop();
        delete whitelistedAdventures[adventure];

        emit AdventureWhitelistUpdated(adventure, false);
    }

    /// @dev Validates that the caller is a whitelisted adventure
    /// Throws when the caller is not in the adventure whitelist.
    function _requireCallerIsWhitelistedAdventure() internal view {
        if(!isAdventureWhitelisted(_msgSender())) {
            revert CallerNotAWhitelistedAdventure();
        }
    }

    /// @dev Validates that the specified adventure has been removed from the whitelist
    /// to prevent early backdoor exiting from adventures.
    /// Throws when specified adventure is still whitelisted.
    function _requireAdventureRemovedFromWhitelist(address adventure) internal view {
        if(isAdventureWhitelisted(adventure)) {
            revert AdventureIsStillWhitelisted();
        }
    }
}

File 20 of 42 : IAdventure.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @title IAdventure
 * @author Limit Break, Inc.
 * @notice The base interface that all `Adventure` contracts must conform to.
 * @dev All contracts that implement the adventure/quest system and interact with an {IAdventurous} token are required to implement this interface.
 */
interface IAdventure is IERC165 {

    /**
     * @dev Returns whether or not quests on this adventure lock tokens.
     * Developers of adventure contract should ensure that this is immutable 
     * after deployment of the adventure contract.  Failure to do so
     * can lead to error that deadlock token transfers.
     */
    function questsLockTokens() external view returns (bool);

    /**
     * @dev A callback function that AdventureERC721 must invoke when a quest has been successfully entered.
     * Throws if the caller is not an expected AdventureERC721 contract designed to work with the Adventure.
     * Not permitted to throw in any other case, as this could lead to tokens being locked in quests.
     */
    function onQuestEntered(address adventurer, uint256 tokenId, uint256 questId) external;

    /**
     * @dev A callback function that AdventureERC721 must invoke when a quest has been successfully exited.
     * Throws if the caller is not an expected AdventureERC721 contract designed to work with the Adventure.
     * Not permitted to throw in any other case, as this could lead to tokens being locked in quests.
     */
    function onQuestExited(address adventurer, uint256 tokenId, uint256 questId, uint256 questStartTimestamp) external;
}

File 21 of 42 : IAdventurous.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "./Quest.sol";
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @title IAdventurous
 * @author Limit Break, Inc.
 * @notice The base interface that all `Adventurous` token contracts must conform to in order to support adventures and quests.
 * @dev All contracts that support adventures and quests are required to implement this interface.
 */
interface IAdventurous is IERC165 {

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets, for special in-game adventures.
     */ 
    event AdventureApprovalForAll(address indexed tokenOwner, address indexed operator, bool approved);

    /**
     * @dev Emitted when a token enters or exits a quest
     */
    event QuestUpdated(uint256 indexed tokenId, address indexed tokenOwner, address indexed adventure, uint256 questId, bool active, bool booted);

    /**
     * @notice Transfers a player's token if they have opted into an authorized, whitelisted adventure.
     */
    function adventureTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @notice Safe transfers a player's token if they have opted into an authorized, whitelisted adventure.
     */
    function adventureSafeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @notice Burns a player's token if they have opted into an authorized, whitelisted adventure.
     */
    function adventureBurn(uint256 tokenId) external;

    /**
     * @notice Enters a player's token into a quest if they have opted into an authorized, whitelisted adventure.
     */
    function enterQuest(uint256 tokenId, uint256 questId) external;

    /**
     * @notice Exits a player's token from a quest if they have opted into an authorized, whitelisted adventure.
     */
    function exitQuest(uint256 tokenId, uint256 questId) external;

    /**
     * @notice Returns the number of quests a token is actively participating in for a specified adventure
     */
    function getQuestCount(uint256 tokenId, address adventure) external view returns (uint256);

    /**
     * @notice Returns the amount of time a token has been participating in the specified quest
     */
    function getTimeOnQuest(uint256 tokenId, address adventure, uint256 questId) external view returns (uint256);

    /**
     * @notice Returns whether or not a token is currently participating in the specified quest as well as the time it was started and the quest index
     */
    function isParticipatingInQuest(uint256 tokenId, address adventure, uint256 questId) external view returns (bool participatingInQuest, uint256 startTimestamp, uint256 index);

    /**
     * @notice Returns a list of all active quests for the specified token id and adventure
     */
    function getActiveQuests(uint256 tokenId, address adventure) external view returns (Quest[] memory activeQuests);
}

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

/**
 * @title Quest
 * @author Limit Break, Inc.
 * @notice Quest data structure for {IAdventurous} contracts.
 */
struct Quest {
    bool isActive;
    uint32 questId;
    uint64 startTimestamp;
    uint32 arrayIndex;
}

File 23 of 42 : IAdventureERC721Initializer.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @title IAdventureERC721Initializer
 * @author Limit Break, Inc.
 * @notice Allows cloneable contracts to include Adventure ERC721 functionality.
 * @dev See https://eips.ethereum.org/EIPS/eip-1167 for details.
 */
interface IAdventureERC721Initializer is IERC165 {

    /**
     * @notice Initializes parameters of {AdventureERC721} contracts
     */
    function initializeAdventureERC721(uint256 maxSimultaneousQuests_) external;
}

File 24 of 42 : IERC721Initializer.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

/**
 * @title IERC721Initializer
 * @author Limit Break, Inc.
 * @notice Allows cloneable contracts to include OpenZeppelin ERC721 functionality.
 * @dev See https://eips.ethereum.org/EIPS/eip-1167 for details.
 */
interface IERC721Initializer is IERC721 {

    /**
     * @notice Initializes parameters of {ERC721} contracts
     */
    function initializeERC721(string memory name_, string memory symbol_) external;
}

File 25 of 42 : IMerkleRootInitializer.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @title IMerkleRootInitializer
 * @author Limit Break, Inc.
 * @notice Allows cloneable contracts to include a merkle root.
 * @dev See https://eips.ethereum.org/EIPS/eip-1167 for details.
 */
interface IMerkleRootInitializer is IERC165 {

    /**
     * @notice Initializes root collection parameters
     */
    function initializeMerkleRoot(bytes32 merkleRoot_) external;
}

File 26 of 42 : IOperatorFiltererInitializer.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

/**
 * @title IOperatorFiltererInitializer
 * @author Limit Break, Inc.
 * @notice Allows cloneable contracts to include OpenSea's OperatorFilterer functionality.
 * @dev See https://eips.ethereum.org/EIPS/eip-1167 for details.
 */
interface IOperatorFiltererInitializer {

    /**
     * @notice Initializes parameters of OperatorFilterer contracts
     */
    function initializeOperatorFilterer(address subscriptionOrRegistrantToCopy, bool subscribe) external;
}

File 27 of 42 : IOwnableInitializer.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @title IOwnableInitializer
 * @author Limit Break, Inc.
 * @notice Allows cloneable contracts to include OpenZeppelin Ownable functionality.
 * @dev See https://eips.ethereum.org/EIPS/eip-1167 for details.
 */
interface IOwnableInitializer is IERC165 {

    /**
     * @notice Initializes the contract owner to the specified address
     */
    function initializeOwner(address owner_) external;

    /**
     * @notice Transfers ownership of the contract to the specified owner
     */
    function transferOwnership(address newOwner) external;
}

File 28 of 42 : IRootCollectionInitializer.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @title IRootCollectionInitializer
 * @author Limit Break, Inc.
 * @notice Allows cloneable contracts to be tied to a root ERC-721 collection.
 * @dev See https://eips.ethereum.org/EIPS/eip-1167 for details.
 */
interface IRootCollectionInitializer is IERC165 {

    /**
     * @notice Initializes root collection parameters
     */
    function initializeRootCollections(address[] memory rootCollection_, uint256[] memory rootCollectionMaxSupply_, uint256[] memory tokensPerClaim_) external;
}

File 29 of 42 : IRoyaltiesInitializer.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @title IRoyaltiesInitializer
 * @author Limit Break, Inc.
 * @notice Allows cloneable contracts to include OpenZeppelin ERC2981 functionality.
 * @dev See https://eips.ethereum.org/EIPS/eip-1167 for details.
 */
interface IRoyaltiesInitializer is IERC165 {

    /**
     * @notice Initializes royalty parameters
     */
    function initializeRoyalties(address receiver, uint96 feeNumerator) external;
}

File 30 of 42 : ISignedApprovalInitializer.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @title ISignedApprovalInitializer
 * @author Limit Break, Inc.
 * @notice Allows cloneable contracts to be assigned an approver to sign transactions allowing mints.
 * @dev See https://eips.ethereum.org/EIPS/eip-1167 for details.
 */
interface ISignedApprovalInitializer is IERC165 {

    /**
     * @notice Initializes approver.
     */
    function initializeSigner(address signer, uint256 maxQuantity) external;
}

File 31 of 42 : IURIInitializer.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @title IURIInitializer
 * @author Limit Break, Inc.
 * @notice Allows cloneable contracts to include a base uri and suffix uri.
 * @dev See https://eips.ethereum.org/EIPS/eip-1167 for details.
 */
interface IURIInitializer is IERC165 {

    /**
     * @notice Initializes uri parameters
     */
    function initializeURI(string memory baseURI_, string memory suffixURI_) external;
}

File 32 of 42 : InitializableDefaultOperatorFilterer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import {InitializableOperatorFilterer} from "./InitializableOperatorFilterer.sol";

/**
 * @title  InitializableDefaultOperatorFilterer
 * @notice Inherits from InitializableOperatorFilterer and automatically subscribes to the default OpenSea subscription during initialization.
 */
abstract contract InitializableDefaultOperatorFilterer is InitializableOperatorFilterer {
    
    /// @dev The default subscription address
    address internal constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);

    /// @dev The parameters are ignored, and the default subscription values are used instead.
    function initializeOperatorFilterer(address /*subscriptionOrRegistrantToCopy*/, bool /*subscribe*/) public virtual override {
        super.initializeOperatorFilterer(DEFAULT_SUBSCRIPTION, true);
    }
}

File 33 of 42 : InitializableOperatorFilterer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
import {IOperatorFiltererInitializer} from "../../initializable/IOperatorFiltererInitializer.sol";

/**
 * @title  InitializableOperatorFilterer
 * @notice Abstract contract whose initializer function automatically registers and optionally subscribes to or copies another
 *         registrant's entries in the OperatorFilterRegistry.
 * @dev    This smart contract is meant to be inherited by token contracts so they can use the following:
 *         - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.
 *         - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
 *         This is safe for use in EIP-1167 clones
 */
abstract contract InitializableOperatorFilterer is IOperatorFiltererInitializer {
    error OperatorNotAllowed(address operator);

    IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);

    modifier onlyAllowedOperator(address from) virtual {
        // Allow spending tokens from addresses with balance
        // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
        // from an EOA.
        if (from != msg.sender) {
            _checkFilterOperator(msg.sender);
        }
        _;
    }

    modifier onlyAllowedOperatorApproval(address operator) virtual {
        _checkFilterOperator(operator);
        _;
    }

    function initializeOperatorFilterer(address subscriptionOrRegistrantToCopy, bool subscribe) public virtual override {
        if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
            if (subscribe) {
                OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
            } else {
                if (subscriptionOrRegistrantToCopy != address(0)) {
                    OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
                } else {
                    OPERATOR_FILTER_REGISTRY.register(address(this));
                }
            }
        }
    }

    function _checkFilterOperator(address operator) internal view virtual {
        // Check registry code length to facilitate testing in environments without a deployed registry.
        if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
            if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) {
                revert OperatorNotAllowed(operator);
            }
        }
    }
}

File 34 of 42 : IOperatorFilterRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface IOperatorFilterRegistry {
    function isOperatorAllowed(address registrant, address operator) external view returns (bool);
    function register(address registrant) external;
    function registerAndSubscribe(address registrant, address subscription) external;
    function registerAndCopyEntries(address registrant, address registrantToCopy) external;
    function unregister(address addr) external;
    function updateOperator(address registrant, address operator, bool filtered) external;
    function updateOperators(address registrant, address[] calldata operators, bool filtered) external;
    function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
    function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;
    function subscribe(address registrant, address registrantToSubscribe) external;
    function unsubscribe(address registrant, bool copyExistingEntries) external;
    function subscriptionOf(address addr) external returns (address registrant);
    function subscribers(address registrant) external returns (address[] memory);
    function subscriberAt(address registrant, uint256 index) external returns (address);
    function copyEntriesOf(address registrant, address registrantToCopy) external;
    function isOperatorFiltered(address registrant, address operator) external returns (bool);
    function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);
    function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);
    function filteredOperators(address addr) external returns (address[] memory);
    function filteredCodeHashes(address addr) external returns (bytes32[] memory);
    function filteredOperatorAt(address registrant, uint256 index) external returns (address);
    function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);
    function isRegistered(address addr) external returns (bool);
    function codeHashOf(address addr) external returns (bytes32);
}

File 35 of 42 : BlacklistedTransferAdventureNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "../adventures/AdventureNFT.sol";
import "../opensea/operator-filter-registry/InitializableDefaultOperatorFilterer.sol";

/**
 * @title BlacklistedTransferAdventureNFT
 * @author Limit Break, Inc.
 * @notice Extends AdventureNFT, adding whitelisted transfer mechanisms.
 */
abstract contract BlacklistedTransferAdventureNFT is AdventureNFT, InitializableDefaultOperatorFilterer {

    function setApprovalForAll(address operator, bool approved) public virtual override onlyAllowedOperatorApproval(operator) {
        super.setApprovalForAll(operator, approved);
    }

    function approve(address operator, uint256 tokenId) public virtual override onlyAllowedOperatorApproval(operator) {
        super.approve(operator, tokenId);
    }

    function transferFrom(address from, address to, uint256 tokenId) public virtual override onlyAllowedOperator(from) {
        super.transferFrom(from, to, tokenId);
    }

    function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override onlyAllowedOperator(from) {
        super.safeTransferFrom(from, to, tokenId);
    }

    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override onlyAllowedOperator(from) {
        super.safeTransferFrom(from, to, tokenId, data);
    }
}

File 36 of 42 : InitializableOwnable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

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

error CallerIsNotTheContractOwner();
error NewOwnerIsTheZeroAddress();
error OwnerAlreadyInitialized();

/**
 * @title InitializableOwnable
 * @author Limit Break, Inc. and OpenZeppelin
 * @notice A tailored version of the {Ownable}  permissions component from OpenZeppelin that is compatible with EIP-1167.
 * @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.
 *
 * Based on OpenZeppelin contracts commit hash 3dac7bbed7b4c0dbf504180c33e8ed8e350b93eb.
 *
 * 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.
 *
 * This version adds an `initializeOwner` call for use with EIP-1167, 
 * as the constructor will not be called during an EIP-1167 operation.
 * Because initializeOwner should only be called once and requires that 
 * the owner is not assigned, the `renounceOwnership` function has been removed to avoid
 * a scenario where a contract could be left without an owner to perform admin protected functions.
 */
abstract contract InitializableOwnable is Context, IOwnableInitializer {
    address private _owner;

    /// @dev Emitted when contract ownership has been transferred.
    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 When EIP-1167 is used to clone a contract that inherits Ownable permissions,
     * this is required to assign the initial contract owner, as the constructor is
     * not called during the cloning process.
     */
    function initializeOwner(address owner_) public override {
      if(_owner != address(0)) {
          revert OwnerAlreadyInitialized();
      }

      _transferOwnership(owner_);
    }

    /**
     * @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 {
        if(owner() != _msgSender()) {
            revert CallerIsNotTheContractOwner();
        }
    }

    /**
     * @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 override onlyOwner {
        if(newOwner == address(0)) {
            revert NewOwnerIsTheZeroAddress();
        }

        _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 37 of 42 : ClaimableHolderMint.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "./SequentialMintBase.sol";
import "./ClaimPeriodBase.sol";
import "../access/InitializableOwnable.sol";
import "../../initializable/IRootCollectionInitializer.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";

error CallerDoesNotOwnRootTokenId();
error CollectionAddressIsNotAnERC721Token();
error InputArrayLengthMismatch();
error InvalidRootCollectionAddress();
error InvalidRootCollectionTokenId();
error MaxSupplyOfRootTokenCannotBeZero();
error MustSpecifyAtLeastOneRootCollection();
error RootCollectionsAlreadyInitialized();
error RootCollectionHasNotBeenInitialized();
error TokenIdAlreadyClaimed();
error TokensPerClaimMustBeBetweenOneAndTen();
error MaxNumberOfRootCollectionsExceeded();
error BatchSizeMustBeGreaterThanZero();
error BatchSizeGreaterThanMaximum();

/**
 * @title ClaimableHolderMint
 * @author Limit Break, Inc.
 * @notice A contract mix-in that may optionally be used with extend ERC-721 tokens with sequential role-based minting capabilities.
 * @dev Inheriting contracts must implement `_mintToken` and implement EIP-165 support as shown:
 *
 * function supportsInterface(bytes4 interfaceId) public view virtual override(AdventureNFT, IERC165) returns (bool) {
 *     return
 *     interfaceId == type(IRootCollectionInitializer).interfaceId ||
 *     super.supportsInterface(interfaceId);
 *  }
 *
 */
abstract contract ClaimableHolderMint is InitializableOwnable, ClaimPeriodBase, SequentialMintBase, ReentrancyGuard, IRootCollectionInitializer {

    struct ClaimableRootCollection {
        /// @dev Indicates whether or not this is a root collection
        bool isRootCollection;

        /// @dev This is the root ERC-721 contract from which claims can be made
        IERC721 rootCollection;

        /// @dev Max supply of the root collection
        uint256 maxSupply;

        /// @dev Number of tokens each user should get per token id claim
        uint256 tokensPerClaim;

        /// @dev Bitmap that helps determine if a token was ever claimed previously
        uint256[] claimedTokenTracker;
    }

    /// @dev The maximum amount of minted tokens from one batch submission.
    uint256 private constant MAX_MINTS_PER_TRANSACTION = 300;

    /// @dev The maximum amount of Root Collections permitted
    uint256 private constant MAX_ROOT_COLLECTIONS = 25;

    /// @dev True if root collections have been initialized, false otherwise.
    bool private initializedRootCollections;

    /// @dev Mapping from root collection address to claim details
    mapping (address => ClaimableRootCollection) private rootCollectionLookup;

    /// @dev Emitted when a holder claims a mint
    event ClaimMinted(address indexed rootCollection, uint256 indexed rootCollectionTokenId, uint256 startTokenId, uint256 endTokenId);

    /// @dev Initializes root collection parameters that determine how the claims will work.
    /// These cannot be set in the constructor because this contract is optionally compatible with EIP-1167.
    /// Params are memory to allow for initialization within constructors.
    /// The sum of all root collections max supplies cannot exceed 256,000 tokens.
    ///
    /// Throws when called by non-owner of contract.
    /// Throws when the root collection has already been initialized.
    /// Throws when the specified root collection is not an ERC721 token.
    /// Throws when the number of tokens per claim is not between 1 and 10.
    function initializeRootCollections(address[] memory rootCollections_, uint256[] memory rootCollectionMaxSupplies_, uint256[] memory tokensPerClaimArray_) public override onlyOwner {
        if(initializedRootCollections) {
            revert RootCollectionsAlreadyInitialized();
        }

        uint256 rootCollectionsArrayLength = rootCollections_.length;

        _requireInputArrayLengthsMatch(rootCollectionsArrayLength, rootCollectionMaxSupplies_.length);
        _requireInputArrayLengthsMatch(rootCollectionsArrayLength, tokensPerClaimArray_.length);

        if(rootCollectionsArrayLength == 0) {
            revert MustSpecifyAtLeastOneRootCollection();
        }
        if(rootCollectionsArrayLength > MAX_ROOT_COLLECTIONS) {
            revert MaxNumberOfRootCollectionsExceeded();
        }

        for(uint256 i = 0; i < rootCollectionsArrayLength;) {
            address rootCollection_ = rootCollections_[i];
            uint256 rootCollectionMaxSupply_ = rootCollectionMaxSupplies_[i];
            uint256 tokensPerClaim_ = tokensPerClaimArray_[i];
            if(!IERC165(rootCollection_).supportsInterface(type(IERC721).interfaceId)) {
                revert CollectionAddressIsNotAnERC721Token();
            }

            if(tokensPerClaim_ == 0 || tokensPerClaim_ > 10) {
                revert TokensPerClaimMustBeBetweenOneAndTen();
            }

            if(rootCollectionMaxSupply_ == 0) {
                revert MaxSupplyOfRootTokenCannotBeZero();
            }

            rootCollectionLookup[rootCollection_].isRootCollection = true;
            rootCollectionLookup[rootCollection_].rootCollection = IERC721(rootCollection_);
            rootCollectionLookup[rootCollection_].maxSupply = rootCollectionMaxSupply_;
            rootCollectionLookup[rootCollection_].tokensPerClaim = tokensPerClaim_;

            unchecked {
                // Initialize memory to use for tracking token ids that have been minted
                // The bit corresponding to token id defaults to 1 when unminted,
                // and will be set to 0 upon mint.
                uint256 numberOfTokenTrackerSlots = _getNumberOfTokenTrackerSlots(rootCollectionMaxSupply_);
                for(uint256 j = 0; j < numberOfTokenTrackerSlots; ++j) {
                    rootCollectionLookup[rootCollection_].claimedTokenTracker.push(type(uint256).max);
                }

                ++i;
            }
        }

        _initializeNextTokenIdCounter();
        initializedRootCollections = true;
    }

    /// @notice Allows a user to claim/mint one or more tokens pegged to their ownership of a list of specified token ids
    ///
    /// Throws when an empty array of root collection token ids is provided.
    /// Throws when the amount of claimed tokens exceeds the max claimable amount.
    /// Throws when the claim period has not opened.
    /// Throws when the claim period has closed.
    /// Throws when the caller does not own the specified token id from the root collection.
    /// Throws when the root token id has already been claimed.
    /// Throws if safe mint receiver is not an EOA or a contract that can receive tokens.
    /// Postconditions:
    /// ---------------
    /// The root collection and token ID combinations are marked as claimed in the root collection's claimed token tracker.
    /// `quantity` tokens are minted to the msg.sender, where `quantity` is the amount of tokens per claim * length of the rootCollectionTokenIds array.
    /// `quantity` ClaimMinted events have been emitted, where `quantity` is the amount of tokens per claim * length of the rootCollectionTokenIds array.
    function claimBatch(address rootCollectionAddress, uint256[] calldata rootCollectionTokenIds) external nonReentrant {
        _requireClaimsOpen();

        if(!initializedRootCollections) {
            revert RootCollectionHasNotBeenInitialized();
        }

        if (rootCollectionTokenIds.length == 0) {
            revert BatchSizeMustBeGreaterThanZero();
        }

        ClaimableRootCollection storage rootCollectionDetails = _getRootCollectionDetailsSafe(rootCollectionAddress);

        uint256 maxBatchSize = MAX_MINTS_PER_TRANSACTION / rootCollectionDetails.tokensPerClaim;

        if (rootCollectionTokenIds.length > maxBatchSize) {
            revert BatchSizeGreaterThanMaximum();
        }

        for(uint256 i = 0; i < rootCollectionTokenIds.length;) {
            _claim(rootCollectionDetails, rootCollectionTokenIds[i]);
            unchecked {
                ++i;
            }
        }
    }

    /// @dev Processes a claim for a Root Collection + Root Collection Token ID Combination
    ///
    /// Throws when the caller does not own the specified token id from the root collection.
    /// Throws when the root token id has already been claimed.
    /// Throws if safe mint receiver is not an EOA or a contract that can receive tokens.
    /// Postconditions:
    /// ---------------
    /// The root collection and tokenID combination are marked as claimed in the root collection's claimed token tracker.
    /// `quantity` tokens are minted to the msg.sender, where `quantity` is the amount of tokens per claim.
    /// The nextTokenId counter is advanced by the `quantity` of tokens minted.
    /// `quantity` ClaimMinted events have been emitted, where `quantity` is the amount of tokens per claim.
    function _claim(ClaimableRootCollection storage rootCollectionDetails, uint256 rootCollectionTokenId) internal {
        if(rootCollectionDetails.rootCollection.ownerOf(rootCollectionTokenId) != _msgSender()) {
            revert CallerDoesNotOwnRootTokenId();
        }

        (bool claimed, uint256 slot, uint256 offset, uint256 slotValue) = _isClaimed(rootCollectionDetails, rootCollectionTokenId);
        if(claimed) {
            revert TokenIdAlreadyClaimed();
        }

        uint256 claimedTokenId = getNextTokenId();
        uint256 tokensPerClaim_ = rootCollectionDetails.tokensPerClaim;
        emit ClaimMinted(address(rootCollectionDetails.rootCollection), rootCollectionTokenId, claimedTokenId, claimedTokenId + tokensPerClaim_ - 1);

        rootCollectionDetails.claimedTokenTracker[slot] = slotValue & ~(uint256(1) << offset);

        unchecked {
            _advanceNextTokenIdCounter(tokensPerClaim_);

            for(uint256 i = 0; i < tokensPerClaim_; ++i) {
                _safeMintToken(_msgSender(), claimedTokenId + i);
            }
        }
    }

    /// @notice Returns true if the specified token id has been claimed
    function isClaimed(address rootCollectionAddress, uint256 tokenId) public view returns (bool) {
        ClaimableRootCollection storage rootCollectionDetails = _getRootCollectionDetailsSafe(rootCollectionAddress);
        
        if(tokenId > rootCollectionDetails.maxSupply) {
            revert InvalidRootCollectionTokenId();
        }

        (bool claimed,,,) = _isClaimed(rootCollectionDetails, tokenId);
        return claimed;
    }

    /// @dev Returns whether or not the specified token id has been claimed/minted as well as the bitmap slot/offset/slot value of the token id
    function _isClaimed(ClaimableRootCollection storage rootCollectionDetails, uint256 tokenId) internal view returns (bool claimed, uint256 slot, uint256 offset, uint256 slotValue) {
        unchecked {
            slot = tokenId / 256;
            offset = tokenId % 256;
            slotValue = rootCollectionDetails.claimedTokenTracker[slot];
            claimed = ((slotValue >> offset) & uint256(1)) == 0;
        }
        
        return (claimed, slot, offset, slotValue);
    }

    /// @dev Determines number of slots required to track minted tokens across the max supply
    function _getNumberOfTokenTrackerSlots(uint256 maxSupply_) internal pure returns (uint256 tokenTrackerSlotsRequired) {
        unchecked {
            // Add 1 because we are starting valid token id range at 1 instead of 0
            uint256 maxSupplyPlusOne = 1 + maxSupply_;
            tokenTrackerSlotsRequired = maxSupplyPlusOne / 256;
            if(maxSupplyPlusOne % 256 > 0) {
                ++tokenTrackerSlotsRequired;
            }
        }

        return tokenTrackerSlotsRequired;
    }

    /// @dev Validates that the length of two input arrays matched.
    /// Throws if the array lengths are mismatched.
    function _requireInputArrayLengthsMatch(uint256 inputArray1Length, uint256 inputArray2Length) internal pure {
        if(inputArray1Length != inputArray2Length) {
            revert InputArrayLengthMismatch();
        }
    }

    /// @dev Inheriting contracts must implement the token minting logic - inheriting contract should use safe mint, or something equivalent
    /// The minting function should throw if `to` is address(0) or `to` is a contract that does not implement IERC721Receiver.
    function _safeMintToken(address to, uint256 tokenId) internal virtual;

    /// @dev Safely gets a storage pointer to the details of a root collection.  Performs validation and throws if the value is not present in the mapping, preventing
    /// the possibility of overwriting an unexpected storage slot.
    ///
    /// Throws when the specified root collection address has not been explicitly set as a key in the mapping.
    function _getRootCollectionDetailsSafe(address rootCollectionAddress) private view returns (ClaimableRootCollection storage) {
        ClaimableRootCollection storage rootCollectionDetails = rootCollectionLookup[rootCollectionAddress];

        if(!rootCollectionDetails.isRootCollection) {
            revert InvalidRootCollectionAddress();
        }

        return rootCollectionDetails;
    }
}

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

import "../access/InitializableOwnable.sol";


error ClaimsMustBeClosedToReopen();
error ClaimPeriodAlreadyInitialized();
error ClaimPeriodIsNotOpen();
error ClaimPeriodMustBeClosedInTheFuture();
error ClaimPeriodMustBeInitialized();

/**
 * @title ClaimPeriodController
 * @author Limit Break, Inc.
 * @notice In order to support multiple contracts with enforced claim periods, the claim period has been moved to this base contract.
 *
 */
abstract contract ClaimPeriodBase is InitializableOwnable {

    /// @dev True if claims have been initalized, false otherwise.
    bool private claimPeriodInitialized;

    /// @dev The timestamp when the claim period closes - when this value is zero and claims are open, the claim period is open indefinitely
    uint256 private claimPeriodClosingTimestamp;

    /// @dev Emitted when a claim period is scheduled to be closed.
    event ClaimPeriodClosing(uint256 claimPeriodClosingTimestamp);

    /// @dev Emitted when a claim period is scheduled to be opened.
    event ClaimPeriodOpened(uint256 claimPeriodClosingTimestamp);

    /// @dev Opens the claim period.  Claims can be closed with a custom amount of warning time using the closeClaims function.
    /// Accepts a claimPeriodClosingTimestamp_ timestamp which will open the period ending at that time (in seconds)
    /// NOTE: Use as high a window as possible to prevent gas wars for claiming
    /// For an unbounded claim window, pass in type(uint256).max
    function openClaims(uint256 claimPeriodClosingTimestamp_) external onlyOwner {
        if(claimPeriodClosingTimestamp_ <= block.timestamp) {
            revert ClaimPeriodMustBeClosedInTheFuture();
        }

        if(claimPeriodInitialized) {
            if(block.timestamp < claimPeriodClosingTimestamp) {
                revert ClaimsMustBeClosedToReopen();
            }
        } else {
            claimPeriodInitialized = true;
        }

        claimPeriodClosingTimestamp = claimPeriodClosingTimestamp_;

        emit ClaimPeriodOpened(claimPeriodClosingTimestamp_);
    }

    /// @dev Closes claims at a specified timestamp.
    ///
    /// Throws when the specified timestamp is not in the future.
    function closeClaims(uint256 claimPeriodClosingTimestamp_) external onlyOwner {
        _requireClaimsOpen();

        if(claimPeriodClosingTimestamp_ <= block.timestamp) {
            revert ClaimPeriodMustBeClosedInTheFuture();
        }

        claimPeriodClosingTimestamp = claimPeriodClosingTimestamp_;
        
        emit ClaimPeriodClosing(claimPeriodClosingTimestamp_);
    }

    /// @dev Returns the Claim Period Timestamp
    function getClaimPeriodClosingTimestamp() external view returns (uint256) {
        return claimPeriodClosingTimestamp;
    }

    /// @notice Returns true if the claim period has been opened, false otherwise
    function isClaimPeriodOpen() external view returns (bool) {
        return _isClaimPeriodOpen();
    }

    /// @dev Returns true if claim period is open, false otherwise.
    function _isClaimPeriodOpen() internal view returns (bool) {
        return claimPeriodInitialized && block.timestamp < claimPeriodClosingTimestamp;
    }

    /// @dev Validates that the claim period is open.
    /// Throws if claims are not open.
    function _requireClaimsOpen() internal view {
        if(!_isClaimPeriodOpen()) {
            revert ClaimPeriodIsNotOpen();
        }
    }

}

File 39 of 42 : InitializableERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "../access/InitializableOwnable.sol";
import "../../initializable/IERC721Initializer.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

error AlreadyInitializedERC721();

/**
 * @title InitializableERC721
 * @author Limit Break, Inc.
 * @notice Wraps OpenZeppelin ERC721 implementation and makes it compatible with EIP-1167.
 * @dev Because OpenZeppelin's `_name` and `_symbol` storage variables are private and inaccessible, 
 * this contract defines two new storage variables `_contractName` and `_contractSymbol` and returns them
 * from the `name()` and `symbol()` functions instead.
 */
abstract contract InitializableERC721 is InitializableOwnable, ERC721, IERC721Initializer {

    /// @notice Specifies whether or not the contract is initialized
    bool private initializedERC721;

    // Token name
    string internal _contractName;

    // Token symbol
    string internal _contractSymbol;

    /// @dev Initializes parameters of ERC721 tokens.
    /// These cannot be set in the constructor because this contract is optionally compatible with EIP-1167.
    function initializeERC721(string memory name_, string memory symbol_) public override onlyOwner {
        if(initializedERC721) {
            revert AlreadyInitializedERC721();
        }

        _contractName = name_;
        _contractSymbol = symbol_;

        initializedERC721 = true;
    }

    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721Initializer).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    function name() public view virtual override returns (string memory) {
        return _contractName;
    }

    function symbol() public view virtual override returns (string memory) {
        return _contractSymbol;
    }
}

File 40 of 42 : MerkleWhitelistMint.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "./SequentialMintBase.sol";
import "./ClaimPeriodBase.sol";
import "../access/InitializableOwnable.sol";
import "../../initializable/IMerkleRootInitializer.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";

error AddressHasAlreadyClaimed();
error InvalidProof();
error MerkleRootAlreadyInitialized();
error MerkleRootHasNotBeenInitialized();
error MerkleRootCannotBeZero();
error MintedQuantityMustBeGreaterThanZero();

/**
 * @title MerkleWhitelistMint
 * @author Limit Break, Inc.
 * @notice A contract mix-in that may optionally be used with extend ERC-721 tokens with merkle-proof based whitelist minting capabilities.
 * @dev Inheriting contracts must implement `_safeMintToken` and implement EIP-165 support as shown:
 *
 * function supportsInterface(bytes4 interfaceId) public view virtual override(AdventureNFT, IERC165) returns (bool) {
 *     return
 *     interfaceId == type(IMerkleRootInitializer).interfaceId ||
 *     super.supportsInterface(interfaceId);
 *  }
 *
 */
abstract contract MerkleWhitelistMint is InitializableOwnable, ClaimPeriodBase, SequentialMintBase, ReentrancyGuard, IMerkleRootInitializer {

    /// @dev This is the root ERC-721 contract from which claims can be made
    bytes32 private merkleRoot;

    /// @dev Mapping that tracks whether or not an address has claimed their whitelist mint
    mapping (address => bool) private whitelistClaimed;

    /// @dev Initializes the merkle root containing the whitelist.
    /// These cannot be set in the constructor because this contract is optionally compatible with EIP-1167.
    ///
    /// Throws when called by non-owner of contract.
    /// Throws when the merkle root has already been initialized.
    /// Throws when the specified merkle root is zero.
    function initializeMerkleRoot(bytes32 merkleRoot_) public override onlyOwner {
        if(merkleRoot != bytes32(0)) {
            revert MerkleRootAlreadyInitialized();
        }

        if(merkleRoot_ == bytes32(0)) {
            revert MerkleRootCannotBeZero();
        }

        merkleRoot = merkleRoot_;
        _initializeNextTokenIdCounter();
    }

    /// @notice Mints the specified quantity to the calling address if the submitted merkle proof successfully verifies the reserved quantity for the caller in the whitelist.
    ///
    /// Throws when the claim period has not opened.
    /// Throws when the claim period has closed.
    /// Throws if a merkle root has not been set.
    /// Throws if the caller has already successfully claimed.
    /// Throws if the submitted merkle proof does not successfully verify the reserved quantity for the caller.
    function whitelistMint(uint256 quantity, bytes32[] calldata merkleProof_) external nonReentrant {
        _requireClaimsOpen();

        bytes32 merkleRootCache = merkleRoot;

        if(merkleRootCache == bytes32(0)) {
            revert MerkleRootHasNotBeenInitialized();
        }

        if(whitelistClaimed[_msgSender()]) {
            revert AddressHasAlreadyClaimed();
        }

        if(!MerkleProof.verify(merkleProof_, merkleRootCache, keccak256(abi.encodePacked(_msgSender(), quantity)))) {
            revert InvalidProof();
        }

        whitelistClaimed[_msgSender()] = true;
        _mintBatch(_msgSender(), quantity);
    }

    /// @notice Returns the merkle root
    function getMerkleRoot() external view returns (bytes32) {
        return merkleRoot;
    }

    /// @notice Returns true if the account already claimed their whitelist mint, false otherwise
    function isWhitelistClaimed(address account) external view returns (bool) {
        return whitelistClaimed[account];
    }

    /// @dev Batch mints the specified quantity to the specified address.
    /// Throws if quantity is zero.
    /// Throws if `to` is a smart contract that does not implement IERC721 receiver.
    function _mintBatch(address to, uint256 quantity) private {

        if(quantity == 0) {
            revert MintedQuantityMustBeGreaterThanZero();
        }

        uint256 tokenIdToMint = getNextTokenId();
        unchecked {
            _advanceNextTokenIdCounter(quantity);

            for(uint256 i = 0; i < quantity; ++i) {
                _safeMintToken(to, tokenIdToMint + i);
            }
        }
    }

    /// @dev Inheriting contracts must implement the token minting logic - inheriting contract should use safe mint, or something equivalent
    /// The minting function should throw if `to` is address(0) or `to` is a contract that does not implement IERC721Receiver.
    function _safeMintToken(address to, uint256 tokenId) internal virtual;
}

File 41 of 42 : SequentialMintBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "../access/InitializableOwnable.sol";
import "../../initializable/IRootCollectionInitializer.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";

/**
 * @title SequentialMintBase
 * @author Limit Break, Inc.
 * @dev In order to support multiple sequential mint mix-ins in a single contract, the token id counter has been moved to this based contract.
 */
abstract contract SequentialMintBase {

    /// @dev The next token id that will be minted - if zero, the next minted token id will be 1
    uint256 private nextTokenIdCounter;

    /// @dev Minting mixins must use this function to advance the next token id counter.
    function _initializeNextTokenIdCounter() internal {
        if(nextTokenIdCounter == 0) {
            nextTokenIdCounter = 1;
        }
    }

    /// @dev Minting mixins must use this function to advance the next token id counter.
    function _advanceNextTokenIdCounter(uint256 amount) internal {
        nextTokenIdCounter += amount;
    }

    /// @dev Returns the next token id counter value
    function getNextTokenId() public view returns (uint256) {
        return nextTokenIdCounter;
    }
}

File 42 of 42 : SignedApprovalMint.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "./SequentialMintBase.sol";
import "../access/InitializableOwnable.sol";
import "../../initializable/ISignedApprovalInitializer.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

error AddressAlreadyMinted();
error InvalidSignature();
error MaxQuantityMustBeGreaterThanZero();
error MintExceedsMaximumAmountBySignedApproval();
error SignedClaimsAreDecommissioned();
error SignerAlreadyInitialized();
error SignerCannotBeInitializedAsAddressZero();
error SignerIsAddressZero();


/**
* @title SignedApprovalMint
* @author Limit Break, Inc.
* @notice A contract mix-in that may optionally be used with extend ERC-721 tokens with Signed Approval minting capabilities, allowing an approved signer to issue a limited amount of mints.
* @dev Inheriting contracts must implement `_mintToken` and implement EIP-165 support as shown:
*
* function supportsInterface(bytes4 interfaceId) public view virtual override(AdventureNFT, IERC165) returns (bool) {
*     return
*     interfaceId == type(ISignedApproverInitializer).interfaceId ||
*     super.supportsInterface(interfaceId);
*  }
*
*/
abstract contract SignedApprovalMint is InitializableOwnable, SequentialMintBase, ReentrancyGuard, EIP712, ISignedApprovalInitializer {

    /// @dev Returns true if signed claims have been decommissioned, false otherwise.
    bool private _signedClaimsDecommissioned;

    /// @dev The address of the signer for approved mints.
    address private _approvalSigner;

    /// @dev The maximum amount of mints done by the approval signer
    /// NOTE: This is an aggregate of all signers, updating signer will not reset or modify this amount.
    uint256 private _maxQuantityMintable;

    /// @dev The amount minted by all signers.
    /// NOTE: This is an aggregate of all signers, updating signer will not reset or modify this amount.
    uint256 private _mintedAmount;

    /// @dev Mapping of addresses who have already minted 
    mapping(address => bool) private addressMinted;

    /// @dev Emitted when signatures are decommissioned
    event SignedClaimsDecommissioned();

    /// @dev Emitted when a signer is updated
    event SignerUpdated(address oldSigner, address newSigner); 

    /// @notice Allows a user to claim/mint one or more tokens as approved by the approved signer
    ///
    /// Throws when a signature is invalid.
    /// Throws when the quantity provided does not match the quantity on the signature provided.
    /// Throws when the address has already claimed a token.
    /// Throws if safe mint receiver is not an EOA or a contract that can receive tokens.
    function claimSignedMint(bytes calldata signature, uint256 quantity) external nonReentrant {
        if (addressMinted[_msgSender()]) {
            revert AddressAlreadyMinted();
        }

        if (_approvalSigner == address(0)) { 
            revert SignerIsAddressZero();
        }

        _requireSignedClaimsActive();

        uint256 newTotal = _mintedAmount + quantity;
        if (newTotal > _maxQuantityMintable) {
            revert MintExceedsMaximumAmountBySignedApproval();
        }

        _mintedAmount = newTotal;

        bytes32 hash = _hashTypedDataV4(
            keccak256(
                abi.encode(
                    keccak256("Approved(address wallet,uint256 quantity)"),
                    _msgSender(),
                    quantity
                )
            )
        );

        if (_approvalSigner != ECDSA.recover(hash, signature)) {
            revert InvalidSignature();
        }

        addressMinted[_msgSender()] = true;

        uint256 tokenIdToMint = getNextTokenId();
        unchecked {
            _advanceNextTokenIdCounter(quantity);

            for(uint256 i = 0; i < quantity; ++i) {
                _safeMintToken(_msgSender(), tokenIdToMint + i);
            }
        }
    }

    /// @notice Decommissions signed approvals
    /// This is a permanent decommissioning, once this is set, no further signatures can be claimed
    ///
    /// Throws if caller is not owner
    /// Throws if already decommissioned
    function decommissionSignedApprovals() external onlyOwner {
        _requireSignedClaimsActive();
        _signedClaimsDecommissioned = true;
        emit SignedClaimsDecommissioned();
    }

    /// @dev Initializes the signer address for signed approvals
    /// This cannot be set in the constructor because this contract is optionally compatible with EIP-1167.
    ///
    /// Throws when called by non-owner of contract.
    /// Throws when the signer has already been initialized.
    /// Throws when the provided signer is address(0).
    /// Throws when maxQuantity = 0
    function initializeSigner(address signer, uint256 maxQuantity) public override onlyOwner {
        if(_approvalSigner != address(0)) {
            revert SignerAlreadyInitialized();
        }
        if(signer == address(0)) {
            revert SignerCannotBeInitializedAsAddressZero();
        }
        if(maxQuantity == 0) {
            revert MaxQuantityMustBeGreaterThanZero();
        }
        _initializeNextTokenIdCounter();
        _approvalSigner = signer;
        _maxQuantityMintable = maxQuantity;
    }

    /// @dev Allows signer to update the signer address
    /// This allows the signer to set new signer to address(0) to prevent future allowed mints
    /// NOTE: Setting signer to address(0) is irreversible - approvals will be disabled permanently and all outstanding signatures will be invalid.
    ///
    /// Throws when caller is not owner
    /// Throws when current signer is address(0)
    function setSigner(address newSigner) public onlyOwner {
        if(_signedClaimsDecommissioned) {
            revert SignedClaimsAreDecommissioned();
        }

        emit SignerUpdated(_approvalSigner, newSigner);
        _approvalSigner = newSigner;
    }

    /// @notice Returns true if the provided account has already minted, false otherwise
    function hasMintedBySignedApproval(address account) public view returns (bool) {
        return addressMinted[account];
    }

    /// @notice Returns the address of the approved signer
    function approvalSigner() public view returns (address) {
        return _approvalSigner;
    }

    /// @notice Returns the maximum amount mintable by approved signers
    function maxQuantityMintable() public view returns (uint256) {
        return _maxQuantityMintable;
    }

    /// @notice Returns the current amount minted by approved signers
    function mintedAmount() public view returns (uint256) {
        return _mintedAmount;
    }

    /// @notice Returns true if signed claims have been decommissioned, false otherwise
    function signedClaimsDecommissioned() public view returns (bool) {
        return _signedClaimsDecommissioned;
    }

    /// @dev Internal function used to revert if signed claims are decommissioned.
    function _requireSignedClaimsActive() internal view {
        if(_signedClaimsDecommissioned) {
            revert SignedClaimsAreDecommissioned();
        }
    }

    /// @dev Inheriting contracts must implement the token minting logic - inheriting contract should use safe mint, or something equivalent
    /// The minting function should throw if `to` is address(0) or `to` is a contract that does not implement IERC721Receiver.
    function _safeMintToken(address to, uint256 tokenId) internal virtual;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"royaltyReceiver_","type":"address"},{"internalType":"uint96","name":"royaltyFeeNumerator_","type":"uint96"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressAlreadyMinted","type":"error"},{"inputs":[],"name":"AddressHasAlreadyClaimed","type":"error"},{"inputs":[],"name":"AdventureApprovalToCaller","type":"error"},{"inputs":[],"name":"AdventureIsStillWhitelisted","type":"error"},{"inputs":[],"name":"AlreadyInitializedAdventureERC721","type":"error"},{"inputs":[],"name":"AlreadyInitializedERC721","type":"error"},{"inputs":[],"name":"AlreadyInitializedRoyalties","type":"error"},{"inputs":[],"name":"AlreadyInitializedURI","type":"error"},{"inputs":[],"name":"AlreadyOnQuest","type":"error"},{"inputs":[],"name":"AlreadyWhitelisted","type":"error"},{"inputs":[],"name":"AnActiveQuestIsPreventingTransfers","type":"error"},{"inputs":[],"name":"ArrayIndexOverflowsUint128","type":"error"},{"inputs":[],"name":"BatchSizeGreaterThanMaximum","type":"error"},{"inputs":[],"name":"BatchSizeMustBeGreaterThanZero","type":"error"},{"inputs":[],"name":"CallerDoesNotOwnRootTokenId","type":"error"},{"inputs":[],"name":"CallerIsNotTheContractOwner","type":"error"},{"inputs":[],"name":"CallerNotAWhitelistedAdventure","type":"error"},{"inputs":[],"name":"CallerNotApprovedForAdventure","type":"error"},{"inputs":[],"name":"CallerNotTokenOwner","type":"error"},{"inputs":[],"name":"ClaimPeriodIsNotOpen","type":"error"},{"inputs":[],"name":"ClaimPeriodMustBeClosedInTheFuture","type":"error"},{"inputs":[],"name":"ClaimsMustBeClosedToReopen","type":"error"},{"inputs":[],"name":"CollectionAddressIsNotAnERC721Token","type":"error"},{"inputs":[],"name":"ExceedsMaxRoyaltyFee","type":"error"},{"inputs":[],"name":"InputArrayLengthMismatch","type":"error"},{"inputs":[],"name":"InvalidAdventureContract","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[],"name":"InvalidRootCollectionAddress","type":"error"},{"inputs":[],"name":"InvalidRootCollectionTokenId","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"MaxNumberOfRootCollectionsExceeded","type":"error"},{"inputs":[],"name":"MaxQuantityMustBeGreaterThanZero","type":"error"},{"inputs":[],"name":"MaxSimultaneousQuestsCannotBeZero","type":"error"},{"inputs":[],"name":"MaxSimultaneousQuestsExceeded","type":"error"},{"inputs":[],"name":"MaxSupplyOfRootTokenCannotBeZero","type":"error"},{"inputs":[],"name":"MerkleRootAlreadyInitialized","type":"error"},{"inputs":[],"name":"MerkleRootCannotBeZero","type":"error"},{"inputs":[],"name":"MerkleRootHasNotBeenInitialized","type":"error"},{"inputs":[],"name":"MintExceedsMaximumAmountBySignedApproval","type":"error"},{"inputs":[],"name":"MintedQuantityMustBeGreaterThanZero","type":"error"},{"inputs":[],"name":"MustSpecifyAtLeastOneRootCollection","type":"error"},{"inputs":[],"name":"NewOwnerIsTheZeroAddress","type":"error"},{"inputs":[],"name":"NonexistentToken","type":"error"},{"inputs":[],"name":"NotOnQuest","type":"error"},{"inputs":[],"name":"NotWhitelisted","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OwnerAlreadyInitialized","type":"error"},{"inputs":[],"name":"QuestIdOutOfRange","type":"error"},{"inputs":[],"name":"RootCollectionHasNotBeenInitialized","type":"error"},{"inputs":[],"name":"RootCollectionsAlreadyInitialized","type":"error"},{"inputs":[],"name":"SignedClaimsAreDecommissioned","type":"error"},{"inputs":[],"name":"SignerAlreadyInitialized","type":"error"},{"inputs":[],"name":"SignerCannotBeInitializedAsAddressZero","type":"error"},{"inputs":[],"name":"SignerIsAddressZero","type":"error"},{"inputs":[],"name":"TokenIdAlreadyClaimed","type":"error"},{"inputs":[],"name":"TokensPerClaimMustBeBetweenOneAndTen","type":"error"},{"inputs":[],"name":"TooManyActiveQuests","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenOwner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"AdventureApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"adventure","type":"address"},{"indexed":false,"internalType":"bool","name":"whitelisted","type":"bool"}],"name":"AdventureWhitelistUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"baseTokenURI","type":"string"}],"name":"BaseURISet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"rootCollection","type":"address"},{"indexed":true,"internalType":"uint256","name":"rootCollectionTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTokenId","type":"uint256"}],"name":"ClaimMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"claimPeriodClosingTimestamp","type":"uint256"}],"name":"ClaimPeriodClosing","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"claimPeriodClosingTimestamp","type":"uint256"}],"name":"ClaimPeriodOpened","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":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"tokenOwner","type":"address"},{"indexed":true,"internalType":"address","name":"adventure","type":"address"},{"indexed":false,"internalType":"uint256","name":"questId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"active","type":"bool"},{"indexed":false,"internalType":"bool","name":"booted","type":"bool"}],"name":"QuestUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"RoyaltySet","type":"event"},{"anonymous":false,"inputs":[],"name":"SignedClaimsDecommissioned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldSigner","type":"address"},{"indexed":false,"internalType":"address","name":"newSigner","type":"address"}],"name":"SignerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"suffixURI","type":"string"}],"name":"SuffixURISet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"OPERATOR_FILTER_REGISTRY","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"activeQuestList","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint32","name":"","type":"uint32"}],"name":"activeQuestLookup","outputs":[{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"uint32","name":"questId","type":"uint32"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"uint32","name":"arrayIndex","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"adventureBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"adventureSafeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"adventureTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"approvalSigner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"areAdventuresApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"adventure","type":"address"}],"name":"bootFromAllQuests","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"rootCollectionAddress","type":"address"},{"internalType":"uint256[]","name":"rootCollectionTokenIds","type":"uint256[]"}],"name":"claimBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"claimSignedMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"claimPeriodClosingTimestamp_","type":"uint256"}],"name":"closeClaims","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decommissionSignedApprovals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"questId","type":"uint256"}],"name":"enterQuest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"questId","type":"uint256"}],"name":"exitQuest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"adventure","type":"address"}],"name":"getActiveQuests","outputs":[{"components":[{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"uint32","name":"questId","type":"uint32"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"uint32","name":"arrayIndex","type":"uint32"}],"internalType":"struct Quest[]","name":"activeQuests","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getClaimPeriodClosingTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNextTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"adventure","type":"address"}],"name":"getQuestCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"adventure","type":"address"},{"internalType":"uint256","name":"questId","type":"uint256"}],"name":"getTimeOnQuest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"hasMintedBySignedApproval","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxSimultaneousQuests_","type":"uint256"}],"name":"initializeAdventureERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"}],"name":"initializeERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"merkleRoot_","type":"bytes32"}],"name":"initializeMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bool","name":"","type":"bool"}],"name":"initializeOperatorFilterer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"}],"name":"initializeOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"rootCollections_","type":"address[]"},{"internalType":"uint256[]","name":"rootCollectionMaxSupplies_","type":"uint256[]"},{"internalType":"uint256[]","name":"tokensPerClaimArray_","type":"uint256[]"}],"name":"initializeRootCollections","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"initializeRoyalties","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint256","name":"maxQuantity","type":"uint256"}],"name":"initializeSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"},{"internalType":"string","name":"suffixURI_","type":"string"}],"name":"initializeURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isAdventureWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isClaimPeriodOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"rootCollectionAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"adventure","type":"address"},{"internalType":"uint256","name":"questId","type":"uint256"}],"name":"isParticipatingInQuest","outputs":[{"internalType":"bool","name":"participatingInQuest","type":"bool"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isWhitelistClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxQuantityMintable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSimultaneousQuests","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"claimPeriodClosingTimestamp_","type":"uint256"}],"name":"openClaims","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_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":"setAdventuresApprovedForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseTokenURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setRoyaltyInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSigner","type":"address"}],"name":"setSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"suffixURI_","type":"string"}],"name":"setSuffixURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signedClaimsDecommissioned","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"suffixURI","outputs":[{"internalType":"string","name":"","type":"string"}],"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":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"adventure","type":"address"}],"name":"unwhitelistAdventure","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"adventure","type":"address"}],"name":"userExitAllQuests","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"adventure","type":"address"},{"internalType":"uint256","name":"questId","type":"uint256"}],"name":"userExitQuest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"adventure","type":"address"}],"name":"whitelistAdventure","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof_","type":"bytes32[]"}],"name":"whitelistMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"whitelistedAdventureList","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedAdventures","outputs":[{"internalType":"bool","name":"isWhitelisted","type":"bool"},{"internalType":"uint128","name":"arrayIndex","type":"uint128"}],"stateMutability":"view","type":"function"}]

610180604052600561014081905264173539b7b760d91b6101609081526200002b91601791906200083c565b503480156200003957600080fd5b50604051620068b6380380620068b68339810160408190526200005c91620008e2565b6040518060400160405280601981526020017f4469676944616967616b754d61736b656456696c6c61696e7300000000000000815250604051806040016040528060018152602001603160f81b8152506040518060200160405280600081525060405180602001604052806000815250620000e6620000e06200028760201b60201c565b6200028b565b8151620000fb9060019060208501906200083c565b508051620001119060029060208401906200083c565b50506001601b5550815160208084019190912082518383012060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81880181905281830187905260608201869052608082019490945230818401528151808203909301835260c00190528051940193909320919290916080523060c052610120525050604080518082018252601981527f4469676944616967616b754d61736b656456696c6c61696e7300000000000000602080830191909152825180840190935260058352642224a226ab60d91b908301526200020693509150620002db565b620002466040518060600160405280603181526020016200688560319139604080518082019091526005815264173539b7b760d91b602082015262000347565b620002526064620003a4565b6200025e8282620003f6565b6200027f733cc6cdda760b79bafa08df41ecfa224f810dceb6600162000442565b5050620009cc565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620002e562000472565b60075460ff16156200030a576040516376f1a0b360e01b815260040160405180910390fd5b81516200031f9060089060208501906200083c565b508051620003359060099060208401906200083c565b50506007805460ff1916600117905550565b6200035162000472565b601554610100900460ff16156200037b57604051635b79f68360e01b815260040160405180910390fd5b6200038682620004a0565b6200039181620004fc565b50506015805461ff001916610100179055565b620003ae62000472565b600c5460ff1615620003d357604051630e009cb560e11b815260040160405180910390fd5b620003de816200054d565b600e55600c805460ff19166001908117909155600d55565b6200040062000472565b60155460ff16156200042557604051639383013960e01b815260040160405180910390fd5b62000431828262000592565b50506015805460ff19166001179055565b6200046e733cc6cdda760b79bafa08df41ecfa224f810dceb660016200062360201b62002b921760201c565b5050565b6000546001600160a01b031633146200049e5760405163097b5fdb60e31b815260040160405180910390fd5b565b620004aa62000472565b8051620004bf9060169060208401906200083c565b507ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f681604051620004f1919062000937565b60405180910390a150565b6200050662000472565b80516200051b9060179060208401906200083c565b507f65ccd57f8a46e7a6cfc4d214d84094e8ba5561ab50fd328f26e4c44052ffeba081604051620004f1919062000937565b806200056c5760405163318ccdef60e11b815260040160405180910390fd5b60648111156200058f57604051639cb75faf60e01b815260040160405180910390fd5b50565b6200059c62000472565b6127106001600160601b0382161115620005c957604051631557c04f60e21b815260040160405180910390fd5b620005d5828262000737565b604080516001600160a01b03841681526001600160601b03831660208201527f23813f5ad446622633cb58c75ceef768a2111751b0f30477a63e06fcaedcff60910160405180910390a15050565b6daaeb6d7670e522a718067333cd4e3b156200046e578015620006b457604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b1580156200069757600080fd5b505af1158015620006ac573d6000803e3d6000fd5b505050505050565b6001600160a01b03821615620007055760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af2903906044016200067c565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e486906024016200067c565b6127106001600160601b0382161115620007ab5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084015b60405180910390fd5b6001600160a01b038216620008035760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401620007a2565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601355565b8280546200084a906200098f565b90600052602060002090601f0160209004810192826200086e5760008555620008b9565b82601f106200088957805160ff1916838001178555620008b9565b82800160010185558215620008b9579182015b82811115620008b95782518255916020019190600101906200089c565b50620008c7929150620008cb565b5090565b5b80821115620008c75760008155600101620008cc565b60008060408385031215620008f657600080fd5b82516001600160a01b03811681146200090e57600080fd5b60208401519092506001600160601b03811681146200092c57600080fd5b809150509250929050565b600060208083528351808285015260005b81811015620009665785810183015185820160400152820162000948565b8181111562000979576000604083870101525b50601f01601f1916929092016040019392505050565b600181811c90821680620009a457607f821691505b60208210811415620009c657634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e0516101005161012051615e6962000a1c6000396000614be601526000614c3501526000614c1001526000614b6901526000614b9301526000614bbd0152615e696000f3fe608060405234801561001057600080fd5b506004361061048d5760003560e01c80637e10b35b1161026b578063b3bcea4811610150578063d96effe9116100c8578063ec8f70c411610097578063f1e923c51161007c578063f1e923c514610b59578063f2fde38b14610b6c578063f3d73e9514610b7f57600080fd5b8063ec8f70c414610b3e578063ee0471e414610b5157600080fd5b8063d96effe914610ac9578063e2989f4c14610adc578063e370ab4614610aef578063e985e9c514610b0257600080fd5b8063c87b56dd1161011f578063d147c97a11610104578063d147c97a14610a9b578063d2cab05614610aae578063d547cfb714610ac157600080fd5b8063c87b56dd14610a80578063caa0f92a14610a9357600080fd5b8063b3bcea4814610a3f578063b88d4fde14610a47578063c05e2f4414610a5a578063c4b125a014610a6d57600080fd5b806395d89b41116101e35780639bc17ea4116101b2578063aa6cab5a11610197578063aa6cab5a146109b5578063aca139f714610a19578063b39fa00014610a2c57600080fd5b80639bc17ea41461098f578063a22cb465146109a257600080fd5b806395d89b411461095957806395fa0ff514610961578063970f9fc8146109745780639967fb651461097c57600080fd5b8063869f91101161023a5780638c5f36bb1161021f5780638c5f36bb146108ff5780638da5cb5b14610912578063916237181461092357600080fd5b8063869f9110146108e45780638be18e57146108ec57600080fd5b80637e10b35b146108565780637f1a5ce114610869578063816a1501146108a55780638521b8e3146108b857600080fd5b8063301be74011610391578063562beba811610309578063703fa929116102d857806372be0d8b116102bd57806372be0d8b1461081d578063772bcfb9146108305780637c04c80a1461084357600080fd5b8063703fa929146107da57806370a082311461080a57600080fd5b8063562beba8146107965780636352211e146107a95780636c19e783146107bc5780636c934620146107cf57600080fd5b80634e02c0781161036057806351dadc281161034557806351dadc281461074857806353401df91461077057806355f804b31461078357600080fd5b80634e02c078146107095780634f3502531461071c57600080fd5b8063301be740146106ad57806341f43434146106d957806342842e0e146106ee578063495906571461070157600080fd5b806311ad408111610424578063247946c9116103f35780632a55205a116103d85780632a55205a146106565780632d380242146106885780632ebb386a1461069a57600080fd5b8063247946c91461063b57806324933ba61461064e57600080fd5b806311ad4081146105ec57806318b1b60e146105ff578063225848cf1461061557806323b872dd1461062857600080fd5b8063081812fc11610460578063081812fc146104f7578063095ea7b3146105225780630f3d911c14610535578063113405571461055557600080fd5b806301ffc9a71461049257806302fa7c47146104ba57806306fdde03146104cf578063070cba17146104e4575b600080fd5b6104a56104a03660046153f0565b610b87565b60405190151581526020015b60405180910390f35b6104cd6104c8366004615422565b610c33565b005b6104d7610ce2565b6040516104b191906154c4565b6104cd6104f23660046154d7565b610d74565b61050a6105053660046154f4565b610fd8565b6040516001600160a01b0390911681526020016104b1565b6104cd61053036600461550d565b610fff565b610548610543366004615539565b611018565b6040516104b1919061555e565b6105b56105633660046155ca565b601260209081526000938452604080852082529284528284209052825290205460ff81169063ffffffff610100820481169167ffffffffffffffff6501000000000082041691600160681b9091041684565b60408051941515855263ffffffff938416602086015267ffffffffffffffff909216918401919091521660608201526080016104b1565b6104cd6105fa366004615615565b611232565b60205461010090046001600160a01b031661050a565b6104cd610623366004615645565b611252565b6104cd610636366004615673565b611271565b6104cd610649366004615773565b61129c565b6104a561130b565b610669610664366004615615565b61131a565b604080516001600160a01b0390931683526020830191909152016104b1565b6022545b6040519081526020016104b1565b6104cd6106a8366004615539565b6113d7565b6104a56106bb3660046154d7565b6001600160a01b03166000908152600b602052604090205460ff1690565b61050a6daaeb6d7670e522a718067333cd4e81565b6104cd6106fc366004615673565b6113f5565b601e5461068c565b6104cd6107173660046157d7565b61141a565b6104a561072a3660046154d7565b6001600160a01b031660009081526023602052604090205460ff1690565b61075b6107563660046157d7565b611437565b60405163ffffffff90911681526020016104b1565b6104cd61077e366004615615565b61148d565b6104cd6107913660046157fe565b6114a9565b6104a56107a436600461550d565b6114ff565b61050a6107b73660046154f4565b611564565b6104cd6107ca3660046154d7565b6115ce565b60205460ff166104a5565b6107ed6107e83660046157d7565b611688565b6040805193151584526020840192909252908201526060016104b1565b61068c6108183660046154d7565b611728565b6104cd61082b3660046154f4565b6117c2565b6104cd61083e3660046154f4565b611879565b6104cd610851366004615878565b6118de565b6104cd6108643660046154d7565b611a50565b6104a56108773660046158cd565b6001600160a01b03918216600090815260106020908152604080832093909416825291909152205460ff1690565b61068c6108b33660046157d7565b611c89565b6104a56108c63660046154d7565b6001600160a01b03166000908152601f602052604090205460ff1690565b600e5461068c565b6104cd6108fa3660046157fe565b611cbe565b6104cd61090d3660046154d7565b611d09565b6000546001600160a01b031661050a565b61068c610931366004615539565b60009182526011602090815260408084206001600160a01b0393909316845291905290205490565b6104d7611d58565b6104cd61096f366004615422565b611d67565b60195461068c565b6104cd61098a36600461598a565b611dc7565b6104cd61099d3660046154f4565b612107565b6104cd6109b0366004615645565b61212e565b6109f16109c33660046154d7565b600b6020526000908152604090205460ff81169061010090046fffffffffffffffffffffffffffffffff1682565b6040805192151583526fffffffffffffffffffffffffffffffff9091166020830152016104b1565b6104cd610a27366004615673565b612142565b6104cd610a3a3660046154f4565b612180565b6104d76121e6565b6104cd610a55366004615a70565b612274565b6104cd610a68366004615645565b6122a1565b6104cd610a7b3660046154f4565b612353565b6104d7610a8e3660046154f4565b6123d9565b601a5461068c565b6104cd610aa9366004615773565b612489565b6104cd610abc366004615af0565b612507565b6104d76126ef565b6104cd610ad7366004615b23565b6126fc565b61050a610aea3660046154f4565b612988565b6104cd610afd366004615673565b6129b2565b6104a5610b103660046158cd565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b6104cd610b4c36600461550d565b6129d3565b60215461068c565b6104cd610b67366004615539565b612ae5565b6104cd610b7a3660046154d7565b612b02565b6104cd612b4a565b60006001600160e01b031982167fec8f70c4000000000000000000000000000000000000000000000000000000001480610bea57506001600160e01b031982167f9967fb6500000000000000000000000000000000000000000000000000000000145b80610c1e57506001600160e01b031982167fc4b125a000000000000000000000000000000000000000000000000000000000145b80610c2d5750610c2d82612cea565b92915050565b610c3b612d5c565b6127106bffffffffffffffffffffffff82161115610c85576040517f555f013c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c8f8282612da2565b604080516001600160a01b03841681526bffffffffffffffffffffffff831660208201527f23813f5ad446622633cb58c75ceef768a2111751b0f30477a63e06fcaedcff60910160405180910390a15050565b606060088054610cf190615b9b565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1d90615b9b565b8015610d6a5780601f10610d3f57610100808354040283529160200191610d6a565b820191906000526020600020905b815481529060010190602001808311610d4d57829003601f168201915b5050505050905090565b610d7c612d5c565b6001600160a01b0381166000908152600b602052604090205460ff16610dce576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0381166000908152600b6020526040812054600a546101009091046fffffffffffffffffffffffffffffffff169190610e1090600190615be6565b905080826fffffffffffffffffffffffffffffffff1614610f3e57600a8181548110610e3e57610e3e615bfd565b600091825260209091200154600a80546001600160a01b03909216916fffffffffffffffffffffffffffffffff8516908110610e7c57610e7c615bfd565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555081600b6000600a856fffffffffffffffffffffffffffffffff1681548110610ed457610ed4615bfd565b60009182526020808320909101546001600160a01b03168352820192909252604001902080546fffffffffffffffffffffffffffffffff92909216610100027fffffffffffffffffffffffffffffff00000000000000000000000000000000ff9092169190911790555b600a805480610f4f57610f4f615c13565b60008281526020808220600019908401810180546001600160a01b03191690559092019092556001600160a01b038516808352600b82526040808420805470ffffffffffffffffffffffffffffffffff1916905551928352917fe152843d7324c2cb58e95865f2b78d38f2dab6ce9eadf09438ec2c41e78c705e910160405180910390a2505050565b6000610fe382612ebc565b506000908152600560205260409020546001600160a01b031690565b8161100981612f20565b611013838361301a565b505050565b60008281526011602090815260408083206001600160a01b03851684529091529020546060908067ffffffffffffffff811115611057576110576156b4565b6040519080825280602002602001820160405280156110a957816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816110755790505b5060008581526011602090815260408083206001600160a01b038816845282528083208054825181850281018501909352808352949650929390929183018282801561114057602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116111035790505b5050505050905060005b828110156112295760008681526012602090815260408083206001600160a01b03891684529091528120835190919084908490811061118b5761118b615bfd565b60209081029190910181015163ffffffff90811683528282019390935260409182016000208251608081018452905460ff811615158252610100810485169282019290925267ffffffffffffffff6501000000000083041692810192909252600160681b90049091166060820152845185908390811061120d5761120d615bfd565b60200260200101819052508061122290615c29565b905061114a565b50505092915050565b61123a613147565b61124382613186565b61124e8233836131d2565b5050565b61124e733cc6cdda760b79bafa08df41ecfa224f810dceb66001612b92565b826001600160a01b038116331461128b5761128b33612f20565b6112968484846135e7565b50505050565b6112a4612d5c565b601554610100900460ff16156112e6576040517f5b79f68300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112ef826114a9565b6112f881611cbe565b50506015805461ff001916610100179055565b600061131561366e565b905090565b60008281526014602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046bffffffffffffffffffffffff169282019290925282916113995750604080518082019091526013546001600160a01b0381168252600160a01b90046bffffffffffffffffffffffff1660208201525b6020810151600090612710906113bd906bffffffffffffffffffffffff1687615c44565b6113c79190615c79565b91519350909150505b9250929050565b6113e081613687565b6113e9826136da565b61124e82826000613724565b826001600160a01b038116331461140f5761140f33612f20565b611296848484613a06565b61142382613687565b61142c836136da565b6110138383836131d2565b6011602052826000526040600020602052816000526040600020818154811061145f57600080fd5b906000526020600020906008918282040191900660040292509250509054906101000a900463ffffffff1681565b611495613147565b61149e82613186565b61124e823383613a21565b6114b1612d5c565b80516114c4906016906020840190615320565b507ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f6816040516114f491906154c4565b60405180910390a150565b60008061150b84613d3e565b9050806001015483111561154b576040517f46bcc34b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006115578285613d91565b5091979650505050505050565b6000818152600360205260408120546001600160a01b031680610c2d5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e204944000000000000000060448201526064015b60405180910390fd5b6115d6612d5c565b60205460ff16156115fa576040516363056b0560e11b815260040160405180910390fd5b60208054604080516001600160a01b0361010090930483168152918416928201929092527f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb910160405180910390a1602080546001600160a01b03909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b6000808063ffffffff8411156116ca576040517f3f8ace8800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505060009283526012602090815260408085206001600160a01b0394909416855292815282842063ffffffff9283168552905291205460ff81169265010000000000820467ffffffffffffffff1692600160681b90920490911690565b60006001600160a01b0382166117a65760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e6572000000000000000000000000000000000000000000000060648201526084016115c5565b506001600160a01b031660009081526004602052604090205490565b6117ca612d5c565b4281116117ea57604051631205a88f60e31b815260040160405180910390fd5b60185460ff161561183657601954421015611831576040517fb80a968c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611844565b6018805460ff191660011790555b60198190556040518181527ff05c67ac09cc489b8b8a4713b524acfbf22fca066ee972319956423eca41e81d906020016114f4565b611881612d5c565b611889613dd9565b4281116118a957604051631205a88f60e31b815260040160405180910390fd5b60198190556040518181527f8ef44b9f15cd912828f8c65a0bc6364c6918b2128c541fa639a6b21f7fdb6b6b906020016114f4565b6002601b5414156119315760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016115c5565b6002601b5561193e613dd9565b601c5460ff1661197a576040517f33e5070800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806119b1576040517f75a5e88100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006119bc84613d3e565b90506000816002015461012c6119d29190615c79565b905080831115611a0e576040517f400b516400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b83811015611a4357611a3b83868684818110611a2f57611a2f615bfd565b90506020020135613e17565b600101611a11565b50506001601b5550505050565b611a58612d5c565b6001600160a01b0381166000908152600b602052604090205460ff1615611aab576040517fb73e95e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516301ffc9a760e01b81527f977e0c1c0000000000000000000000000000000000000000000000000000000060048201526001600160a01b038216906301ffc9a79060240160206040518083038186803b158015611b0a57600080fd5b505afa158015611b1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b429190615c8d565b611b78576040517f90c51dd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600a546fffffffffffffffffffffffffffffffff811115611bc5576040517fd571eff200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0382166000818152600b602090815260408083208054600170ffffffffffffffffffffffffffffffffff199091166101006fffffffffffffffffffffffffffffffff891602178117909155600a8054808301825594527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a890930180546001600160a01b03191685179055519182527fe152843d7324c2cb58e95865f2b78d38f2dab6ce9eadf09438ec2c41e78c705e910160405180910390a25050565b6000806000611c99868686611688565b509150915081611caa576000611cb4565b611cb48142615be6565b9695505050505050565b611cc6612d5c565b8051611cd9906017906020840190615320565b507f65ccd57f8a46e7a6cfc4d214d84094e8ba5561ab50fd328f26e4c44052ffeba0816040516114f491906154c4565b6000546001600160a01b031615611d4c576040517f9b07432800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611d5581614018565b50565b606060098054610cf190615b9b565b611d6f612d5c565b60155460ff1615611dac576040517f9383013900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611db68282610c33565b50506015805460ff19166001179055565b611dcf612d5c565b601c5460ff1615611e0c576040517ffec09a2c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82518251611e1b908290614068565b611e26818351614068565b80611e5d576040517fd6bf7c7500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6019811115611e98576040517f4ac9dcf100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156120eb576000858281518110611eb757611eb7615bfd565b602002602001015190506000858381518110611ed557611ed5615bfd565b602002602001015190506000858481518110611ef357611ef3615bfd565b60209081029190910101516040516301ffc9a760e01b81526380ac58cd60e01b60048201529091506001600160a01b038416906301ffc9a79060240160206040518083038186803b158015611f4757600080fd5b505afa158015611f5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f7f9190615c8d565b611fb5576040517fdde498aa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b801580611fc25750600a81115b15611ff9576040517f5f49c51e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81612030576040517f6530928400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383166000818152601d6020526040812080546101009093027fffffffffffffffffffffff000000000000000000000000000000000000000000909316929092176001908117835582018490556002909101829055612095836140a1565b905060005b818110156120db576001600160a01b0385166000908152601d602090815260408220600301805460018181018355918452919092206000199101550161209a565b5084600101945050505050611e9b565b506120f46140c2565b5050601c805460ff191660011790555050565b61210f613147565b61211881613186565b6002600d55612126816140d0565b506001600d55565b8161213881612f20565b6110138383614177565b61214a613147565b61215381613186565b6002600d8190555061217683838360405180602001604052806000815250614182565b50506001600d5550565b612188612d5c565b600c5460ff16156121c5576040517f1c01396a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6121ce8161420b565b600e55600c805460ff19166001908117909155600d55565b601780546121f390615b9b565b80601f016020809104026020016040519081016040528092919081815260200182805461221f90615b9b565b801561226c5780601f106122415761010080835404028352916020019161226c565b820191906000526020600020905b81548152906001019060200180831161224f57829003601f168201915b505050505081565b836001600160a01b038116331461228e5761228e33612f20565b61229a8585858561427d565b5050505050565b336001600160a01b0383168114156122e5576040517fa7fecee600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03818116600081815260106020908152604080832094881680845294825291829020805460ff191687151590811790915591519182527f83347dcc77580bb841ae3bac834b5b8ac5ccd2326276d265e638987eb6b2c05691015b60405180910390a3505050565b61235b612d5c565b601e5415612395576040517f8c079fa000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806123cc576040517f3b1a1c7300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601e819055611d556140c2565b6000818152600360205260409020546060906001600160a01b031661242a576040517fb1d04f0800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000612434614305565b905060008151116124545760405180602001604052806000815250612482565b8061245e84614314565b601760405160200161247293929190615caa565b6040516020818303038152906040525b9392505050565b612491612d5c565b60075460ff16156124ce576040517f76f1a0b300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81516124e1906008906020850190615320565b5080516124f5906009906020840190615320565b50506007805460ff1916600117905550565b6002601b54141561255a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016115c5565b6002601b55612567613dd9565b601e54806125a1576040517f233a325500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152601f602052604090205460ff16156125eb576040517f690fa02900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61268a83838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525085925061262d91506131ce9050565b8760405160200161266f92919060609290921b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000168252601482015260340190565b6040516020818303038152906040528051906020012061444e565b6126c0576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000818152601f60205260409020805460ff191660011790556126e49085614464565b50506001601b555050565b601680546121f390615b9b565b6002601b54141561274f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016115c5565b6002601b553360009081526023602052604090205460ff161561279e576040517ff5f915f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60205461010090046001600160a01b03166127e5576040517f9944046e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6127ed6144d0565b6000816022546127fd9190615d6e565b905060215481111561283b576040517f28c06e1300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602281905560006128a77fc0fdf125e87206a394c0bd622ce60a53bc2a9f9a841cabce9655320c90da0b68336040805160208101939093526001600160a01b039091169082015260608101859052608001604051602081830303815290604052805190602001206144f4565b90506128e98186868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061455d92505050565b60205461010090046001600160a01b03908116911614612935576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152602360205260409020805460ff19166001179055601a5461295b84614581565b60005b8481101561297a576129723382840161459b565b60010161295e565b50506001601b555050505050565b600a818154811061299857600080fd5b6000918252602090912001546001600160a01b0316905081565b6129ba613147565b6129c381613186565b6002600d556121768383836145a5565b6129db612d5c565b60205461010090046001600160a01b031615612a23576040517fab12310000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038216612a63576040517f487a40cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80612a9a576040517f72198a6d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612aa26140c2565b602080546001600160a01b03909316610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff90931692909217909155602155565b612aed612d5c565b612af681613687565b61124e82826001613724565b612b0a612d5c565b6001600160a01b038116611d4c576040517ff82d512f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612b52612d5c565b612b5a6144d0565b6020805460ff191660011790556040517f43a0371893d0cbfd9e3892248a769a55c4fd6131a91f13b27fb2f57c8d5f70d690600090a1565b6daaeb6d7670e522a718067333cd4e3b1561124e578015612c38576040517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b158015612c1c57600080fd5b505af1158015612c30573d6000803e3d6000fd5b505050505050565b6001600160a01b03821615612ca0576040517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af290390604401612c02565b6040517f4420e4860000000000000000000000000000000000000000000000000000000081523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401612c02565b60006001600160e01b031982167f95fa0ff5000000000000000000000000000000000000000000000000000000001480612d4d57506001600160e01b031982167f247946c900000000000000000000000000000000000000000000000000000000145b80610c2d5750610c2d8261477d565b6000546001600160a01b03163314612da0576040517f4bdafed800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b6127106bffffffffffffffffffffffff82161115612e285760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c2065786365656460448201527f2073616c6550726963650000000000000000000000000000000000000000000060648201526084016115c5565b6001600160a01b038216612e7e5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016115c5565b604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff9091166020909201829052600160a01b90910217601355565b6000818152600360205260409020546001600160a01b0316611d555760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e204944000000000000000060448201526064016115c5565b6daaeb6d7670e522a718067333cd4e3b15611d55576040517fc61711340000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c61711349060440160206040518083038186803b158015612fa157600080fd5b505afa158015612fb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fd99190615c8d565b611d55576040517fede71dcc0000000000000000000000000000000000000000000000000000000081526001600160a01b03821660048201526024016115c5565b600061302582611564565b9050806001600160a01b0316836001600160a01b031614156130af5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084016115c5565b336001600160a01b03821614806130cb57506130cb8133610b10565b61313d5760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c000060648201526084016115c5565b61101383836147bb565b613150336106bb565b612da0576040517f9eea455500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61319861319282611564565b33610877565b611d55576040517f362df0d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3390565b60008060006131e2868686611688565b9250925092508261321f576040517f20f59f0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008681526011602090815260408083206001600160a01b038916845290915281205485919061325190600190615be6565b90508083146133c05760008881526011602090815260408083206001600160a01b038b168452909152902080548290811061328e5761328e615bfd565b600091825260208083206008830401548b84526011825260408085206001600160a01b038d1686529092529220805460079092166004026101000a90920463ffffffff169190859081106132e4576132e4615bfd565b600091825260208083206008830401805460079093166004026101000a63ffffffff8181021990941695909316929092029390931790558981526012825260408082206001600160a01b038b168084529084528183208c84526011855282842091845293528120805486939291908590811061336257613362615bfd565b6000918252602080832060088304015460079092166004026101000a90910463ffffffff90811684529083019390935260409091019020805470ffffffff000000000000000000000000001916600160681b93909216929092021790555b60008881526011602090815260408083206001600160a01b038b16845290915290208054806133f1576133f1615c13565b60008281526020808220600860001990940193840401805463ffffffff600460078716026101000a810219909116909155929093558a81526012835260408082206001600160a01b038c16835284528082209286168252919092528120805470ffffffffffffffffffffffffffffffffff1916905561346f89611564565b9050876001600160a01b0316816001600160a01b03168a7f1171d71105bda3fa01f863317a96e01684416ccb1e5416de7c09510bdfbe6aee8a6000806040516134cd9392919092835290151560208301521515604082015260600190565b60405180910390a4876001600160a01b03166392b612946040518163ffffffff1660e01b815260040160206040518083038186803b15801561350e57600080fd5b505afa158015613522573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135469190615c8d565b1561356c576000898152600f60205260408120805490919061356790615d86565b909155505b604051636d4229c960e01b81526001600160a01b038281166004830152602482018b90526044820189905260648201879052891690636d4229c990608401600060405180830381600087803b1580156135c457600080fd5b505af11580156135d8573d6000803e3d6000fd5b50505050505050505050505050565b6135f13382614829565b6136635760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f76656400000000000000000000000000000000000060648201526084016115c5565b6110138383836145a5565b60185460009060ff168015611315575050601954421090565b6001600160a01b0381166000908152600b602052604090205460ff1615611d55576040517fc0f8cffb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336136e482611564565b6001600160a01b031614611d55576040517fb23b68b700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061372f84611564565b60008581526011602090815260408083206001600160a01b038816845290915281205491925050836001600160a01b03166392b612946040518163ffffffff1660e01b815260040160206040518083038186803b15801561378f57600080fd5b505afa1580156137a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137c79190615c8d565b156137f0576000858152600f6020526040812080548392906137ea908490615be6565b90915550505b60005b818110156139da5760008681526011602090815260408083206001600160a01b0389168452909152812080548390811061382f5761382f615bfd565b600091825260208083206008830401548a84526012825260408085206001600160a01b038c8116808852918552828720600790961660040261010090810a90940463ffffffff9081168089529686528388208451608081018652905460ff81161515825295860482168188015265010000000000860467ffffffffffffffff16818601819052600160681b9096049091166060808301919091528451888152968701989098528c151593860193909352949650909491939092908916918c917f1171d71105bda3fa01f863317a96e01684416ccb1e5416de7c09510bdfbe6aee910160405180910390a460008981526012602090815260408083206001600160a01b038c811680865291845282852063ffffffff8916808752945293829020805470ffffffffffffffffffffffffffffffffff191690559051636d4229c960e01b81529289166004840152602483018c905260448301919091526064820183905290636d4229c990608401600060405180830381600087803b1580156139b457600080fd5b505af11580156139c8573d6000803e3d6000fd5b505050508360010193505050506137f3565b5060008581526011602090815260408083206001600160a01b0388168452909152812061229a916153a4565b61101383838360405180602001604052806000815250612274565b6000613a2e848484611688565b505090508015613a6a576040517f7f53cfe300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008481526011602090815260408083206001600160a01b0387168452909152902054600e548110613ac8576040517ff8315a8700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008581526011602090815260408083206001600160a01b03881680855290835281842080546001808201835591865284862060088204018054600790921660040261010090810a63ffffffff818102199094168c8516918202179092558c88526012875285882094885293865284872081885290955292852080547fffffffffffffffffffffffffffffffffffffff0000000000000000ffffffff0016650100000000004267ffffffffffffffff1602179091177fffffffffffffffffffffffffffffff00000000ffffffffffffffff00000000ff169190930270ffffffff00000000000000000000000000191617600160681b918516919091021790558390613bd287611564565b604080518781526001602082015260008183015290519192506001600160a01b0388811692908416918a917f1171d71105bda3fa01f863317a96e01684416ccb1e5416de7c09510bdfbe6aee9181900360600190a4856001600160a01b03166392b612946040518163ffffffff1660e01b815260040160206040518083038186803b158015613c6057600080fd5b505afa158015613c74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c989190615c8d565b15613cb3576000878152600f60205260409020805460010190555b6040517f688a37410000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152602482018990526044820187905287169063688a374190606401600060405180830381600087803b158015613d1d57600080fd5b505af1158015613d31573d6000803e3d6000fd5b5050505050505050505050565b6001600160a01b0381166000908152601d60205260408120805460ff16610c2d576040517fd6c5698200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60038201805460009161010084049160ff851691849184908110613db757613db7615bfd565b9060005260206000200154905060018282901c16600014935092959194509250565b613de161366e565b612da0576040517f63d8e84c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3382546040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b039283169261010090920490911690636352211e9060240160206040518083038186803b158015613e7e57600080fd5b505afa158015613e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613eb69190615d9d565b6001600160a01b031614613ef6576040517f7004d82100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080600080613f068686613d91565b93509350935093508315613f46576040517f4d56330200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000613f51601a5490565b6002880154885491925090879061010090046001600160a01b03167fae8f914c8af222221e50256a64e9f2812cd4e16dd5b5ec6d846ee5459dbf8dee846001613f9a8683615d6e565b613fa49190615be6565b6040805192835260208301919091520160405180910390a3836001901b198316886003018681548110613fd957613fd9615bfd565b600091825260209091200155613fee81614581565b60005b8181101561400d576140053382850161459b565b600101613ff1565b505050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80821461124e576040517f43714afd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610100600182019081049060ff8116156140bc578160010191505b50919050565b601a54612da0576001601a55565b60006140db82611564565b90506140e9816000846148a7565b6140f46000836147bb565b6001600160a01b038116600090815260046020526040812080546001929061411d908490615be6565b909155505060008281526003602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b61124e3383836148ed565b61418d8484846145a5565b614199848484846149b4565b6112965760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e746572000000000000000000000000000060648201526084016115c5565b80614242576040517f63199bde00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6064811115611d55576040517f9cb75faf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6142873383614829565b6142f95760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f76656400000000000000000000000000000000000060648201526084016115c5565b61129684848484614182565b606060168054610cf190615b9b565b60608161435457505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561437e578061436881615c29565b91506143779050600a83615c79565b9150614358565b60008167ffffffffffffffff811115614399576143996156b4565b6040519080825280601f01601f1916602001820160405280156143c3576020820181803683370190505b5090505b8415614446576143d8600183615be6565b91506143e5600a86615dba565b6143f0906030615d6e565b60f81b81838151811061440557614405615bfd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061443f600a86615c79565b94506143c7565b949350505050565b60008261445b8584614b17565b14949350505050565b8061449b576040517f2465b2bb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006144a6601a5490565b90506144b182614581565b60005b82811015611296576144c88482840161459b565b6001016144b4565b60205460ff1615612da0576040516363056b0560e11b815260040160405180910390fd5b6000610c2d614501614b5c565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600080600061456c8585614c83565b9150915061457981614cf0565b509392505050565b80601a60008282546145939190615d6e565b909155505050565b61124e8282614eab565b826001600160a01b03166145b882611564565b6001600160a01b0316146146345760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e657200000000000000000000000000000000000000000000000000000060648201526084016115c5565b6001600160a01b0382166146af5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016115c5565b6146ba8383836148a7565b6146c56000826147bb565b6001600160a01b03831660009081526004602052604081208054600192906146ee908490615be6565b90915550506001600160a01b038216600090815260046020526040812080546001929061471c908490615d6e565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006001600160e01b031982167f2a55205a000000000000000000000000000000000000000000000000000000001480610c2d5750610c2d82614ec5565b600081815260056020526040902080546001600160a01b0319166001600160a01b03841690811790915581906147f082611564565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061483583611564565b9050806001600160a01b0316846001600160a01b0316148061487c57506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b806144465750836001600160a01b031661489584610fd8565b6001600160a01b031614949350505050565b6000818152600f602052604090205415611013576040517f95e7c04000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816001600160a01b0316836001600160a01b0316141561494f5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016115c5565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101612346565b60006001600160a01b0384163b15614b0c57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906149f8903390899088908890600401615dce565b602060405180830381600087803b158015614a1257600080fd5b505af1925050508015614a42575060408051601f3d908101601f19168201909252614a3f91810190615e00565b60015b614af2573d808015614a70576040519150601f19603f3d011682016040523d82523d6000602084013e614a75565b606091505b508051614aea5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e746572000000000000000000000000000060648201526084016115c5565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050614446565b506001949350505050565b600081815b845181101561457957614b4882868381518110614b3b57614b3b615bfd565b6020026020010151614f37565b915080614b5481615c29565b915050614b1c565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015614bb557507f000000000000000000000000000000000000000000000000000000000000000046145b15614bdf57507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b600080825160411415614cba5760208301516040840151606085015160001a614cae87828585614f63565b945094505050506113d0565b825160401415614ce45760208301516040840151614cd9868383615050565b9350935050506113d0565b506000905060026113d0565b6000816004811115614d0457614d04615e1d565b1415614d0d5750565b6001816004811115614d2157614d21615e1d565b1415614d6f5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016115c5565b6002816004811115614d8357614d83615e1d565b1415614dd15760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016115c5565b6003816004811115614de557614de5615e1d565b1415614e3e5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016115c5565b6004816004811115614e5257614e52615e1d565b1415611d555760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016115c5565b61124e8282604051806020016040528060008152506150a2565b60006001600160e01b031982167ff9f7ab41000000000000000000000000000000000000000000000000000000001480614f2857506001600160e01b031982167fb39fa00000000000000000000000000000000000000000000000000000000000145b80610c2d5750610c2d8261512b565b6000818310614f53576000828152602084905260409020612482565b5060009182526020526040902090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115614f9a5750600090506003615047565b8460ff16601b14158015614fb257508460ff16601c14155b15614fc35750600090506004615047565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015615017573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661504057600060019250925050615047565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161508660ff86901c601b615d6e565b905061509487828885614f63565b935093505050935093915050565b6150ac8383615169565b6150b960008484846149b4565b6110135760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e746572000000000000000000000000000060648201526084016115c5565b60006001600160e01b031982167fd147c97a000000000000000000000000000000000000000000000000000000001480610c2d5750610c2d826152b7565b6001600160a01b0382166151bf5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016115c5565b6000818152600360205260409020546001600160a01b0316156152245760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016115c5565b615230600083836148a7565b6001600160a01b0382166000908152600460205260408120805460019290615259908490615d6e565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160e01b031982166380ac58cd60e01b148061530157506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610c2d57506301ffc9a760e01b6001600160e01b0319831614610c2d565b82805461532c90615b9b565b90600052602060002090601f01602090048101928261534e5760008555615394565b82601f1061536757805160ff1916838001178555615394565b82800160010185558215615394579182015b82811115615394578251825591602001919060010190615379565b506153a09291506153c5565b5090565b508054600082556007016008900490600052602060002090810190611d5591905b5b808211156153a057600081556001016153c6565b6001600160e01b031981168114611d5557600080fd5b60006020828403121561540257600080fd5b8135612482816153da565b6001600160a01b0381168114611d5557600080fd5b6000806040838503121561543557600080fd5b82356154408161540d565b915060208301356bffffffffffffffffffffffff8116811461546157600080fd5b809150509250929050565b60005b8381101561548757818101518382015260200161546f565b838111156112965750506000910152565b600081518084526154b081602086016020860161546c565b601f01601f19169290920160200192915050565b6020815260006124826020830184615498565b6000602082840312156154e957600080fd5b81356124828161540d565b60006020828403121561550657600080fd5b5035919050565b6000806040838503121561552057600080fd5b823561552b8161540d565b946020939093013593505050565b6000806040838503121561554c57600080fd5b8235915060208301356154618161540d565b602080825282518282018190526000919060409081850190868401855b828110156115575781518051151585528681015163ffffffff908116888701528682015167ffffffffffffffff168787015260609182015116908501526080909301929085019060010161557b565b6000806000606084860312156155df57600080fd5b8335925060208401356155f18161540d565b9150604084013563ffffffff8116811461560a57600080fd5b809150509250925092565b6000806040838503121561562857600080fd5b50508035926020909101359150565b8015158114611d5557600080fd5b6000806040838503121561565857600080fd5b82356156638161540d565b9150602083013561546181615637565b60008060006060848603121561568857600080fd5b83356156938161540d565b925060208401356156a38161540d565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156156f3576156f36156b4565b604052919050565b600067ffffffffffffffff831115615715576157156156b4565b615728601f8401601f19166020016156ca565b905082815283838301111561573c57600080fd5b828260208301376000602084830101529392505050565b600082601f83011261576457600080fd5b612482838335602085016156fb565b6000806040838503121561578657600080fd5b823567ffffffffffffffff8082111561579e57600080fd5b6157aa86838701615753565b935060208501359150808211156157c057600080fd5b506157cd85828601615753565b9150509250929050565b6000806000606084860312156157ec57600080fd5b8335925060208401356156a38161540d565b60006020828403121561581057600080fd5b813567ffffffffffffffff81111561582757600080fd5b61444684828501615753565b60008083601f84011261584557600080fd5b50813567ffffffffffffffff81111561585d57600080fd5b6020830191508360208260051b85010111156113d057600080fd5b60008060006040848603121561588d57600080fd5b83356158988161540d565b9250602084013567ffffffffffffffff8111156158b457600080fd5b6158c086828701615833565b9497909650939450505050565b600080604083850312156158e057600080fd5b82356158eb8161540d565b915060208301356154618161540d565b600067ffffffffffffffff821115615915576159156156b4565b5060051b60200190565b600082601f83011261593057600080fd5b81356020615945615940836158fb565b6156ca565b82815260059290921b8401810191818101908684111561596457600080fd5b8286015b8481101561597f5780358352918301918301615968565b509695505050505050565b60008060006060848603121561599f57600080fd5b833567ffffffffffffffff808211156159b757600080fd5b818601915086601f8301126159cb57600080fd5b813560206159db615940836158fb565b82815260059290921b8401810191818101908a8411156159fa57600080fd5b948201945b83861015615a21578535615a128161540d565b825294820194908201906159ff565b97505087013592505080821115615a3757600080fd5b615a438783880161591f565b93506040860135915080821115615a5957600080fd5b50615a668682870161591f565b9150509250925092565b60008060008060808587031215615a8657600080fd5b8435615a918161540d565b93506020850135615aa18161540d565b925060408501359150606085013567ffffffffffffffff811115615ac457600080fd5b8501601f81018713615ad557600080fd5b615ae4878235602084016156fb565b91505092959194509250565b600080600060408486031215615b0557600080fd5b83359250602084013567ffffffffffffffff8111156158b457600080fd5b600080600060408486031215615b3857600080fd5b833567ffffffffffffffff80821115615b5057600080fd5b818601915086601f830112615b6457600080fd5b813581811115615b7357600080fd5b876020828501011115615b8557600080fd5b6020928301989097509590910135949350505050565b600181811c90821680615baf57607f821691505b602082108114156140bc57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082821015615bf857615bf8615bd0565b500390565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6000600019821415615c3d57615c3d615bd0565b5060010190565b6000816000190483118215151615615c5e57615c5e615bd0565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615c8857615c88615c63565b500490565b600060208284031215615c9f57600080fd5b815161248281615637565b600084516020615cbd8285838a0161546c565b855191840191615cd08184848a0161546c565b8554920191600090600181811c9080831680615ced57607f831692505b858310811415615d0b57634e487b7160e01b85526022600452602485fd5b808015615d1f5760018114615d3057615d5d565b60ff19851688528388019550615d5d565b60008b81526020902060005b85811015615d555781548a820152908401908801615d3c565b505083880195505b50939b9a5050505050505050505050565b60008219821115615d8157615d81615bd0565b500190565b600081615d9557615d95615bd0565b506000190190565b600060208284031215615daf57600080fd5b81516124828161540d565b600082615dc957615dc9615c63565b500690565b60006001600160a01b03808716835280861660208401525083604083015260806060830152611cb46080830184615498565b600060208284031215615e1257600080fd5b8151612482816153da565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220597fd75ad0a9783e54e57c151dbfdc5f602eec9792d1c8e3ad183e364341f9f064736f6c6343000809003368747470733a2f2f6469676964616967616b752e636f6d2f6d61736b65642d76696c6c61696e732f6d657461646174612f0000000000000000000000001d22b8545d1e185ebca5c592964b3fbe9719916b00000000000000000000000000000000000000000000000000000000000003e8

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061048d5760003560e01c80637e10b35b1161026b578063b3bcea4811610150578063d96effe9116100c8578063ec8f70c411610097578063f1e923c51161007c578063f1e923c514610b59578063f2fde38b14610b6c578063f3d73e9514610b7f57600080fd5b8063ec8f70c414610b3e578063ee0471e414610b5157600080fd5b8063d96effe914610ac9578063e2989f4c14610adc578063e370ab4614610aef578063e985e9c514610b0257600080fd5b8063c87b56dd1161011f578063d147c97a11610104578063d147c97a14610a9b578063d2cab05614610aae578063d547cfb714610ac157600080fd5b8063c87b56dd14610a80578063caa0f92a14610a9357600080fd5b8063b3bcea4814610a3f578063b88d4fde14610a47578063c05e2f4414610a5a578063c4b125a014610a6d57600080fd5b806395d89b41116101e35780639bc17ea4116101b2578063aa6cab5a11610197578063aa6cab5a146109b5578063aca139f714610a19578063b39fa00014610a2c57600080fd5b80639bc17ea41461098f578063a22cb465146109a257600080fd5b806395d89b411461095957806395fa0ff514610961578063970f9fc8146109745780639967fb651461097c57600080fd5b8063869f91101161023a5780638c5f36bb1161021f5780638c5f36bb146108ff5780638da5cb5b14610912578063916237181461092357600080fd5b8063869f9110146108e45780638be18e57146108ec57600080fd5b80637e10b35b146108565780637f1a5ce114610869578063816a1501146108a55780638521b8e3146108b857600080fd5b8063301be74011610391578063562beba811610309578063703fa929116102d857806372be0d8b116102bd57806372be0d8b1461081d578063772bcfb9146108305780637c04c80a1461084357600080fd5b8063703fa929146107da57806370a082311461080a57600080fd5b8063562beba8146107965780636352211e146107a95780636c19e783146107bc5780636c934620146107cf57600080fd5b80634e02c0781161036057806351dadc281161034557806351dadc281461074857806353401df91461077057806355f804b31461078357600080fd5b80634e02c078146107095780634f3502531461071c57600080fd5b8063301be740146106ad57806341f43434146106d957806342842e0e146106ee578063495906571461070157600080fd5b806311ad408111610424578063247946c9116103f35780632a55205a116103d85780632a55205a146106565780632d380242146106885780632ebb386a1461069a57600080fd5b8063247946c91461063b57806324933ba61461064e57600080fd5b806311ad4081146105ec57806318b1b60e146105ff578063225848cf1461061557806323b872dd1461062857600080fd5b8063081812fc11610460578063081812fc146104f7578063095ea7b3146105225780630f3d911c14610535578063113405571461055557600080fd5b806301ffc9a71461049257806302fa7c47146104ba57806306fdde03146104cf578063070cba17146104e4575b600080fd5b6104a56104a03660046153f0565b610b87565b60405190151581526020015b60405180910390f35b6104cd6104c8366004615422565b610c33565b005b6104d7610ce2565b6040516104b191906154c4565b6104cd6104f23660046154d7565b610d74565b61050a6105053660046154f4565b610fd8565b6040516001600160a01b0390911681526020016104b1565b6104cd61053036600461550d565b610fff565b610548610543366004615539565b611018565b6040516104b1919061555e565b6105b56105633660046155ca565b601260209081526000938452604080852082529284528284209052825290205460ff81169063ffffffff610100820481169167ffffffffffffffff6501000000000082041691600160681b9091041684565b60408051941515855263ffffffff938416602086015267ffffffffffffffff909216918401919091521660608201526080016104b1565b6104cd6105fa366004615615565b611232565b60205461010090046001600160a01b031661050a565b6104cd610623366004615645565b611252565b6104cd610636366004615673565b611271565b6104cd610649366004615773565b61129c565b6104a561130b565b610669610664366004615615565b61131a565b604080516001600160a01b0390931683526020830191909152016104b1565b6022545b6040519081526020016104b1565b6104cd6106a8366004615539565b6113d7565b6104a56106bb3660046154d7565b6001600160a01b03166000908152600b602052604090205460ff1690565b61050a6daaeb6d7670e522a718067333cd4e81565b6104cd6106fc366004615673565b6113f5565b601e5461068c565b6104cd6107173660046157d7565b61141a565b6104a561072a3660046154d7565b6001600160a01b031660009081526023602052604090205460ff1690565b61075b6107563660046157d7565b611437565b60405163ffffffff90911681526020016104b1565b6104cd61077e366004615615565b61148d565b6104cd6107913660046157fe565b6114a9565b6104a56107a436600461550d565b6114ff565b61050a6107b73660046154f4565b611564565b6104cd6107ca3660046154d7565b6115ce565b60205460ff166104a5565b6107ed6107e83660046157d7565b611688565b6040805193151584526020840192909252908201526060016104b1565b61068c6108183660046154d7565b611728565b6104cd61082b3660046154f4565b6117c2565b6104cd61083e3660046154f4565b611879565b6104cd610851366004615878565b6118de565b6104cd6108643660046154d7565b611a50565b6104a56108773660046158cd565b6001600160a01b03918216600090815260106020908152604080832093909416825291909152205460ff1690565b61068c6108b33660046157d7565b611c89565b6104a56108c63660046154d7565b6001600160a01b03166000908152601f602052604090205460ff1690565b600e5461068c565b6104cd6108fa3660046157fe565b611cbe565b6104cd61090d3660046154d7565b611d09565b6000546001600160a01b031661050a565b61068c610931366004615539565b60009182526011602090815260408084206001600160a01b0393909316845291905290205490565b6104d7611d58565b6104cd61096f366004615422565b611d67565b60195461068c565b6104cd61098a36600461598a565b611dc7565b6104cd61099d3660046154f4565b612107565b6104cd6109b0366004615645565b61212e565b6109f16109c33660046154d7565b600b6020526000908152604090205460ff81169061010090046fffffffffffffffffffffffffffffffff1682565b6040805192151583526fffffffffffffffffffffffffffffffff9091166020830152016104b1565b6104cd610a27366004615673565b612142565b6104cd610a3a3660046154f4565b612180565b6104d76121e6565b6104cd610a55366004615a70565b612274565b6104cd610a68366004615645565b6122a1565b6104cd610a7b3660046154f4565b612353565b6104d7610a8e3660046154f4565b6123d9565b601a5461068c565b6104cd610aa9366004615773565b612489565b6104cd610abc366004615af0565b612507565b6104d76126ef565b6104cd610ad7366004615b23565b6126fc565b61050a610aea3660046154f4565b612988565b6104cd610afd366004615673565b6129b2565b6104a5610b103660046158cd565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b6104cd610b4c36600461550d565b6129d3565b60215461068c565b6104cd610b67366004615539565b612ae5565b6104cd610b7a3660046154d7565b612b02565b6104cd612b4a565b60006001600160e01b031982167fec8f70c4000000000000000000000000000000000000000000000000000000001480610bea57506001600160e01b031982167f9967fb6500000000000000000000000000000000000000000000000000000000145b80610c1e57506001600160e01b031982167fc4b125a000000000000000000000000000000000000000000000000000000000145b80610c2d5750610c2d82612cea565b92915050565b610c3b612d5c565b6127106bffffffffffffffffffffffff82161115610c85576040517f555f013c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c8f8282612da2565b604080516001600160a01b03841681526bffffffffffffffffffffffff831660208201527f23813f5ad446622633cb58c75ceef768a2111751b0f30477a63e06fcaedcff60910160405180910390a15050565b606060088054610cf190615b9b565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1d90615b9b565b8015610d6a5780601f10610d3f57610100808354040283529160200191610d6a565b820191906000526020600020905b815481529060010190602001808311610d4d57829003601f168201915b5050505050905090565b610d7c612d5c565b6001600160a01b0381166000908152600b602052604090205460ff16610dce576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0381166000908152600b6020526040812054600a546101009091046fffffffffffffffffffffffffffffffff169190610e1090600190615be6565b905080826fffffffffffffffffffffffffffffffff1614610f3e57600a8181548110610e3e57610e3e615bfd565b600091825260209091200154600a80546001600160a01b03909216916fffffffffffffffffffffffffffffffff8516908110610e7c57610e7c615bfd565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555081600b6000600a856fffffffffffffffffffffffffffffffff1681548110610ed457610ed4615bfd565b60009182526020808320909101546001600160a01b03168352820192909252604001902080546fffffffffffffffffffffffffffffffff92909216610100027fffffffffffffffffffffffffffffff00000000000000000000000000000000ff9092169190911790555b600a805480610f4f57610f4f615c13565b60008281526020808220600019908401810180546001600160a01b03191690559092019092556001600160a01b038516808352600b82526040808420805470ffffffffffffffffffffffffffffffffff1916905551928352917fe152843d7324c2cb58e95865f2b78d38f2dab6ce9eadf09438ec2c41e78c705e910160405180910390a2505050565b6000610fe382612ebc565b506000908152600560205260409020546001600160a01b031690565b8161100981612f20565b611013838361301a565b505050565b60008281526011602090815260408083206001600160a01b03851684529091529020546060908067ffffffffffffffff811115611057576110576156b4565b6040519080825280602002602001820160405280156110a957816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816110755790505b5060008581526011602090815260408083206001600160a01b038816845282528083208054825181850281018501909352808352949650929390929183018282801561114057602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116111035790505b5050505050905060005b828110156112295760008681526012602090815260408083206001600160a01b03891684529091528120835190919084908490811061118b5761118b615bfd565b60209081029190910181015163ffffffff90811683528282019390935260409182016000208251608081018452905460ff811615158252610100810485169282019290925267ffffffffffffffff6501000000000083041692810192909252600160681b90049091166060820152845185908390811061120d5761120d615bfd565b60200260200101819052508061122290615c29565b905061114a565b50505092915050565b61123a613147565b61124382613186565b61124e8233836131d2565b5050565b61124e733cc6cdda760b79bafa08df41ecfa224f810dceb66001612b92565b826001600160a01b038116331461128b5761128b33612f20565b6112968484846135e7565b50505050565b6112a4612d5c565b601554610100900460ff16156112e6576040517f5b79f68300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112ef826114a9565b6112f881611cbe565b50506015805461ff001916610100179055565b600061131561366e565b905090565b60008281526014602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046bffffffffffffffffffffffff169282019290925282916113995750604080518082019091526013546001600160a01b0381168252600160a01b90046bffffffffffffffffffffffff1660208201525b6020810151600090612710906113bd906bffffffffffffffffffffffff1687615c44565b6113c79190615c79565b91519350909150505b9250929050565b6113e081613687565b6113e9826136da565b61124e82826000613724565b826001600160a01b038116331461140f5761140f33612f20565b611296848484613a06565b61142382613687565b61142c836136da565b6110138383836131d2565b6011602052826000526040600020602052816000526040600020818154811061145f57600080fd5b906000526020600020906008918282040191900660040292509250509054906101000a900463ffffffff1681565b611495613147565b61149e82613186565b61124e823383613a21565b6114b1612d5c565b80516114c4906016906020840190615320565b507ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f6816040516114f491906154c4565b60405180910390a150565b60008061150b84613d3e565b9050806001015483111561154b576040517f46bcc34b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006115578285613d91565b5091979650505050505050565b6000818152600360205260408120546001600160a01b031680610c2d5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e204944000000000000000060448201526064015b60405180910390fd5b6115d6612d5c565b60205460ff16156115fa576040516363056b0560e11b815260040160405180910390fd5b60208054604080516001600160a01b0361010090930483168152918416928201929092527f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb910160405180910390a1602080546001600160a01b03909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b6000808063ffffffff8411156116ca576040517f3f8ace8800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505060009283526012602090815260408085206001600160a01b0394909416855292815282842063ffffffff9283168552905291205460ff81169265010000000000820467ffffffffffffffff1692600160681b90920490911690565b60006001600160a01b0382166117a65760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e6572000000000000000000000000000000000000000000000060648201526084016115c5565b506001600160a01b031660009081526004602052604090205490565b6117ca612d5c565b4281116117ea57604051631205a88f60e31b815260040160405180910390fd5b60185460ff161561183657601954421015611831576040517fb80a968c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611844565b6018805460ff191660011790555b60198190556040518181527ff05c67ac09cc489b8b8a4713b524acfbf22fca066ee972319956423eca41e81d906020016114f4565b611881612d5c565b611889613dd9565b4281116118a957604051631205a88f60e31b815260040160405180910390fd5b60198190556040518181527f8ef44b9f15cd912828f8c65a0bc6364c6918b2128c541fa639a6b21f7fdb6b6b906020016114f4565b6002601b5414156119315760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016115c5565b6002601b5561193e613dd9565b601c5460ff1661197a576040517f33e5070800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806119b1576040517f75a5e88100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006119bc84613d3e565b90506000816002015461012c6119d29190615c79565b905080831115611a0e576040517f400b516400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b83811015611a4357611a3b83868684818110611a2f57611a2f615bfd565b90506020020135613e17565b600101611a11565b50506001601b5550505050565b611a58612d5c565b6001600160a01b0381166000908152600b602052604090205460ff1615611aab576040517fb73e95e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516301ffc9a760e01b81527f977e0c1c0000000000000000000000000000000000000000000000000000000060048201526001600160a01b038216906301ffc9a79060240160206040518083038186803b158015611b0a57600080fd5b505afa158015611b1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b429190615c8d565b611b78576040517f90c51dd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600a546fffffffffffffffffffffffffffffffff811115611bc5576040517fd571eff200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0382166000818152600b602090815260408083208054600170ffffffffffffffffffffffffffffffffff199091166101006fffffffffffffffffffffffffffffffff891602178117909155600a8054808301825594527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a890930180546001600160a01b03191685179055519182527fe152843d7324c2cb58e95865f2b78d38f2dab6ce9eadf09438ec2c41e78c705e910160405180910390a25050565b6000806000611c99868686611688565b509150915081611caa576000611cb4565b611cb48142615be6565b9695505050505050565b611cc6612d5c565b8051611cd9906017906020840190615320565b507f65ccd57f8a46e7a6cfc4d214d84094e8ba5561ab50fd328f26e4c44052ffeba0816040516114f491906154c4565b6000546001600160a01b031615611d4c576040517f9b07432800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611d5581614018565b50565b606060098054610cf190615b9b565b611d6f612d5c565b60155460ff1615611dac576040517f9383013900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611db68282610c33565b50506015805460ff19166001179055565b611dcf612d5c565b601c5460ff1615611e0c576040517ffec09a2c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82518251611e1b908290614068565b611e26818351614068565b80611e5d576040517fd6bf7c7500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6019811115611e98576040517f4ac9dcf100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156120eb576000858281518110611eb757611eb7615bfd565b602002602001015190506000858381518110611ed557611ed5615bfd565b602002602001015190506000858481518110611ef357611ef3615bfd565b60209081029190910101516040516301ffc9a760e01b81526380ac58cd60e01b60048201529091506001600160a01b038416906301ffc9a79060240160206040518083038186803b158015611f4757600080fd5b505afa158015611f5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f7f9190615c8d565b611fb5576040517fdde498aa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b801580611fc25750600a81115b15611ff9576040517f5f49c51e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81612030576040517f6530928400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0383166000818152601d6020526040812080546101009093027fffffffffffffffffffffff000000000000000000000000000000000000000000909316929092176001908117835582018490556002909101829055612095836140a1565b905060005b818110156120db576001600160a01b0385166000908152601d602090815260408220600301805460018181018355918452919092206000199101550161209a565b5084600101945050505050611e9b565b506120f46140c2565b5050601c805460ff191660011790555050565b61210f613147565b61211881613186565b6002600d55612126816140d0565b506001600d55565b8161213881612f20565b6110138383614177565b61214a613147565b61215381613186565b6002600d8190555061217683838360405180602001604052806000815250614182565b50506001600d5550565b612188612d5c565b600c5460ff16156121c5576040517f1c01396a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6121ce8161420b565b600e55600c805460ff19166001908117909155600d55565b601780546121f390615b9b565b80601f016020809104026020016040519081016040528092919081815260200182805461221f90615b9b565b801561226c5780601f106122415761010080835404028352916020019161226c565b820191906000526020600020905b81548152906001019060200180831161224f57829003601f168201915b505050505081565b836001600160a01b038116331461228e5761228e33612f20565b61229a8585858561427d565b5050505050565b336001600160a01b0383168114156122e5576040517fa7fecee600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03818116600081815260106020908152604080832094881680845294825291829020805460ff191687151590811790915591519182527f83347dcc77580bb841ae3bac834b5b8ac5ccd2326276d265e638987eb6b2c05691015b60405180910390a3505050565b61235b612d5c565b601e5415612395576040517f8c079fa000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806123cc576040517f3b1a1c7300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601e819055611d556140c2565b6000818152600360205260409020546060906001600160a01b031661242a576040517fb1d04f0800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000612434614305565b905060008151116124545760405180602001604052806000815250612482565b8061245e84614314565b601760405160200161247293929190615caa565b6040516020818303038152906040525b9392505050565b612491612d5c565b60075460ff16156124ce576040517f76f1a0b300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81516124e1906008906020850190615320565b5080516124f5906009906020840190615320565b50506007805460ff1916600117905550565b6002601b54141561255a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016115c5565b6002601b55612567613dd9565b601e54806125a1576040517f233a325500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152601f602052604090205460ff16156125eb576040517f690fa02900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61268a83838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525085925061262d91506131ce9050565b8760405160200161266f92919060609290921b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000168252601482015260340190565b6040516020818303038152906040528051906020012061444e565b6126c0576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000818152601f60205260409020805460ff191660011790556126e49085614464565b50506001601b555050565b601680546121f390615b9b565b6002601b54141561274f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016115c5565b6002601b553360009081526023602052604090205460ff161561279e576040517ff5f915f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60205461010090046001600160a01b03166127e5576040517f9944046e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6127ed6144d0565b6000816022546127fd9190615d6e565b905060215481111561283b576040517f28c06e1300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602281905560006128a77fc0fdf125e87206a394c0bd622ce60a53bc2a9f9a841cabce9655320c90da0b68336040805160208101939093526001600160a01b039091169082015260608101859052608001604051602081830303815290604052805190602001206144f4565b90506128e98186868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061455d92505050565b60205461010090046001600160a01b03908116911614612935576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152602360205260409020805460ff19166001179055601a5461295b84614581565b60005b8481101561297a576129723382840161459b565b60010161295e565b50506001601b555050505050565b600a818154811061299857600080fd5b6000918252602090912001546001600160a01b0316905081565b6129ba613147565b6129c381613186565b6002600d556121768383836145a5565b6129db612d5c565b60205461010090046001600160a01b031615612a23576040517fab12310000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038216612a63576040517f487a40cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80612a9a576040517f72198a6d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612aa26140c2565b602080546001600160a01b03909316610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff90931692909217909155602155565b612aed612d5c565b612af681613687565b61124e82826001613724565b612b0a612d5c565b6001600160a01b038116611d4c576040517ff82d512f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612b52612d5c565b612b5a6144d0565b6020805460ff191660011790556040517f43a0371893d0cbfd9e3892248a769a55c4fd6131a91f13b27fb2f57c8d5f70d690600090a1565b6daaeb6d7670e522a718067333cd4e3b1561124e578015612c38576040517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b158015612c1c57600080fd5b505af1158015612c30573d6000803e3d6000fd5b505050505050565b6001600160a01b03821615612ca0576040517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af290390604401612c02565b6040517f4420e4860000000000000000000000000000000000000000000000000000000081523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401612c02565b60006001600160e01b031982167f95fa0ff5000000000000000000000000000000000000000000000000000000001480612d4d57506001600160e01b031982167f247946c900000000000000000000000000000000000000000000000000000000145b80610c2d5750610c2d8261477d565b6000546001600160a01b03163314612da0576040517f4bdafed800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b6127106bffffffffffffffffffffffff82161115612e285760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c2065786365656460448201527f2073616c6550726963650000000000000000000000000000000000000000000060648201526084016115c5565b6001600160a01b038216612e7e5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016115c5565b604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff9091166020909201829052600160a01b90910217601355565b6000818152600360205260409020546001600160a01b0316611d555760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e204944000000000000000060448201526064016115c5565b6daaeb6d7670e522a718067333cd4e3b15611d55576040517fc61711340000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c61711349060440160206040518083038186803b158015612fa157600080fd5b505afa158015612fb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fd99190615c8d565b611d55576040517fede71dcc0000000000000000000000000000000000000000000000000000000081526001600160a01b03821660048201526024016115c5565b600061302582611564565b9050806001600160a01b0316836001600160a01b031614156130af5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084016115c5565b336001600160a01b03821614806130cb57506130cb8133610b10565b61313d5760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c000060648201526084016115c5565b61101383836147bb565b613150336106bb565b612da0576040517f9eea455500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61319861319282611564565b33610877565b611d55576040517f362df0d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3390565b60008060006131e2868686611688565b9250925092508261321f576040517f20f59f0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008681526011602090815260408083206001600160a01b038916845290915281205485919061325190600190615be6565b90508083146133c05760008881526011602090815260408083206001600160a01b038b168452909152902080548290811061328e5761328e615bfd565b600091825260208083206008830401548b84526011825260408085206001600160a01b038d1686529092529220805460079092166004026101000a90920463ffffffff169190859081106132e4576132e4615bfd565b600091825260208083206008830401805460079093166004026101000a63ffffffff8181021990941695909316929092029390931790558981526012825260408082206001600160a01b038b168084529084528183208c84526011855282842091845293528120805486939291908590811061336257613362615bfd565b6000918252602080832060088304015460079092166004026101000a90910463ffffffff90811684529083019390935260409091019020805470ffffffff000000000000000000000000001916600160681b93909216929092021790555b60008881526011602090815260408083206001600160a01b038b16845290915290208054806133f1576133f1615c13565b60008281526020808220600860001990940193840401805463ffffffff600460078716026101000a810219909116909155929093558a81526012835260408082206001600160a01b038c16835284528082209286168252919092528120805470ffffffffffffffffffffffffffffffffff1916905561346f89611564565b9050876001600160a01b0316816001600160a01b03168a7f1171d71105bda3fa01f863317a96e01684416ccb1e5416de7c09510bdfbe6aee8a6000806040516134cd9392919092835290151560208301521515604082015260600190565b60405180910390a4876001600160a01b03166392b612946040518163ffffffff1660e01b815260040160206040518083038186803b15801561350e57600080fd5b505afa158015613522573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135469190615c8d565b1561356c576000898152600f60205260408120805490919061356790615d86565b909155505b604051636d4229c960e01b81526001600160a01b038281166004830152602482018b90526044820189905260648201879052891690636d4229c990608401600060405180830381600087803b1580156135c457600080fd5b505af11580156135d8573d6000803e3d6000fd5b50505050505050505050505050565b6135f13382614829565b6136635760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f76656400000000000000000000000000000000000060648201526084016115c5565b6110138383836145a5565b60185460009060ff168015611315575050601954421090565b6001600160a01b0381166000908152600b602052604090205460ff1615611d55576040517fc0f8cffb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336136e482611564565b6001600160a01b031614611d55576040517fb23b68b700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061372f84611564565b60008581526011602090815260408083206001600160a01b038816845290915281205491925050836001600160a01b03166392b612946040518163ffffffff1660e01b815260040160206040518083038186803b15801561378f57600080fd5b505afa1580156137a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137c79190615c8d565b156137f0576000858152600f6020526040812080548392906137ea908490615be6565b90915550505b60005b818110156139da5760008681526011602090815260408083206001600160a01b0389168452909152812080548390811061382f5761382f615bfd565b600091825260208083206008830401548a84526012825260408085206001600160a01b038c8116808852918552828720600790961660040261010090810a90940463ffffffff9081168089529686528388208451608081018652905460ff81161515825295860482168188015265010000000000860467ffffffffffffffff16818601819052600160681b9096049091166060808301919091528451888152968701989098528c151593860193909352949650909491939092908916918c917f1171d71105bda3fa01f863317a96e01684416ccb1e5416de7c09510bdfbe6aee910160405180910390a460008981526012602090815260408083206001600160a01b038c811680865291845282852063ffffffff8916808752945293829020805470ffffffffffffffffffffffffffffffffff191690559051636d4229c960e01b81529289166004840152602483018c905260448301919091526064820183905290636d4229c990608401600060405180830381600087803b1580156139b457600080fd5b505af11580156139c8573d6000803e3d6000fd5b505050508360010193505050506137f3565b5060008581526011602090815260408083206001600160a01b0388168452909152812061229a916153a4565b61101383838360405180602001604052806000815250612274565b6000613a2e848484611688565b505090508015613a6a576040517f7f53cfe300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008481526011602090815260408083206001600160a01b0387168452909152902054600e548110613ac8576040517ff8315a8700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008581526011602090815260408083206001600160a01b03881680855290835281842080546001808201835591865284862060088204018054600790921660040261010090810a63ffffffff818102199094168c8516918202179092558c88526012875285882094885293865284872081885290955292852080547fffffffffffffffffffffffffffffffffffffff0000000000000000ffffffff0016650100000000004267ffffffffffffffff1602179091177fffffffffffffffffffffffffffffff00000000ffffffffffffffff00000000ff169190930270ffffffff00000000000000000000000000191617600160681b918516919091021790558390613bd287611564565b604080518781526001602082015260008183015290519192506001600160a01b0388811692908416918a917f1171d71105bda3fa01f863317a96e01684416ccb1e5416de7c09510bdfbe6aee9181900360600190a4856001600160a01b03166392b612946040518163ffffffff1660e01b815260040160206040518083038186803b158015613c6057600080fd5b505afa158015613c74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c989190615c8d565b15613cb3576000878152600f60205260409020805460010190555b6040517f688a37410000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152602482018990526044820187905287169063688a374190606401600060405180830381600087803b158015613d1d57600080fd5b505af1158015613d31573d6000803e3d6000fd5b5050505050505050505050565b6001600160a01b0381166000908152601d60205260408120805460ff16610c2d576040517fd6c5698200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60038201805460009161010084049160ff851691849184908110613db757613db7615bfd565b9060005260206000200154905060018282901c16600014935092959194509250565b613de161366e565b612da0576040517f63d8e84c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3382546040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b039283169261010090920490911690636352211e9060240160206040518083038186803b158015613e7e57600080fd5b505afa158015613e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613eb69190615d9d565b6001600160a01b031614613ef6576040517f7004d82100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080600080613f068686613d91565b93509350935093508315613f46576040517f4d56330200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000613f51601a5490565b6002880154885491925090879061010090046001600160a01b03167fae8f914c8af222221e50256a64e9f2812cd4e16dd5b5ec6d846ee5459dbf8dee846001613f9a8683615d6e565b613fa49190615be6565b6040805192835260208301919091520160405180910390a3836001901b198316886003018681548110613fd957613fd9615bfd565b600091825260209091200155613fee81614581565b60005b8181101561400d576140053382850161459b565b600101613ff1565b505050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80821461124e576040517f43714afd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610100600182019081049060ff8116156140bc578160010191505b50919050565b601a54612da0576001601a55565b60006140db82611564565b90506140e9816000846148a7565b6140f46000836147bb565b6001600160a01b038116600090815260046020526040812080546001929061411d908490615be6565b909155505060008281526003602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b61124e3383836148ed565b61418d8484846145a5565b614199848484846149b4565b6112965760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e746572000000000000000000000000000060648201526084016115c5565b80614242576040517f63199bde00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6064811115611d55576040517f9cb75faf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6142873383614829565b6142f95760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f76656400000000000000000000000000000000000060648201526084016115c5565b61129684848484614182565b606060168054610cf190615b9b565b60608161435457505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561437e578061436881615c29565b91506143779050600a83615c79565b9150614358565b60008167ffffffffffffffff811115614399576143996156b4565b6040519080825280601f01601f1916602001820160405280156143c3576020820181803683370190505b5090505b8415614446576143d8600183615be6565b91506143e5600a86615dba565b6143f0906030615d6e565b60f81b81838151811061440557614405615bfd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061443f600a86615c79565b94506143c7565b949350505050565b60008261445b8584614b17565b14949350505050565b8061449b576040517f2465b2bb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006144a6601a5490565b90506144b182614581565b60005b82811015611296576144c88482840161459b565b6001016144b4565b60205460ff1615612da0576040516363056b0560e11b815260040160405180910390fd5b6000610c2d614501614b5c565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600080600061456c8585614c83565b9150915061457981614cf0565b509392505050565b80601a60008282546145939190615d6e565b909155505050565b61124e8282614eab565b826001600160a01b03166145b882611564565b6001600160a01b0316146146345760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e657200000000000000000000000000000000000000000000000000000060648201526084016115c5565b6001600160a01b0382166146af5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016115c5565b6146ba8383836148a7565b6146c56000826147bb565b6001600160a01b03831660009081526004602052604081208054600192906146ee908490615be6565b90915550506001600160a01b038216600090815260046020526040812080546001929061471c908490615d6e565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006001600160e01b031982167f2a55205a000000000000000000000000000000000000000000000000000000001480610c2d5750610c2d82614ec5565b600081815260056020526040902080546001600160a01b0319166001600160a01b03841690811790915581906147f082611564565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061483583611564565b9050806001600160a01b0316846001600160a01b0316148061487c57506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b806144465750836001600160a01b031661489584610fd8565b6001600160a01b031614949350505050565b6000818152600f602052604090205415611013576040517f95e7c04000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816001600160a01b0316836001600160a01b0316141561494f5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016115c5565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101612346565b60006001600160a01b0384163b15614b0c57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906149f8903390899088908890600401615dce565b602060405180830381600087803b158015614a1257600080fd5b505af1925050508015614a42575060408051601f3d908101601f19168201909252614a3f91810190615e00565b60015b614af2573d808015614a70576040519150601f19603f3d011682016040523d82523d6000602084013e614a75565b606091505b508051614aea5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e746572000000000000000000000000000060648201526084016115c5565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050614446565b506001949350505050565b600081815b845181101561457957614b4882868381518110614b3b57614b3b615bfd565b6020026020010151614f37565b915080614b5481615c29565b915050614b1c565b6000306001600160a01b037f000000000000000000000000812f5cf0d10539ef9534929940f3aeede3d3d96716148015614bb557507f000000000000000000000000000000000000000000000000000000000000000146145b15614bdf57507f6b80a3e54c5a0689013e1ebf06524176caf3ea0bbd44ef1ae9fc3f9551d0383690565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f760e19fb9842da4b97c2a66abbea12482b881beda866affeb5e89f58920a3a7f828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b600080825160411415614cba5760208301516040840151606085015160001a614cae87828585614f63565b945094505050506113d0565b825160401415614ce45760208301516040840151614cd9868383615050565b9350935050506113d0565b506000905060026113d0565b6000816004811115614d0457614d04615e1d565b1415614d0d5750565b6001816004811115614d2157614d21615e1d565b1415614d6f5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016115c5565b6002816004811115614d8357614d83615e1d565b1415614dd15760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016115c5565b6003816004811115614de557614de5615e1d565b1415614e3e5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016115c5565b6004816004811115614e5257614e52615e1d565b1415611d555760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016115c5565b61124e8282604051806020016040528060008152506150a2565b60006001600160e01b031982167ff9f7ab41000000000000000000000000000000000000000000000000000000001480614f2857506001600160e01b031982167fb39fa00000000000000000000000000000000000000000000000000000000000145b80610c2d5750610c2d8261512b565b6000818310614f53576000828152602084905260409020612482565b5060009182526020526040902090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115614f9a5750600090506003615047565b8460ff16601b14158015614fb257508460ff16601c14155b15614fc35750600090506004615047565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015615017573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661504057600060019250925050615047565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161508660ff86901c601b615d6e565b905061509487828885614f63565b935093505050935093915050565b6150ac8383615169565b6150b960008484846149b4565b6110135760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e746572000000000000000000000000000060648201526084016115c5565b60006001600160e01b031982167fd147c97a000000000000000000000000000000000000000000000000000000001480610c2d5750610c2d826152b7565b6001600160a01b0382166151bf5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016115c5565b6000818152600360205260409020546001600160a01b0316156152245760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016115c5565b615230600083836148a7565b6001600160a01b0382166000908152600460205260408120805460019290615259908490615d6e565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160e01b031982166380ac58cd60e01b148061530157506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610c2d57506301ffc9a760e01b6001600160e01b0319831614610c2d565b82805461532c90615b9b565b90600052602060002090601f01602090048101928261534e5760008555615394565b82601f1061536757805160ff1916838001178555615394565b82800160010185558215615394579182015b82811115615394578251825591602001919060010190615379565b506153a09291506153c5565b5090565b508054600082556007016008900490600052602060002090810190611d5591905b5b808211156153a057600081556001016153c6565b6001600160e01b031981168114611d5557600080fd5b60006020828403121561540257600080fd5b8135612482816153da565b6001600160a01b0381168114611d5557600080fd5b6000806040838503121561543557600080fd5b82356154408161540d565b915060208301356bffffffffffffffffffffffff8116811461546157600080fd5b809150509250929050565b60005b8381101561548757818101518382015260200161546f565b838111156112965750506000910152565b600081518084526154b081602086016020860161546c565b601f01601f19169290920160200192915050565b6020815260006124826020830184615498565b6000602082840312156154e957600080fd5b81356124828161540d565b60006020828403121561550657600080fd5b5035919050565b6000806040838503121561552057600080fd5b823561552b8161540d565b946020939093013593505050565b6000806040838503121561554c57600080fd5b8235915060208301356154618161540d565b602080825282518282018190526000919060409081850190868401855b828110156115575781518051151585528681015163ffffffff908116888701528682015167ffffffffffffffff168787015260609182015116908501526080909301929085019060010161557b565b6000806000606084860312156155df57600080fd5b8335925060208401356155f18161540d565b9150604084013563ffffffff8116811461560a57600080fd5b809150509250925092565b6000806040838503121561562857600080fd5b50508035926020909101359150565b8015158114611d5557600080fd5b6000806040838503121561565857600080fd5b82356156638161540d565b9150602083013561546181615637565b60008060006060848603121561568857600080fd5b83356156938161540d565b925060208401356156a38161540d565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156156f3576156f36156b4565b604052919050565b600067ffffffffffffffff831115615715576157156156b4565b615728601f8401601f19166020016156ca565b905082815283838301111561573c57600080fd5b828260208301376000602084830101529392505050565b600082601f83011261576457600080fd5b612482838335602085016156fb565b6000806040838503121561578657600080fd5b823567ffffffffffffffff8082111561579e57600080fd5b6157aa86838701615753565b935060208501359150808211156157c057600080fd5b506157cd85828601615753565b9150509250929050565b6000806000606084860312156157ec57600080fd5b8335925060208401356156a38161540d565b60006020828403121561581057600080fd5b813567ffffffffffffffff81111561582757600080fd5b61444684828501615753565b60008083601f84011261584557600080fd5b50813567ffffffffffffffff81111561585d57600080fd5b6020830191508360208260051b85010111156113d057600080fd5b60008060006040848603121561588d57600080fd5b83356158988161540d565b9250602084013567ffffffffffffffff8111156158b457600080fd5b6158c086828701615833565b9497909650939450505050565b600080604083850312156158e057600080fd5b82356158eb8161540d565b915060208301356154618161540d565b600067ffffffffffffffff821115615915576159156156b4565b5060051b60200190565b600082601f83011261593057600080fd5b81356020615945615940836158fb565b6156ca565b82815260059290921b8401810191818101908684111561596457600080fd5b8286015b8481101561597f5780358352918301918301615968565b509695505050505050565b60008060006060848603121561599f57600080fd5b833567ffffffffffffffff808211156159b757600080fd5b818601915086601f8301126159cb57600080fd5b813560206159db615940836158fb565b82815260059290921b8401810191818101908a8411156159fa57600080fd5b948201945b83861015615a21578535615a128161540d565b825294820194908201906159ff565b97505087013592505080821115615a3757600080fd5b615a438783880161591f565b93506040860135915080821115615a5957600080fd5b50615a668682870161591f565b9150509250925092565b60008060008060808587031215615a8657600080fd5b8435615a918161540d565b93506020850135615aa18161540d565b925060408501359150606085013567ffffffffffffffff811115615ac457600080fd5b8501601f81018713615ad557600080fd5b615ae4878235602084016156fb565b91505092959194509250565b600080600060408486031215615b0557600080fd5b83359250602084013567ffffffffffffffff8111156158b457600080fd5b600080600060408486031215615b3857600080fd5b833567ffffffffffffffff80821115615b5057600080fd5b818601915086601f830112615b6457600080fd5b813581811115615b7357600080fd5b876020828501011115615b8557600080fd5b6020928301989097509590910135949350505050565b600181811c90821680615baf57607f821691505b602082108114156140bc57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082821015615bf857615bf8615bd0565b500390565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6000600019821415615c3d57615c3d615bd0565b5060010190565b6000816000190483118215151615615c5e57615c5e615bd0565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615c8857615c88615c63565b500490565b600060208284031215615c9f57600080fd5b815161248281615637565b600084516020615cbd8285838a0161546c565b855191840191615cd08184848a0161546c565b8554920191600090600181811c9080831680615ced57607f831692505b858310811415615d0b57634e487b7160e01b85526022600452602485fd5b808015615d1f5760018114615d3057615d5d565b60ff19851688528388019550615d5d565b60008b81526020902060005b85811015615d555781548a820152908401908801615d3c565b505083880195505b50939b9a5050505050505050505050565b60008219821115615d8157615d81615bd0565b500190565b600081615d9557615d95615bd0565b506000190190565b600060208284031215615daf57600080fd5b81516124828161540d565b600082615dc957615dc9615c63565b500690565b60006001600160a01b03808716835280861660208401525083604083015260806060830152611cb46080830184615498565b600060208284031215615e1257600080fd5b8151612482816153da565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220597fd75ad0a9783e54e57c151dbfdc5f602eec9792d1c8e3ad183e364341f9f064736f6c63430008090033

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

0000000000000000000000001d22b8545d1e185ebca5c592964b3fbe9719916b00000000000000000000000000000000000000000000000000000000000003e8

-----Decoded View---------------
Arg [0] : royaltyReceiver_ (address): 0x1D22B8545d1E185EbcA5C592964b3fBE9719916b
Arg [1] : royaltyFeeNumerator_ (uint96): 1000

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000001d22b8545d1e185ebca5c592964b3fbe9719916b
Arg [1] : 00000000000000000000000000000000000000000000000000000000000003e8


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.