ETH Price: $1,602.90 (-2.16%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transfer Ownersh...218221812025-02-11 8:46:5961 days ago1739263619IN
0x13AeF6aA...10a4c63e5
0 ETH0.00004131.44195045
Transfer Ownersh...216588282025-01-19 13:27:5983 days ago1737293279IN
0x13AeF6aA...10a4c63e5
0 ETH0.0008385129.27480625
Execute Actions215140382024-12-30 8:16:23104 days ago1735546583IN
0x13AeF6aA...10a4c63e5
0 ETH0.000586613.82364489
Transfer Ownersh...212580862024-11-24 14:05:23139 days ago1732457123IN
0x13AeF6aA...10a4c63e5
0 ETH0.000249778.72035808
Execute Actions210037182024-10-20 2:11:47175 days ago1729390307IN
0x13AeF6aA...10a4c63e5
0 ETH0.001221747.31181675
Execute Actions207112682024-09-09 6:28:47216 days ago1725863327IN
0x13AeF6aA...10a4c63e5
0 ETH0.000225391.87523617
Execute Actions207112652024-09-09 6:28:11216 days ago1725863291IN
0x13AeF6aA...10a4c63e5
0 ETH0.000424831.90336853
Execute Actions200443762024-06-08 3:18:23309 days ago1717816703IN
0x13AeF6aA...10a4c63e5
0 ETH0.001239266.31510217
Execute Actions200443592024-06-08 3:14:59309 days ago1717816499IN
0x13AeF6aA...10a4c63e5
0 ETH0.001262676.00702272
Execute Actions197569942024-04-28 23:08:11349 days ago1714345691IN
0x13AeF6aA...10a4c63e5
0 ETH0.000781454.93914066
Execute Actions197569862024-04-28 23:06:35349 days ago1714345595IN
0x13AeF6aA...10a4c63e5
0 ETH0.000885584.5128044
Execute Actions197079052024-04-22 2:17:35356 days ago1713752255IN
0x13AeF6aA...10a4c63e5
0 ETH0.000801086.66492649
Execute Actions196145342024-04-09 0:31:47369 days ago1712622707IN
0x13AeF6aA...10a4c63e5
0 ETH0.0024114120.89721043
Execute Actions195947232024-04-06 5:53:47372 days ago1712382827IN
0x13AeF6aA...10a4c63e5
0 ETH0.001512512.58386747
Execute Actions195947122024-04-06 5:51:23372 days ago1712382683IN
0x13AeF6aA...10a4c63e5
0 ETH0.0024389410.41124582
Execute Actions195786702024-04-03 23:57:23374 days ago1712188643IN
0x13AeF6aA...10a4c63e5
0 ETH0.0037581423.75310879
Execute Actions195254492024-03-27 11:45:47382 days ago1711539947IN
0x13AeF6aA...10a4c63e5
0 ETH0.003551530.77717219
Execute Actions195240362024-03-27 6:56:23382 days ago1711522583IN
0x13AeF6aA...10a4c63e5
0 ETH0.002717722.61095436
Execute Actions195226972024-03-27 2:21:11382 days ago1711506071IN
0x13AeF6aA...10a4c63e5
0 ETH0.0036862223.29853608
Execute Actions195223302024-03-27 1:06:47382 days ago1711501607IN
0x13AeF6aA...10a4c63e5
0 ETH0.0052517726.76213611
Execute Actions195219952024-03-26 23:58:23382 days ago1711497503IN
0x13AeF6aA...10a4c63e5
0 ETH0.0030490125.36748283
Execute Actions195215562024-03-26 22:27:47382 days ago1711492067IN
0x13AeF6aA...10a4c63e5
0 ETH0.0082490135.75693411
Execute Actions195210972024-03-26 20:54:11382 days ago1711486451IN
0x13AeF6aA...10a4c63e5
0 ETH0.0053460744.47869995
Execute Actions195210912024-03-26 20:52:59382 days ago1711486379IN
0x13AeF6aA...10a4c63e5
0 ETH0.0107268640.56691112
Execute Actions194980242024-03-23 14:54:35385 days ago1711205675IN
0x13AeF6aA...10a4c63e5
0 ETH0.0027820224.10887927
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ClickMarketplace

Compiler Version
v0.8.21+commit.d9974bed

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 30 : ClickMarketplace.sol
//SPDX-License-Identifier: NONE
pragma solidity ^0.8.18;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./ClickPaymentReceiver.sol";
import "./ClickMarketplaceStructs.sol";
import "./ClickMarketplaceErrors.sol";
import "./IClickToken.sol";

contract ClickMarketplace is Ownable, AccessControl, Pausable, ClickPaymentReceiver, ClickMarketplaceStructs, ClickMarketplaceErrors {

  event ClicksBought(address indexed buyer, address indexed token, uint256 amount);
  event NFTBurnedForClicks(address indexed burner, address indexed token, uint256 tokenId, uint256 burnPrice);
  event ListingBought(address indexed buyer, uint32 indexed tokenId, uint32 amount);
  event ListingAdded(uint32 indexed tokenId, uint32 clickPrice, uint32 maxSupply, uint48 startTimestamp, uint48 endTimestamp);
  event ListingRemoved(uint32 indexed tokenId);
  event BurnableTokenAdded(address indexed token, uint32 price);
  event BurnableTokenRemoved(address indexed token);

  address private constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;
  bytes32 private constant ADMIN_ROLE = keccak256("ADMIN_ROLE");

  IClickToken public immutable CLICK_TOKEN;
  uint256 public immutable CLICK_TOKEN_ID;

  mapping(address => BurnableToken) public erc721BurnableTokens;
  mapping(uint32 => MarketplaceListing) public listings;

  address[] public permaErc721BurnableTokensArray;
  uint32[] public permaListingsArray;

  constructor(
    address _owner, IClickToken _clickToken, uint256 _clickTokenId,
    address _paymentReceiver, uint96 _ethPrice
  )
    ClickPaymentReceiver(_paymentReceiver, _ethPrice)
  {
    _transferOwnership(_owner);

    CLICK_TOKEN = _clickToken;
    CLICK_TOKEN_ID = _clickTokenId;
  }

  modifier onlyAdminOrOwner() {
    if (!hasRole(ADMIN_ROLE, msg.sender) && msg.sender != owner()) revert NotAuthorized();
    _;
  }

  function executeActions(
    ActionBuyClickWithEth[] calldata buyClickWithEth,
    ActionBuyClickWithERC20[] calldata buyClickWithERC20,
    ActionBurn721ForClick[] calldata burn721ForClick,
    ActionBuyMarketplaceItem[] calldata buyMarketplaceItem
  ) external payable whenNotPaused {
    uint256 clicksOwed = 0;

    clicksOwed += _executeBuyClickWithEth(buyClickWithEth);
    clicksOwed += _executeBuyClickWithERC20(buyClickWithERC20);
    clicksOwed += _executeBurn721ForClick(burn721ForClick);

    _executeBuyMarketplaceItem(buyMarketplaceItem, clicksOwed);
  }

  function _executeBuyClickWithEth(ActionBuyClickWithEth[] calldata buyClickWithEth) internal returns (uint256 clicksOwed) {
    if (buyClickWithEth.length > 1) revert DoubleETHPayment();
    if (buyClickWithEth.length == 1) {
      uint256 amount = buyClickWithEth[0].amount;
      _takeETHPayment(amount);

      clicksOwed += amount;
      emit ClicksBought(msg.sender, address(0), amount);
    } else if (msg.value > 0) {
      revert ETHPaymentTooHigh();
    }
  }

  function _executeBuyClickWithERC20(ActionBuyClickWithERC20[] calldata buyClickWithERC20) internal returns (uint256 clicksOwed) {
    uint256 length = buyClickWithERC20.length;
    for (uint256 i; i < length; ++i) {
      uint256 amount = buyClickWithERC20[i].amount;
      IERC20 token = buyClickWithERC20[i].token;
      _takeERC20Payment(token, amount);
      clicksOwed += amount;
      emit ClicksBought(msg.sender, address(token), amount);
    }
  }

  function _executeBurn721ForClick(ActionBurn721ForClick[] calldata burn721ForClick) internal returns (uint256 clicksOwed) {
    uint256 length = burn721ForClick.length;
    for (uint256 i; i < length; ++i) {
      ActionBurn721ForClick memory burnData = burn721ForClick[i];

      IERC721 token = burnData.token;
      BurnableToken memory burnableToken = erc721BurnableTokens[address(token)];
      if (!burnableToken.exists) revert ERC721NotEligibleForBurn(token);
      
      uint32 burnPrice = burnableToken.price;
      uint256 tokenId = burnData.tokenId;
      token.transferFrom(msg.sender, BURN_ADDRESS, tokenId);
      clicksOwed += burnPrice;

      emit NFTBurnedForClicks(msg.sender, address(token), tokenId, burnPrice);
    }
  }

  /**
  * @dev ClickToken ERC1155Creator implements a reentrancy guard, this function either triggers a reentrancy error or does nothing,
  * so this is fine.
  */
  function _executeBuyMarketplaceItem(ActionBuyMarketplaceItem[] calldata buyMarketplaceItem, uint256 clicksOwed) internal {
    if (buyMarketplaceItem.length == 0) {
      if (clicksOwed > 0) {
        CLICK_TOKEN.mintBaseExisting(
          _asSingletonArray(msg.sender), _asSingletonArray(CLICK_TOKEN_ID), 
          _asSingletonArray(clicksOwed)
        );
      }
      return;
    }

    uint256 spent = 0;

    uint256 length = buyMarketplaceItem.length;
    uint256 lengthPlus1 = length + 1;
    uint256[] memory tokenIds = new uint256[](lengthPlus1);
    uint256[] memory amounts = new uint256[](lengthPlus1);
    for (uint256 i; i < length; ++i) {
      ActionBuyMarketplaceItem memory marketplaceItem = buyMarketplaceItem[i];
      uint32 tokenId = marketplaceItem.tokenId;
      MarketplaceListing memory listing = listings[tokenId];
      if (!listing.exists) revert ListingDoesNotExist(tokenId);

      uint32 amount = marketplaceItem.amount;

      if (listing.maxSupply > 0) {
        uint256 currentSupply = CLICK_TOKEN.totalSupply(uint256(tokenId));
        if (currentSupply + amount > listing.maxSupply) {
          amount = listing.maxSupply - uint32(currentSupply); // Reduce amount to fit maxSupply
        }
      }

      if (amount == 0) continue; // Don't revert an entire tx, just skip this listing

      if (listing.startTimestamp > 0 && block.timestamp < listing.startTimestamp) revert ListingNotStarted(tokenId);
      if (listing.endTimestamp > 0 && block.timestamp > listing.endTimestamp) revert ListingEnded(tokenId);

      tokenIds[i] = tokenId;
      amounts[i] = amount;

      spent += uint256(listing.clickPrice) * amount;

      emit ListingBought(msg.sender, tokenId, amount);
    }

    address paymentReceiver_ = paymentReceiver; // cache, avoid dirty sload in 1st case
    tokenIds[length] = CLICK_TOKEN_ID; // prevent revert, amount still = 0
    if (spent > clicksOwed) {
      CLICK_TOKEN.safeTransferFrom(msg.sender, paymentReceiver_, CLICK_TOKEN_ID, spent - clicksOwed, "");
      CLICK_TOKEN.mintBaseExisting(_asSingletonArray(paymentReceiver_), _asSingletonArray(CLICK_TOKEN_ID), _asSingletonArray(clicksOwed));
    } else if (spent < clicksOwed) {
      amounts[length] = clicksOwed - spent;
      CLICK_TOKEN.mintBaseExisting(
        _asSingletonArray(paymentReceiver_), _asSingletonArray(CLICK_TOKEN_ID), 
        _asSingletonArray(spent)
      );
    } else {
      CLICK_TOKEN.mintBaseExisting(
        _asSingletonArray(paymentReceiver_), _asSingletonArray(CLICK_TOKEN_ID), 
        _asSingletonArray(spent)
      );
    }

    CLICK_TOKEN.mintBaseExisting(_asSingletonArray(msg.sender), tokenIds, amounts);
  }

  // Owner / admin functions

  function addAdmin(address account) external onlyOwner {
    grantRole(ADMIN_ROLE, account);
  }

  function removeAdmin(address account) external onlyOwner {
    revokeRole(ADMIN_ROLE, account);
  }

  function pause() external onlyAdminOrOwner {
    _pause();
  }

  function unpause() external onlyAdminOrOwner {
    _unpause();
  }

  function setETHPrice(uint96 price) external onlyAdminOrOwner {
    _setETHPrice(price);
  }

  function setERC20Price(IERC20 token, uint256 price) external onlyAdminOrOwner {
    _setERC20Price(token, price);
  }

  function setPaymentReceiver(address _paymentReceiver) external onlyOwner {
    _setPaymentReceiver(_paymentReceiver);
  }

  function setBurnableToken(
    address token,
    uint32 price
  ) external onlyAdminOrOwner {
    if (erc721BurnableTokens[token].exists) {
      emit BurnableTokenRemoved(token);
    } else if (!erc721BurnableTokens[token].hasExisted) {
      permaErc721BurnableTokensArray.push(token);
    }

    erc721BurnableTokens[token] = BurnableToken({
      exists: true,
      hasExisted: true,
      price: price
    });

    emit BurnableTokenAdded(token, price);
  }

  function setBurnableTokens(
    address[] calldata token,
    uint32[] calldata price
  ) external onlyAdminOrOwner {
    uint256 length = token.length;

    if (length != price.length) revert MismatchingArrayLength();

    for (uint256 i; i < length; ++i) {
      address token_ = token[i];
      uint32 price_ = price[i];

      if (erc721BurnableTokens[token_].exists) {
        emit BurnableTokenRemoved(token_);
      } else if (!erc721BurnableTokens[token_].hasExisted) {
        permaErc721BurnableTokensArray.push(token_);
      }

      erc721BurnableTokens[token_] = BurnableToken({
        exists: true,
        hasExisted: true,
        price: price_
      });

      emit BurnableTokenAdded(token_, price_);
    }
  }

  function removeListing(uint32 tokenId) external onlyAdminOrOwner {
    if (!listings[tokenId].exists) return;

    listings[tokenId].exists = false;
    emit ListingRemoved(tokenId);
  }

  function removeListings(uint32[] calldata tokenId) external onlyAdminOrOwner {
    uint256 length = tokenId.length;
    for (uint256 i; i < length; ++i) {
      uint32 tokenId_ = tokenId[i];
      if (!listings[tokenId_].exists) continue;

      listings[tokenId_].exists = false;
      emit ListingRemoved(tokenId_);
    }
  }

  function setListing(
    uint32 tokenId,
    uint32 clickPrice,
    uint32 maxSupply,
    uint48 startTimestamp,
    uint48 endTimestamp
  ) external onlyAdminOrOwner {
    if (startTimestamp > 0 && endTimestamp > 0 && startTimestamp > endTimestamp) revert ListingTimeInputInvalid();

    if (listings[tokenId].exists) {
      emit ListingRemoved(tokenId);
    } else if (!listings[tokenId].hasExisted) {
      permaListingsArray.push(tokenId);
    }

    listings[tokenId] = MarketplaceListing({
      exists: true,
      hasExisted: true,
      clickPrice: clickPrice,
      maxSupply: maxSupply,
      startTimestamp: startTimestamp,
      endTimestamp: endTimestamp
    });

    emit ListingAdded(tokenId, clickPrice, maxSupply, startTimestamp, endTimestamp);
  }

  function setListings(
    uint32[] calldata tokenId,
    uint32[] calldata clickPrice,
    uint32[] calldata maxSupply,
    uint48[] calldata startTimestamp,
    uint48[] calldata endTimestamp
  ) external onlyAdminOrOwner {
    uint256 length = tokenId.length;

    if (length != clickPrice.length) revert MismatchingArrayLength();
    if (length != maxSupply.length) revert MismatchingArrayLength();
    if (length != startTimestamp.length) revert MismatchingArrayLength();
    if (length != endTimestamp.length) revert MismatchingArrayLength();
    
    for (uint256 i; i < length; ++i) {
      uint48 startTimestamp_ = startTimestamp[i];
      uint48 endTimestamp_ = endTimestamp[i];
      if (startTimestamp_ > 0 && endTimestamp_ > 0 && startTimestamp_ > endTimestamp_) revert ListingTimeInputInvalid();

      uint32 tokenId_ = tokenId[i];
      uint32 clickPrice_ = clickPrice[i];
      uint32 maxSupply_ = maxSupply[i];

      if (listings[tokenId_].exists) {
        emit ListingRemoved(tokenId_);
      } else {
        permaListingsArray.push(tokenId_);
      }

      listings[tokenId_] = MarketplaceListing({
        exists: true,
        hasExisted: true,
        clickPrice: clickPrice_,
        maxSupply: maxSupply_,
        startTimestamp: startTimestamp_,
        endTimestamp: endTimestamp_
      });

      emit ListingAdded(tokenId_, clickPrice_, maxSupply_, startTimestamp_, endTimestamp_);
    }
  }

  function _asSingletonArray(address element) internal pure returns (address[] memory) {
    address[] memory array = new address[](1);
    array[0] = element;

    return array;
  }

  function _asSingletonArray(uint256 element) internal pure returns (uint256[] memory) {
    uint256[] memory array = new uint256[](1);
    array[0] = element;

    return array;
  }

  // view helper functions
  function getAllInfo() external view returns (
    AllInfo memory allInfo
  ) {

    address[] memory permaErc721BurnableTokensArray_ = permaErc721BurnableTokensArray;
    uint256 length = permaErc721BurnableTokensArray_.length;
    BurnableTokenInfo[] memory burnableTokens_ = new BurnableTokenInfo[](length);
    uint256 index;
    for (uint256 i; i < length; ++i) {
      address token = permaErc721BurnableTokensArray_[i];
      BurnableToken memory burnableToken = erc721BurnableTokens[token];
      if (burnableToken.exists) {
        burnableTokens_[index] = BurnableTokenInfo(
          token,
          burnableToken.price
        );
        ++index;
      }
    }

    uint32[] memory permaListingsArray_ = permaListingsArray;
    length = permaListingsArray_.length;
    MarketplaceListingInfo[] memory marketplaceListings_ = new MarketplaceListingInfo[](length);
    index = 0;
    for (uint256 i; i < length; ++i) {
      uint32 tokenId = permaListingsArray_[i];
      MarketplaceListing memory listing = listings[tokenId];
      if (listing.exists) {
        uint32 currentSupply = uint32(CLICK_TOKEN.totalSupply(uint256(tokenId)));
        marketplaceListings_[index] = MarketplaceListingInfo(
          tokenId,
          listing.clickPrice,
          currentSupply,
          listing.maxSupply,
          listing.startTimestamp,
          listing.endTimestamp
        );
        ++index;
      }
    }
    return AllInfo(burnableTokens_, marketplaceListings_);
  }

  function sweepERC20(IERC20 token, address to) external onlyOwner {
    uint256 balance = token.balanceOf(address(this));
    SafeERC20.safeTransfer(token, to, balance);
  }

}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 3 of 30 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 4 of 30 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

File 6 of 30 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

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

File 8 of 30 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] calldata accounts,
        uint256[] calldata ids
    ) external view returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 9 of 30 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 10 of 30 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

