ETH Price: $3,368.65 (+0.04%)
Gas: 6.54 Gwei

Token

SPELL (Mutant Spell)
 

Overview

Max Total Supply

5,555 Mutant Spell

Holders

4,909

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
1 Mutant Spell
0xdB02f6936D491DD3D78FBAD0E6071Aa1d0571746
Loading...
Loading
Loading...
Loading
Loading...
Loading

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

Contract Source Code Verified (Exact Match)

Contract Name:
Spell

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 15 : MutantSpell.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./ERC721AS.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

contract Spell is Ownable, ERC721AS, ReentrancyGuard {
    constructor(
    ) ERC721AS("SPELL", "Mutant Spell", 10, 5555) {}

    function reserveMint(uint256 quantity) external onlyOwner {
        require(
            totalSupply() + quantity <= collectionSize,
            "Can't mint more."
        );
        uint256 numChunks = quantity / maxBatchSize;
        for (uint256 i = 0; i < numChunks; i++) {
            _safeMint(msg.sender, maxBatchSize);
        }
        if (quantity % maxBatchSize != 0){
            _safeMint(msg.sender, quantity % maxBatchSize);
        }
    }

    string private _baseTokenURI;

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

    function setBaseURI(string calldata baseURI) external onlyOwner {
        _baseTokenURI = baseURI;
    }

    function tokenURI(uint256 tokenId)
        public
        view
        override
        returns (string memory)
    {
        require(_exists(tokenId), "Spell does not exist.");
        string memory bookType = toString(bookTypeOf(tokenId));
        string memory spellType = toString(spellTypeOf(tokenId));
        string memory spellLevel = toString(spellLevelOf(tokenId));
        string memory tokenIdText = toString(tokenId);
        string memory baseURI = _baseURI();
        string memory output = string(abi.encodePacked(baseURI, bookType, '-', spellType, '-', spellLevel, '-', tokenIdText));
        return output;
    }

    function withdrawMoney() external onlyOwner nonReentrant {
        (bool success, ) = msg.sender.call{value: address(this).balance}("");
        require(success, "Transfer failed.");
    }

    function setOwnersExplicit(uint256 quantity) external onlyOwner nonReentrant {
        _setOwnersExplicit(quantity);
    }

    function numberMinted(address owner) public view returns (uint256) {
        return _numberMinted(owner);
    }

    function getOwnershipData(uint256 tokenId)
    external
    view
    returns (TokenOwnership memory)
    {
        return ownershipOf(tokenId);
    }

    bool public publicSaleStatus = false; //TEST PROD false
    uint256 public publicPrice = 0.006900 ether; //TEST PROD 0.0069
    uint256 public amountForPublicSale = 5555;
    uint256 public immutable publicSalePerMint = 10;

    function publicSaleMint(uint256 quantity) external payable {
        require(publicSaleStatus,"Public sale has not started.");
        require(totalSupply() + quantity <= collectionSize,"Max supply reached.");
        require(amountForPublicSale >= quantity,"Public sale limit reached.");
        require(quantity <= publicSalePerMint,"Single transaction limit reached.");
        uint maxFreeNum = potionBalanceOf();
        if (maxFreeNum == 0) {
            maxFreeNum = 1;
        } else if (maxFreeNum > 5) {
            maxFreeNum = 5;
        }
        if (numberMinted(msg.sender) + quantity > maxFreeNum) {
            uint numberToPay;
            if ( numberMinted(msg.sender) >= maxFreeNum) {
                numberToPay = quantity;
            } else {
                numberToPay = numberMinted(msg.sender) + quantity - maxFreeNum;
            }
            require(uint256(publicPrice) * numberToPay <= msg.value, string(abi.encodePacked("Not enough ETH, you are allowed ", toString(maxFreeNum), " free mint")));
        }
        _safeMint(msg.sender, quantity);
        amountForPublicSale -= quantity;
    }

    function setPublicSaleStatus(bool status) external onlyOwner {
        publicSaleStatus = status;
    }

    function getPublicSaleStatus() external view returns(bool) {
        return publicSaleStatus;
    }


    function setPotionAddress(address addr) external onlyOwner {
        potionAddress = addr;
    }

    function toString(uint256 value) internal pure returns (string memory) {
        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);
    }
}

File 2 of 15 : 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 3 of 15 : 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 4 of 15 : ERC721AS.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "../MutantPotion/Potion.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints.
 *
 * Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..).
 *
 * Assumes the number of issuable tokens (collection size) is capped and fits in a uint128.
 *
 * Does not support burning tokens to address(0).
 */