File 11 of 30 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 12 of 30 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

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

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

File 15 of 30 : 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 16 of 30 : ERC165Checker.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/ERC165Checker.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Library used to query support of an interface declared via {IERC165}.
 *
 * Note that these functions return the actual result of the query: they do not
 * `revert` if an interface is not supported. It is up to the caller to decide
 * what to do in these cases.
 */
library ERC165Checker {
    // As per the EIP-165 spec, no interface should ever match 0xffffffff
    bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;

    /**
     * @dev Returns true if `account` supports the {IERC165} interface.
     */
    function supportsERC165(address account) internal view returns (bool) {
        // Any contract that implements ERC165 must explicitly indicate support of
        // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
        return
            supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&
            !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);
    }

    /**
     * @dev Returns true if `account` supports the interface defined by
     * `interfaceId`. Support for {IERC165} itself is queried automatically.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
        // query support of both ERC165 as per the spec and support of _interfaceId
        return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);
    }

    /**
     * @dev Returns a boolean array where each value corresponds to the
     * interfaces passed in and whether they're supported or not. This allows
     * you to batch check interfaces for a contract where your expectation
     * is that some interfaces may not be supported.
     *
     * See {IERC165-supportsInterface}.
     *
     * _Available since v3.4._
     */
    function getSupportedInterfaces(
        address account,
        bytes4[] memory interfaceIds
    ) internal view returns (bool[] memory) {
        // an array of booleans corresponding to interfaceIds and whether they're supported or not
        bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);

        // query support of ERC165 itself
        if (supportsERC165(account)) {
            // query support of each interface in interfaceIds
            for (uint256 i = 0; i < interfaceIds.length; i++) {
                interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);
            }
        }

        return interfaceIdsSupported;
    }

    /**
     * @dev Returns true if `account` supports all the interfaces defined in
     * `interfaceIds`. Support for {IERC165} itself is queried automatically.
     *
     * Batch-querying can lead to gas savings by skipping repeated checks for
     * {IERC165} support.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
        // query support of ERC165 itself
        if (!supportsERC165(account)) {
            return false;
        }

        // query support of each interface in interfaceIds
        for (uint256 i = 0; i < interfaceIds.length; i++) {
            if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {
                return false;
            }
        }

        // all interfaces supported
        return true;
    }

    /**
     * @notice Query if a contract implements an interface, does not check ERC165 support
     * @param account The address of the contract to query for support of an interface
     * @param interfaceId The interface identifier, as specified in ERC-165
     * @return true if the contract at account indicates support of the interface with
     * identifier interfaceId, false otherwise
     * @dev Assumes that account contains a contract that supports ERC165, otherwise
     * the behavior of this method is undefined. This precondition can be checked
     * with {supportsERC165}.
     *
     * Some precompiled contracts will falsely indicate support for a given interface, so caution
     * should be exercised when using this function.
     *
     * Interface identification is specified in ERC-165.
     */
    function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {
        // prepare call
        bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);

        // perform static call
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly {
            success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0x00)
        }

        return success && returnSize >= 0x20 && returnValue > 0;
    }
}

File 17 of 30 : 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 18 of 30 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 19 of 30 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 21 of 30 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 22 of 30 : ClickMarketplaceErrors.sol
//SPDX-License-Identifier: NONE
pragma solidity ^0.8.18;

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

interface ClickMarketplaceErrors {
  
  error NotAuthorized();
  error MismatchingArrayLength();
  error ETHPaymentTooHigh();
  error DoubleETHPayment();
  error ERC721NotEligibleForBurn(IERC721 token);
  error ListingDoesNotExist(uint32 tokenId);
  error PriceIsZero(uint32 tokenId);
  error MaxSupplyExceeded(uint32 tokenId);
  error ListingNotStarted(uint32 tokenId);
  error ListingEnded(uint32 tokenId);
  error InsufficientClicks();
  error ListingTimeInputInvalid();
  error MinTokenIdGreaterThanMaxTokenId();

}

File 23 of 30 : ClickMarketplaceStructs.sol
//SPDX-License-Identifier: NONE
pragma solidity ^0.8.18;

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

interface ClickMarketplaceStructs {

  struct MarketplaceListing {
    bool exists;
    bool hasExisted;
    uint32 clickPrice;
    uint32 maxSupply;
    uint48 startTimestamp;
    uint48 endTimestamp;
  }

  struct BurnableToken {
    bool exists;
    bool hasExisted;
    uint32 price;
  }

  struct ActionBuyClickWithEth {
    uint256 amount;
  }

  struct ActionBuyClickWithERC20 {
    IERC20 token;
    uint256 amount;
  }

  struct ActionBurn721ForClick {
    IERC721 token;
    uint256 tokenId;
  }

  struct ActionBuyMarketplaceItem {
    uint32 tokenId;
    uint32 amount;
  }

  struct AllInfo {
    BurnableTokenInfo[] burnableTokens;
    MarketplaceListingInfo[] marketplaceListings;
  }

  struct BurnableTokenInfo {
    address token;
    uint32 price;
  }

  struct MarketplaceListingInfo {
    uint32 tokenId;
    uint32 clickPrice;
    uint32 currentSupply;
    uint32 maxSupply;
    uint48 startTimestamp;
    uint48 endTimestamp;
  }

}

File 24 of 30 : ClickPaymentReceiver.sol
//SPDX-License-Identifier: NONE
pragma solidity ^0.8.18;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

error ETHPaymentFailed();
error ETHPaymentTooHigh();
error ERC20PaymentNotSupported(IERC20 token);

contract ClickPaymentReceiver {

  address public paymentReceiver;
  uint96 public ethPrice;
  mapping(address => uint256) public erc20Prices;

  constructor(address _paymentReceiver, uint96 _ethPrice) {
    paymentReceiver = _paymentReceiver;
    ethPrice = _ethPrice;
  }

  function _takeETHPayment(uint256 amountTokens) internal {
    uint256 amount = amountTokens * ethPrice;
    if (msg.value != amount) revert ETHPaymentTooHigh();
    (bool success, /* bytes memory data */ ) = paymentReceiver.call{value: amount}("");
    if (!success) revert ETHPaymentFailed();
  }

  function _takeERC20Payment(IERC20 token, uint256 amountTokens) internal {
    uint256 price = erc20Prices[address(token)];
    if (price == 0) revert ERC20PaymentNotSupported(token);
    uint256 amount = amountTokens * price;
    
    SafeERC20.safeTransferFrom(token, msg.sender, paymentReceiver, amount);
  }

  function _setETHPrice(uint96 price) internal {
    ethPrice = price;
  }

  function _setERC20Price(IERC20 token, uint256 price) internal {
    erc20Prices[address(token)] = price;
  }

  function _setPaymentReceiver(address _paymentReceiver) internal {
    paymentReceiver = _paymentReceiver;
  }

}

File 25 of 30 : IClickToken.sol
//SPDX-License-Identifier: NONE
pragma solidity ^0.8.18;

import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "./manifold-creator-core/core/IERC1155CreatorCore.sol";

interface IClickToken is IERC1155, IERC1155CreatorCore {

  function mintBaseExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;

}

File 26 of 30 : CreatorCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";

import "../extensions/ICreatorExtensionTokenURI.sol";
import "../extensions/ICreatorExtensionRoyalties.sol";

import "./ICreatorCore.sol";

/**
 * @dev Core creator implementation
 */
abstract contract CreatorCore is ReentrancyGuard, ICreatorCore, ERC165 {
    using Strings for uint256;
    using EnumerableSet for EnumerableSet.AddressSet;
    using AddressUpgradeable for address;

    uint256 internal _tokenCount = 0;

    // Base approve transfers address location
    address internal _approveTransferBase;

    // Track registered extensions data
    EnumerableSet.AddressSet internal _extensions;
    EnumerableSet.AddressSet internal _blacklistedExtensions;

    // The baseURI for a given extension
    mapping (address => string) private _extensionBaseURI;
    mapping (address => bool) private _extensionBaseURIIdentical;

    // The prefix for any tokens with a uri configured
    mapping (address => string) private _extensionURIPrefix;

    // Mapping for individual token URIs
    mapping (uint256 => string) internal _tokenURIs;

    // Royalty configurations
    struct RoyaltyConfig {
        address payable receiver;
        uint16 bps;
    }
    mapping (address => RoyaltyConfig[]) internal _extensionRoyalty;
    mapping (uint256 => RoyaltyConfig[]) internal _tokenRoyalty;

    bytes4 private constant _CREATOR_CORE_V1 = 0x28f10a21;

    /**
     * External interface identifiers for royalties
     */

    /**
     *  @dev CreatorCore
     *
     *  bytes4(keccak256('getRoyalties(uint256)')) == 0xbb3bafd6
     *
     *  => 0xbb3bafd6 = 0xbb3bafd6
     */
    bytes4 private constant _INTERFACE_ID_ROYALTIES_CREATORCORE = 0xbb3bafd6;

    /**
     *  @dev Rarible: RoyaltiesV1
     *
     *  bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb
     *  bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f
     *
     *  => 0xb9c4d9fb ^ 0x0ebd4c7f = 0xb7799584
     */
    bytes4 private constant _INTERFACE_ID_ROYALTIES_RARIBLE = 0xb7799584;

    /**
     *  @dev Foundation
     *
     *  bytes4(keccak256('getFees(uint256)')) == 0xd5a06d4c
     *
     *  => 0xd5a06d4c = 0xd5a06d4c
     */
    bytes4 private constant _INTERFACE_ID_ROYALTIES_FOUNDATION = 0xd5a06d4c;

    /**
     *  @dev EIP-2981
     *
     * bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a
     *
     * => 0x2a55205a = 0x2a55205a
     */
    bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x2a55205a;

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

    /**
     * @dev Only allows registered extensions to call the specified function
     */
    function requireExtension() internal view {
        require(_extensions.contains(msg.sender), "Must be registered extension");
    }

    /**
     * @dev Only allows non-blacklisted extensions
     */
    function requireNonBlacklist(address extension) internal view {
        require(!_blacklistedExtensions.contains(extension), "Extension blacklisted");
    }   

    /**
     * @dev See {ICreatorCore-getExtensions}.
     */
    function getExtensions() external view override returns (address[] memory extensions) {
        extensions = new address[](_extensions.length());
        for (uint i; i < _extensions.length();) {
            extensions[i] = _extensions.at(i);
            unchecked { ++i; }
        }
        return extensions;
    }

    /**
     * @dev Register an extension
     */
    function _registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) internal virtual {
        require(extension != address(this) && extension.isContract(), "Invalid");
        emit ExtensionRegistered(extension, msg.sender);
        _extensionBaseURI[extension] = baseURI;
        _extensionBaseURIIdentical[extension] = baseURIIdentical;
        _extensions.add(extension);
        _setApproveTransferExtension(extension, true);
    }

    /**
     * @dev See {ICreatorCore-setApproveTransferExtension}.
     */
    function setApproveTransferExtension(bool enabled) external override {
        requireExtension();
        _setApproveTransferExtension(msg.sender, enabled);
    }

    /**
     * @dev Set whether or not tokens minted by the extension defers transfer approvals to the extension
     */
    function _setApproveTransferExtension(address extension, bool enabled) internal virtual;

    /**
     * @dev Unregister an extension
     */
    function _unregisterExtension(address extension) internal {
        emit ExtensionUnregistered(extension, msg.sender);
        _extensions.remove(extension);
    }

    /**
     * @dev Blacklist an extension
     */
    function _blacklistExtension(address extension) internal {
       require(extension != address(0) && extension != address(this), "Cannot blacklist yourself");
       if (_extensions.contains(extension)) {
           emit ExtensionUnregistered(extension, msg.sender);
           _extensions.remove(extension);
       }
       if (!_blacklistedExtensions.contains(extension)) {
           emit ExtensionBlacklisted(extension, msg.sender);
           _blacklistedExtensions.add(extension);
       }
    }

    /**
     * @dev Set base token uri for an extension
     */
    function _setBaseTokenURIExtension(string calldata uri, bool identical) internal {
        _extensionBaseURI[msg.sender] = uri;
        _extensionBaseURIIdentical[msg.sender] = identical;
    }

    /**
     * @dev Set token uri prefix for an extension
     */
    function _setTokenURIPrefixExtension(string calldata prefix) internal {
        _extensionURIPrefix[msg.sender] = prefix;
    }

    /**
     * @dev Set token uri for a token of an extension
     */
    function _setTokenURIExtension(uint256 tokenId, string calldata uri) internal {
        require(_tokenExtension(tokenId) == msg.sender, "Invalid token");
        _tokenURIs[tokenId] = uri;
    }

    /**
     * @dev Set base token uri for tokens with no extension
     */
    function _setBaseTokenURI(string calldata uri) internal {
        _extensionBaseURI[address(0)] = uri;
    }

    /**
     * @dev Set token uri prefix for tokens with no extension
     */
    function _setTokenURIPrefix(string calldata prefix) internal {
        _extensionURIPrefix[address(0)] = prefix;
    }


    /**
     * @dev Set token uri for a token with no extension
     */
    function _setTokenURI(uint256 tokenId, string calldata uri) internal {
        require(tokenId > 0 && tokenId <= _tokenCount && _tokenExtension(tokenId) == address(0), "Invalid token");
        _tokenURIs[tokenId] = uri;
    }

    /**
     * @dev Retrieve a token's URI
     */
    function _tokenURI(uint256 tokenId) internal view returns (string memory) {
        require(tokenId > 0 && tokenId <= _tokenCount, "Invalid token");

        address extension = _tokenExtension(tokenId);
        require(!_blacklistedExtensions.contains(extension), "Extension blacklisted");

        if (bytes(_tokenURIs[tokenId]).length != 0) {
            if (bytes(_extensionURIPrefix[extension]).length != 0) {
                return string(abi.encodePacked(_extensionURIPrefix[extension], _tokenURIs[tokenId]));
            }
            return _tokenURIs[tokenId];
        }

        if (ERC165Checker.supportsInterface(extension, type(ICreatorExtensionTokenURI).interfaceId)) {
            return ICreatorExtensionTokenURI(extension).tokenURI(address(this), tokenId);
        }

        if (!_extensionBaseURIIdentical[extension]) {
            return string(abi.encodePacked(_extensionBaseURI[extension], tokenId.toString()));
        } else {
            return _extensionBaseURI[extension];
        }
    }

    /**
     * Helper to get royalties for a token
     */
    function _getRoyalties(uint256 tokenId) view internal returns (address payable[] memory receivers, uint256[] memory bps) {

        // Get token level royalties
        RoyaltyConfig[] memory royalties = _tokenRoyalty[tokenId];
        if (royalties.length == 0) {
            // Get extension specific royalties
            address extension = _tokenExtension(tokenId);
            if (extension != address(0)) {
                if (ERC165Checker.supportsInterface(extension, type(ICreatorExtensionRoyalties).interfaceId)) {
                    (receivers, bps) = ICreatorExtensionRoyalties(extension).getRoyalties(address(this), tokenId);
                    // Extension override exists, just return that
                    if (receivers.length > 0) return (receivers, bps);
                }
                royalties = _extensionRoyalty[extension];
            }
        }
        if (royalties.length == 0) {
            // Get the default royalty
            royalties = _extensionRoyalty[address(0)];
        }
        
        if (royalties.length > 0) {
            receivers = new address payable[](royalties.length);
            bps = new uint256[](royalties.length);
            for (uint i; i < royalties.length;) {
                receivers[i] = royalties[i].receiver;
                bps[i] = royalties[i].bps;
                unchecked { ++i; }
            }
        }
    }

    /**
     * Helper to get royalty receivers for a token
     */
    function _getRoyaltyReceivers(uint256 tokenId) view internal returns (address payable[] memory recievers) {
        (recievers, ) = _getRoyalties(tokenId);
    }

    /**
     * Helper to get royalty basis points for a token
     */
    function _getRoyaltyBPS(uint256 tokenId) view internal returns (uint256[] memory bps) {
        (, bps) = _getRoyalties(tokenId);
    }

    function _getRoyaltyInfo(uint256 tokenId, uint256 value) view internal returns (address receiver, uint256 amount){
        (address payable[] memory receivers, uint256[] memory bps) = _getRoyalties(tokenId);
        require(receivers.length <= 1, "More than 1 royalty receiver");
        
        if (receivers.length == 0) {
            return (address(this), 0);
        }
        return (receivers[0], bps[0]*value/10000);
    }

    /**
     * Set royalties for a token
     */
    function _setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) internal {
       _checkRoyalties(receivers, basisPoints);
        delete _tokenRoyalty[tokenId];
        _setRoyalties(receivers, basisPoints, _tokenRoyalty[tokenId]);
        emit RoyaltiesUpdated(tokenId, receivers, basisPoints);
    }

    /**
     * Set royalties for all tokens of an extension
     */
    function _setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) internal {
        _checkRoyalties(receivers, basisPoints);
        delete _extensionRoyalty[extension];
        _setRoyalties(receivers, basisPoints, _extensionRoyalty[extension]);
        if (extension == address(0)) {
            emit DefaultRoyaltiesUpdated(receivers, basisPoints);
        } else {
            emit ExtensionRoyaltiesUpdated(extension, receivers, basisPoints);
        }
    }

    /**
     * Helper function to check that royalties provided are valid
     */
    function _checkRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints) private pure {
        require(receivers.length == basisPoints.length, "Invalid input");
        uint256 totalBasisPoints;
        for (uint i; i < basisPoints.length;) {
            totalBasisPoints += basisPoints[i];
            unchecked { ++i; }
        }
        require(totalBasisPoints < 10000, "Invalid total royalties");
    }

    /**
     * Helper function to set royalties
     */
    function _setRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints, RoyaltyConfig[] storage royalties) private {
        for (uint i; i < basisPoints.length;) {
            royalties.push(
                RoyaltyConfig(
                    {
                        receiver: receivers[i],
                        bps: uint16(basisPoints[i])
                    }
                )
            );
            unchecked { ++i; }
        }
    }

    /**
     * @dev Set the base contract's approve transfer contract location
     */
    function _setApproveTransferBase(address extension) internal {
        _approveTransferBase = extension;
        emit ApproveTransferUpdated(extension);
    }

    /**
     * @dev See {ICreatorCore-getApproveTransfer}.
     */
    function getApproveTransfer() external view override returns (address) {
        return _approveTransferBase;
    }

    /**
     * @dev Get the extension for the given token
     */
    function _tokenExtension(uint256 tokenId) internal virtual view returns(address);
}

File 27 of 30 : ICreatorCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

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

/**
 * @dev Core creator interface
 */
interface ICreatorCore is IERC165 {

    event ExtensionRegistered(address indexed extension, address indexed sender);
    event ExtensionUnregistered(address indexed extension, address indexed sender);
    event ExtensionBlacklisted(address indexed extension, address indexed sender);
    event MintPermissionsUpdated(address indexed extension, address indexed permissions, address indexed sender);
    event RoyaltiesUpdated(uint256 indexed tokenId, address payable[] receivers, uint256[] basisPoints);
    event DefaultRoyaltiesUpdated(address payable[] receivers, uint256[] basisPoints);
    event ApproveTransferUpdated(address extension);
    event ExtensionRoyaltiesUpdated(address indexed extension, address payable[] receivers, uint256[] basisPoints);
    event ExtensionApproveTransferUpdated(address indexed extension, bool enabled);

    /**
     * @dev gets address of all extensions
     */
    function getExtensions() external view returns (address[] memory);

    /**
     * @dev add an extension.  Can only be called by contract owner or admin.
     * extension address must point to a contract implementing ICreatorExtension.
     * Returns True if newly added, False if already added.
     */
    function registerExtension(address extension, string calldata baseURI) external;

    /**
     * @dev add an extension.  Can only be called by contract owner or admin.
     * extension address must point to a contract implementing ICreatorExtension.
     * Returns True if newly added, False if already added.
     */
    function registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) external;

    /**
     * @dev add an extension.  Can only be called by contract owner or admin.
     * Returns True if removed, False if already removed.
     */
    function unregisterExtension(address extension) external;

    /**
     * @dev blacklist an extension.  Can only be called by contract owner or admin.
     * This function will destroy all ability to reference the metadata of any tokens created
     * by the specified extension. It will also unregister the extension if needed.
     * Returns True if removed, False if already removed.
     */
    function blacklistExtension(address extension) external;

    /**
     * @dev set the baseTokenURI of an extension.  Can only be called by extension.
     */
    function setBaseTokenURIExtension(string calldata uri) external;

    /**
     * @dev set the baseTokenURI of an extension.  Can only be called by extension.
     * For tokens with no uri configured, tokenURI will return "uri+tokenId"
     */
    function setBaseTokenURIExtension(string calldata uri, bool identical) external;

    /**
     * @dev set the common prefix of an extension.  Can only be called by extension.
     * If configured, and a token has a uri set, tokenURI will return "prefixURI+tokenURI"
     * Useful if you want to use ipfs/arweave
     */
    function setTokenURIPrefixExtension(string calldata prefix) external;

    /**
     * @dev set the tokenURI of a token extension.  Can only be called by extension that minted token.
     */
    function setTokenURIExtension(uint256 tokenId, string calldata uri) external;

    /**
     * @dev set the tokenURI of a token extension for multiple tokens.  Can only be called by extension that minted token.
     */
    function setTokenURIExtension(uint256[] memory tokenId, string[] calldata uri) external;

    /**
     * @dev set the baseTokenURI for tokens with no extension.  Can only be called by owner/admin.
     * For tokens with no uri configured, tokenURI will return "uri+tokenId"
     */
    function setBaseTokenURI(string calldata uri) external;

    /**
     * @dev set the common prefix for tokens with no extension.  Can only be called by owner/admin.
     * If configured, and a token has a uri set, tokenURI will return "prefixURI+tokenURI"
     * Useful if you want to use ipfs/arweave
     */
    function setTokenURIPrefix(string calldata prefix) external;

    /**
     * @dev set the tokenURI of a token with no extension.  Can only be called by owner/admin.
     */
    function setTokenURI(uint256 tokenId, string calldata uri) external;

    /**
     * @dev set the tokenURI of multiple tokens with no extension.  Can only be called by owner/admin.
     */
    function setTokenURI(uint256[] memory tokenIds, string[] calldata uris) external;

    /**
     * @dev set a permissions contract for an extension.  Used to control minting.
     */
    function setMintPermissions(address extension, address permissions) external;

    /**
     * @dev Configure so transfers of tokens created by the caller (must be extension) gets approval
     * from the extension before transferring
     */
    function setApproveTransferExtension(bool enabled) external;

    /**
     * @dev get the extension of a given token
     */
    function tokenExtension(uint256 tokenId) external view returns (address);

    /**
     * @dev Set default royalties
     */
    function setRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints) external;

    /**
     * @dev Set royalties of a token
     */
    function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external;

    /**
     * @dev Set royalties of an extension
     */
    function setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) external;

    /**
     * @dev Get royalites of a token.  Returns list of receivers and basisPoints
     */
    function getRoyalties(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
    
    // Royalty support for various other standards
    function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory);
    function getFeeBps(uint256 tokenId) external view returns (uint[] memory);
    function getFees(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
    function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);

    /**
     * @dev Set the default approve transfer contract location.
     */
    function setApproveTransfer(address extension) external; 

    /**
     * @dev Get the default approve transfer contract location.
     */
    function getApproveTransfer() external view returns (address);
}

File 28 of 30 : IERC1155CreatorCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "./CreatorCore.sol";

/**
 * @dev Core ERC1155 creator interface
 */
interface IERC1155CreatorCore is ICreatorCore {