contract ERC721AS is
  Context,
  ERC165,
  IERC721,
  IERC721Metadata,
  IERC721Enumerable
{
  using Address for address;
  using Strings for uint256;

  struct TokenOwnership {
    address addr;
    uint64 startTimestamp;
  }

  uint256 private currentIndex = 0;

  uint256 internal immutable collectionSize;
  uint256 internal immutable maxBatchSize;

  // Token name
  string private _name;

  // Token symbol
  string private _symbol;

  // Mapping from token ID to ownership details
  // An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details.
  mapping(uint256 => TokenOwnership) private _ownerships;

  // Mapping owner address to address data
  mapping(address => AddressData) private _addressData;

  // 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;

  // Custom Attr
  struct AddressData {
    uint128 balance;
    uint128 numberMinted;
  }

  struct craftData {
    uint potionId;
    uint spellId;
    uint startBlock;
    uint newBookType;
    uint newSpellType;
    uint newSpellLevel;
  }

  address internal potionAddress;
  mapping(uint => uint) internal bookTypeMap;
  mapping(uint => uint) internal spellLevelMap;
  mapping(uint => uint) internal spellTypeMap;

  mapping(address => craftData) internal craftDataMap;

  // Custom Func
  function bookTypeOf(uint tokenId) public view returns (uint256) {
    require(_exists(tokenId), "This book does not exist.");
    return bookTypeMap[tokenId];
  }

  function spellLevelOf(uint tokenId) public view returns (uint256) {
    require(_exists(tokenId), "This book does not exist.");
    return spellLevelMap[tokenId];
  }

  function spellTypeOf(uint tokenId) public view returns (uint256) {
    require(_exists(tokenId), "This book does not exist.");
    return spellTypeMap[tokenId];
  }

  function getPotionAddress() public view returns (address) {
    return potionAddress;
  }

  function craftDataOf() public view returns (craftData memory) {
    return craftDataMap[msg.sender];
  }

  function potionBalanceOf() public view returns (uint) {
    Potion potionContract = Potion(potionAddress);
     return potionContract.balanceOf(msg.sender);
  }

  function craft(uint potionId, uint spellId) public {
    Potion potionContract = Potion(potionAddress);
    require(potionContract.ownerOf(potionId) == msg.sender, "This is not your potion.");
    require(_exists(spellId), "This spell does not exist.");
    require(ownerOf(spellId) == msg.sender, "This is not your spell book.");
    require(craftDataOf().startBlock == 0, "You are still crafting something...");
    if (bookTypeOf(spellId) == 0) {
      require(potionContract.levelOf(potionId) == 1, "Need Lv.1 potion.");
      craftDataMap[msg.sender].newBookType = potionContract.typeOf(potionId);
      craftDataMap[msg.sender].newSpellLevel = 0;
      craftDataMap[msg.sender].newSpellType = 0;
    } else if (bookTypeOf(spellId) != 0 && spellLevelOf(spellId) == 0) {
      require(potionContract.levelOf(potionId) >= 2, "Need Lv.2 potion.");
      craftDataMap[msg.sender].newBookType = bookTypeOf(spellId);
      craftDataMap[msg.sender].newSpellLevel = 1;
      craftDataMap[msg.sender].newSpellType = potionContract.typeOf(potionId);
    } else if (spellLevelOf(spellId) == 1) {
      require(potionContract.levelOf(potionId) >= 3, "Need Lv.3 potion.");
      craftDataMap[msg.sender].newBookType = bookTypeOf(spellId);
      if (potionContract.typeOf(potionId) == spellTypeOf(spellId)) {
        craftDataMap[msg.sender].newSpellLevel = 2;
        craftDataMap[msg.sender].newSpellType = spellTypeOf(spellId);
      } else {
        craftDataMap[msg.sender].newSpellLevel = 1;
        craftDataMap[msg.sender].newSpellType = potionContract.typeOf(potionId);
      }
    } else if (spellLevelOf(spellId) == 2) {
      require(potionContract.levelOf(potionId) >= 4, "Need Lv.4 potion.");
      craftDataMap[msg.sender].newBookType = bookTypeOf(spellId);
      craftDataMap[msg.sender].newSpellLevel = 3;
      craftDataMap[msg.sender].newSpellType = spellTypeOf(spellId);
    } else {
      revert("Can't upgrade this spell with potion.");
    }
    craftDataMap[msg.sender].potionId = potionId;
    craftDataMap[msg.sender].spellId = spellId;
    craftDataMap[msg.sender].startBlock = block.number;
  }

  function cancel() public {
    require(craftDataOf().startBlock != 0, "You are not crafting anything.");
    craftDataMap[msg.sender].startBlock = 0;
  }

  function claim() public payable {
    Potion potionContract = Potion(potionAddress);
    uint potionId = craftDataMap[msg.sender].potionId;
    uint spellId = craftDataMap[msg.sender].spellId;
    uint startBlock = craftDataMap[msg.sender].startBlock;
    require(startBlock != 0, "You are not crafting anything.");
    require(ownerOf(spellId) == msg.sender, "This is not your spell book.");
    require(potionContract.ownerOf(potionId) == msg.sender, "This is not your potion.");
    require(block.number - startBlock > 900, "Still crafting..."); //TEST, PROD 900
    if (msg.value < 0.0069 ether) {
      potionContract.transferFrom(msg.sender, 0x000000000000000000000000000000000000dEaD, craftDataMap[msg.sender].potionId);
    }
    bookTypeMap[craftDataMap[msg.sender].spellId] = craftDataMap[msg.sender].newBookType;
    spellLevelMap[craftDataMap[msg.sender].spellId] = craftDataMap[msg.sender].newSpellLevel;
    spellTypeMap[craftDataMap[msg.sender].spellId] = craftDataMap[msg.sender].newSpellType;
    craftDataMap[msg.sender].startBlock = 0;
  }

  function _burn(
    uint256 tokenId
  ) internal {
    require(_exists(tokenId), "This spell does not exist.");
    address from = ownerOf(tokenId);
    address to = address(0xdead);

    TokenOwnership memory prevOwnership = ownershipOf(tokenId);

    _beforeTokenTransfers(from, to, tokenId, 1);

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

    _addressData[from].balance -= 1;
    _addressData[to].balance += 1;
    _ownerships[tokenId] = TokenOwnership(to, uint64(block.timestamp));

    // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
    // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
    uint256 nextTokenId = tokenId + 1;
    if (_ownerships[nextTokenId].addr == address(0)) {
      if (_exists(nextTokenId)) {
        _ownerships[nextTokenId] = TokenOwnership(
          prevOwnership.addr,
          prevOwnership.startTimestamp
        );
      }
    }

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

  /**
   * @dev
   * `maxBatchSize` refers to how much a minter can mint at a time.
   * `collectionSize_` refers to how many tokens are in the collection.
   */
  constructor(
    string memory name_,
    string memory symbol_,
    uint256 maxBatchSize_,
    uint256 collectionSize_
  ) {
    require(
      collectionSize_ > 0,
      "ERC721A: collection must have a nonzero supply"
    );
    require(maxBatchSize_ > 0, "ERC721A: max batch size must be nonzero");
    _name = name_;
    _symbol = symbol_;
    maxBatchSize = maxBatchSize_;
    collectionSize = collectionSize_;
  }

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

  /**
   * @dev See {IERC721Enumerable-tokenByIndex}.
   */
  function tokenByIndex(uint256 index) public view override returns (uint256) {
    require(index < totalSupply(), "ERC721A: global index out of bounds");
    return index;
  }

  /**
   * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
   * This read function is O(collectionSize). If calling from a separate contract, be sure to test gas first.
   * It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case.
   */
  function tokenOfOwnerByIndex(address owner, uint256 index)
    public
    view
    override
    returns (uint256)
  {
    require(index < balanceOf(owner), "ERC721A: owner index out of bounds");
    uint256 numMintedSoFar = totalSupply();
    uint256 tokenIdsIdx = 0;
    address currOwnershipAddr = address(0);
    for (uint256 i = 0; i < numMintedSoFar; i++) {
      TokenOwnership memory ownership = _ownerships[i];
      if (ownership.addr != address(0)) {
        currOwnershipAddr = ownership.addr;
      }
      if (currOwnershipAddr == owner) {
        if (tokenIdsIdx == index) {
          return i;
        }
        tokenIdsIdx++;
      }
    }
    revert("ERC721A: unable to get token of owner by index");
  }

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

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

  function _numberMinted(address owner) internal view returns (uint256) {
    require(
      owner != address(0),
      "ERC721A: number minted query for the zero address"
    );
    return uint256(_addressData[owner].numberMinted);
  }

  function ownershipOf(uint256 tokenId)
    internal
    view
    returns (TokenOwnership memory)
  {
    require(_exists(tokenId), "ERC721A: owner query for nonexistent token");

    uint256 lowestTokenToCheck;
    if (tokenId >= maxBatchSize) {
      lowestTokenToCheck = tokenId - maxBatchSize + 1;
    }

    for (uint256 curr = tokenId; curr >= lowestTokenToCheck; curr--) {
      TokenOwnership memory ownership = _ownerships[curr];
      if (ownership.addr != address(0)) {
        return ownership;
      }
    }

    revert("ERC721A: unable to determine the owner of token");
  }

  /**
   * @dev See {IERC721-ownerOf}.
   */
  function ownerOf(uint256 tokenId) public view override returns (address) {
    return ownershipOf(tokenId).addr;
  }

  /**
   * @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)
  {}

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

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

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

    _approve(to, tokenId, owner);
  }

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

    return _tokenApprovals[tokenId];
  }

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

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

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

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

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

  /**
   * @dev See {IERC721-safeTransferFrom}.
   */
  function safeTransferFrom(
    address from,
    address to,
    uint256 tokenId,
    bytes memory _data
  ) public override {
    _transfer(from, to, tokenId);
    require(
      _checkOnERC721Received(from, to, tokenId, _data),
      "ERC721A: transfer to non ERC721Receiver implementer"
    );
  }

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

  function _safeMint(address to, uint256 quantity) internal {
    _safeMint(to, quantity, "");
  }

  /**
   * @dev Mints `quantity` tokens and transfers them to `to`.
   *
   * Requirements:
   *
   * - there must be `quantity` tokens remaining unminted in the total collection.
   * - `to` cannot be the zero address.
   * - `quantity` cannot be larger than the max batch size.
   *
   * Emits a {Transfer} event.
   */
  function _safeMint(
    address to,
    uint256 quantity,
    bytes memory _data
  ) internal {
    uint256 startTokenId = currentIndex;
    require(to != address(0), "ERC721A: mint to the zero address");
    require(!_exists(startTokenId), "ERC721A: token already minted");
    require(quantity <= maxBatchSize, "ERC721A: quantity to mint too high");

    _beforeTokenTransfers(address(0), to, startTokenId, quantity);

    AddressData memory addressData = _addressData[to];
    _addressData[to] = AddressData(
      addressData.balance + uint128(quantity),
      addressData.numberMinted + uint128(quantity)
    );
    _ownerships[startTokenId] = TokenOwnership(to, uint64(block.timestamp));

    uint256 updatedIndex = startTokenId;

    for (uint256 i = 0; i < quantity; i++) {
      emit Transfer(address(0), to, updatedIndex);
      require(
        _checkOnERC721Received(address(0), to, updatedIndex, _data),
        "ERC721A: transfer to non ERC721Receiver implementer"
      );
      updatedIndex++;
    }

    currentIndex = updatedIndex;
    _afterTokenTransfers(address(0), to, startTokenId, quantity);
  }

  /**
   * @dev Transfers `tokenId` from `from` to `to`.
   *
   * 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
  ) private {
    TokenOwnership memory prevOwnership = ownershipOf(tokenId);

    bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
      getApproved(tokenId) == _msgSender() ||
      isApprovedForAll(prevOwnership.addr, _msgSender()));

    require(
      isApprovedOrOwner,
      "ERC721A: transfer caller is not owner nor approved"
    );

    require(
      prevOwnership.addr == from,
      "ERC721A: transfer from incorrect owner"
    );
    require(to != address(0), "ERC721A: transfer to the zero address");

    _beforeTokenTransfers(from, to, tokenId, 1);

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

    _addressData[from].balance -= 1;
    _addressData[to].balance += 1;
    _ownerships[tokenId] = TokenOwnership(to, uint64(block.timestamp));

    // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
    // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
    uint256 nextTokenId = tokenId + 1;
    if (_ownerships[nextTokenId].addr == address(0)) {
      if (_exists(nextTokenId)) {
        _ownerships[nextTokenId] = TokenOwnership(
          prevOwnership.addr,
          prevOwnership.startTimestamp
        );
      }
    }

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

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

  uint256 public nextOwnerToExplicitlySet = 0;

  /**
   * @dev Explicitly set `owners` to eliminate loops in future calls of ownerOf().
   */
  function _setOwnersExplicit(uint256 quantity) internal {
    uint256 oldNextOwnerToSet = nextOwnerToExplicitlySet;
    require(quantity > 0, "quantity must be nonzero");
    uint256 endIndex = oldNextOwnerToSet + quantity - 1;
    if (endIndex > collectionSize - 1) {
      endIndex = collectionSize - 1;
    }
    // We know if the last one in the group exists, all in the group exist, due to serial ordering.
    require(_exists(endIndex), "not enough minted yet for this cleanup");
    for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) {
      if (_ownerships[i].addr == address(0)) {
        TokenOwnership memory ownership = ownershipOf(i);
        _ownerships[i] = TokenOwnership(
          ownership.addr,
          ownership.startTimestamp
        );
      }
    }
    nextOwnerToExplicitlySet = endIndex + 1;
  }

  /**
   * @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(to).onERC721Received.selector;
      } catch (bytes memory reason) {
        if (reason.length == 0) {
          revert("ERC721A: transfer to non ERC721Receiver implementer");
        } else {
          assembly {
            revert(add(32, reason), mload(reason))
          }
        }
      }
    } else {
      return true;
    }
  }

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

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

File 5 of 15 : 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 6 of 15 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

File 7 of 15 : Potion.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./ERC721A.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

contract Potion is Ownable, ERC721A, ReentrancyGuard {
    constructor(
    ) ERC721A("POTION", "Mutant Potion", 10, 6666) {}

    function reserveMint(uint256 quantity) external onlyOwner {
        require(
            totalSupply() + quantity <= collectionSize,
            "Can't mint more."
        );
        uint256 numChunks = quantity / maxBatchSize;
        for (uint256 i = 0; i < numChunks; i++) {
            _safeMint(msg.sender, maxBatchSize);
        }
        if (quantity % maxBatchSize != 0){
            _safeMint(msg.sender, quantity % maxBatchSize);
        }
    }

    string private _baseTokenURI;

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

    function setBaseURI(string calldata baseURI) external onlyOwner {
        _baseTokenURI = baseURI;
    }

    function tokenURI(uint256 tokenId)
        public
        view
        override
        returns (string memory)
    {
        require(_exists(tokenId), "Potion does not exist.");
        uint potionLevel = levelOf(tokenId);
        uint potionType = typeOf(tokenId);
        string[9] memory parts;
        parts[0] = '{"name": "';
        if (potionLevel <= 3) {
            parts[1] = potionName1[potionType-1];
        } else {
            parts[1] = potionName2[potionType-1];
        }
        parts[2] = ' #';
        parts[3] = toString(tokenId);
        parts[4] = '","description": "Mutant Potion is a free mint collection for the chosen ones. Handle with care. Instructions to follow on our official website.","image":"';
        parts[5] = string(abi.encodePacked( _baseURI(), toString(potionType), '-', toString(potionLevel), '.png'));
        parts[6] = '","attributes": [{"trait_type": "Level","value":';
        parts[7] = toString(potionLevel);
        parts[8] = '}]}';

        string memory output = string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5], parts[6], parts[7], parts[8]));

        string memory json = Base64.encode(bytes(output));
    
        output = string(abi.encodePacked('data:application/json;base64,', json));
        return output;
    }

    function withdrawMoney() external onlyOwner nonReentrant {
        (bool success, ) = msg.sender.call{value: address(this).balance}("");
        require(success, "Transfer failed.");
    }

    function setOwnersExplicit(uint256 quantity) external onlyOwner nonReentrant {
        _setOwnersExplicit(quantity);
    }

    function numberMinted(address owner) public view returns (uint256) {
        return _numberMinted(owner);
    }

    function isChosenOne(address owner) public view returns (bool) {
        bool chosen = false;
        for (uint i = 0; i < chosenList.length; i++) {
            IERC721 c = IERC721(chosenList[i]);
            if (c.balanceOf(owner) > 0) {
                chosen = true;
                break;
            }
        }
        return chosen;
    }

    function getOwnershipData(uint256 tokenId)
    external
    view
    returns (TokenOwnership memory)
    {
        return ownershipOf(tokenId);
    }

    bool public publicSaleStatus = true; //TEST PROD false
    uint256 public publicPrice = 0.0003900 ether; //TEST PROD 0.0039
    uint256 public amountForPublicSale = 6666;
    uint256 public immutable publicSalePerMint = 10;

    function publicSaleMint(uint256 quantity) external payable {
        require(publicSaleStatus,"Public sale has not started.");
        require(totalSupply() + quantity <= collectionSize,"Max supply reached.");
        require(amountForPublicSale >= quantity,"Public sale limit reached.");
        require(quantity <= publicSalePerMint,"Single transaction limit reached.");
        bool chosen = isChosenOne(msg.sender);
        if (chosen && numberMinted(msg.sender) + quantity > 5) {
            uint numberToPay;
            if ( numberMinted(msg.sender) >= 5) {
                numberToPay = quantity;
            } else {
                numberToPay = numberMinted(msg.sender) + quantity - 5;
            }
            require(uint256(publicPrice) * numberToPay <= msg.value,"Not enough ETH, chosen ones can mint 5 potion for free");
        } else if (!chosen && numberMinted(msg.sender) + quantity > 1) {
            uint numberToPay;
            if ( numberMinted(msg.sender) >= 1) {
                numberToPay = quantity;
            } else {
                numberToPay = numberMinted(msg.sender) + quantity - 1;
            }
            require(uint256(publicPrice) * numberToPay <= msg.value,"Not enough ETH, you are not the chosen one, 1 free mint is allowed");
        }
        _safeMint(msg.sender, quantity);
        amountForPublicSale -= quantity;
    }

    function setPublicSaleStatus(bool status) external onlyOwner {
        publicSaleStatus = status;
    }

    function getPublicSaleStatus() external view returns(bool) {
        return publicSaleStatus;
    }

    function toString(uint256 value) internal pure returns (string memory) {
        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);
    }

    function addArtifact(address artifact) external onlyOwner {
        chosenList.push(artifact);
    }

    function removeArtifact(uint index) external onlyOwner {
        require(index < chosenList.length);
        chosenList[index] = chosenList[chosenList.length-1];
        chosenList.pop();
    }

    function stakeArtifact(address itemAddress, uint tokenId, address staker, address vault) external onlyOwner {
        IERC721 artifact = IERC721(itemAddress);
        artifact.transferFrom(staker, vault, tokenId);
    }
}

library Base64 {
    bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    function encode(bytes memory data) internal pure returns (string memory) {
        uint256 len = data.length;
        if (len == 0) return "";

        uint256 encodedLen = 4 * ((len + 2) / 3);

        bytes memory result = new bytes(encodedLen + 32);

        bytes memory table = TABLE;

        assembly {
            let tablePtr := add(table, 1)
            let resultPtr := add(result, 32)

            for {
                let i := 0
            } lt(i, len) {

            } {
                i := add(i, 3)
                let input := and(mload(add(data, i)), 0xffffff)

                let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))
                out := shl(8, out)
                out := add(out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF))
                out := shl(8, out)
                out := add(out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF))
                out := shl(8, out)
                out := add(out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF))
                out := shl(224, out)

                mstore(resultPtr, out)

                resultPtr := add(resultPtr, 4)
            }

            switch mod(len, 3)
            case 1 {
                mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
            }
            case 2 {
                mstore(sub(resultPtr, 1), shl(248, 0x3d))
            }

            mstore(result, encodedLen)
        }

        return string(result);
    }
}

File 8 of 15 : 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 9 of 15 : 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 10 of 15 : 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 11 of 15 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 12 of 15 : 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 13 of 15 : 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 14 of 15 : 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 15 of 15 : ERC721A.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints.
 *
 * Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..).
 *
 * Assumes the number of issuable tokens (collection size) is capped and fits in a uint128.
 *
 * Does not support burning tokens to address(0).
 */
contract ERC721A is
  Context,
  ERC165,
  IERC721,
  IERC721Metadata,
  IERC721Enumerable
{
  using Address for address;
  using Strings for uint256;

  struct TokenOwnership {
    address addr;
    uint64 startTimestamp;
  }

  struct AddressData {
    uint128 balance;
    uint128 numberMinted;
  }

  struct brewData {
    uint tokenIdA;
    uint tokenIdB;
    address artifact;
    uint startBlock;
  }

  uint256 private currentIndex = 0;

  uint256 internal immutable collectionSize;
  uint256 internal immutable maxBatchSize;

  // Token name
  string private _name;

  // Token symbol
  string private _symbol;

  // Mapping from token ID to ownership details
  // An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details.
  mapping(uint256 => TokenOwnership) private _ownerships;

  // Mapping owner address to address data
  mapping(address => AddressData) private _addressData;

  // 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;

  // Custom Attr
  // address[] internal chosenList = [0x39ee2c7b3cb80254225884ca001F57118C8f21B6,0x31d45de84fdE2fB36575085e05754a4932DD5170,0x23581767a106ae21c074b2276D25e5C3e136a68b,0x34d85c9CDeB23FA97cb08333b511ac86E1C4E258,0x60E4d786628Fea6478F785A6d7e704777c86a7c6,0xBd3531dA5CF5857e7CfAA92426877b022e612cf8,0xd1258DB6Ac08eB0e625B75b371C023dA478E94A9,0x49cF6f5d44E70224e2E23fDcdd2C053F30aDA28B,0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D,0x8a90CAb2b38dba80c64b7734e58Ee1dB38B8992e,0xba30E5F9Bb24caa003E9f2f0497Ad287FDF95623,0xED5AF388653567Af2F388E6224dC7C4b3241C544];
  address[] internal chosenList;
  // address[] internal chosenList = [];

  string[] internal potionName1 = ["Red Potion" , "Aqua Potion" , "Dark Potion" , "Night Potion" , "Dream Potion" , "Firefly Potion"];
  string[] internal potionName2 = ["Alchemist Potion", "Alchemist Potion" , "Rainbow Potion" , "Rainbow Potion", "Purity Potion", "Purity Potion" ];
  mapping(uint => uint) internal potionLevelMap;
  mapping(uint => uint) internal potionTypeMap;
  mapping(address => brewData) internal brewDataMap;

  function typeOf(uint tokenId) public view returns (uint256) {
    require(_exists(tokenId), "This potion does not exist.");
    return potionTypeMap[tokenId] + 1;
  }

  function levelOf(uint tokenId) public view returns (uint256) {
    require(_exists(tokenId), "This potion does not exist.");
    return potionLevelMap[tokenId] + 1;
  }

  function isArtifact(address testArtifact) public view returns (bool) {
    bool chosen = false;
    for (uint i = 0; i < chosenList.length; i++) {
        if (chosenList[i] == testArtifact) {
            chosen = true;
            break;
        }
    }
    return chosen;
  }

  function getArtifactList() public view returns (address[] memory) {
    return chosenList;
  }

  function brewDataOf() public view returns (brewData memory) {
    return brewDataMap[msg.sender];
  }

  function brew(uint tokenIdA, uint tokenIdB, address artifact) public {
    require(_exists(tokenIdA), "1st potion does not exist.");
    require(ownerOf(tokenIdA) == msg.sender, "1st potion is not owned by you.");
    require(_exists(tokenIdB), "2nd potion does not exist.");
    require(ownerOf(tokenIdB) == msg.sender, "2nd potion is not owned by you.");
    require(brewDataOf().startBlock == 0, "You are still brewing something...");
    require(isArtifact(artifact), "Invalid artifact.");
    brewDataMap[msg.sender].tokenIdA = tokenIdA;
    brewDataMap[msg.sender].tokenIdB = tokenIdB;
    brewDataMap[msg.sender].artifact = artifact;
    brewDataMap[msg.sender].startBlock = block.number;
  }

  function cancel() public {
    require(brewDataOf().startBlock != 0, "You are not brewing anything.");
    brewDataMap[msg.sender].startBlock = 0;
  }

  function claim() public payable {
    uint tokenIdA = brewDataMap[msg.sender].tokenIdA;
    uint tokenIdB = brewDataMap[msg.sender].tokenIdB;
    IERC721 artifact = IERC721(brewDataMap[msg.sender].artifact);
    uint startBlock = brewDataMap[msg.sender].startBlock;
    require(startBlock != 0, "You are not brewing anything.");
    require(_exists(tokenIdA), "1st potion does not exist.");
    require(ownerOf(tokenIdA) == msg.sender, "1st potion is not owned by you.");
    require(_exists(tokenIdB), "2nd potion does not exist.");
    require(ownerOf(tokenIdB) == msg.sender, "2nd potion is not owned by you.");
    uint potionLevelA = levelOf(tokenIdA);
    uint potionTypeA = typeOf(tokenIdA);
    uint potionLevelB = levelOf(tokenIdB);
    uint potionTypeB = typeOf(tokenIdB);
    if (potionLevelA == 1) {
      require(potionLevelB == 1, "Brewing failed, try potion with the same level.");
      require(potionTypeB == potionTypeA, "Brewing failed, try potion with the same type.");
      require(msg.value >= 0.0039 ether, "Not enough ETH.");
      require(block.number - startBlock > 0, "Still brewing..."); //TEST, PROD 300
      _burn(tokenIdB);
      potionLevelMap[tokenIdA] ++;
      brewDataMap[msg.sender].startBlock = 0;
      return;
    } else if (potionLevelA == 2){
      require(potionLevelB == 2, "Brewing failed, try potion with the same level.");
      require(potionTypeB == potionTypeA, "Brewing failed, try potion with the same type.");
      require(msg.value >= 0.0039 ether, "Not enough ETH.");
      require(block.number - startBlock > 0, "Still brewing..."); //TEST, PROD 3600
      require(artifact.balanceOf(msg.sender) > 0, "You don't own any artifacts."); 
      _burn(tokenIdB);
      potionLevelMap[tokenIdA] ++;
      brewDataMap[msg.sender].startBlock = 0;
      return;
    } else if (potionLevelA == 3){
      require(potionLevelB == 3, "Brewing failed, try potion with the same level.");
      if (potionTypeA == 1 || potionTypeA == 3 || potionTypeA == 5) {
        require(potionTypeB == potionTypeA + 1, "Brewing failed, try potion with the right type.");
      } else {
        require(potionTypeB == potionTypeA - 1, "Brewing failed, try potion with the right type.");
      }
      require(msg.value >= 0.0039 ether, "Not enough ETH.");
      require(block.number - startBlock > 0, "Still brewing..."); //TEST, PROD 7200
      require(artifact.balanceOf(msg.sender) > 0, "You don't own any artifacts."); 
      _burn(tokenIdB);
      potionLevelMap[tokenIdA] ++;
      brewDataMap[msg.sender].startBlock = 0;
      return;
    } else {
      revert("Brewing failed, try potion with different level.");
    }
  }

  function _burn(
    uint256 tokenId
  ) internal {
    require(_exists(tokenId), "This potion does not exist.");
    address from = ownerOf(tokenId);
    address to = address(0xdead);

    TokenOwnership memory prevOwnership = ownershipOf(tokenId);

    _beforeTokenTransfers(from, to, tokenId, 1);

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

    _addressData[from].balance -= 1;
    _addressData[to].balance += 1;
    _ownerships[tokenId] = TokenOwnership(to, uint64(block.timestamp));

    // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
    // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
    uint256 nextTokenId = tokenId + 1;
    if (_ownerships[nextTokenId].addr == address(0)) {
      if (_exists(nextTokenId)) {
        _ownerships[nextTokenId] = TokenOwnership(
          prevOwnership.addr,
          prevOwnership.startTimestamp
        );
      }
    }

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

  /**
   * @dev
   * `maxBatchSize` refers to how much a minter can mint at a time.
   * `collectionSize_` refers to how many tokens are in the collection.
   */
  constructor(
    string memory name_,
    string memory symbol_,
    uint256 maxBatchSize_,
    uint256 collectionSize_
  ) {
    require(
      collectionSize_ > 0,
      "ERC721A: collection must have a nonzero supply"
    );
    require(maxBatchSize_ > 0, "ERC721A: max batch size must be nonzero");
    _name = name_;
    _symbol = symbol_;
    maxBatchSize = maxBatchSize_;
    collectionSize = collectionSize_;
  }

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

  /**
   * @dev See {IERC721Enumerable-tokenByIndex}.
   */
  function tokenByIndex(uint256 index) public view override returns (uint256) {
    require(index < totalSupply(), "ERC721A: global index out of bounds");
    return index;
  }

  /**
   * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
   * This read function is O(collectionSize). If calling from a separate contract, be sure to test gas first.
   * It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case.
   */
  function tokenOfOwnerByIndex(address owner, uint256 index)
    public
    view
    override
    returns (uint256)
  {
    require(index < balanceOf(owner), "ERC721A: owner index out of bounds");
    uint256 numMintedSoFar = totalSupply();
    uint256 tokenIdsIdx = 0;
    address currOwnershipAddr = address(0);
    for (uint256 i = 0; i < numMintedSoFar; i++) {
      TokenOwnership memory ownership = _ownerships[i];
      if (ownership.addr != address(0)) {
        currOwnershipAddr = ownership.addr;
      }
      if (currOwnershipAddr == owner) {
        if (tokenIdsIdx == index) {
          return i;
        }
        tokenIdsIdx++;
      }
    }
    revert("ERC721A: unable to get token of owner by index");
  }

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

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

  function _numberMinted(address owner) internal view returns (uint256) {
    require(
      owner != address(0),
      "ERC721A: number minted query for the zero address"
    );
    return uint256(_addressData[owner].numberMinted);
  }

  function ownershipOf(uint256 tokenId)
    internal
    view
    returns (TokenOwnership memory)
  {
    require(_exists(tokenId), "ERC721A: owner query for nonexistent token");

    uint256 lowestTokenToCheck;
    if (tokenId >= maxBatchSize) {
      lowestTokenToCheck = tokenId - maxBatchSize + 1;
    }

    for (uint256 curr = tokenId; curr >= lowestTokenToCheck; curr--) {
      TokenOwnership memory ownership = _ownerships[curr];
      if (ownership.addr != address(0)) {
        return ownership;
      }
    }

    revert("ERC721A: unable to determine the owner of token");
  }

  /**
   * @dev See {IERC721-ownerOf}.
   */
  function ownerOf(uint256 tokenId) public view override returns (address) {
    return ownershipOf(tokenId).addr;
  }

  /**
   * @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)
  {}

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

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

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

    _approve(to, tokenId, owner);
  }

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

    return _tokenApprovals[tokenId];
  }

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

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

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

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

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

  /**
   * @dev See {IERC721-safeTransferFrom}.
   */
  function safeTransferFrom(
    address from,
    address to,
    uint256 tokenId,
    bytes memory _data
  ) public override {
    _transfer(from, to, tokenId);
    require(
      _checkOnERC721Received(from, to, tokenId, _data),
      "ERC721A: transfer to non ERC721Receiver implementer"
    );
  }

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

  function _safeMint(address to, uint256 quantity) internal {
    _safeMint(to, quantity, "");
  }

  /**
   * @dev Mints `quantity` tokens and transfers them to `to`.
   *
   * Requirements:
   *
   * - there must be `quantity` tokens remaining unminted in the total collection.
   * - `to` cannot be the zero address.
   * - `quantity` cannot be larger than the max batch size.
   *
   * Emits a {Transfer} event.
   */
  function _safeMint(
    address to,
    uint256 quantity,
    bytes memory _data
  ) internal {
    uint256 startTokenId = currentIndex;
    require(to != address(0), "ERC721A: mint to the zero address");
    require(!_exists(startTokenId), "ERC721A: token already minted");
    require(quantity <= maxBatchSize, "ERC721A: quantity to mint too high");

    _beforeTokenTransfers(address(0), to, startTokenId, quantity);

    AddressData memory addressData = _addressData[to];
    _addressData[to] = AddressData(
      addressData.balance + uint128(quantity),
      addressData.numberMinted + uint128(quantity)
    );
    _ownerships[startTokenId] = TokenOwnership(to, uint64(block.timestamp));

    uint256 updatedIndex = startTokenId;

    for (uint256 i = 0; i < quantity; i++) {
      uint fakeRnd = uint256(blockhash(block.number)) + uint256(uint160(msg.sender)) + startTokenId + i;
      uint potionType = fakeRnd % 6;
      potionTypeMap[startTokenId + i] = potionType;
      if (msg.value < 0.003 ether && potionType >= 3) {
        potionTypeMap[startTokenId + i] = potionType - 3;
      }

      emit Transfer(address(0), to, updatedIndex);
      require(
        _checkOnERC721Received(address(0), to, updatedIndex, _data),
        "ERC721A: transfer to non ERC721Receiver implementer"
      );
      updatedIndex++;
    }

    currentIndex = updatedIndex;
    _afterTokenTransfers(address(0), to, startTokenId, quantity);
  }

  /**
   * @dev Transfers `tokenId` from `from` to `to`.
   *
   * 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
  ) private {
    TokenOwnership memory prevOwnership = ownershipOf(tokenId);

    bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
      getApproved(tokenId) == _msgSender() ||
      isApprovedForAll(prevOwnership.addr, _msgSender()));

    require(
      isApprovedOrOwner,
      "ERC721A: transfer caller is not owner nor approved"
    );

    require(
      prevOwnership.addr == from,
      "ERC721A: transfer from incorrect owner"
    );
    require(to != address(0), "ERC721A: transfer to the zero address");

    _beforeTokenTransfers(from, to, tokenId, 1);

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

    _addressData[from].balance -= 1;
    _addressData[to].balance += 1;
    _ownerships[tokenId] = TokenOwnership(to, uint64(block.timestamp));

    // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
    // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
    uint256 nextTokenId = tokenId + 1;
    if (_ownerships[nextTokenId].addr == address(0)) {
      if (_exists(nextTokenId)) {
        _ownerships[nextTokenId] = TokenOwnership(
          prevOwnership.addr,
          prevOwnership.startTimestamp
        );
      }
    }

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

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

  uint256 public nextOwnerToExplicitlySet = 0;

  /**
   * @dev Explicitly set `owners` to eliminate loops in future calls of ownerOf().
   */
  function _setOwnersExplicit(uint256 quantity) internal {
    uint256 oldNextOwnerToSet = nextOwnerToExplicitlySet;
    require(quantity > 0, "quantity must be nonzero");
    uint256 endIndex = oldNextOwnerToSet + quantity - 1;
    if (endIndex > collectionSize - 1) {
      endIndex = collectionSize - 1;
    }
    // We know if the last one in the group exists, all in the group exist, due to serial ordering.
    require(_exists(endIndex), "not enough minted yet for this cleanup");
    for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) {
      if (_ownerships[i].addr == address(0)) {
        TokenOwnership memory ownership = ownershipOf(i);
        _ownerships[i] = TokenOwnership(
          ownership.addr,
          ownership.startTimestamp
        );
      }
    }
    nextOwnerToExplicitlySet = endIndex + 1;
  }

  /**
   * @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(to).onERC721Received.selector;
      } catch (bytes memory reason) {
        if (reason.length == 0) {
          revert("ERC721A: transfer to non ERC721Receiver implementer");
        } else {
          assembly {
            revert(add(32, reason), mload(reason))
          }
        }
      }
    } else {
      return true;
    }
  }

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"amountForPublicSale","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"bookTypeOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"potionId","type":"uint256"},{"internalType":"uint256","name":"spellId","type":"uint256"}],"name":"craft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"craftDataOf","outputs":[{"components":[{"internalType":"uint256","name":"potionId","type":"uint256"},{"internalType":"uint256","name":"spellId","type":"uint256"},{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"uint256","name":"newBookType","type":"uint256"},{"internalType":"uint256","name":"newSpellType","type":"uint256"},{"internalType":"uint256","name":"newSpellLevel","type":"uint256"}],"internalType":"struct ERC721AS.craftData","name":"","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":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getOwnershipData","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"}],"internalType":"struct ERC721AS.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPotionAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPublicSaleStatus","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":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextOwnerToExplicitlySet","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"numberMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"potionBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"publicSaleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"publicSalePerMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSaleStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"reserveMint","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":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"setOwnersExplicit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setPotionAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"status","type":"bool"}],"name":"setPublicSaleStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"spellLevelOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"spellTypeOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawMoney","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e060405260006001819055600d556010805460ff191690556618838370f340006011556115b3601255600a60c0523480156200003b57600080fd5b506040518060400160405280600581526020016414d411531360da1b8152506040518060400160405280600c81526020016b135d5d185b9d0814dc195b1b60a21b815250600a6115b36200009e62000098620001af60201b60201c565b620001b3565b600081116200010b5760405162461bcd60e51b815260206004820152602e60248201527f455243373231413a20636f6c6c656374696f6e206d757374206861766520612060448201526d6e6f6e7a65726f20737570706c7960901b60648201526084015b60405180910390fd5b600082116200016d5760405162461bcd60e51b815260206004820152602760248201527f455243373231413a206d61782062617463682073697a65206d757374206265206044820152666e6f6e7a65726f60c81b606482015260840162000102565b83516200018290600290602087019062000203565b5082516200019890600390602086019062000203565b5060a09190915260805250506001600e55620002e6565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8280546200021190620002a9565b90600052602060002090601f01602090048101928262000235576000855562000280565b82601f106200025057805160ff191683800117855562000280565b8280016001018555821562000280579182015b828111156200028057825182559160200191906001019062000263565b506200028e92915062000292565b5090565b5b808211156200028e576000815560010162000293565b600181811c90821680620002be57607f821691505b60208210811415620002e057634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c0516138816200035c600039600081816103f80152611ea6015260008181610b3d01528181610b7501528181610bb101528181610be4015281816129ab015281816129d50152612ea0015260008181610ac201528181611ddb015281816127b001526127e201526138816000f3fe60806040526004361061025c5760003560e01c80638da5cb5b11610144578063b7bef61c116100b6578063d7224ba01161007a578063d7224ba01461073d578063dc33e68114610753578063e985e9c514610773578063ea8a1af0146107bc578063f0c21dcd146107d1578063f2fde38b146107f157600080fd5b8063b7bef61c1461069f578063b88d4fde146106bd578063bfb2959a146106dd578063c87b56dd146106fd578063cbafd4ea1461071d57600080fd5b8063a22cb46511610108578063a22cb46514610607578063a945bf8014610627578063ac4460021461063d578063b3ab66b014610652578063b423fe6714610665578063b6c693e51461068557600080fd5b80638da5cb5b1461050f5780639231ab2a1461052d57806394891c871461057b57806395d89b41146105dc5780639dc74e63146105f157600080fd5b80632f745c59116101dd5780634f6ccce7116101a15780634f6ccce71461045a57806355f804b31461047a5780636352211e1461049a57806370a08231146104ba578063715018a6146104da5780638291f8f6146104ef57600080fd5b80632f745c59146103c65780633ba5ae24146103e657806342842e0e1461041a578063499e8eec1461043a5780634e71d92d1461045257600080fd5b806318160ddd1161022457806318160ddd1461033257806323b872dd1461035157806324b10a7714610371578063289137a1146103865780632d20fb60146103a657600080fd5b806301ffc9a71461026157806306fdde0314610296578063081812fc146102b8578063095ea7b3146102f05780631342ff4c14610312575b600080fd5b34801561026d57600080fd5b5061028161027c36600461337a565b610811565b60405190151581526020015b60405180910390f35b3480156102a257600080fd5b506102ab61087e565b60405161028d91906135c9565b3480156102c457600080fd5b506102d86102d3366004613426565b610910565b6040516001600160a01b03909116815260200161028d565b3480156102fc57600080fd5b5061031061030b366004613333565b6109a0565b005b34801561031e57600080fd5b5061031061032d366004613426565b610ab8565b34801561033e57600080fd5b506001545b60405190815260200161028d565b34801561035d57600080fd5b5061031061036c3660046131dd565b610c12565b34801561037d57600080fd5b50610343610c1d565b34801561039257600080fd5b506103106103a1366004613458565b610ca1565b3480156103b257600080fd5b506103106103c1366004613426565b6114d9565b3480156103d257600080fd5b506103436103e1366004613333565b61154a565b3480156103f257600080fd5b506103437f000000000000000000000000000000000000000000000000000000000000000081565b34801561042657600080fd5b506103106104353660046131dd565b6116c3565b34801561044657600080fd5b5060105460ff16610281565b6103106116de565b34801561046657600080fd5b50610343610475366004613426565b6119ba565b34801561048657600080fd5b506103106104953660046133b4565b611a23565b3480156104a657600080fd5b506102d86104b5366004613426565b611a37565b3480156104c657600080fd5b506103436104d5366004613163565b611a49565b3480156104e657600080fd5b50610310611ada565b3480156104fb57600080fd5b5061031061050a366004613163565b611aee565b34801561051b57600080fd5b506000546001600160a01b03166102d8565b34801561053957600080fd5b5061054d610548366004613426565b611b18565b6040805182516001600160a01b0316815260209283015167ffffffffffffffff16928101929092520161028d565b34801561058757600080fd5b50610590611b35565b60405161028d9190600060c082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015292915050565b3480156105e857600080fd5b506102ab611bc8565b3480156105fd57600080fd5b5061034360125481565b34801561061357600080fd5b506103106106223660046132fe565b611bd7565b34801561063357600080fd5b5061034360115481565b34801561064957600080fd5b50610310611c9c565b610310610660366004613426565b611d87565b34801561067157600080fd5b5061031061068036600461335f565b612018565b34801561069157600080fd5b506010546102819060ff1681565b3480156106ab57600080fd5b506008546001600160a01b03166102d8565b3480156106c957600080fd5b506103106106d836600461321e565b612033565b3480156106e957600080fd5b506103436106f8366004613426565b61206c565b34801561070957600080fd5b506102ab610718366004613426565b6120a8565b34801561072957600080fd5b50610343610738366004613426565b61217e565b34801561074957600080fd5b50610343600d5481565b34801561075f57600080fd5b5061034361076e366004613163565b6121ba565b34801561077f57600080fd5b5061028161078e3660046131a4565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b3480156107c857600080fd5b506103106121c5565b3480156107dd57600080fd5b506103436107ec366004613426565b612232565b3480156107fd57600080fd5b5061031061080c366004613163565b61226e565b60006001600160e01b031982166380ac58cd60e01b148061084257506001600160e01b03198216635b5e139f60e01b145b8061085d57506001600160e01b0319821663780e9d6360e01b145b8061087857506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606002805461088d9061375e565b80601f01602080910402602001604051908101604052809291908181526020018280546108b99061375e565b80156109065780601f106108db57610100808354040283529160200191610906565b820191906000526020600020905b8154815290600101906020018083116108e957829003601f168201915b5050505050905090565b600061091d826001541190565b6109845760405162461bcd60e51b815260206004820152602d60248201527f455243373231413a20617070726f76656420717565727920666f72206e6f6e6560448201526c3c34b9ba32b73a103a37b5b2b760991b60648201526084015b60405180910390fd5b506000908152600660205260409020546001600160a01b031690565b60006109ab82611a37565b9050806001600160a01b0316836001600160a01b03161415610a1a5760405162461bcd60e51b815260206004820152602260248201527f455243373231413a20617070726f76616c20746f2063757272656e74206f776e60448201526132b960f11b606482015260840161097b565b336001600160a01b0382161480610a365750610a36813361078e565b610aa85760405162461bcd60e51b815260206004820152603960248201527f455243373231413a20617070726f76652063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f76656420666f7220616c6c00000000000000606482015260840161097b565b610ab38383836122e7565b505050565b610ac0612343565b7f000000000000000000000000000000000000000000000000000000000000000081610aeb60015490565b610af59190613691565b1115610b365760405162461bcd60e51b815260206004820152601060248201526f21b0b713ba1036b4b73a1036b7b9329760811b604482015260640161097b565b6000610b627f0000000000000000000000000000000000000000000000000000000000000000836136a9565b905060005b81811015610bab57610b99337f000000000000000000000000000000000000000000000000000000000000000061239d565b80610ba381613799565b915050610b67565b50610bd67f0000000000000000000000000000000000000000000000000000000000000000836137b4565b15610c0e57610c0e33610c097f0000000000000000000000000000000000000000000000000000000000000000856137b4565b61239d565b5050565b610ab38383836123b7565b6008546040516370a0823160e01b81523360048201526000916001600160a01b03169081906370a082319060240160206040518083038186803b158015610c6357600080fd5b505afa158015610c77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9b919061343f565b91505090565b6008546040516331a9108f60e11b8152600481018490526001600160a01b039091169033908290636352211e9060240160206040518083038186803b158015610ce957600080fd5b505afa158015610cfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d219190613187565b6001600160a01b031614610d725760405162461bcd60e51b81526020600482015260186024820152772a3434b99034b9903737ba103cb7bab9103837ba34b7b71760411b604482015260640161097b565b610d7d826001541190565b610dc95760405162461bcd60e51b815260206004820152601a60248201527f54686973207370656c6c20646f6573206e6f742065786973742e000000000000604482015260640161097b565b33610dd383611a37565b6001600160a01b031614610e295760405162461bcd60e51b815260206004820152601c60248201527f54686973206973206e6f7420796f7572207370656c6c20626f6f6b2e00000000604482015260640161097b565b610e31611b35565b6040015115610e8e5760405162461bcd60e51b815260206004820152602360248201527f596f7520617265207374696c6c206372616674696e6720736f6d657468696e6760448201526217171760e91b606482015260840161097b565b610e978261206c565b610ff7576040516336af181960e11b8152600481018490526001600160a01b03821690636d5e30329060240160206040518083038186803b158015610edb57600080fd5b505afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f13919061343f565b600114610f565760405162461bcd60e51b81526020600482015260116024820152702732b2b210263b1718903837ba34b7b71760791b604482015260640161097b565b60405163c588ff8b60e01b8152600481018490526001600160a01b0382169063c588ff8b9060240160206040518083038186803b158015610f9657600080fd5b505afa158015610faa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fce919061343f565b336000908152600c602052604081206003810192909255600582018190556004909101556114b8565b6110008261206c565b15801590611014575061101282612232565b155b15611192576040516336af181960e11b8152600481018490526002906001600160a01b03831690636d5e30329060240160206040518083038186803b15801561105c57600080fd5b505afa158015611070573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611094919061343f565b10156110d65760405162461bcd60e51b81526020600482015260116024820152702732b2b210263b1719103837ba34b7b71760791b604482015260640161097b565b6110df8261206c565b336000908152600c602052604090819020600381019290925560016005909201919091555163c588ff8b60e01b8152600481018490526001600160a01b0382169063c588ff8b906024015b60206040518083038186803b15801561114257600080fd5b505afa158015611156573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117a919061343f565b336000908152600c60205260409020600401556114b8565b61119b82612232565b60011415611367576040516336af181960e11b8152600481018490526003906001600160a01b03831690636d5e30329060240160206040518083038186803b1580156111e657600080fd5b505afa1580156111fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061121e919061343f565b10156112605760405162461bcd60e51b81526020600482015260116024820152702732b2b210263b1719903837ba34b7b71760791b604482015260640161097b565b6112698261206c565b336000908152600c60205260409020600301556112858261217e565b60405163c588ff8b60e01b8152600481018590526001600160a01b0383169063c588ff8b9060240160206040518083038186803b1580156112c557600080fd5b505afa1580156112d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112fd919061343f565b141561132357336000908152600c60205260409020600260059091015561117a8261217e565b336000908152600c60205260409081902060016005909101555163c588ff8b60e01b8152600481018490526001600160a01b0382169063c588ff8b9060240161112a565b61137082612232565b60021415611462576040516336af181960e11b81526004808201859052906001600160a01b03831690636d5e30329060240160206040518083038186803b1580156113ba57600080fd5b505afa1580156113ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f2919061343f565b10156114345760405162461bcd60e51b81526020600482015260116024820152702732b2b210263b171a103837ba34b7b71760791b604482015260640161097b565b61143d8261206c565b336000908152600c602052604090206003808201929092556005015561117a8261217e565b60405162461bcd60e51b815260206004820152602560248201527f43616e277420757067726164652074686973207370656c6c207769746820706f6044820152643a34b7b71760d91b606482015260840161097b565b50336000908152600c60205260409020918255600182015543600290910155565b6114e1612343565b6002600e5414156115345760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161097b565b6002600e556115428161273f565b506001600e55565b600061155583611a49565b82106115ae5760405162461bcd60e51b815260206004820152602260248201527f455243373231413a206f776e657220696e646578206f7574206f6620626f756e604482015261647360f01b606482015260840161097b565b60006115b960015490565b905060008060005b83811015611663576000818152600460209081526040918290208251808401909352546001600160a01b038116808452600160a01b90910467ffffffffffffffff16918301919091521561161457805192505b876001600160a01b0316836001600160a01b0316141561165057868414156116425750935061087892505050565b8361164c81613799565b9450505b508061165b81613799565b9150506115c1565b5060405162461bcd60e51b815260206004820152602e60248201527f455243373231413a20756e61626c6520746f2067657420746f6b656e206f662060448201526d0deeedccae440c4f240d2dcc8caf60931b606482015260840161097b565b610ab383838360405180602001604052806000815250612033565b600854336000908152600c60205260409020805460018201546002909201546001600160a01b0390931692909190806117595760405162461bcd60e51b815260206004820152601e60248201527f596f7520617265206e6f74206372616674696e6720616e797468696e672e0000604482015260640161097b565b3361176383611a37565b6001600160a01b0316146117b95760405162461bcd60e51b815260206004820152601c60248201527f54686973206973206e6f7420796f7572207370656c6c20626f6f6b2e00000000604482015260640161097b565b6040516331a9108f60e11b81526004810184905233906001600160a01b03861690636352211e9060240160206040518083038186803b1580156117fb57600080fd5b505afa15801561180f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118339190613187565b6001600160a01b0316146118845760405162461bcd60e51b81526020600482015260186024820152772a3434b99034b9903737ba103cb7bab9103837ba34b7b71760411b604482015260640161097b565b6103846118918243613704565b116118d25760405162461bcd60e51b815260206004820152601160248201527029ba34b6361031b930b33a34b73397171760791b604482015260640161097b565b6618838370f3400034101561195b57336000818152600c6020526040908190205490516323b872dd60e01b8152600481019290925261dead602483015260448201526001600160a01b038516906323b872dd90606401600060405180830381600087803b15801561194257600080fd5b505af1158015611956573d6000803e3d6000fd5b505050505b5050336000818152600c60208181526040808420600381015460018201805487526009855283872091909155600582015481548752600a855283872055600482015490548652600b845291852091909155938352526002909101555050565b60006119c560015490565b8210611a1f5760405162461bcd60e51b815260206004820152602360248201527f455243373231413a20676c6f62616c20696e646578206f7574206f6620626f756044820152626e647360e81b606482015260840161097b565b5090565b611a2b612343565b610ab3600f83836130be565b6000611a4282612929565b5192915050565b60006001600160a01b038216611ab55760405162461bcd60e51b815260206004820152602b60248201527f455243373231413a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b606482015260840161097b565b506001600160a01b03166000908152600560205260409020546001600160801b031690565b611ae2612343565b611aec6000612ad3565b565b611af6612343565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b604080518082019091526000808252602082015261087882612929565b611b6e6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b50336000908152600c6020908152604091829020825160c08101845281548152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015460a082015290565b60606003805461088d9061375e565b6001600160a01b038216331415611c305760405162461bcd60e51b815260206004820152601a60248201527f455243373231413a20617070726f766520746f2063616c6c6572000000000000604482015260640161097b565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611ca4612343565b6002600e541415611cf75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161097b565b6002600e55604051600090339047908381818185875af1925050503d8060008114611d3e576040519150601f19603f3d011682016040523d82523d6000602084013e611d43565b606091505b50509050806115425760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b604482015260640161097b565b60105460ff16611dd95760405162461bcd60e51b815260206004820152601c60248201527f5075626c69632073616c6520686173206e6f7420737461727465642e00000000604482015260640161097b565b7f000000000000000000000000000000000000000000000000000000000000000081611e0460015490565b611e0e9190613691565b1115611e525760405162461bcd60e51b815260206004820152601360248201527226b0bc1039bab838363c903932b0b1b432b21760691b604482015260640161097b565b806012541015611ea45760405162461bcd60e51b815260206004820152601a60248201527f5075626c69632073616c65206c696d697420726561636865642e000000000000604482015260640161097b565b7f0000000000000000000000000000000000000000000000000000000000000000811115611f1e5760405162461bcd60e51b815260206004820152602160248201527f53696e676c65207472616e73616374696f6e206c696d697420726561636865646044820152601760f91b606482015260840161097b565b6000611f28610c1d565b905080611f3757506001611f44565b6005811115611f44575060055b8082611f4f336121ba565b611f599190613691565b1115611ff357600081611f6b336121ba565b10611f77575081611f99565b8183611f82336121ba565b611f8c9190613691565b611f969190613704565b90505b3481601154611fa891906136bd565b1115611fb383612b23565b604051602001611fc39190613533565b60405160208183030381529060405290611ff05760405162461bcd60e51b815260040161097b91906135c9565b50505b611ffd338361239d565b816012600082825461200f9190613704565b90915550505050565b612020612343565b6010805460ff1916911515919091179055565b61203e8484846123b7565b61204a84848484612c29565b6120665760405162461bcd60e51b815260040161097b90613613565b50505050565b6000612079826001541190565b6120955760405162461bcd60e51b815260040161097b906135dc565b5060009081526009602052604090205490565b60606120b5826001541190565b6120f95760405162461bcd60e51b815260206004820152601560248201527429b832b636103237b2b9903737ba1032bc34b9ba1760591b604482015260640161097b565b600061210c6121078461206c565b612b23565b9050600061211c6121078561217e565b9050600061212c61210786612232565b9050600061213986612b23565b90506000612145612d36565b9050600081868686866040516020016121629594939291906134a6565b60408051601f1981840301815291905298975050505050505050565b600061218b826001541190565b6121a75760405162461bcd60e51b815260040161097b906135dc565b506000908152600b602052604090205490565b600061087882612d45565b6121cd611b35565b6040015161221d5760405162461bcd60e51b815260206004820152601e60248201527f596f7520617265206e6f74206372616674696e6720616e797468696e672e0000604482015260640161097b565b336000908152600c6020526040812060020155565b600061223f826001541190565b61225b5760405162461bcd60e51b815260040161097b906135dc565b506000908152600a602052604090205490565b612276612343565b6001600160a01b0381166122db5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161097b565b6122e481612ad3565b50565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000546001600160a01b03163314611aec5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161097b565b610c0e828260405180602001604052806000815250612de3565b60006123c282612929565b80519091506000906001600160a01b0316336001600160a01b031614806123f95750336123ee84610910565b6001600160a01b0316145b8061240b5750815161240b903361078e565b9050806124755760405162461bcd60e51b815260206004820152603260248201527f455243373231413a207472616e736665722063616c6c6572206973206e6f74206044820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b606482015260840161097b565b846001600160a01b031682600001516001600160a01b0316146124e95760405162461bcd60e51b815260206004820152602660248201527f455243373231413a207472616e736665722066726f6d20696e636f72726563746044820152651037bbb732b960d11b606482015260840161097b565b6001600160a01b03841661254d5760405162461bcd60e51b815260206004820152602560248201527f455243373231413a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161097b565b61255d60008484600001516122e7565b6001600160a01b038516600090815260056020526040812080546001929061258f9084906001600160801b03166136dc565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b038616600090815260056020526040812080546001945090926125db91859116613666565b82546001600160801b039182166101009390930a9283029190920219909116179055506040805180820182526001600160a01b03808716825267ffffffffffffffff428116602080850191825260008981526004909152948520935184549151909216600160a01b026001600160e01b03199091169190921617179055612663846001613691565b6000818152600460205260409020549091506001600160a01b03166126f55761268d816001541190565b156126f55760408051808201825284516001600160a01b03908116825260208087015167ffffffffffffffff9081168285019081526000878152600490935294909120925183549451909116600160a01b026001600160e01b03199094169116179190911790555b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b600d548161278f5760405162461bcd60e51b815260206004820152601860248201527f7175616e74697479206d757374206265206e6f6e7a65726f0000000000000000604482015260640161097b565b6000600161279d8484613691565b6127a79190613704565b90506127d460017f0000000000000000000000000000000000000000000000000000000000000000613704565b8111156128095761280660017f0000000000000000000000000000000000000000000000000000000000000000613704565b90505b612814816001541190565b61286f5760405162461bcd60e51b815260206004820152602660248201527f6e6f7420656e6f756768206d696e7465642079657420666f722074686973206360448201526506c65616e75760d41b606482015260840161097b565b815b818111612915576000818152600460205260409020546001600160a01b031661290357600061289f82612929565b60408051808201825282516001600160a01b03908116825260209384015167ffffffffffffffff9081168584019081526000888152600490965293909420915182549351909416600160a01b026001600160e01b0319909316931692909217179055505b8061290d81613799565b915050612871565b50612921816001613691565b600d55505050565b6040805180820190915260008082526020820152612948826001541190565b6129a75760405162461bcd60e51b815260206004820152602a60248201527f455243373231413a206f776e657220717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b606482015260840161097b565b60007f00000000000000000000000000000000000000000000000000000000000000008310612a08576129fa7f000000000000000000000000000000000000000000000000000000000000000084613704565b612a05906001613691565b90505b825b818110612a72576000818152600460209081526040918290208251808401909352546001600160a01b038116808452600160a01b90910467ffffffffffffffff169183019190915215612a5f57949350505050565b5080612a6a81613747565b915050612a0a565b5060405162461bcd60e51b815260206004820152602f60248201527f455243373231413a20756e61626c6520746f2064657465726d696e652074686560448201526e1037bbb732b91037b3103a37b5b2b760891b606482015260840161097b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606081612b475750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612b715780612b5b81613799565b9150612b6a9050600a836136a9565b9150612b4b565b60008167ffffffffffffffff811115612b8c57612b8c61380a565b6040519080825280601f01601f191660200182016040528015612bb6576020820181803683370190505b5090505b8415612c2157612bcb600183613704565b9150612bd8600a866137b4565b612be3906030613691565b60f81b818381518110612bf857612bf86137f4565b60200101906001600160f81b031916908160001a905350612c1a600a866136a9565b9450612bba565b949350505050565b60006001600160a01b0384163b15612d2b57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612c6d90339089908890889060040161358c565b602060405180830381600087803b158015612c8757600080fd5b505af1925050508015612cb7575060408051601f3d908101601f19168201909252612cb491810190613397565b60015b612d11573d808015612ce5576040519150601f19603f3d011682016040523d82523d6000602084013e612cea565b606091505b508051612d095760405162461bcd60e51b815260040161097b90613613565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612c21565b506001949350505050565b6060600f805461088d9061375e565b60006001600160a01b038216612db75760405162461bcd60e51b815260206004820152603160248201527f455243373231413a206e756d626572206d696e74656420717565727920666f7260448201527020746865207a65726f206164647265737360781b606482015260840161097b565b506001600160a01b0316600090815260056020526040902054600160801b90046001600160801b031690565b6001546001600160a01b038416612e465760405162461bcd60e51b815260206004820152602160248201527f455243373231413a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b606482015260840161097b565b612e51816001541190565b15612e9e5760405162461bcd60e51b815260206004820152601d60248201527f455243373231413a20746f6b656e20616c7265616479206d696e746564000000604482015260640161097b565b7f0000000000000000000000000000000000000000000000000000000000000000831115612f195760405162461bcd60e51b815260206004820152602260248201527f455243373231413a207175616e7469747920746f206d696e7420746f6f2068696044820152610ced60f31b606482015260840161097b565b6001600160a01b0384166000908152600560209081526040918290208251808401845290546001600160801b038082168352600160801b9091041691810191909152815180830190925280519091908190612f75908790613666565b6001600160801b03168152602001858360200151612f939190613666565b6001600160801b039081169091526001600160a01b0380881660008181526005602090815260408083208751978301518716600160801b0297909616969096179094558451808601865291825267ffffffffffffffff4281168386019081528883526004909552948120915182549451909516600160a01b026001600160e01b031990941694909216939093179190911790915582905b858110156130b35760405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46130776000888488612c29565b6130935760405162461bcd60e51b815260040161097b90613613565b8161309d81613799565b92505080806130ab90613799565b91505061302a565b506001819055612737565b8280546130ca9061375e565b90600052602060002090601f0160209004810192826130ec5760008555613132565b82601f106131055782800160ff19823516178555613132565b82800160010185558215613132579182015b82811115613132578235825591602001919060010190613117565b50611a1f9291505b80821115611a1f576000815560010161313a565b8035801515811461315e57600080fd5b919050565b60006020828403121561317557600080fd5b813561318081613820565b9392505050565b60006020828403121561319957600080fd5b815161318081613820565b600080604083850312156131b757600080fd5b82356131c281613820565b915060208301356131d281613820565b809150509250929050565b6000806000606084860312156131f257600080fd5b83356131fd81613820565b9250602084013561320d81613820565b929592945050506040919091013590565b6000806000806080858703121561323457600080fd5b843561323f81613820565b9350602085013561324f81613820565b925060408501359150606085013567ffffffffffffffff8082111561327357600080fd5b818701915087601f83011261328757600080fd5b8135818111156132995761329961380a565b604051601f8201601f19908116603f011681019083821181831017156132c1576132c161380a565b816040528281528a60208487010111156132da57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561331157600080fd5b823561331c81613820565b915061332a6020840161314e565b90509250929050565b6000806040838503121561334657600080fd5b823561335181613820565b946020939093013593505050565b60006020828403121561337157600080fd5b6131808261314e565b60006020828403121561338c57600080fd5b813561318081613835565b6000602082840312156133a957600080fd5b815161318081613835565b600080602083850312156133c757600080fd5b823567ffffffffffffffff808211156133df57600080fd5b818501915085601f8301126133f357600080fd5b81358181111561340257600080fd5b86602082850101111561341457600080fd5b60209290920196919550909350505050565b60006020828403121561343857600080fd5b5035919050565b60006020828403121561345157600080fd5b5051919050565b6000806040838503121561346b57600080fd5b50508035926020909101359150565b6000815180845261349281602086016020860161371b565b601f01601f19169290920160200192915050565b600086516134b8818460208b0161371b565b8651908301906134cc818360208b0161371b565b602d60f81b910181815286519091906134ec816001850160208b0161371b565b600192019182018190528551613509816002850160208a0161371b565b6002920191820152835161352481600384016020880161371b565b01600301979650505050505050565b7f4e6f7420656e6f756768204554482c20796f752061726520616c6c6f7765642081526000825161356b81602085016020870161371b565b6908199c9959481b5a5b9d60b21b6020939091019283015250602a01919050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906135bf9083018461347a565b9695505050505050565b602081526000613180602083018461347a565b60208082526019908201527f5468697320626f6f6b20646f6573206e6f742065786973742e00000000000000604082015260600190565b60208082526033908201527f455243373231413a207472616e7366657220746f206e6f6e204552433732315260408201527232b1b2b4bb32b91034b6b83632b6b2b73a32b960691b606082015260800190565b60006001600160801b03808316818516808303821115613688576136886137c8565b01949350505050565b600082198211156136a4576136a46137c8565b500190565b6000826136b8576136b86137de565b500490565b60008160001904831182151516156136d7576136d76137c8565b500290565b60006001600160801b03838116908316818110156136fc576136fc6137c8565b039392505050565b600082821015613716576137166137c8565b500390565b60005b8381101561373657818101518382015260200161371e565b838111156120665750506000910152565b600081613756576137566137c8565b506000190190565b600181811c9082168061377257607f821691505b6020821081141561379357634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156137ad576137ad6137c8565b5060010190565b6000826137c3576137c36137de565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146122e457600080fd5b6001600160e01b0319811681146122e457600080fdfea26469706673582212209f811f5f9ce74ebc30abf6da165b9928855fae1d7e9e88376c9231133191132664736f6c63430008070033

Deployed Bytecode

0x60806040526004361061025c5760003560e01c80638da5cb5b11610144578063b7bef61c116100b6578063d7224ba01161007a578063d7224ba01461073d578063dc33e68114610753578063e985e9c514610773578063ea8a1af0146107bc578063f0c21dcd146107d1578063f2fde38b146107f157600080fd5b8063b7bef61c1461069f578063b88d4fde146106bd578063bfb2959a146106dd578063c87b56dd146106fd578063cbafd4ea1461071d57600080fd5b8063a22cb46511610108578063a22cb46514610607578063a945bf8014610627578063ac4460021461063d578063b3ab66b014610652578063b423fe6714610665578063b6c693e51461068557600080fd5b80638da5cb5b1461050f5780639231ab2a1461052d57806394891c871461057b57806395d89b41146105dc5780639dc74e63146105f157600080fd5b80632f745c59116101dd5780634f6ccce7116101a15780634f6ccce71461045a57806355f804b31461047a5780636352211e1461049a57806370a08231146104ba578063715018a6146104da5780638291f8f6146104ef57600080fd5b80632f745c59146103c65780633ba5ae24146103e657806342842e0e1461041a578063499e8eec1461043a5780634e71d92d1461045257600080fd5b806318160ddd1161022457806318160ddd1461033257806323b872dd1461035157806324b10a7714610371578063289137a1146103865780632d20fb60146103a657600080fd5b806301ffc9a71461026157806306fdde0314610296578063081812fc146102b8578063095ea7b3146102f05780631342ff4c14610312575b600080fd5b34801561026d57600080fd5b5061028161027c36600461337a565b610811565b60405190151581526020015b60405180910390f35b3480156102a257600080fd5b506102ab61087e565b60405161028d91906135c9565b3480156102c457600080fd5b506102d86102d3366004613426565b610910565b6040516001600160a01b03909116815260200161028d565b3480156102fc57600080fd5b5061031061030b366004613333565b6109a0565b005b34801561031e57600080fd5b5061031061032d366004613426565b610ab8565b34801561033e57600080fd5b506001545b60405190815260200161028d565b34801561035d57600080fd5b5061031061036c3660046131dd565b610c12565b34801561037d57600080fd5b50610343610c1d565b34801561039257600080fd5b506103106103a1366004613458565b610ca1565b3480156103b257600080fd5b506103106103c1366004613426565b6114d9565b3480156103d257600080fd5b506103436103e1366004613333565b61154a565b3480156103f257600080fd5b506103437f000000000000000000000000000000000000000000000000000000000000000a81565b34801561042657600080fd5b506103106104353660046131dd565b6116c3565b34801561044657600080fd5b5060105460ff16610281565b6103106116de565b34801561046657600080fd5b50610343610475366004613426565b6119ba565b34801561048657600080fd5b506103106104953660046133b4565b611a23565b3480156104a657600080fd5b506102d86104b5366004613426565b611a37565b3480156104c657600080fd5b506103436104d5366004613163565b611a49565b3480156104e657600080fd5b50610310611ada565b3480156104fb57600080fd5b5061031061050a366004613163565b611aee565b34801561051b57600080fd5b506000546001600160a01b03166102d8565b34801561053957600080fd5b5061054d610548366004613426565b611b18565b6040805182516001600160a01b0316815260209283015167ffffffffffffffff16928101929092520161028d565b34801561058757600080fd5b50610590611b35565b60405161028d9190600060c082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015292915050565b3480156105e857600080fd5b506102ab611bc8565b3480156105fd57600080fd5b5061034360125481565b34801561061357600080fd5b506103106106223660046132fe565b611bd7565b34801561063357600080fd5b5061034360115481565b34801561064957600080fd5b50610310611c9c565b610310610660366004613426565b611d87565b34801561067157600080fd5b5061031061068036600461335f565b612018565b34801561069157600080fd5b506010546102819060ff1681565b3480156106ab57600080fd5b506008546001600160a01b03166102d8565b3480156106c957600080fd5b506103106106d836600461321e565b612033565b3480156106e957600080fd5b506103436106f8366004613426565b61206c565b34801561070957600080fd5b506102ab610718366004613426565b6120a8565b34801561072957600080fd5b50610343610738366004613426565b61217e565b34801561074957600080fd5b50610343600d5481565b34801561075f57600080fd5b5061034361076e366004613163565b6121ba565b34801561077f57600080fd5b5061028161078e3660046131a4565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b3480156107c857600080fd5b506103106121c5565b3480156107dd57600080fd5b506103436107ec366004613426565b612232565b3480156107fd57600080fd5b5061031061080c366004613163565b61226e565b60006001600160e01b031982166380ac58cd60e01b148061084257506001600160e01b03198216635b5e139f60e01b145b8061085d57506001600160e01b0319821663780e9d6360e01b145b8061087857506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606002805461088d9061375e565b80601f01602080910402602001604051908101604052809291908181526020018280546108b99061375e565b80156109065780601f106108db57610100808354040283529160200191610906565b820191906000526020600020905b8154815290600101906020018083116108e957829003601f168201915b5050505050905090565b600061091d826001541190565b6109845760405162461bcd60e51b815260206004820152602d60248201527f455243373231413a20617070726f76656420717565727920666f72206e6f6e6560448201526c3c34b9ba32b73a103a37b5b2b760991b60648201526084015b60405180910390fd5b506000908152600660205260409020546001600160a01b031690565b60006109ab82611a37565b9050806001600160a01b0316836001600160a01b03161415610a1a5760405162461bcd60e51b815260206004820152602260248201527f455243373231413a20617070726f76616c20746f2063757272656e74206f776e60448201526132b960f11b606482015260840161097b565b336001600160a01b0382161480610a365750610a36813361078e565b610aa85760405162461bcd60e51b815260206004820152603960248201527f455243373231413a20617070726f76652063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f76656420666f7220616c6c00000000000000606482015260840161097b565b610ab38383836122e7565b505050565b610ac0612343565b7f00000000000000000000000000000000000000000000000000000000000015b381610aeb60015490565b610af59190613691565b1115610b365760405162461bcd60e51b815260206004820152601060248201526f21b0b713ba1036b4b73a1036b7b9329760811b604482015260640161097b565b6000610b627f000000000000000000000000000000000000000000000000000000000000000a836136a9565b905060005b81811015610bab57610b99337f000000000000000000000000000000000000000000000000000000000000000a61239d565b80610ba381613799565b915050610b67565b50610bd67f000000000000000000000000000000000000000000000000000000000000000a836137b4565b15610c0e57610c0e33610c097f000000000000000000000000000000000000000000000000000000000000000a856137b4565b61239d565b5050565b610ab38383836123b7565b6008546040516370a0823160e01b81523360048201526000916001600160a01b03169081906370a082319060240160206040518083038186803b158015610c6357600080fd5b505afa158015610c77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9b919061343f565b91505090565b6008546040516331a9108f60e11b8152600481018490526001600160a01b039091169033908290636352211e9060240160206040518083038186803b158015610ce957600080fd5b505afa158015610cfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d219190613187565b6001600160a01b031614610d725760405162461bcd60e51b81526020600482015260186024820152772a3434b99034b9903737ba103cb7bab9103837ba34b7b71760411b604482015260640161097b565b610d7d826001541190565b610dc95760405162461bcd60e51b815260206004820152601a60248201527f54686973207370656c6c20646f6573206e6f742065786973742e000000000000604482015260640161097b565b33610dd383611a37565b6001600160a01b031614610e295760405162461bcd60e51b815260206004820152601c60248201527f54686973206973206e6f7420796f7572207370656c6c20626f6f6b2e00000000604482015260640161097b565b610e31611b35565b6040015115610e8e5760405162461bcd60e51b815260206004820152602360248201527f596f7520617265207374696c6c206372616674696e6720736f6d657468696e6760448201526217171760e91b606482015260840161097b565b610e978261206c565b610ff7576040516336af181960e11b8152600481018490526001600160a01b03821690636d5e30329060240160206040518083038186803b158015610edb57600080fd5b505afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f13919061343f565b600114610f565760405162461bcd60e51b81526020600482015260116024820152702732b2b210263b1718903837ba34b7b71760791b604482015260640161097b565b60405163c588ff8b60e01b8152600481018490526001600160a01b0382169063c588ff8b9060240160206040518083038186803b158015610f9657600080fd5b505afa158015610faa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fce919061343f565b336000908152600c602052604081206003810192909255600582018190556004909101556114b8565b6110008261206c565b15801590611014575061101282612232565b155b15611192576040516336af181960e11b8152600481018490526002906001600160a01b03831690636d5e30329060240160206040518083038186803b15801561105c57600080fd5b505afa158015611070573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611094919061343f565b10156110d65760405162461bcd60e51b81526020600482015260116024820152702732b2b210263b1719103837ba34b7b71760791b604482015260640161097b565b6110df8261206c565b336000908152600c602052604090819020600381019290925560016005909201919091555163c588ff8b60e01b8152600481018490526001600160a01b0382169063c588ff8b906024015b60206040518083038186803b15801561114257600080fd5b505afa158015611156573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117a919061343f565b336000908152600c60205260409020600401556114b8565b61119b82612232565b60011415611367576040516336af181960e11b8152600481018490526003906001600160a01b03831690636d5e30329060240160206040518083038186803b1580156111e657600080fd5b505afa1580156111fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061121e919061343f565b10156112605760405162461bcd60e51b81526020600482015260116024820152702732b2b210263b1719903837ba34b7b71760791b604482015260640161097b565b6112698261206c565b336000908152600c60205260409020600301556112858261217e565b60405163c588ff8b60e01b8152600481018590526001600160a01b0383169063c588ff8b9060240160206040518083038186803b1580156112c557600080fd5b505afa1580156112d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112fd919061343f565b141561132357336000908152600c60205260409020600260059091015561117a8261217e565b336000908152600c60205260409081902060016005909101555163c588ff8b60e01b8152600481018490526001600160a01b0382169063c588ff8b9060240161112a565b61137082612232565b60021415611462576040516336af181960e11b81526004808201859052906001600160a01b03831690636d5e30329060240160206040518083038186803b1580156113ba57600080fd5b505afa1580156113ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f2919061343f565b10156114345760405162461bcd60e51b81526020600482015260116024820152702732b2b210263b171a103837ba34b7b71760791b604482015260640161097b565b61143d8261206c565b336000908152600c602052604090206003808201929092556005015561117a8261217e565b60405162461bcd60e51b815260206004820152602560248201527f43616e277420757067726164652074686973207370656c6c207769746820706f6044820152643a34b7b71760d91b606482015260840161097b565b50336000908152600c60205260409020918255600182015543600290910155565b6114e1612343565b6002600e5414156115345760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161097b565b6002600e556115428161273f565b506001600e55565b600061155583611a49565b82106115ae5760405162461bcd60e51b815260206004820152602260248201527f455243373231413a206f776e657220696e646578206f7574206f6620626f756e604482015261647360f01b606482015260840161097b565b60006115b960015490565b905060008060005b83811015611663576000818152600460209081526040918290208251808401909352546001600160a01b038116808452600160a01b90910467ffffffffffffffff16918301919091521561161457805192505b876001600160a01b0316836001600160a01b0316141561165057868414156116425750935061087892505050565b8361164c81613799565b9450505b508061165b81613799565b9150506115c1565b5060405162461bcd60e51b815260206004820152602e60248201527f455243373231413a20756e61626c6520746f2067657420746f6b656e206f662060448201526d0deeedccae440c4f240d2dcc8caf60931b606482015260840161097b565b610ab383838360405180602001604052806000815250612033565b600854336000908152600c60205260409020805460018201546002909201546001600160a01b0390931692909190806117595760405162461bcd60e51b815260206004820152601e60248201527f596f7520617265206e6f74206372616674696e6720616e797468696e672e0000604482015260640161097b565b3361176383611a37565b6001600160a01b0316146117b95760405162461bcd60e51b815260206004820152601c60248201527f54686973206973206e6f7420796f7572207370656c6c20626f6f6b2e00000000604482015260640161097b565b6040516331a9108f60e11b81526004810184905233906001600160a01b03861690636352211e9060240160206040518083038186803b1580156117fb57600080fd5b505afa15801561180f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118339190613187565b6001600160a01b0316146118845760405162461bcd60e51b81526020600482015260186024820152772a3434b99034b9903737ba103cb7bab9103837ba34b7b71760411b604482015260640161097b565b6103846118918243613704565b116118d25760405162461bcd60e51b815260206004820152601160248201527029ba34b6361031b930b33a34b73397171760791b604482015260640161097b565b6618838370f3400034101561195b57336000818152600c6020526040908190205490516323b872dd60e01b8152600481019290925261dead602483015260448201526001600160a01b038516906323b872dd90606401600060405180830381600087803b15801561194257600080fd5b505af1158015611956573d6000803e3d6000fd5b505050505b5050336000818152600c60208181526040808420600381015460018201805487526009855283872091909155600582015481548752600a855283872055600482015490548652600b845291852091909155938352526002909101555050565b60006119c560015490565b8210611a1f5760405162461bcd60e51b815260206004820152602360248201527f455243373231413a20676c6f62616c20696e646578206f7574206f6620626f756044820152626e647360e81b606482015260840161097b565b5090565b611a2b612343565b610ab3600f83836130be565b6000611a4282612929565b5192915050565b60006001600160a01b038216611ab55760405162461bcd60e51b815260206004820152602b60248201527f455243373231413a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b606482015260840161097b565b506001600160a01b03166000908152600560205260409020546001600160801b031690565b611ae2612343565b611aec6000612ad3565b565b611af6612343565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b604080518082019091526000808252602082015261087882612929565b611b6e6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b50336000908152600c6020908152604091829020825160c08101845281548152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015460a082015290565b60606003805461088d9061375e565b6001600160a01b038216331415611c305760405162461bcd60e51b815260206004820152601a60248201527f455243373231413a20617070726f766520746f2063616c6c6572000000000000604482015260640161097b565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611ca4612343565b6002600e541415611cf75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161097b565b6002600e55604051600090339047908381818185875af1925050503d8060008114611d3e576040519150601f19603f3d011682016040523d82523d6000602084013e611d43565b606091505b50509050806115425760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b604482015260640161097b565b60105460ff16611dd95760405162461bcd60e51b815260206004820152601c60248201527f5075626c69632073616c6520686173206e6f7420737461727465642e00000000604482015260640161097b565b7f00000000000000000000000000000000000000000000000000000000000015b381611e0460015490565b611e0e9190613691565b1115611e525760405162461bcd60e51b815260206004820152601360248201527226b0bc1039bab838363c903932b0b1b432b21760691b604482015260640161097b565b806012541015611ea45760405162461bcd60e51b815260206004820152601a60248201527f5075626c69632073616c65206c696d697420726561636865642e000000000000604482015260640161097b565b7f000000000000000000000000000000000000000000000000000000000000000a811115611f1e5760405162461bcd60e51b815260206004820152602160248201527f53696e676c65207472616e73616374696f6e206c696d697420726561636865646044820152601760f91b606482015260840161097b565b6000611f28610c1d565b905080611f3757506001611f44565b6005811115611f44575060055b8082611f4f336121ba565b611f599190613691565b1115611ff357600081611f6b336121ba565b10611f77575081611f99565b8183611f82336121ba565b611f8c9190613691565b611f969190613704565b90505b3481601154611fa891906136bd565b1115611fb383612b23565b604051602001611fc39190613533565b60405160208183030381529060405290611ff05760405162461bcd60e51b815260040161097b91906135c9565b50505b611ffd338361239d565b816012600082825461200f9190613704565b90915550505050565b612020612343565b6010805460ff1916911515919091179055565b61203e8484846123b7565b61204a84848484612c29565b6120665760405162461bcd60e51b815260040161097b90613613565b50505050565b6000612079826001541190565b6120955760405162461bcd60e51b815260040161097b906135dc565b5060009081526009602052604090205490565b60606120b5826001541190565b6120f95760405162461bcd60e51b815260206004820152601560248201527429b832b636103237b2b9903737ba1032bc34b9ba1760591b604482015260640161097b565b600061210c6121078461206c565b612b23565b9050600061211c6121078561217e565b9050600061212c61210786612232565b9050600061213986612b23565b90506000612145612d36565b9050600081868686866040516020016121629594939291906134a6565b60408051601f1981840301815291905298975050505050505050565b600061218b826001541190565b6121a75760405162461bcd60e51b815260040161097b906135dc565b506000908152600b602052604090205490565b600061087882612d45565b6121cd611b35565b6040015161221d5760405162461bcd60e51b815260206004820152601e60248201527f596f7520617265206e6f74206372616674696e6720616e797468696e672e0000604482015260640161097b565b336000908152600c6020526040812060020155565b600061223f826001541190565b61225b5760405162461bcd60e51b815260040161097b906135dc565b506000908152600a602052604090205490565b612276612343565b6001600160a01b0381166122db5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161097b565b6122e481612ad3565b50565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000546001600160a01b03163314611aec5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161097b565b610c0e828260405180602001604052806000815250612de3565b60006123c282612929565b80519091506000906001600160a01b0316336001600160a01b031614806123f95750336123ee84610910565b6001600160a01b0316145b8061240b5750815161240b903361078e565b9050806124755760405162461bcd60e51b815260206004820152603260248201527f455243373231413a207472616e736665722063616c6c6572206973206e6f74206044820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b606482015260840161097b565b846001600160a01b031682600001516001600160a01b0316146124e95760405162461bcd60e51b815260206004820152602660248201527f455243373231413a207472616e736665722066726f6d20696e636f72726563746044820152651037bbb732b960d11b606482015260840161097b565b6001600160a01b03841661254d5760405162461bcd60e51b815260206004820152602560248201527f455243373231413a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161097b565b61255d60008484600001516122e7565b6001600160a01b038516600090815260056020526040812080546001929061258f9084906001600160801b03166136dc565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b038616600090815260056020526040812080546001945090926125db91859116613666565b82546001600160801b039182166101009390930a9283029190920219909116179055506040805180820182526001600160a01b03808716825267ffffffffffffffff428116602080850191825260008981526004909152948520935184549151909216600160a01b026001600160e01b03199091169190921617179055612663846001613691565b6000818152600460205260409020549091506001600160a01b03166126f55761268d816001541190565b156126f55760408051808201825284516001600160a01b03908116825260208087015167ffffffffffffffff9081168285019081526000878152600490935294909120925183549451909116600160a01b026001600160e01b03199094169116179190911790555b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b600d548161278f5760405162461bcd60e51b815260206004820152601860248201527f7175616e74697479206d757374206265206e6f6e7a65726f0000000000000000604482015260640161097b565b6000600161279d8484613691565b6127a79190613704565b90506127d460017f00000000000000000000000000000000000000000000000000000000000015b3613704565b8111156128095761280660017f00000000000000000000000000000000000000000000000000000000000015b3613704565b90505b612814816001541190565b61286f5760405162461bcd60e51b815260206004820152602660248201527f6e6f7420656e6f756768206d696e7465642079657420666f722074686973206360448201526506c65616e75760d41b606482015260840161097b565b815b818111612915576000818152600460205260409020546001600160a01b031661290357600061289f82612929565b60408051808201825282516001600160a01b03908116825260209384015167ffffffffffffffff9081168584019081526000888152600490965293909420915182549351909416600160a01b026001600160e01b0319909316931692909217179055505b8061290d81613799565b915050612871565b50612921816001613691565b600d55505050565b6040805180820190915260008082526020820152612948826001541190565b6129a75760405162461bcd60e51b815260206004820152602a60248201527f455243373231413a206f776e657220717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b606482015260840161097b565b60007f000000000000000000000000000000000000000000000000000000000000000a8310612a08576129fa7f000000000000000000000000000000000000000000000000000000000000000a84613704565b612a05906001613691565b90505b825b818110612a72576000818152600460209081526040918290208251808401909352546001600160a01b038116808452600160a01b90910467ffffffffffffffff169183019190915215612a5f57949350505050565b5080612a6a81613747565b915050612a0a565b5060405162461bcd60e51b815260206004820152602f60248201527f455243373231413a20756e61626c6520746f2064657465726d696e652074686560448201526e1037bbb732b91037b3103a37b5b2b760891b606482015260840161097b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606081612b475750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612b715780612b5b81613799565b9150612b6a9050600a836136a9565b9150612b4b565b60008167ffffffffffffffff811115612b8c57612b8c61380a565b6040519080825280601f01601f191660200182016040528015612bb6576020820181803683370190505b5090505b8415612c2157612bcb600183613704565b9150612bd8600a866137b4565b612be3906030613691565b60f81b818381518110612bf857612bf86137f4565b60200101906001600160f81b031916908160001a905350612c1a600a866136a9565b9450612bba565b949350505050565b60006001600160a01b0384163b15612d2b57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612c6d90339089908890889060040161358c565b602060405180830381600087803b158015612c8757600080fd5b505af1925050508015612cb7575060408051601f3d908101601f19168201909252612cb491810190613397565b60015b612d11573d808015612ce5576040519150601f19603f3d011682016040523d82523d6000602084013e612cea565b606091505b508051612d095760405162461bcd60e51b815260040161097b90613613565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612c21565b506001949350505050565b6060600f805461088d9061375e565b60006001600160a01b038216612db75760405162461bcd60e51b815260206004820152603160248201527f455243373231413a206e756d626572206d696e74656420717565727920666f7260448201527020746865207a65726f206164647265737360781b606482015260840161097b565b506001600160a01b0316600090815260056020526040902054600160801b90046001600160801b031690565b6001546001600160a01b038416612e465760405162461bcd60e51b815260206004820152602160248201527f455243373231413a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b606482015260840161097b565b612e51816001541190565b15612e9e5760405162461bcd60e51b815260206004820152601d60248201527f455243373231413a20746f6b656e20616c7265616479206d696e746564000000604482015260640161097b565b7f000000000000000000000000000000000000000000000000000000000000000a831115612f195760405162461bcd60e51b815260206004820152602260248201527f455243373231413a207175616e7469747920746f206d696e7420746f6f2068696044820152610ced60f31b606482015260840161097b565b6001600160a01b0384166000908152600560209081526040918290208251808401845290546001600160801b038082168352600160801b9091041691810191909152815180830190925280519091908190612f75908790613666565b6001600160801b03168152602001858360200151612f939190613666565b6001600160801b039081169091526001600160a01b0380881660008181526005602090815260408083208751978301518716600160801b0297909616969096179094558451808601865291825267ffffffffffffffff4281168386019081528883526004909552948120915182549451909516600160a01b026001600160e01b031990941694909216939093179190911790915582905b858110156130b35760405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46130776000888488612c29565b6130935760405162461bcd60e51b815260040161097b90613613565b8161309d81613799565b92505080806130ab90613799565b91505061302a565b506001819055612737565b8280546130ca9061375e565b90600052602060002090601f0160209004810192826130ec5760008555613132565b82601f106131055782800160ff19823516178555613132565b82800160010185558215613132579182015b82811115613132578235825591602001919060010190613117565b50611a1f9291505b80821115611a1f576000815560010161313a565b8035801515811461315e57600080fd5b919050565b60006020828403121561317557600080fd5b813561318081613820565b9392505050565b60006020828403121561319957600080fd5b815161318081613820565b600080604083850312156131b757600080fd5b82356131c281613820565b915060208301356131d281613820565b809150509250929050565b6000806000606084860312156131f257600080fd5b83356131fd81613820565b9250602084013561320d81613820565b929592945050506040919091013590565b6000806000806080858703121561323457600080fd5b843561323f81613820565b9350602085013561324f81613820565b925060408501359150606085013567ffffffffffffffff8082111561327357600080fd5b818701915087601f83011261328757600080fd5b8135818111156132995761329961380a565b604051601f8201601f19908116603f011681019083821181831017156132c1576132c161380a565b816040528281528a60208487010111156132da57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561331157600080fd5b823561331c81613820565b915061332a6020840161314e565b90509250929050565b6000806040838503121561334657600080fd5b823561335181613820565b946020939093013593505050565b60006020828403121561337157600080fd5b6131808261314e565b60006020828403121561338c57600080fd5b813561318081613835565b6000602082840312156133a957600080fd5b815161318081613835565b600080602083850312156133c757600080fd5b823567ffffffffffffffff808211156133df57600080fd5b818501915085601f8301126133f357600080fd5b81358181111561340257600080fd5b86602082850101111561341457600080fd5b60209290920196919550909350505050565b60006020828403121561343857600080fd5b5035919050565b60006020828403121561345157600080fd5b5051919050565b6000806040838503121561346b57600080fd5b50508035926020909101359150565b6000815180845261349281602086016020860161371b565b601f01601f19169290920160200192915050565b600086516134b8818460208b0161371b565b8651908301906134cc818360208b0161371b565b602d60f81b910181815286519091906134ec816001850160208b0161371b565b600192019182018190528551613509816002850160208a0161371b565b6002920191820152835161352481600384016020880161371b565b01600301979650505050505050565b7f4e6f7420656e6f756768204554482c20796f752061726520616c6c6f7765642081526000825161356b81602085016020870161371b565b6908199c9959481b5a5b9d60b21b6020939091019283015250602a01919050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906135bf9083018461347a565b9695505050505050565b602081526000613180602083018461347a565b60208082526019908201527f5468697320626f6f6b20646f6573206e6f742065786973742e00000000000000604082015260600190565b60208082526033908201527f455243373231413a207472616e7366657220746f206e6f6e204552433732315260408201527232b1b2b4bb32b91034b6b83632b6b2b73a32b960691b606082015260800190565b60006001600160801b03808316818516808303821115613688576136886137c8565b01949350505050565b600082198211156136a4576136a46137c8565b500190565b6000826136b8576136b86137de565b500490565b60008160001904831182151516156136d7576136d76137c8565b500290565b60006001600160801b03838116908316818110156136fc576136fc6137c8565b039392505050565b600082821015613716576137166137c8565b500390565b60005b8381101561373657818101518382015260200161371e565b838111156120665750506000910152565b600081613756576137566137c8565b506000190190565b600181811c9082168061377257607f821691505b6020821081141561379357634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156137ad576137ad6137c8565b5060010190565b6000826137c3576137c36137de565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146122e457600080fd5b6001600160e01b0319811681146122e457600080fdfea26469706673582212209f811f5f9ce74ebc30abf6da165b9928855fae1d7e9e88376c9231133191132664736f6c63430008070033

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.