    /**
     * @dev mint a token with no extension. Can only be called by an admin.
     *
     * @param to       - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
     * @param amounts  - Can be a single element array (all recipients get the same amount) or a multi-element array
     * @param uris     - If no elements, all tokens use the default uri.
     *                   If any element is an empty string, the corresponding token uses the default uri.
     *
     *
     * Requirements: If to is a multi-element array, then uris must be empty or single element array
     *               If to is a multi-element array, then amounts must be a single element array or a multi-element array of the same size
     *               If to is a single element array, uris must be empty or the same length as amounts
     *
     * Examples:
     *    mintBaseNew(['0x....1', '0x....2'], [1], [])
     *        Mints a single new token, and gives 1 each to '0x....1' and '0x....2'.  Token uses default uri.
     *    
     *    mintBaseNew(['0x....1', '0x....2'], [1, 2], [])
     *        Mints a single new token, and gives 1 to '0x....1' and 2 to '0x....2'.  Token uses default uri.
     *    
     *    mintBaseNew(['0x....1'], [1, 2], ["", "http://token2.com"])
     *        Mints two new tokens to '0x....1'. 1 of the first token, 2 of the second.  1st token uses default uri, second uses "http://token2.com".
     *    
     * @return Returns list of tokenIds minted
     */
    function mintBaseNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory);

    /**
     * @dev batch mint existing token with no extension. Can only be called by an admin.
     *
     * @param to        - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
     * @param tokenIds  - Can be a single element array (all recipients get the same token) or a multi-element array
     * @param amounts   - Can be a single element array (all recipients get the same amount) or a multi-element array
     *
     * Requirements: If any of the parameters are multi-element arrays, they need to be the same length as other multi-element arrays
     *
     * Examples:
     *    mintBaseExisting(['0x....1', '0x....2'], [1], [10])
     *        Mints 10 of tokenId 1 to each of '0x....1' and '0x....2'.
     *    
     *    mintBaseExisting(['0x....1', '0x....2'], [1, 2], [10, 20])
     *        Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 2 to '0x....2'.
     *    
     *    mintBaseExisting(['0x....1'], [1, 2], [10, 20])
     *        Mints 10 of tokenId 1 and 20 of tokenId 2 to '0x....1'.
     *    
     *    mintBaseExisting(['0x....1', '0x....2'], [1], [10, 20])
     *        Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 1 to '0x....2'.
     *    
     */
    function mintBaseExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;

    /**
     * @dev mint a token from an extension. Can only be called by a registered extension.
     *
     * @param to       - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
     * @param amounts  - Can be a single element array (all recipients get the same amount) or a multi-element array
     * @param uris     - If no elements, all tokens use the default uri.
     *                   If any element is an empty string, the corresponding token uses the default uri.
     *
     *
     * Requirements: If to is a multi-element array, then uris must be empty or single element array
     *               If to is a multi-element array, then amounts must be a single element array or a multi-element array of the same size
     *               If to is a single element array, uris must be empty or the same length as amounts
     *
     * Examples:
     *    mintExtensionNew(['0x....1', '0x....2'], [1], [])
     *        Mints a single new token, and gives 1 each to '0x....1' and '0x....2'.  Token uses default uri.
     *    
     *    mintExtensionNew(['0x....1', '0x....2'], [1, 2], [])
     *        Mints a single new token, and gives 1 to '0x....1' and 2 to '0x....2'.  Token uses default uri.
     *    
     *    mintExtensionNew(['0x....1'], [1, 2], ["", "http://token2.com"])
     *        Mints two new tokens to '0x....1'. 1 of the first token, 2 of the second.  1st token uses default uri, second uses "http://token2.com".
     *    
     * @return Returns list of tokenIds minted
     */
    function mintExtensionNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory);

    /**
     * @dev batch mint existing token from extension. Can only be called by a registered extension.
     *
     * @param to        - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
     * @param tokenIds  - Can be a single element array (all recipients get the same token) or a multi-element array
     * @param amounts   - Can be a single element array (all recipients get the same amount) or a multi-element array
     *
     * Requirements: If any of the parameters are multi-element arrays, they need to be the same length as other multi-element arrays
     *
     * Examples:
     *    mintExtensionExisting(['0x....1', '0x....2'], [1], [10])
     *        Mints 10 of tokenId 1 to each of '0x....1' and '0x....2'.
     *    
     *    mintExtensionExisting(['0x....1', '0x....2'], [1, 2], [10, 20])
     *        Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 2 to '0x....2'.
     *    
     *    mintExtensionExisting(['0x....1'], [1, 2], [10, 20])
     *        Mints 10 of tokenId 1 and 20 of tokenId 2 to '0x....1'.
     *    
     *    mintExtensionExisting(['0x....1', '0x....2'], [1], [10, 20])
     *        Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 1 to '0x....2'.
     *    
     */
    function mintExtensionExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;

    /**
     * @dev burn tokens. Can only be called by token owner or approved address.
     * On burn, calls back to the registered extension's onBurn method
     */
    function burn(address account, uint256[] calldata tokenIds, uint256[] calldata amounts) external;

    /**
     * @dev Total amount of tokens in with a given tokenId.
     */
    function totalSupply(uint256 tokenId) external view returns (uint256);
}

File 29 of 30 : ICreatorExtensionRoyalties.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

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

/**
 * @dev Implement this if you want your extension to have overloadable royalties
 */
interface ICreatorExtensionRoyalties is IERC165 {

    /**
     * Get the royalties for a given creator/tokenId
     */
    function getRoyalties(address creator, uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
}

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

pragma solidity ^0.8.0;

/// @author: manifold.xyz

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

/**
 * @dev Implement this if you want your extension to have overloadable URI's
 */
interface ICreatorExtensionTokenURI is IERC165 {

    /**
     * Get the uri for a given creator/tokenId
     */
    function tokenURI(address creator, uint256 tokenId) external view returns (string memory);
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"contract IClickToken","name":"_clickToken","type":"address"},{"internalType":"uint256","name":"_clickTokenId","type":"uint256"},{"internalType":"address","name":"_paymentReceiver","type":"address"},{"internalType":"uint96","name":"_ethPrice","type":"uint96"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"DoubleETHPayment","type":"error"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"ERC20PaymentNotSupported","type":"error"},{"inputs":[{"internalType":"contract IERC721","name":"token","type":"address"}],"name":"ERC721NotEligibleForBurn","type":"error"},{"inputs":[],"name":"ETHPaymentFailed","type":"error"},{"inputs":[],"name":"ETHPaymentTooHigh","type":"error"},{"inputs":[],"name":"ETHPaymentTooHigh","type":"error"},{"inputs":[],"name":"InsufficientClicks","type":"error"},{"inputs":[{"internalType":"uint32","name":"tokenId","type":"uint32"}],"name":"ListingDoesNotExist","type":"error"},{"inputs":[{"internalType":"uint32","name":"tokenId","type":"uint32"}],"name":"ListingEnded","type":"error"},{"inputs":[{"internalType":"uint32","name":"tokenId","type":"uint32"}],"name":"ListingNotStarted","type":"error"},{"inputs":[],"name":"ListingTimeInputInvalid","type":"error"},{"inputs":[{"internalType":"uint32","name":"tokenId","type":"uint32"}],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[],"name":"MinTokenIdGreaterThanMaxTokenId","type":"error"},{"inputs":[],"name":"MismatchingArrayLength","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"inputs":[{"internalType":"uint32","name":"tokenId","type":"uint32"}],"name":"PriceIsZero","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint32","name":"price","type":"uint32"}],"name":"BurnableTokenAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"BurnableTokenRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClicksBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"tokenId","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"clickPrice","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"maxSupply","type":"uint32"},{"indexed":false,"internalType":"uint48","name":"startTimestamp","type":"uint48"},{"indexed":false,"internalType":"uint48","name":"endTimestamp","type":"uint48"}],"name":"ListingAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"uint32","name":"tokenId","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"amount","type":"uint32"}],"name":"ListingBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"tokenId","type":"uint32"}],"name":"ListingRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"burner","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"burnPrice","type":"uint256"}],"name":"NFTBurnedForClicks","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"CLICK_TOKEN","outputs":[{"internalType":"contract IClickToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CLICK_TOKEN_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"erc20Prices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"erc721BurnableTokens","outputs":[{"internalType":"bool","name":"exists","type":"bool"},{"internalType":"bool","name":"hasExisted","type":"bool"},{"internalType":"uint32","name":"price","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethPrice","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ClickMarketplaceStructs.ActionBuyClickWithEth[]","name":"buyClickWithEth","type":"tuple[]"},{"components":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ClickMarketplaceStructs.ActionBuyClickWithERC20[]","name":"buyClickWithERC20","type":"tuple[]"},{"components":[{"internalType":"contract IERC721","name":"token","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct ClickMarketplaceStructs.ActionBurn721ForClick[]","name":"burn721ForClick","type":"tuple[]"},{"components":[{"internalType":"uint32","name":"tokenId","type":"uint32"},{"internalType":"uint32","name":"amount","type":"uint32"}],"internalType":"struct ClickMarketplaceStructs.ActionBuyMarketplaceItem[]","name":"buyMarketplaceItem","type":"tuple[]"}],"name":"executeActions","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getAllInfo","outputs":[{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint32","name":"price","type":"uint32"}],"internalType":"struct ClickMarketplaceStructs.BurnableTokenInfo[]","name":"burnableTokens","type":"tuple[]"},{"components":[{"internalType":"uint32","name":"tokenId","type":"uint32"},{"internalType":"uint32","name":"clickPrice","type":"uint32"},{"internalType":"uint32","name":"currentSupply","type":"uint32"},{"internalType":"uint32","name":"maxSupply","type":"uint32"},{"internalType":"uint48","name":"startTimestamp","type":"uint48"},{"internalType":"uint48","name":"endTimestamp","type":"uint48"}],"internalType":"struct ClickMarketplaceStructs.MarketplaceListingInfo[]","name":"marketplaceListings","type":"tuple[]"}],"internalType":"struct ClickMarketplaceStructs.AllInfo","name":"allInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"listings","outputs":[{"internalType":"bool","name":"exists","type":"bool"},{"internalType":"bool","name":"hasExisted","type":"bool"},{"internalType":"uint32","name":"clickPrice","type":"uint32"},{"internalType":"uint32","name":"maxSupply","type":"uint32"},{"internalType":"uint48","name":"startTimestamp","type":"uint48"},{"internalType":"uint48","name":"endTimestamp","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"permaErc721BurnableTokensArray","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"permaListingsArray","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"removeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"tokenId","type":"uint32"}],"name":"removeListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"tokenId","type":"uint32[]"}],"name":"removeListings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint32","name":"price","type":"uint32"}],"name":"setBurnableToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"token","type":"address[]"},{"internalType":"uint32[]","name":"price","type":"uint32[]"}],"name":"setBurnableTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setERC20Price","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint96","name":"price","type":"uint96"}],"name":"setETHPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"tokenId","type":"uint32"},{"internalType":"uint32","name":"clickPrice","type":"uint32"},{"internalType":"uint32","name":"maxSupply","type":"uint32"},{"internalType":"uint48","name":"startTimestamp","type":"uint48"},{"internalType":"uint48","name":"endTimestamp","type":"uint48"}],"name":"setListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"tokenId","type":"uint32[]"},{"internalType":"uint32[]","name":"clickPrice","type":"uint32[]"},{"internalType":"uint32[]","name":"maxSupply","type":"uint32[]"},{"internalType":"uint48[]","name":"startTimestamp","type":"uint48[]"},{"internalType":"uint48[]","name":"endTimestamp","type":"uint48[]"}],"name":"setListings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_paymentReceiver","type":"address"}],"name":"setPaymentReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"sweepERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c060405234801562000010575f80fd5b5060405162003e6838038062003e68833981016040819052620000339162000113565b81816200004033620000ac565b600280546001600160a01b03909316610100026001600160a81b031990931692909217909155600380546001600160601b039092166001600160601b03199092169190911790556200009285620000ac565b50506001600160a01b0390911660805260a052506200018d565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811462000110575f80fd5b50565b5f805f805f60a0868803121562000128575f80fd5b85516200013581620000fb565b60208701519095506200014881620000fb565b6040870151606088015191955093506200016281620000fb565b60808701519092506001600160601b03811681146200017f575f80fd5b809150509295509295909350565b60805160a051613c57620002115f395f818161059f01528181612381015281816127e9015281816128610152818161293b01528181612a250152612a8f01525f81816105f101528181611b3f01528181612346015281816125ac0152818161283801528181612900015281816129ea01528181612a540152612b0a0152613c575ff3fe608060405260043610610207575f3560e01c80638456cb5911610113578063b2a8bbf31161009d578063cb37f3b21161006d578063cb37f3b214610666578063d547741f1461068a578063f2fde38b146106a9578063f81c2347146106c8578063ff186b2e14610778575f80fd5b8063b2a8bbf3146105c1578063b9e30200146105e0578063c30eac5314610613578063cb267c2514610632575f80fd5b80639f543161116100e35780639f5431611461051c578063a14701111461053b578063a217fddf1461055a578063b18e15bd1461056d578063b23329631461058e575f80fd5b80638456cb591461049a57806384b36c2f146104ae5780638da5cb5b146104cd57806391d14854146104fd575f80fd5b80633f4ba83a1161019457806365ebf99a1161016457806365ebf99a1461040a5780636ffdb0a0146104295780637048027514610448578063715018a61461046757806383ba01781461047b575f80fd5b80633f4ba83a146103ad578063582515c7146103c15780635c975abb146103e0578063635c4fac146103f7575f80fd5b8063248a9ca3116101da578063248a9ca31461029e5780632f2ff15d146102db5780632fef304c146102fa578063334f13101461036357806336568abe1461038e575f80fd5b806301ffc9a71461020b5780631785f53c1461023f5780631a76e3f414610260578063246c87ff1461027f575b5f80fd5b348015610216575f80fd5b5061022a6102253660046132cb565b6107af565b60405190151581526020015b60405180910390f35b34801561024a575f80fd5b5061025e610259366004613306565b6107e5565b005b34801561026b575f80fd5b5061025e61027a36600461334e565b610807565b34801561028a575f80fd5b5061025e6102993660046133af565b610acf565b3480156102a9575f80fd5b506102cd6102b83660046133c8565b5f908152600160208190526040909120015490565b604051908152602001610236565b3480156102e6575f80fd5b5061025e6102f53660046133df565b610b6a565b348015610305575f80fd5b50610340610314366004613306565b60056020525f908152604090205460ff8082169161010081049091169062010000900463ffffffff1683565b604080519315158452911515602084015263ffffffff1690820152606001610236565b34801561036e575f80fd5b506102cd61037d366004613306565b60046020525f908152604090205481565b348015610399575f80fd5b5061025e6103a83660046133df565b610b94565b3480156103b8575f80fd5b5061025e610c17565b3480156103cc575f80fd5b5061025e6103db36600461340d565b610c6d565b3480156103eb575f80fd5b5060025460ff1661022a565b61025e6104053660046134c2565b610cea565b348015610415575f80fd5b5061025e610424366004613306565b610d4b565b348015610434575f80fd5b5061025e61044336600461357d565b610d76565b348015610453575f80fd5b5061025e610462366004613306565b610f3a565b348015610472575f80fd5b5061025e610f59565b348015610486575f80fd5b5061025e6104953660046135b0565b610f6a565b3480156104a5575f80fd5b5061025e610fd2565b3480156104b9575f80fd5b5061025e6104c83660046135da565b611026565b3480156104d8575f80fd5b505f546001600160a01b03165b6040516001600160a01b039091168152602001610236565b348015610508575f80fd5b5061022a6105173660046133df565b611111565b348015610527575f80fd5b5061025e610536366004613619565b61113b565b348015610546575f80fd5b5061025e6105553660046136ff565b61155d565b348015610565575f80fd5b506102cd5f81565b348015610578575f80fd5b506105816117b8565b60405161023691906137f0565b348015610599575f80fd5b506102cd7f000000000000000000000000000000000000000000000000000000000000000081565b3480156105cc575f80fd5b506104e56105db3660046133c8565b611c72565b3480156105eb575f80fd5b506104e57f000000000000000000000000000000000000000000000000000000000000000081565b34801561061e575f80fd5b5061025e61062d366004613875565b611c9a565b34801561063d575f80fd5b5061065161064c3660046133c8565b611d09565b60405163ffffffff9091168152602001610236565b348015610671575f80fd5b506002546104e59061010090046001600160a01b031681565b348015610695575f80fd5b5061025e6106a43660046133df565b611d40565b3480156106b4575f80fd5b5061025e6106c3366004613306565b611d65565b3480156106d3575f80fd5b506107346106e23660046133af565b60066020525f908152604090205460ff8082169161010081049091169063ffffffff620100008204811691600160301b81049091169065ffffffffffff600160501b8204811691600160801b90041686565b604080519615158752941515602087015263ffffffff938416948601949094529116606084015265ffffffffffff90811660808401521660a082015260c001610236565b348015610783575f80fd5b50600354610797906001600160601b031681565b6040516001600160601b039091168152602001610236565b5f6001600160e01b03198216637965db0b60e01b14806107df57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6107ed611ddb565b6108045f80516020613c0283398151915282611d40565b50565b61081e5f80516020613c0283398151915233611111565b15801561083557505f546001600160a01b03163314155b156108535760405163ea8e4eb560e01b815260040160405180910390fd5b5f8265ffffffffffff1611801561087157505f8165ffffffffffff16115b801561088c57508065ffffffffffff168265ffffffffffff16115b156108aa57604051631ded50d760e11b815260040160405180910390fd5b63ffffffff85165f9081526006602052604090205460ff16156108e95760405163ffffffff8616905f80516020613be2833981519152905f90a2610964565b63ffffffff85165f90815260066020526040902054610100900460ff1661096457600880546001810182555f8290529081047ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee301805463ffffffff80891660046007909516949094026101000a938402930219169190911790555b6040805160c0810182526001808252602080830191825263ffffffff8089168486019081528882166060860190815265ffffffffffff808a166080880190815289821660a089019081528e86165f8181526006909852968a902098518954985195519451925191518416600160801b0265ffffffffffff60801b1992909416600160501b02919091166bffffffffffffffffffffffff60501b19928716600160301b0269ffffffff000000000000199590971662010000029490941669ffffffffffffffff0000199515156101000261ff00199215159290921661ffff19909916989098171793909316959095179290921716179190911790915590517fc956384381edaeb0a57ce0fc3122d9164d6c0cd749e82a990e78d5681fb1fbc090610ac090879087908790879063ffffffff948516815292909316602083015265ffffffffffff908116604083015291909116606082015260800190565b60405180910390a25050505050565b610ae65f80516020613c0283398151915233611111565b158015610afd57505f546001600160a01b03163314155b15610b1b5760405163ea8e4eb560e01b815260040160405180910390fd5b63ffffffff81165f9081526006602052604090205460ff16156108045763ffffffff81165f81815260066020526040808220805460ff19169055515f80516020613be28339815191529190a250565b5f8281526001602081905260409091200154610b8581611e34565b610b8f8383611e3e565b505050565b6001600160a01b0381163314610c095760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610c138282611ea8565b5050565b610c2e5f80516020613c0283398151915233611111565b158015610c4557505f546001600160a01b03163314155b15610c635760405163ea8e4eb560e01b815260040160405180910390fd5b610c6b611f0e565b565b610c75611ddb565b6040516370a0823160e01b81523060048201525f906001600160a01b038416906370a0823190602401602060405180830381865afa158015610cb9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cdd919061389b565b9050610b8f838383611f60565b610cf2611fc3565b5f610cfd8989612009565b610d0790826138c6565b9050610d1387876120c5565b610d1d90826138c6565b9050610d298585612199565b610d3390826138c6565b9050610d40838383612336565b505050505050505050565b610d53611ddb565b60028054610100600160a81b0319166101006001600160a01b0384160217905550565b610d8d5f80516020613c0283398151915233611111565b158015610da457505f546001600160a01b03163314155b15610dc25760405163ea8e4eb560e01b815260040160405180910390fd5b6001600160a01b0382165f9081526005602052604090205460ff1615610e1a576040516001600160a01b038316907fa8f823d1b8a45afef297c4a67ec114fc1cfd7bdfa55521b80892e17dc2e353d7905f90a2610e89565b6001600160a01b0382165f90815260056020526040902054610100900460ff16610e8957600780546001810182555f919091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b0319166001600160a01b0384161790555b604080516060810182526001808252602080830191825263ffffffff8581168486018181526001600160a01b0389165f81815260058652889020965187549651925161ffff1990971690151561ff00191617610100921515929092029190911765ffffffff00001916620100009590931694909402919091179093559251918252917fd5260d825eeec5ed7c5396d5908d74a13c6b769591d66e6b54a3f3f02fc81440910160405180910390a25050565b610f42611ddb565b6108045f80516020613c0283398151915282610b6a565b610f61611ddb565b610c6b5f612b98565b610f815f80516020613c0283398151915233611111565b158015610f9857505f546001600160a01b03163314155b15610fb65760405163ea8e4eb560e01b815260040160405180910390fd5b6001600160a01b03919091165f90815260046020526040902055565b610fe95f80516020613c0283398151915233611111565b15801561100057505f546001600160a01b03163314155b1561101e5760405163ea8e4eb560e01b815260040160405180910390fd5b610c6b612be7565b61103d5f80516020613c0283398151915233611111565b15801561105457505f546001600160a01b03163314155b156110725760405163ea8e4eb560e01b815260040160405180910390fd5b805f5b8181101561110b575f848483818110611090576110906138d9565b90506020020160208101906110a591906133af565b63ffffffff81165f9081526006602052604090205490915060ff166110ca57506110fb565b63ffffffff81165f81815260066020526040808220805460ff19169055515f80516020613be28339815191529190a2505b611104816138ed565b9050611075565b50505050565b5f9182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6111525f80516020613c0283398151915233611111565b15801561116957505f546001600160a01b03163314155b156111875760405163ea8e4eb560e01b815260040160405180910390fd5b888781146111a85760405163e22ffb0960e01b815260040160405180910390fd5b8086146111c85760405163e22ffb0960e01b815260040160405180910390fd5b8084146111e85760405163e22ffb0960e01b815260040160405180910390fd5b8082146112085760405163e22ffb0960e01b815260040160405180910390fd5b5f5b8181101561154f575f868683818110611225576112256138d9565b905060200201602081019061123a9190613905565b90505f85858481811061124f5761124f6138d9565b90506020020160208101906112649190613905565b90505f8265ffffffffffff1611801561128457505f8165ffffffffffff16115b801561129f57508065ffffffffffff168265ffffffffffff16115b156112bd57604051631ded50d760e11b815260040160405180910390fd5b5f8e8e858181106112d0576112d06138d9565b90506020020160208101906112e591906133af565b90505f8d8d868181106112fa576112fa6138d9565b905060200201602081019061130f91906133af565b90505f8c8c87818110611324576113246138d9565b905060200201602081019061133991906133af565b63ffffffff84165f9081526006602052604090205490915060ff161561137b5760405163ffffffff8416905f80516020613be2833981519152905f90a26113d5565b600880546001810182555f8290529081047ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee301805463ffffffff80871660046007909516949094026101000a938402930219169190911790555b6040805160c0810182526001808252602080830191825263ffffffff8087168486019081528682166060860190815265ffffffffffff808d16608088019081528c821660a089019081528c86165f8181526006909852968a902098518954985195519451925191518416600160801b0265ffffffffffff60801b1992909416600160501b02919091166bffffffffffffffffffffffff60501b19928716600160301b0269ffffffff000000000000199590971662010000029490941669ffffffffffffffff0000199515156101000261ff00199215159290921661ffff19909916989098171793909316959095179290921716179190911790915590517fc956384381edaeb0a57ce0fc3122d9164d6c0cd749e82a990e78d5681fb1fbc09061153190859085908a908a9063ffffffff948516815292909316602083015265ffffffffffff908116604083015291909116606082015260800190565b60405180910390a2505050505080611548906138ed565b905061120a565b505050505050505050505050565b6115745f80516020613c0283398151915233611111565b15801561158b57505f546001600160a01b03163314155b156115a95760405163ea8e4eb560e01b815260040160405180910390fd5b828181146115ca5760405163e22ffb0960e01b815260040160405180910390fd5b5f5b818110156117b0575f8686838181106115e7576115e76138d9565b90506020020160208101906115fc9190613306565b90505f858584818110611611576116116138d9565b905060200201602081019061162691906133af565b6001600160a01b0383165f9081526005602052604090205490915060ff1615611681576040516001600160a01b038316907fa8f823d1b8a45afef297c4a67ec114fc1cfd7bdfa55521b80892e17dc2e353d7905f90a26116f0565b6001600160a01b0382165f90815260056020526040902054610100900460ff166116f057600780546001810182555f919091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b0319166001600160a01b0384161790555b604080516060810182526001808252602080830191825263ffffffff8581168486018181526001600160a01b0389165f81815260058652889020965187549651925161ffff1990971690151561ff00191617610100921515929092029190911765ffffffff00001916620100009590931694909402919091179093559251918252917fd5260d825eeec5ed7c5396d5908d74a13c6b769591d66e6b54a3f3f02fc81440910160405180910390a25050806117a9906138ed565b90506115cc565b505050505050565b60408051808201909152606080825260208201525f600780548060200260200160405190810160405280929190818152602001828054801561182157602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311611803575b505050505090505f815190505f8167ffffffffffffffff8111156118475761184761391e565b60405190808252806020026020018201604052801561188b57816020015b604080518082019091525f80825260208201528152602001906001900390816118655790505b5090505f805b83811015611975575f8582815181106118ac576118ac6138d9565b6020908102919091018101516001600160a01b0381165f908152600583526040908190208151606081018352905460ff8082161580158452610100830490911615159583019590955262010000900463ffffffff169181019190915290925090611962576040518060400160405280836001600160a01b03168152602001826040015163ffffffff1681525085858151811061194a5761194a6138d9565b60200260200101819052508361195f906138ed565b93505b50508061196e906138ed565b9050611891565b505f60088054806020026020016040519081016040528092919081815260200182805480156119ec57602002820191905f5260205f20905f905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116119af5790505b50505050509050805193505f8467ffffffffffffffff811115611a1157611a1161391e565b604051908082528060200260200182016040528015611a6f57816020015b6040805160c0810182525f8082526020808301829052928201819052606082018190526080820181905260a082015282525f19909201910181611a2f5790505b5090505f92505f5b85811015611c55575f838281518110611a9257611a926138d9565b60209081029190910181015163ffffffff8082165f90815260068452604090819020815160c081018352905460ff80821615801584526101008304909116151596830196909652620100008104841692820192909252600160301b8204909216606083015265ffffffffffff600160501b820481166080840152600160801b9091041660a082015290925090611c425760405163bd85b03960e01b815263ffffffff831660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063bd85b03990602401602060405180830381865afa158015611b8c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bb0919061389b565b90506040518060c001604052808463ffffffff168152602001836040015163ffffffff1681526020018263ffffffff168152602001836060015163ffffffff168152602001836080015165ffffffffffff1681526020018360a0015165ffffffffffff16815250858881518110611c2957611c296138d9565b602002602001018190525086611c3e906138ed565b9650505b505080611c4e906138ed565b9050611a77565b506040805180820190915293845260208401525090949350505050565b60078181548110611c81575f80fd5b5f918252602090912001546001600160a01b0316905081565b611cb15f80516020613c0283398151915233611111565b158015611cc857505f546001600160a01b03163314155b15611ce65760405163ea8e4eb560e01b815260040160405180910390fd5b600380546bffffffffffffffffffffffff19166001600160601b03831617905550565b60088181548110611d18575f80fd5b905f5260205f209060089182820401919006600402915054906101000a900463ffffffff1681565b5f8281526001602081905260409091200154611d5b81611e34565b610b8f8383611ea8565b611d6d611ddb565b6001600160a01b038116611dd25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c00565b61080481612b98565b5f546001600160a01b03163314610c6b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c00565b6108048133612c24565b611e488282611111565b610c13575f8281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b611eb28282611111565b15610c13575f8281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b611f16612c7d565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6040516001600160a01b038316602482015260448101829052610b8f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612cc6565b60025460ff1615610c6b5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610c00565b5f600182111561202c57604051633520673360e01b815260040160405180910390fd5b60018290036120a6575f83835f818110612048576120486138d9565b9050602002015f0135905061205c81612d99565b61206681836138c6565b6040518281529092505f9033907f608d7b286eecd6ec46f6871b357f9c2345916d0ded18ade42bcd5e337d7713249060200160405180910390a3506107df565b34156107df5760405163195adfc760e31b815260040160405180910390fd5b5f81815b81811015612191575f8585838181106120e4576120e46138d9565b9050604002016020013590505f868684818110612103576121036138d9565b6121199260206040909202019081019150613306565b90506121258183612e49565b61212f82866138c6565b9450806001600160a01b0316336001600160a01b03167f608d7b286eecd6ec46f6871b357f9c2345916d0ded18ade42bcd5e337d7713248460405161217691815260200190565b60405180910390a350508061218a906138ed565b90506120c9565b505092915050565b5f81815b81811015612191575f8585838181106121b8576121b86138d9565b9050604002018036038101906121ce9190613967565b80516001600160a01b0381165f908152600560209081526040918290208251606081018452905460ff8082161515808452610100830490911615159383019390935262010000900463ffffffff169281019290925292935090916122505760405163d28f103b60e01b81526001600160a01b0383166004820152602401610c00565b604081810151602085015191516323b872dd60e01b815233600482015261dead6024820152604481018390529091906001600160a01b038516906323b872dd906064015f604051808303815f87803b1580156122aa575f80fd5b505af11580156122bc573d5f803e3d5ffd5b505050508163ffffffff16886122d291906138c6565b6040805183815263ffffffff851660208201529199506001600160a01b0386169133917fd8a3fdc3b82f7c01440fd1020b268406abd1637523e283dbd21f5a538a04a4f4910160405180910390a350505050508061232f906138ed565b905061219d565b5f8290036123fe578015610b8f577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663695c96e661237c33612ebb565b6123a57f0000000000000000000000000000000000000000000000000000000000000000612f11565b6123ae85612f11565b6040518463ffffffff1660e01b81526004016123cc939291906139cd565b5f604051808303815f87803b1580156123e3575f80fd5b505af11580156123f5573d5f803e3d5ffd5b50505050505050565b5f828161240c8260016138c6565b90505f8167ffffffffffffffff8111156124285761242861391e565b604051908082528060200260200182016040528015612451578160200160208202803683370190505b5090505f8267ffffffffffffffff81111561246e5761246e61391e565b604051908082528060200260200182016040528015612497578160200160208202803683370190505b5090505f5b848110156127cd575f8989838181106124b7576124b76138d9565b9050604002018036038101906124cd9190613a41565b805163ffffffff8082165f90815260066020908152604091829020825160c081018452905460ff80821615158084526101008304909116151593830193909352620100008104851693820193909352600160301b8304909316606084015265ffffffffffff600160501b830481166080850152600160801b90920490911660a0830152929350909161257a5760405163b70f3a5f60e01b815263ffffffff83166004820152602401610c00565b6020830151606082015163ffffffff16156126575760405163bd85b03960e01b815263ffffffff841660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063bd85b03990602401602060405180830381865afa1580156125f9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061261d919061389b565b9050826060015163ffffffff168263ffffffff168261263c91906138c6565b1115612655578083606001516126529190613a7c565b91505b505b8063ffffffff165f0361266d57505050506127bd565b5f826080015165ffffffffffff161180156126935750816080015165ffffffffffff1642105b156126b957604051633a59b31760e01b815263ffffffff84166004820152602401610c00565b5f8260a0015165ffffffffffff161180156126df57508160a0015165ffffffffffff1642115b156127055760405163393a845760e01b815263ffffffff84166004820152602401610c00565b8263ffffffff1687868151811061271e5761271e6138d9565b6020026020010181815250508063ffffffff16868681518110612743576127436138d9565b6020026020010181815250508063ffffffff16826040015163ffffffff1661276b9190613aa0565b612775908b6138c6565b60405163ffffffff8381168252919b509084169033907fbeb09feae9f91ac209f3a395592de5ebf4f1b1e0f93876dfafd6ed399ab6f2e39060200160405180910390a3505050505b6127c6816138ed565b905061249c565b505f600260019054906101000a90046001600160a01b031690507f000000000000000000000000000000000000000000000000000000000000000083868151811061281a5761281a6138d9565b602002602001018181525050868611156129b8576001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663f242432a33837f000000000000000000000000000000000000000000000000000000000000000061288a8c8c613ab7565b6040516001600160e01b031960e087901b1681526001600160a01b0394851660048201529390921660248401526044830152606482015260a060848201525f60a482015260c4015f604051808303815f87803b1580156128e8575f80fd5b505af11580156128fa573d5f803e3d5ffd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663695c96e661293683612ebb565b61295f7f0000000000000000000000000000000000000000000000000000000000000000612f11565b6129688b612f11565b6040518463ffffffff1660e01b8152600401612986939291906139cd565b5f604051808303815f87803b15801561299d575f80fd5b505af11580156129af573d5f803e3d5ffd5b50505050612b08565b86861015612a52576129ca8688613ab7565b8286815181106129dc576129dc6138d9565b6020026020010181815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663695c96e6612a2083612ebb565b612a497f0000000000000000000000000000000000000000000000000000000000000000612f11565b6129688a612f11565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663695c96e6612a8a83612ebb565b612ab37f0000000000000000000000000000000000000000000000000000000000000000612f11565b612abc8a612f11565b6040518463ffffffff1660e01b8152600401612ada939291906139cd565b5f604051808303815f87803b158015612af1575f80fd5b505af1158015612b03573d5f803e3d5ffd5b505050505b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663695c96e6612b4033612ebb565b85856040518463ffffffff1660e01b8152600401612b60939291906139cd565b5f604051808303815f87803b158015612b77575f80fd5b505af1158015612b89573d5f803e3d5ffd5b50505050505050505050505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b612bef611fc3565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611f433390565b612c2e8282611111565b610c1357612c3b81612f5a565b612c46836020612f6c565b604051602001612c57929190613aec565b60408051601f198184030181529082905262461bcd60e51b8252610c0091600401613b60565b60025460ff16610c6b5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610c00565b5f612d1a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166131099092919063ffffffff16565b905080515f1480612d3a575080806020019051810190612d3a9190613b92565b610b8f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c00565b6003545f90612db1906001600160601b031683613aa0565b9050803414612dd35760405163195adfc760e31b815260040160405180910390fd5b6002546040515f9161010090046001600160a01b03169083908381818185875af1925050503d805f8114612e22576040519150601f19603f3d011682016040523d82523d5f602084013e612e27565b606091505b5050905080610b8f57604051630139482b60e11b815260040160405180910390fd5b6001600160a01b0382165f9081526004602052604081205490819003612e8d576040516308db7ac960e41b81526001600160a01b0384166004820152602401610c00565b5f612e988284613aa0565b905061110b8433600260019054906101000a90046001600160a01b03168461311f565b6040805160018082528183019092526060915f91906020808301908036833701905050905082815f81518110612ef357612ef36138d9565b6001600160a01b039092166020928302919091019091015292915050565b6040805160018082528183019092526060915f91906020808301908036833701905050905082815f81518110612f4957612f496138d9565b602090810291909101015292915050565b60606107df6001600160a01b03831660145b60605f612f7a836002613aa0565b612f859060026138c6565b67ffffffffffffffff811115612f9d57612f9d61391e565b6040519080825280601f01601f191660200182016040528015612fc7576020820181803683370190505b509050600360fc1b815f81518110612fe157612fe16138d9565b60200101906001600160f81b03191690815f1a905350600f60fb1b8160018151811061300f5761300f6138d9565b60200101906001600160f81b03191690815f1a9053505f613031846002613aa0565b61303c9060016138c6565b90505b60018111156130b3576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613070576130706138d9565b1a60f81b828281518110613086576130866138d9565b60200101906001600160f81b03191690815f1a90535060049490941c936130ac81613bb1565b905061303f565b5083156131025760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c00565b9392505050565b606061311784845f85613157565b949350505050565b6040516001600160a01b038085166024830152831660448201526064810182905261110b9085906323b872dd60e01b90608401611f8c565b6060824710156131b85760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c00565b5f80866001600160a01b031685876040516131d39190613bc6565b5f6040518083038185875af1925050503d805f811461320d576040519150601f19603f3d011682016040523d82523d5f602084013e613212565b606091505b50915091506132238783838761322e565b979650505050505050565b6060831561329c5782515f03613295576001600160a01b0385163b6132955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c00565b5081613117565b61311783838151156132b15781518083602001fd5b8060405162461bcd60e51b8152600401610c009190613b60565b5f602082840312156132db575f80fd5b81356001600160e01b031981168114613102575f80fd5b6001600160a01b0381168114610804575f80fd5b5f60208284031215613316575f80fd5b8135613102816132f2565b803563ffffffff81168114613334575f80fd5b919050565b803565ffffffffffff81168114613334575f80fd5b5f805f805f60a08688031215613362575f80fd5b61336b86613321565b945061337960208701613321565b935061338760408701613321565b925061339560608701613339565b91506133a360808701613339565b90509295509295909350565b5f602082840312156133bf575f80fd5b61310282613321565b5f602082840312156133d8575f80fd5b5035919050565b5f80604083850312156133f0575f80fd5b823591506020830135613402816132f2565b809150509250929050565b5f806040838503121561341e575f80fd5b8235613429816132f2565b91506020830135613402816132f2565b5f8083601f840112613449575f80fd5b50813567ffffffffffffffff811115613460575f80fd5b6020830191508360208260051b850101111561347a575f80fd5b9250929050565b5f8083601f840112613491575f80fd5b50813567ffffffffffffffff8111156134a8575f80fd5b6020830191508360208260061b850101111561347a575f80fd5b5f805f805f805f806080898b0312156134d9575f80fd5b883567ffffffffffffffff808211156134f0575f80fd5b6134fc8c838d01613439565b909a50985060208b0135915080821115613514575f80fd5b6135208c838d01613481565b909850965060408b0135915080821115613538575f80fd5b6135448c838d01613481565b909650945060608b013591508082111561355c575f80fd5b506135698b828c01613481565b999c989b5096995094979396929594505050565b5f806040838503121561358e575f80fd5b8235613599816132f2565b91506135a760208401613321565b90509250929050565b5f80604083850312156135c1575f80fd5b82356135cc816132f2565b946020939093013593505050565b5f80602083850312156135eb575f80fd5b823567ffffffffffffffff811115613601575f80fd5b61360d85828601613439565b90969095509350505050565b5f805f805f805f805f8060a08b8d031215613632575f80fd5b8a3567ffffffffffffffff80821115613649575f80fd5b6136558e838f01613439565b909c509a5060208d013591508082111561366d575f80fd5b6136798e838f01613439565b909a50985060408d0135915080821115613691575f80fd5b61369d8e838f01613439565b909850965060608d01359150808211156136b5575f80fd5b6136c18e838f01613439565b909650945060808d01359150808211156136d9575f80fd5b506136e68d828e01613439565b915080935050809150509295989b9194979a5092959850565b5f805f8060408587031215613712575f80fd5b843567ffffffffffffffff80821115613729575f80fd5b61373588838901613439565b9096509450602087013591508082111561374d575f80fd5b5061375a87828801613439565b95989497509550505050565b5f8151808452602080850194508084015f5b838110156137e5578151805163ffffffff9081168952848201518116858a01526040808301518216908a01526060808301519091169089015260808082015165ffffffffffff908116918a019190915260a091820151169088015260c09096019590820190600101613778565b509495945050505050565b6020808252825160408383018190528151606085018190525f9392830191849160808701905b8084101561384e57845180516001600160a01b0316835286015163ffffffff1686830152938501936001939093019290820190613816565b5093870151868503601f190182880152936138698186613766565b98975050505050505050565b5f60208284031215613885575f80fd5b81356001600160601b0381168114613102575f80fd5b5f602082840312156138ab575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b808201808211156107df576107df6138b2565b634e487b7160e01b5f52603260045260245ffd5b5f600182016138fe576138fe6138b2565b5060010190565b5f60208284031215613915575f80fd5b61310282613339565b634e487b7160e01b5f52604160045260245ffd5b6040805190810167ffffffffffffffff8111828210171561396157634e487b7160e01b5f52604160045260245ffd5b60405290565b5f60408284031215613977575f80fd5b61397f613932565b823561398a816132f2565b81526020928301359281019290925250919050565b5f8151808452602080850194508084015f5b838110156137e5578151875295820195908201906001016139b1565b606080825284519082018190525f906020906080840190828801845b82811015613a0e5781516001600160a01b0316845292840192908401906001016139e9565b50505083810382850152613a22818761399f565b9150508281036040840152613a37818561399f565b9695505050505050565b5f60408284031215613a51575f80fd5b613a59613932565b613a6283613321565b8152613a7060208401613321565b60208201529392505050565b63ffffffff828116828216039080821115613a9957613a996138b2565b5092915050565b80820281158282048414176107df576107df6138b2565b818103818111156107df576107df6138b2565b5f5b83811015613ae4578181015183820152602001613acc565b50505f910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351613b23816017850160208801613aca565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613b54816028840160208801613aca565b01602801949350505050565b602081525f8251806020840152613b7e816040850160208701613aca565b601f01601f19169190910160400192915050565b5f60208284031215613ba2575f80fd5b81518015158114613102575f80fd5b5f81613bbf57613bbf6138b2565b505f190190565b5f8251613bd7818460208701613aca565b919091019291505056fe811597c598c81d966aa6d2628e52396f78f5c0d5686cf7860866a6bbda68c52ca49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a26469706673582212204d2f6e74926e0d4a77de9a81ca421b8f9b4818e05114d69233da06afb2c7e49d64736f6c63430008150033000000000000000000000000fcb4c6770d1da3f2ae8bf5dfc97dabf22cd5577e000000000000000000000000c67820db3fdab73a05c972baa42777f310b010260000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f4dfb4ec3945770e41ae8bf0f6afdf186dc8a45d0000000000000000000000000000000000000000033b2e3c91efc989409c0000

Deployed Bytecode

0x608060405260043610610207575f3560e01c80638456cb5911610113578063b2a8bbf31161009d578063cb37f3b21161006d578063cb37f3b214610666578063d547741f1461068a578063f2fde38b146106a9578063f81c2347146106c8578063ff186b2e14610778575f80fd5b8063b2a8bbf3146105c1578063b9e30200146105e0578063c30eac5314610613578063cb267c2514610632575f80fd5b80639f543161116100e35780639f5431611461051c578063a14701111461053b578063a217fddf1461055a578063b18e15bd1461056d578063b23329631461058e575f80fd5b80638456cb591461049a57806384b36c2f146104ae5780638da5cb5b146104cd57806391d14854146104fd575f80fd5b80633f4ba83a1161019457806365ebf99a1161016457806365ebf99a1461040a5780636ffdb0a0146104295780637048027514610448578063715018a61461046757806383ba01781461047b575f80fd5b80633f4ba83a146103ad578063582515c7146103c15780635c975abb146103e0578063635c4fac146103f7575f80fd5b8063248a9ca3116101da578063248a9ca31461029e5780632f2ff15d146102db5780632fef304c146102fa578063334f13101461036357806336568abe1461038e575f80fd5b806301ffc9a71461020b5780631785f53c1461023f5780631a76e3f414610260578063246c87ff1461027f575b5f80fd5b348015610216575f80fd5b5061022a6102253660046132cb565b6107af565b60405190151581526020015b60405180910390f35b34801561024a575f80fd5b5061025e610259366004613306565b6107e5565b005b34801561026b575f80fd5b5061025e61027a36600461334e565b610807565b34801561028a575f80fd5b5061025e6102993660046133af565b610acf565b3480156102a9575f80fd5b506102cd6102b83660046133c8565b5f908152600160208190526040909120015490565b604051908152602001610236565b3480156102e6575f80fd5b5061025e6102f53660046133df565b610b6a565b348015610305575f80fd5b50610340610314366004613306565b60056020525f908152604090205460ff8082169161010081049091169062010000900463ffffffff1683565b604080519315158452911515602084015263ffffffff1690820152606001610236565b34801561036e575f80fd5b506102cd61037d366004613306565b60046020525f908152604090205481565b348015610399575f80fd5b5061025e6103a83660046133df565b610b94565b3480156103b8575f80fd5b5061025e610c17565b3480156103cc575f80fd5b5061025e6103db36600461340d565b610c6d565b3480156103eb575f80fd5b5060025460ff1661022a565b61025e6104053660046134c2565b610cea565b348015610415575f80fd5b5061025e610424366004613306565b610d4b565b348015610434575f80fd5b5061025e61044336600461357d565b610d76565b348015610453575f80fd5b5061025e610462366004613306565b610f3a565b348015610472575f80fd5b5061025e610f59565b348015610486575f80fd5b5061025e6104953660046135b0565b610f6a565b3480156104a5575f80fd5b5061025e610fd2565b3480156104b9575f80fd5b5061025e6104c83660046135da565b611026565b3480156104d8575f80fd5b505f546001600160a01b03165b6040516001600160a01b039091168152602001610236565b348015610508575f80fd5b5061022a6105173660046133df565b611111565b348015610527575f80fd5b5061025e610536366004613619565b61113b565b348015610546575f80fd5b5061025e6105553660046136ff565b61155d565b348015610565575f80fd5b506102cd5f81565b348015610578575f80fd5b506105816117b8565b60405161023691906137f0565b348015610599575f80fd5b506102cd7f000000000000000000000000000000000000000000000000000000000000000181565b3480156105cc575f80fd5b506104e56105db3660046133c8565b611c72565b3480156105eb575f80fd5b506104e57f000000000000000000000000c67820db3fdab73a05c972baa42777f310b0102681565b34801561061e575f80fd5b5061025e61062d366004613875565b611c9a565b34801561063d575f80fd5b5061065161064c3660046133c8565b611d09565b60405163ffffffff9091168152602001610236565b348015610671575f80fd5b506002546104e59061010090046001600160a01b031681565b348015610695575f80fd5b5061025e6106a43660046133df565b611d40565b3480156106b4575f80fd5b5061025e6106c3366004613306565b611d65565b3480156106d3575f80fd5b506107346106e23660046133af565b60066020525f908152604090205460ff8082169161010081049091169063ffffffff620100008204811691600160301b81049091169065ffffffffffff600160501b8204811691600160801b90041686565b604080519615158752941515602087015263ffffffff938416948601949094529116606084015265ffffffffffff90811660808401521660a082015260c001610236565b348015610783575f80fd5b50600354610797906001600160601b031681565b6040516001600160601b039091168152602001610236565b5f6001600160e01b03198216637965db0b60e01b14806107df57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6107ed611ddb565b6108045f80516020613c0283398151915282611d40565b50565b61081e5f80516020613c0283398151915233611111565b15801561083557505f546001600160a01b03163314155b156108535760405163ea8e4eb560e01b815260040160405180910390fd5b5f8265ffffffffffff1611801561087157505f8165ffffffffffff16115b801561088c57508065ffffffffffff168265ffffffffffff16115b156108aa57604051631ded50d760e11b815260040160405180910390fd5b63ffffffff85165f9081526006602052604090205460ff16156108e95760405163ffffffff8616905f80516020613be2833981519152905f90a2610964565b63ffffffff85165f90815260066020526040902054610100900460ff1661096457600880546001810182555f8290529081047ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee301805463ffffffff80891660046007909516949094026101000a938402930219169190911790555b6040805160c0810182526001808252602080830191825263ffffffff8089168486019081528882166060860190815265ffffffffffff808a166080880190815289821660a089019081528e86165f8181526006909852968a902098518954985195519451925191518416600160801b0265ffffffffffff60801b1992909416600160501b02919091166bffffffffffffffffffffffff60501b19928716600160301b0269ffffffff000000000000199590971662010000029490941669ffffffffffffffff0000199515156101000261ff00199215159290921661ffff19909916989098171793909316959095179290921716179190911790915590517fc956384381edaeb0a57ce0fc3122d9164d6c0cd749e82a990e78d5681fb1fbc090610ac090879087908790879063ffffffff948516815292909316602083015265ffffffffffff908116604083015291909116606082015260800190565b60405180910390a25050505050565b610ae65f80516020613c0283398151915233611111565b158015610afd57505f546001600160a01b03163314155b15610b1b5760405163ea8e4eb560e01b815260040160405180910390fd5b63ffffffff81165f9081526006602052604090205460ff16156108045763ffffffff81165f81815260066020526040808220805460ff19169055515f80516020613be28339815191529190a250565b5f8281526001602081905260409091200154610b8581611e34565b610b8f8383611e3e565b505050565b6001600160a01b0381163314610c095760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610c138282611ea8565b5050565b610c2e5f80516020613c0283398151915233611111565b158015610c4557505f546001600160a01b03163314155b15610c635760405163ea8e4eb560e01b815260040160405180910390fd5b610c6b611f0e565b565b610c75611ddb565b6040516370a0823160e01b81523060048201525f906001600160a01b038416906370a0823190602401602060405180830381865afa158015610cb9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cdd919061389b565b9050610b8f838383611f60565b610cf2611fc3565b5f610cfd8989612009565b610d0790826138c6565b9050610d1387876120c5565b610d1d90826138c6565b9050610d298585612199565b610d3390826138c6565b9050610d40838383612336565b505050505050505050565b610d53611ddb565b60028054610100600160a81b0319166101006001600160a01b0384160217905550565b610d8d5f80516020613c0283398151915233611111565b158015610da457505f546001600160a01b03163314155b15610dc25760405163ea8e4eb560e01b815260040160405180910390fd5b6001600160a01b0382165f9081526005602052604090205460ff1615610e1a576040516001600160a01b038316907fa8f823d1b8a45afef297c4a67ec114fc1cfd7bdfa55521b80892e17dc2e353d7905f90a2610e89565b6001600160a01b0382165f90815260056020526040902054610100900460ff16610e8957600780546001810182555f919091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b0319166001600160a01b0384161790555b604080516060810182526001808252602080830191825263ffffffff8581168486018181526001600160a01b0389165f81815260058652889020965187549651925161ffff1990971690151561ff00191617610100921515929092029190911765ffffffff00001916620100009590931694909402919091179093559251918252917fd5260d825eeec5ed7c5396d5908d74a13c6b769591d66e6b54a3f3f02fc81440910160405180910390a25050565b610f42611ddb565b6108045f80516020613c0283398151915282610b6a565b610f61611ddb565b610c6b5f612b98565b610f815f80516020613c0283398151915233611111565b158015610f9857505f546001600160a01b03163314155b15610fb65760405163ea8e4eb560e01b815260040160405180910390fd5b6001600160a01b03919091165f90815260046020526040902055565b610fe95f80516020613c0283398151915233611111565b15801561100057505f546001600160a01b03163314155b1561101e5760405163ea8e4eb560e01b815260040160405180910390fd5b610c6b612be7565b61103d5f80516020613c0283398151915233611111565b15801561105457505f546001600160a01b03163314155b156110725760405163ea8e4eb560e01b815260040160405180910390fd5b805f5b8181101561110b575f848483818110611090576110906138d9565b90506020020160208101906110a591906133af565b63ffffffff81165f9081526006602052604090205490915060ff166110ca57506110fb565b63ffffffff81165f81815260066020526040808220805460ff19169055515f80516020613be28339815191529190a2505b611104816138ed565b9050611075565b50505050565b5f9182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6111525f80516020613c0283398151915233611111565b15801561116957505f546001600160a01b03163314155b156111875760405163ea8e4eb560e01b815260040160405180910390fd5b888781146111a85760405163e22ffb0960e01b815260040160405180910390fd5b8086146111c85760405163e22ffb0960e01b815260040160405180910390fd5b8084146111e85760405163e22ffb0960e01b815260040160405180910390fd5b8082146112085760405163e22ffb0960e01b815260040160405180910390fd5b5f5b8181101561154f575f868683818110611225576112256138d9565b905060200201602081019061123a9190613905565b90505f85858481811061124f5761124f6138d9565b90506020020160208101906112649190613905565b90505f8265ffffffffffff1611801561128457505f8165ffffffffffff16115b801561129f57508065ffffffffffff168265ffffffffffff16115b156112bd57604051631ded50d760e11b815260040160405180910390fd5b5f8e8e858181106112d0576112d06138d9565b90506020020160208101906112e591906133af565b90505f8d8d868181106112fa576112fa6138d9565b905060200201602081019061130f91906133af565b90505f8c8c87818110611324576113246138d9565b905060200201602081019061133991906133af565b63ffffffff84165f9081526006602052604090205490915060ff161561137b5760405163ffffffff8416905f80516020613be2833981519152905f90a26113d5565b600880546001810182555f8290529081047ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee301805463ffffffff80871660046007909516949094026101000a938402930219169190911790555b6040805160c0810182526001808252602080830191825263ffffffff8087168486019081528682166060860190815265ffffffffffff808d16608088019081528c821660a089019081528c86165f8181526006909852968a902098518954985195519451925191518416600160801b0265ffffffffffff60801b1992909416600160501b02919091166bffffffffffffffffffffffff60501b19928716600160301b0269ffffffff000000000000199590971662010000029490941669ffffffffffffffff0000199515156101000261ff00199215159290921661ffff19909916989098171793909316959095179290921716179190911790915590517fc956384381edaeb0a57ce0fc3122d9164d6c0cd749e82a990e78d5681fb1fbc09061153190859085908a908a9063ffffffff948516815292909316602083015265ffffffffffff908116604083015291909116606082015260800190565b60405180910390a2505050505080611548906138ed565b905061120a565b505050505050505050505050565b6115745f80516020613c0283398151915233611111565b15801561158b57505f546001600160a01b03163314155b156115a95760405163ea8e4eb560e01b815260040160405180910390fd5b828181146115ca5760405163e22ffb0960e01b815260040160405180910390fd5b5f5b818110156117b0575f8686838181106115e7576115e76138d9565b90506020020160208101906115fc9190613306565b90505f858584818110611611576116116138d9565b905060200201602081019061162691906133af565b6001600160a01b0383165f9081526005602052604090205490915060ff1615611681576040516001600160a01b038316907fa8f823d1b8a45afef297c4a67ec114fc1cfd7bdfa55521b80892e17dc2e353d7905f90a26116f0565b6001600160a01b0382165f90815260056020526040902054610100900460ff166116f057600780546001810182555f919091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b0319166001600160a01b0384161790555b604080516060810182526001808252602080830191825263ffffffff8581168486018181526001600160a01b0389165f81815260058652889020965187549651925161ffff1990971690151561ff00191617610100921515929092029190911765ffffffff00001916620100009590931694909402919091179093559251918252917fd5260d825eeec5ed7c5396d5908d74a13c6b769591d66e6b54a3f3f02fc81440910160405180910390a25050806117a9906138ed565b90506115cc565b505050505050565b60408051808201909152606080825260208201525f600780548060200260200160405190810160405280929190818152602001828054801561182157602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311611803575b505050505090505f815190505f8167ffffffffffffffff8111156118475761184761391e565b60405190808252806020026020018201604052801561188b57816020015b604080518082019091525f80825260208201528152602001906001900390816118655790505b5090505f805b83811015611975575f8582815181106118ac576118ac6138d9565b6020908102919091018101516001600160a01b0381165f908152600583526040908190208151606081018352905460ff8082161580158452610100830490911615159583019590955262010000900463ffffffff169181019190915290925090611962576040518060400160405280836001600160a01b03168152602001826040015163ffffffff1681525085858151811061194a5761194a6138d9565b60200260200101819052508361195f906138ed565b93505b50508061196e906138ed565b9050611891565b505f60088054806020026020016040519081016040528092919081815260200182805480156119ec57602002820191905f5260205f20905f905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116119af5790505b50505050509050805193505f8467ffffffffffffffff811115611a1157611a1161391e565b604051908082528060200260200182016040528015611a6f57816020015b6040805160c0810182525f8082526020808301829052928201819052606082018190526080820181905260a082015282525f19909201910181611a2f5790505b5090505f92505f5b85811015611c55575f838281518110611a9257611a926138d9565b60209081029190910181015163ffffffff8082165f90815260068452604090819020815160c081018352905460ff80821615801584526101008304909116151596830196909652620100008104841692820192909252600160301b8204909216606083015265ffffffffffff600160501b820481166080840152600160801b9091041660a082015290925090611c425760405163bd85b03960e01b815263ffffffff831660048201525f907f000000000000000000000000c67820db3fdab73a05c972baa42777f310b010266001600160a01b03169063bd85b03990602401602060405180830381865afa158015611b8c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bb0919061389b565b90506040518060c001604052808463ffffffff168152602001836040015163ffffffff1681526020018263ffffffff168152602001836060015163ffffffff168152602001836080015165ffffffffffff1681526020018360a0015165ffffffffffff16815250858881518110611c2957611c296138d9565b602002602001018190525086611c3e906138ed565b9650505b505080611c4e906138ed565b9050611a77565b506040805180820190915293845260208401525090949350505050565b60078181548110611c81575f80fd5b5f918252602090912001546001600160a01b0316905081565b611cb15f80516020613c0283398151915233611111565b158015611cc857505f546001600160a01b03163314155b15611ce65760405163ea8e4eb560e01b815260040160405180910390fd5b600380546bffffffffffffffffffffffff19166001600160601b03831617905550565b60088181548110611d18575f80fd5b905f5260205f209060089182820401919006600402915054906101000a900463ffffffff1681565b5f8281526001602081905260409091200154611d5b81611e34565b610b8f8383611ea8565b611d6d611ddb565b6001600160a01b038116611dd25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c00565b61080481612b98565b5f546001600160a01b03163314610c6b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c00565b6108048133612c24565b611e488282611111565b610c13575f8281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b611eb28282611111565b15610c13575f8281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b611f16612c7d565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6040516001600160a01b038316602482015260448101829052610b8f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612cc6565b60025460ff1615610c6b5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610c00565b5f600182111561202c57604051633520673360e01b815260040160405180910390fd5b60018290036120a6575f83835f818110612048576120486138d9565b9050602002015f0135905061205c81612d99565b61206681836138c6565b6040518281529092505f9033907f608d7b286eecd6ec46f6871b357f9c2345916d0ded18ade42bcd5e337d7713249060200160405180910390a3506107df565b34156107df5760405163195adfc760e31b815260040160405180910390fd5b5f81815b81811015612191575f8585838181106120e4576120e46138d9565b9050604002016020013590505f868684818110612103576121036138d9565b6121199260206040909202019081019150613306565b90506121258183612e49565b61212f82866138c6565b9450806001600160a01b0316336001600160a01b03167f608d7b286eecd6ec46f6871b357f9c2345916d0ded18ade42bcd5e337d7713248460405161217691815260200190565b60405180910390a350508061218a906138ed565b90506120c9565b505092915050565b5f81815b81811015612191575f8585838181106121b8576121b86138d9565b9050604002018036038101906121ce9190613967565b80516001600160a01b0381165f908152600560209081526040918290208251606081018452905460ff8082161515808452610100830490911615159383019390935262010000900463ffffffff169281019290925292935090916122505760405163d28f103b60e01b81526001600160a01b0383166004820152602401610c00565b604081810151602085015191516323b872dd60e01b815233600482015261dead6024820152604481018390529091906001600160a01b038516906323b872dd906064015f604051808303815f87803b1580156122aa575f80fd5b505af11580156122bc573d5f803e3d5ffd5b505050508163ffffffff16886122d291906138c6565b6040805183815263ffffffff851660208201529199506001600160a01b0386169133917fd8a3fdc3b82f7c01440fd1020b268406abd1637523e283dbd21f5a538a04a4f4910160405180910390a350505050508061232f906138ed565b905061219d565b5f8290036123fe578015610b8f577f000000000000000000000000c67820db3fdab73a05c972baa42777f310b010266001600160a01b031663695c96e661237c33612ebb565b6123a57f0000000000000000000000000000000000000000000000000000000000000001612f11565b6123ae85612f11565b6040518463ffffffff1660e01b81526004016123cc939291906139cd565b5f604051808303815f87803b1580156123e3575f80fd5b505af11580156123f5573d5f803e3d5ffd5b50505050505050565b5f828161240c8260016138c6565b90505f8167ffffffffffffffff8111156124285761242861391e565b604051908082528060200260200182016040528015612451578160200160208202803683370190505b5090505f8267ffffffffffffffff81111561246e5761246e61391e565b604051908082528060200260200182016040528015612497578160200160208202803683370190505b5090505f5b848110156127cd575f8989838181106124b7576124b76138d9565b9050604002018036038101906124cd9190613a41565b805163ffffffff8082165f90815260066020908152604091829020825160c081018452905460ff80821615158084526101008304909116151593830193909352620100008104851693820193909352600160301b8304909316606084015265ffffffffffff600160501b830481166080850152600160801b90920490911660a0830152929350909161257a5760405163b70f3a5f60e01b815263ffffffff83166004820152602401610c00565b6020830151606082015163ffffffff16156126575760405163bd85b03960e01b815263ffffffff841660048201525f907f000000000000000000000000c67820db3fdab73a05c972baa42777f310b010266001600160a01b03169063bd85b03990602401602060405180830381865afa1580156125f9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061261d919061389b565b9050826060015163ffffffff168263ffffffff168261263c91906138c6565b1115612655578083606001516126529190613a7c565b91505b505b8063ffffffff165f0361266d57505050506127bd565b5f826080015165ffffffffffff161180156126935750816080015165ffffffffffff1642105b156126b957604051633a59b31760e01b815263ffffffff84166004820152602401610c00565b5f8260a0015165ffffffffffff161180156126df57508160a0015165ffffffffffff1642115b156127055760405163393a845760e01b815263ffffffff84166004820152602401610c00565b8263ffffffff1687868151811061271e5761271e6138d9565b6020026020010181815250508063ffffffff16868681518110612743576127436138d9565b6020026020010181815250508063ffffffff16826040015163ffffffff1661276b9190613aa0565b612775908b6138c6565b60405163ffffffff8381168252919b509084169033907fbeb09feae9f91ac209f3a395592de5ebf4f1b1e0f93876dfafd6ed399ab6f2e39060200160405180910390a3505050505b6127c6816138ed565b905061249c565b505f600260019054906101000a90046001600160a01b031690507f000000000000000000000000000000000000000000000000000000000000000183868151811061281a5761281a6138d9565b602002602001018181525050868611156129b8576001600160a01b037f000000000000000000000000c67820db3fdab73a05c972baa42777f310b010261663f242432a33837f000000000000000000000000000000000000000000000000000000000000000161288a8c8c613ab7565b6040516001600160e01b031960e087901b1681526001600160a01b0394851660048201529390921660248401526044830152606482015260a060848201525f60a482015260c4015f604051808303815f87803b1580156128e8575f80fd5b505af11580156128fa573d5f803e3d5ffd5b505050507f000000000000000000000000c67820db3fdab73a05c972baa42777f310b010266001600160a01b031663695c96e661293683612ebb565b61295f7f0000000000000000000000000000000000000000000000000000000000000001612f11565b6129688b612f11565b6040518463ffffffff1660e01b8152600401612986939291906139cd565b5f604051808303815f87803b15801561299d575f80fd5b505af11580156129af573d5f803e3d5ffd5b50505050612b08565b86861015612a52576129ca8688613ab7565b8286815181106129dc576129dc6138d9565b6020026020010181815250507f000000000000000000000000c67820db3fdab73a05c972baa42777f310b010266001600160a01b031663695c96e6612a2083612ebb565b612a497f0000000000000000000000000000000000000000000000000000000000000001612f11565b6129688a612f11565b7f000000000000000000000000c67820db3fdab73a05c972baa42777f310b010266001600160a01b031663695c96e6612a8a83612ebb565b612ab37f0000000000000000000000000000000000000000000000000000000000000001612f11565b612abc8a612f11565b6040518463ffffffff1660e01b8152600401612ada939291906139cd565b5f604051808303815f87803b158015612af1575f80fd5b505af1158015612b03573d5f803e3d5ffd5b505050505b7f000000000000000000000000c67820db3fdab73a05c972baa42777f310b010266001600160a01b031663695c96e6612b4033612ebb565b85856040518463ffffffff1660e01b8152600401612b60939291906139cd565b5f604051808303815f87803b158015612b77575f80fd5b505af1158015612b89573d5f803e3d5ffd5b50505050505050505050505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b612bef611fc3565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611f433390565b612c2e8282611111565b610c1357612c3b81612f5a565b612c46836020612f6c565b604051602001612c57929190613aec565b60408051601f198184030181529082905262461bcd60e51b8252610c0091600401613b60565b60025460ff16610c6b5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610c00565b5f612d1a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166131099092919063ffffffff16565b905080515f1480612d3a575080806020019051810190612d3a9190613b92565b610b8f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c00565b6003545f90612db1906001600160601b031683613aa0565b9050803414612dd35760405163195adfc760e31b815260040160405180910390fd5b6002546040515f9161010090046001600160a01b03169083908381818185875af1925050503d805f8114612e22576040519150601f19603f3d011682016040523d82523d5f602084013e612e27565b606091505b5050905080610b8f57604051630139482b60e11b815260040160405180910390fd5b6001600160a01b0382165f9081526004602052604081205490819003612e8d576040516308db7ac960e41b81526001600160a01b0384166004820152602401610c00565b5f612e988284613aa0565b905061110b8433600260019054906101000a90046001600160a01b03168461311f565b6040805160018082528183019092526060915f91906020808301908036833701905050905082815f81518110612ef357612ef36138d9565b6001600160a01b039092166020928302919091019091015292915050565b6040805160018082528183019092526060915f91906020808301908036833701905050905082815f81518110612f4957612f496138d9565b602090810291909101015292915050565b60606107df6001600160a01b03831660145b60605f612f7a836002613aa0565b612f859060026138c6565b67ffffffffffffffff811115612f9d57612f9d61391e565b6040519080825280601f01601f191660200182016040528015612fc7576020820181803683370190505b509050600360fc1b815f81518110612fe157612fe16138d9565b60200101906001600160f81b03191690815f1a905350600f60fb1b8160018151811061300f5761300f6138d9565b60200101906001600160f81b03191690815f1a9053505f613031846002613aa0565b61303c9060016138c6565b90505b60018111156130b3576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613070576130706138d9565b1a60f81b828281518110613086576130866138d9565b60200101906001600160f81b03191690815f1a90535060049490941c936130ac81613bb1565b905061303f565b5083156131025760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c00565b9392505050565b606061311784845f85613157565b949350505050565b6040516001600160a01b038085166024830152831660448201526064810182905261110b9085906323b872dd60e01b90608401611f8c565b6060824710156131b85760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c00565b5f80866001600160a01b031685876040516131d39190613bc6565b5f6040518083038185875af1925050503d805f811461320d576040519150601f19603f3d011682016040523d82523d5f602084013e613212565b606091505b50915091506132238783838761322e565b979650505050505050565b6060831561329c5782515f03613295576001600160a01b0385163b6132955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c00565b5081613117565b61311783838151156132b15781518083602001fd5b8060405162461bcd60e51b8152600401610c009190613b60565b5f602082840312156132db575f80fd5b81356001600160e01b031981168114613102575f80fd5b6001600160a01b0381168114610804575f80fd5b5f60208284031215613316575f80fd5b8135613102816132f2565b803563ffffffff81168114613334575f80fd5b919050565b803565ffffffffffff81168114613334575f80fd5b5f805f805f60a08688031215613362575f80fd5b61336b86613321565b945061337960208701613321565b935061338760408701613321565b925061339560608701613339565b91506133a360808701613339565b90509295509295909350565b5f602082840312156133bf575f80fd5b61310282613321565b5f602082840312156133d8575f80fd5b5035919050565b5f80604083850312156133f0575f80fd5b823591506020830135613402816132f2565b809150509250929050565b5f806040838503121561341e575f80fd5b8235613429816132f2565b91506020830135613402816132f2565b5f8083601f840112613449575f80fd5b50813567ffffffffffffffff811115613460575f80fd5b6020830191508360208260051b850101111561347a575f80fd5b9250929050565b5f8083601f840112613491575f80fd5b50813567ffffffffffffffff8111156134a8575f80fd5b6020830191508360208260061b850101111561347a575f80fd5b5f805f805f805f806080898b0312156134d9575f80fd5b883567ffffffffffffffff808211156134f0575f80fd5b6134fc8c838d01613439565b909a50985060208b0135915080821115613514575f80fd5b6135208c838d01613481565b909850965060408b0135915080821115613538575f80fd5b6135448c838d01613481565b909650945060608b013591508082111561355c575f80fd5b506135698b828c01613481565b999c989b5096995094979396929594505050565b5f806040838503121561358e575f80fd5b8235613599816132f2565b91506135a760208401613321565b90509250929050565b5f80604083850312156135c1575f80fd5b82356135cc816132f2565b946020939093013593505050565b5f80602083850312156135eb575f80fd5b823567ffffffffffffffff811115613601575f80fd5b61360d85828601613439565b90969095509350505050565b5f805f805f805f805f8060a08b8d031215613632575f80fd5b8a3567ffffffffffffffff80821115613649575f80fd5b6136558e838f01613439565b909c509a5060208d013591508082111561366d575f80fd5b6136798e838f01613439565b909a50985060408d0135915080821115613691575f80fd5b61369d8e838f01613439565b909850965060608d01359150808211156136b5575f80fd5b6136c18e838f01613439565b909650945060808d01359150808211156136d9575f80fd5b506136e68d828e01613439565b915080935050809150509295989b9194979a5092959850565b5f805f8060408587031215613712575f80fd5b843567ffffffffffffffff80821115613729575f80fd5b61373588838901613439565b9096509450602087013591508082111561374d575f80fd5b5061375a87828801613439565b95989497509550505050565b5f8151808452602080850194508084015f5b838110156137e5578151805163ffffffff9081168952848201518116858a01526040808301518216908a01526060808301519091169089015260808082015165ffffffffffff908116918a019190915260a091820151169088015260c09096019590820190600101613778565b509495945050505050565b6020808252825160408383018190528151606085018190525f9392830191849160808701905b8084101561384e57845180516001600160a01b0316835286015163ffffffff1686830152938501936001939093019290820190613816565b5093870151868503601f190182880152936138698186613766565b98975050505050505050565b5f60208284031215613885575f80fd5b81356001600160601b0381168114613102575f80fd5b5f602082840312156138ab575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b808201808211156107df576107df6138b2565b634e487b7160e01b5f52603260045260245ffd5b5f600182016138fe576138fe6138b2565b5060010190565b5f60208284031215613915575f80fd5b61310282613339565b634e487b7160e01b5f52604160045260245ffd5b6040805190810167ffffffffffffffff8111828210171561396157634e487b7160e01b5f52604160045260245ffd5b60405290565b5f60408284031215613977575f80fd5b61397f613932565b823561398a816132f2565b81526020928301359281019290925250919050565b5f8151808452602080850194508084015f5b838110156137e5578151875295820195908201906001016139b1565b606080825284519082018190525f906020906080840190828801845b82811015613a0e5781516001600160a01b0316845292840192908401906001016139e9565b50505083810382850152613a22818761399f565b9150508281036040840152613a37818561399f565b9695505050505050565b5f60408284031215613a51575f80fd5b613a59613932565b613a6283613321565b8152613a7060208401613321565b60208201529392505050565b63ffffffff828116828216039080821115613a9957613a996138b2565b5092915050565b80820281158282048414176107df576107df6138b2565b818103818111156107df576107df6138b2565b5f5b83811015613ae4578181015183820152602001613acc565b50505f910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351613b23816017850160208801613aca565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613b54816028840160208801613aca565b01602801949350505050565b602081525f8251806020840152613b7e816040850160208701613aca565b601f01601f19169190910160400192915050565b5f60208284031215613ba2575f80fd5b81518015158114613102575f80fd5b5f81613bbf57613bbf6138b2565b505f190190565b5f8251613bd7818460208701613aca565b919091019291505056fe811597c598c81d966aa6d2628e52396f78f5c0d5686cf7860866a6bbda68c52ca49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a26469706673582212204d2f6e74926e0d4a77de9a81ca421b8f9b4818e05114d69233da06afb2c7e49d64736f6c63430008150033

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

000000000000000000000000fcb4c6770d1da3f2ae8bf5dfc97dabf22cd5577e000000000000000000000000c67820db3fdab73a05c972baa42777f310b010260000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f4dfb4ec3945770e41ae8bf0f6afdf186dc8a45d0000000000000000000000000000000000000000033b2e3c91efc989409c0000

-----Decoded View---------------
Arg [0] : _owner (address): 0xfCB4c6770d1DA3F2Ae8BF5dfc97DAbf22CD5577E
Arg [1] : _clickToken (address): 0xc67820DB3fDab73A05c972BAa42777F310B01026
Arg [2] : _clickTokenId (uint256): 1
Arg [3] : _paymentReceiver (address): 0xf4dFB4eC3945770e41AE8BF0f6AfDF186dC8a45D
Arg [4] : _ethPrice (uint96): 999999999000000000000000000

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000fcb4c6770d1da3f2ae8bf5dfc97dabf22cd5577e
Arg [1] : 000000000000000000000000c67820db3fdab73a05c972baa42777f310b01026
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [3] : 000000000000000000000000f4dfb4ec3945770e41ae8bf0f6afdf186dc8a45d
Arg [4] : 0000000000000000000000000000000000000000033b2e3c91efc989409c0000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.