Contract 0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d94

 
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xa2d29fe097ced8e94445ed9bc06d86857d1e1de60c5a1496c6f7036dd00efbbcCreate Martket I...365860322022-12-08 17:21:2813 mins ago0x0af6d07bef622b68f3a5d41d9f1476eb8d038717 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.013337684987 51.679827757
0x731fa85386cbbeff15383db4018ce0e5cd452042494275d4c249dd5ecfc0651cCancel Order365859822022-12-08 17:19:4415 mins ago0x0af6d07bef622b68f3a5d41d9f1476eb8d038717 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.008170637095 58.784945143
0xc7efd0360e3091463023607afc58dc5c461ea61ef7b68430458e18636c675abeCreate Martket I...365858072022-12-08 17:13:4620 mins ago0x1b37f98497ba7044854dd56c3ecdb5541007c976 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.019593386423 75.915404883
0xd1c18297f8dbcd0f801a6a36daa464aed1a51e155d117a80ab7659e29e07f427Create Martket I...365858062022-12-08 17:13:4421 mins ago0x0c4173fc5382c1ead22817115eeb3f7ff79d6d9c IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.019336461241 78.665218004
0x7e4675ba89176f2aa471fb32f1ec91504bb65ff12ef55edbf738a568a3209f0cCreate Martket I...365857382022-12-08 17:11:2423 mins ago0x7a540e0c2263b49939dbc68c981d721998515639 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.019618629713 82.408710703
0xfdcf52ad0ad33c0a3ca1b614dff95e7875def0de10ef796b15e75be8da2822aeCreate Martket I...365857232022-12-08 17:10:5023 mins ago0x99403d89fed4759383081b645fefdf1de4f916ad IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.016954689762 71.823949786
0x8d64e12e286bb47f5b68ca144819e5eda27d670a7feae5f6c3502ff93332de7eCreate Martket I...365857162022-12-08 17:10:3624 mins ago0x7a540e0c2263b49939dbc68c981d721998515639 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.018439809125 74.243003916
0xbc172a8fad2e37e72ccc97016ceb670fc15a4e558855737a161f4c824ffdbe58Cancel Order365857112022-12-08 17:10:2624 mins ago0x0c4173fc5382c1ead22817115eeb3f7ff79d6d9c IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.009392810906 74.95539858
0xda1f31039125c60874977bf3d426019ea31db0a9a7f955ef2ec5e46685848e0fCreate Martket I...365856852022-12-08 17:09:3425 mins ago0x7a540e0c2263b49939dbc68c981d721998515639 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.021626892774 83.798207455
0x4c9badbd70a8a1ab6cae52f1f194c14f7ebe043c3cd2a50030ab82b38601ff1aCreate Martket I...365856612022-12-08 17:08:4226 mins ago0x99403d89fed4759383081b645fefdf1de4f916ad IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.017850285761 72.629747861
0x135009b575a9d3080e311f30d7f72ef7c6bd2dff2ce3725c91cf1e79d780ee4eCreate Martket I...365856532022-12-08 17:08:2626 mins ago0x7a540e0c2263b49939dbc68c981d721998515639 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.016309297109 72.240148426
0xd0b59fb2892e6c023ed820528f89e2bf4e96b30b6edd6269c86fe8362fccee9cCreate Martket I...365856402022-12-08 17:08:0026 mins ago0x99403d89fed4759383081b645fefdf1de4f916ad IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.019722615166 77.021909151
0xaf14ecb86b6f374094a48f520688041a49efc388316f6839d10cf39816551fdcCreate Martket I...365856362022-12-08 17:07:5226 mins ago0x7a540e0c2263b49939dbc68c981d721998515639 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.016544053592 70.084400904
0x57c1d0e04d131ffc7c5ddc4177e9323ade11bd8e254eb1bf266470bc8798301aCreate Martket I...365856202022-12-08 17:07:2027 mins ago0x99403d89fed4759383081b645fefdf1de4f916ad IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.018636528934 72.780461736
0x12129569dfa975e88e96bc332c8716a2d62dc747d71e6b5be53f67df82b60bb3Create Martket I...365856012022-12-08 17:06:4228 mins ago0x7a540e0c2263b49939dbc68c981d721998515639 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.022451289827 83.655789533
0x4967d2bdc0cd40ac8824c319d1e816c36d066daedc688db34077e1a229a639dfCreate Martket I...365855422022-12-08 17:04:4030 mins ago0x1b37f98497ba7044854dd56c3ecdb5541007c976 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.022800179824 96.586784762
0xb50089d83b18053b18ef165d66bc3d34d1c8ec1a18f4c533b58f465236794d25Create Martket I...365855052022-12-08 17:03:2231 mins ago0x0c4173fc5382c1ead22817115eeb3f7ff79d6d9c IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.024916859798 101.377474432
0x48716120531ee4b7011daca4581563d3572250546644d38e9963fc0e02ec5adcCancel Order365854712022-12-08 17:02:1032 mins ago0x0c4173fc5382c1ead22817115eeb3f7ff79d6d9c IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.013998342926 111.70792044
0xed5d648a78a256e01599189133bfd9b741d6f59daa0d542fb9dc12f4ef396504Create Martket I...365854332022-12-08 17:00:5433 mins ago0xdfb922dbe070f19f4e22758775d8dff2bd526cb0 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.035391044577 137.130475768
0xd9bb7e7bda71afed3697a3baa9d7d629f32b9145eedcb2aa5eb29f78a5909530Create Martket I...365854022022-12-08 16:59:4834 mins ago0x80a09334e989aac729996b5027aaf515f9c807ab IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.029974490157 132.761486589
0xc2accf75b7eb678a3327f28b911624c360953e75c481ae34e695abc4a7e9a1d8Create Martket I...365853612022-12-08 16:58:2636 mins ago0x1b37f98497ba7044854dd56c3ecdb5541007c976 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.034355663026 145.538458716
0x5335d8f0c27e75ba416f192a327f36b55217ec37e197ff67e2b2da9b0c3d1476Create Martket I...365853412022-12-08 16:57:4237 mins ago0xc46de763c2c568aeb9b24c07de0d7c4b50d814e6 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.042324592472 187.481860584
0xf19bb986bb7153953e428bca20f8334afff44c9378b8a8e5fe75b5f59bc5ec90Buy Martket Item365853362022-12-08 16:57:3237 mins ago0x78b4a45bd9c3dddc70efc7c1db91921fadded5c8 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.040559795586 178.838231657
0x4a830f572c4151bedd659f0c0fa1d6644e9e0b29f6cbd09d686ff76d1f74cf7dCreate Martket I...365853302022-12-08 16:57:2037 mins ago0x1b37f98497ba7044854dd56c3ecdb5541007c976 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.045311051685 182.441754417
0x305d41c793ed23720e4daa62a8e9cd58214cd5e017e95483b6a4a1f9f4a1dbf5Buy Martket Item365853282022-12-08 16:57:1637 mins ago0xdfb922dbe070f19f4e22758775d8dff2bd526cb0 IN  0x6fe86d8f0d2cf30fdedb86e137c25d3418cd4d940 MATIC0.042070183353 173.228128773
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
GsoMarketPlace

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 28 : GsoMarketPlace.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./MarketStorage.sol";
import "./common/TransferHelper.sol";
import "./common/AccessController.sol";

contract GsoMarketPlace is AccessController, ERC721Holder, ReentrancyGuard, Pausable {
  using Counters for Counters.Counter;
  using SafeERC20 for IERC20;
  using Address for address;
  using ECDSA for bytes32;

  MarketStorage private _storageAddress;
  mapping(uint256 => uint256) private creatorFeeByNftType;
  mapping(uint256 => address) private creatorAddressByNftType;
  mapping(uint256 => address) private commissionAddressByNftType;
  mapping(uint256 => uint256) private commissionFeeByCurrencyType;

  constructor(address _storage) {
    _storageAddress = MarketStorage(_storage);
    _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
  }
  
  struct PriceByTimestamp {
    uint256 currentPrice;
    uint256 timestamp;
  }

  event SELLORDER(uint256 orderId, uint256 nftId, uint256 price, address seller, uint nftType, uint256 timeStamp, uint256 ranking, uint256 currencyType, bool isExchangePrice);
  event BUYMARKETITEM(uint256 orderId, uint256 nftId, uint256 price, address seller, address buyer, uint nftType, uint256 currencyType, uint256 transactionFee, uint256 timeStamp);
  event CANCELSELLORDER(uint256 orderId, uint256 nftId, uint256 price, address seller, uint nftType, uint256 timeStamp);

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

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

  function setCommissionFeeByCurrencyType(uint256[] calldata currencyExchanges, uint256[] calldata feePerCurrency) external onlyAdmin {
    require(currencyExchanges.length == feePerCurrency.length, "Invalid input");
    for(uint256 index = 0; index < currencyExchanges.length; index++){
      commissionFeeByCurrencyType[currencyExchanges[index]] = feePerCurrency[index];
    }
  }

  function setCommissionAddressByNftType(uint256[] calldata _nftTypes, address[] calldata _commissionAddresses) external onlyAdmin {
    require(_nftTypes.length == _commissionAddresses.length, "Invalid input");
    for(uint256 index = 0; index < _nftTypes.length; index++){
      commissionAddressByNftType[_nftTypes[index]] = _commissionAddresses[index];
    }
  }

  function setCreatorFeeByNftType(uint256[] calldata _nftTypes, uint256[] calldata _creatorFees, address[] calldata _creatorAddresses) external onlyAdmin {
    require(_nftTypes.length == _creatorFees.length && _nftTypes.length == _creatorAddresses.length, "Invalid Input: Array length mismatch");
    for(uint256 index = 0; index < _nftTypes.length; index++){
      require(_creatorFees[index] > 0 && _creatorAddresses[index] != address(0) , "Invalid input") ;
      creatorFeeByNftType[_nftTypes[index]] = _creatorFees[index];
      creatorAddressByNftType[_nftTypes[index]] = _creatorAddresses[index];
    }
  }
  
  function createMartketItem(
    uint256 _nftId,
    uint256 _price,
    uint256 _nftType,
    uint256 currencyType,
    bool isExchangePrice
  ) external nonReentrant whenNotPaused {
    MarketStorage.StorageInfor memory info = _storageAddress.getInfor();
    require(currencyType < info.countCurrency, "Invalid currency type");
    IERC721 _nftAddress = _storageAddress.getNftAddress(_nftType);
    require(_nftType < info.countNft, "INVALID_NFT_TYPE");
    require(_nftAddress.ownerOf(_nftId) == _msgSender(), "Owner token: not owner!");
    require(_nftId > 0, "Token id must be greater than 0");
    require(_storageAddress.isBlockAddress(_msgSender()) == false, "Address: Address can not impact it!");
    address seller = _msgSender();
    require(_price > 0, "Order price must be greater than 0");
    MarketStorage.OrderItem memory currentItem = _storageAddress.createItemOrder(_nftId, _price, _nftType, seller);
    _transferNFT(seller, address(this), _nftId, _nftType);
    emit SELLORDER(currentItem.id, _nftId, _price, seller, _nftType, block.timestamp, 0, currencyType, isExchangePrice);
  }

  function buyMartketItem(
    uint256 _nftId,
    uint256 _ranking,
    string memory _orderId,
    bytes memory _signature,
    uint256 _nftType,
    uint256 _currencyType,
    uint256 _sellOrderId,
    PriceByTimestamp memory priceByTimestamp
  ) external nonReentrant whenNotPaused {
    MarketStorage.StorageInfor memory info = _storageAddress.getInfor();
    require(priceByTimestamp.timestamp + info.maxWaitingTime > block.timestamp, "EXCEED_WAITING_TIME");
    require(_nftType < info.countNft, "INVALID_NFT_TYPE");
    require(_storageAddress.isExecutedOrder(_orderId) == false, "ORDER_IS_EXECUTED");
    require(_validatorSignature(_nftId, _sellOrderId, _ranking, _orderId, _signature, _msgSender(), _nftType, priceByTimestamp.currentPrice, priceByTimestamp.timestamp, _currencyType, info.adminVerify), "INVALID_PARAM");
    require(_nftId > 0, "Index must be greater than 0");
    require(_storageAddress.isBlockAddress(_msgSender()) == false, "Address: Address can not impact it!");
    address buyer = _msgSender();
    _storageAddress.setExecutedOrder(_orderId, true);
    MarketStorage.OrderItem memory order = _storageAddress.getOrder(_nftId, _nftType);
    address token = _storageAddress.getCurrencyExchange(_currencyType);
    uint256 fees = commissionFeeByCurrencyType[_currencyType];
    require(order.id == _sellOrderId && order.itemId == _nftId, "Order does not exist or invalid order");
    require(_ranking >= order.ranking, "Ranking: not enough!");
    require(order.seller != address(0), "Invalid seller");
    require(order.seller != buyer, "Buy by seller");
    require(priceByTimestamp.currentPrice > 0, "Current price must be greater than 0");
    TransferHelper.safeEnoughTokenApproved(token, _msgSender(), address(this), priceByTimestamp.currentPrice);
    _storageAddress.deleteSellOrder(_nftId, _nftType);
    _payment(token, priceByTimestamp.currentPrice, buyer, order.seller, _nftType, fees);
    _transferNFT(address(this), buyer, order.itemId, _nftType);
    emit BUYMARKETITEM(order.id, order.itemId,  priceByTimestamp.currentPrice, order.seller, buyer, _nftType, _currencyType, fees, block.timestamp);
  }

  function cancelOrder(uint256 _nftId, uint256 _nftType) external nonReentrant {
    MarketStorage.StorageInfor memory info = _storageAddress.getInfor();
    require(_nftType < info.countNft, "INVALID_NFT_TYPE");
    require(_nftId > 0, "Index must be greater than 0");
    address sender = _msgSender();
    MarketStorage.OrderItem memory order = _storageAddress.getOrder(_nftId, _nftType);
    require(order.id != 0 && order.itemId == _nftId, "Order does not exist or invalid order");
    require(order.seller == sender, "The sender must be the seller");
     _storageAddress.deleteSellOrder(_nftId, _nftType);
    _transferNFT(address(this), order.seller, _nftId, _nftType);
    emit CANCELSELLORDER(order.id, _nftId, order.unitPrice, order.seller, _nftType, block.timestamp);
  }

  function _payment(
    address currencyExchange,
    uint256 paymentValue,
    address sender,
    address seller,
    uint256 nftType,
    uint256 fee
  ) private {
    uint256 tax = paymentValue * fee / 1000;
    TransferHelper.safeTransferFrom(currencyExchange, sender, commissionAddressByNftType[nftType], tax);
    if(creatorFeeByNftType[nftType] != 0){
      uint256 creatorFee = paymentValue * creatorFeeByNftType[nftType] / 1000;
      TransferHelper.safeTransferFrom(currencyExchange, sender, creatorAddressByNftType[nftType], creatorFee);
      TransferHelper.safeTransferFrom(currencyExchange, sender, seller, paymentValue - tax - creatorFee);
    } else {
      TransferHelper.safeTransferFrom(currencyExchange, sender, seller, paymentValue - tax);
    }
  }

  function _transferNFT(
    address from,
    address to,
    uint256 nftId,
    uint256 _nftType
  ) private {
    IERC721 _nftAddress = _storageAddress.getNftAddress(_nftType);
    return _nftAddress.safeTransferFrom(from, to, nftId);
  }

  function _validatorSignature(
    uint256 _nftId,
    uint256 _sellOrderId,
    uint256 _ranking,
    string memory _orderId,
    bytes memory signature,
    address _wallet,
    uint256 _nftType,
    uint256 _price,
    uint256 timestamp,
    uint256 _currencyType,
    address verifyAddress
  ) private pure returns (bool) {
    bytes32 hashValue = keccak256(abi.encodePacked(_nftId, _sellOrderId, _orderId, _ranking, _wallet, _nftType, _price, _currencyType, timestamp));
    address recover = hashValue.toEthSignedMessageHash().recover(signature);
    return recover == verifyAddress;
  }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 4 of 28 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 5 of 28 : ERC721Holder.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.0;

import "../IERC721Receiver.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721Holder is IERC721Receiver {
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
}

File 6 of 28 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

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

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-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;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

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

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    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");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    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");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 10 of 28 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

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

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

File 11 of 28 : MarketStorage.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./CommonItem.sol";
import "./IEnums.sol";

contract MarketStorage is AccessControl, ReentrancyGuard, Pausable {
  using Counters for Counters.Counter;
  using SafeERC20 for IERC20;
  using Address for address;
  using SafeMath for uint256;
  using ECDSA for bytes32;

  uint256 private _maxWaitingTime;
  address[] private _currencyExchanges;
  uint256[] private _feePerCurrency;
  address private _receiveAddress;
  bytes32 private constant OPERATOR = keccak256("OPERATOR");
  bytes32 private constant MARKET = keccak256("MARKET");
  bytes32 private constant USER_MANAGEMENT = keccak256("USER_MANAGEMENT");
  address public adminVerify;
  mapping(address => bool) private _addressLocked;
  mapping(string => bool) private _executedOrderIds;
  mapping(uint256 => Counters.Counter) private _orderIds;
  mapping(IEnums.MarketType => mapping(uint256 => Counters.Counter)) private _orderERC1155Ids;
  IERC721[] private _nftAddress;
  address private _officalAddress;
  address private _commonItem;

  constructor() {
    _receiveAddress = msg.sender;
    adminVerify = msg.sender;
    _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
    _setupRole(USER_MANAGEMENT, msg.sender);
  }

  struct OrderItem {
    uint256 id;
    uint256 itemId;
    uint256 nftType;
    uint256 unitPrice;
    address seller;
    uint256 ranking;
  }

  struct OrderERC1155 {
    uint256 id;
    uint256 itemId;
    uint256 unitPrice;
    address seller;
    uint256 ranking;
    uint256 amount;
  }

  struct StorageInfor {
    uint256 countNft;
    address receiveAddress;
    uint256 maxWaitingTime;
    address adminVerify;
    address officalAddress;
    uint256 countCurrency;
  }

  mapping(uint256 => mapping(uint256 => OrderItem)) public orders;
  mapping(uint256 => mapping(uint256 => mapping(uint256 => OrderERC1155))) public orderERC1155;

  modifier onlyUserManagement() {
    require(hasRole(USER_MANAGEMENT, msg.sender), "Restricted to user management.");
    _;
  }

  modifier onlyOperator() {
    require(hasRole(OPERATOR, msg.sender), "Restricted to OPERATOR.");
    _;
  }

  modifier onlyAdmin() {
    require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Restricted to admin.");
    _;
  }

  modifier onlyMarket() {
    require(hasRole(MARKET, msg.sender), "Restricted to market.");
    _;
  }

  function setCurrencyExchangesAndFee(address[] memory currencyExchanges, uint256[] memory feePerCurrency) external onlyAdmin {
    require(currencyExchanges.length == feePerCurrency.length, "Invalid input");
    for(uint256 index =0; index < currencyExchanges.length; index++){
      _currencyExchanges.push(currencyExchanges[index]);
      _feePerCurrency.push(feePerCurrency[index]);
    }
  }

  function reloadExchangesAndFee(address[] memory currencyExchanges, uint256[] memory feePerCurrency) external onlyAdmin {
    require(currencyExchanges.length > 0, "INVALD_WALLET");
    require(_currencyExchanges.length >= currencyExchanges.length, "INVALD_PARAMS");
    for(uint256 i = 0; i < currencyExchanges.length; i++) {
        _currencyExchanges[i] = currencyExchanges[i];
        _feePerCurrency[i] = feePerCurrency[i];
    }
  }

  function setNftAddress(IERC721[] memory nftAddresses) external onlyAdmin {
    for(uint index = 0;index < nftAddresses.length;index++) {
      _nftAddress.push(nftAddresses[index]);
    }
  }

  function reloadNftAddress(IERC721[] memory nftAddresses) external onlyAdmin {
    require(nftAddresses.length > 0, "INVALD_WALLET");
    require(_nftAddress.length >= nftAddresses.length, "INVALD_PARAMS");
    for(uint256 i = 0; i < nftAddresses.length; i++) {
        _nftAddress[i] = nftAddresses[i];
    }
  }

  function setMaxWaitingTime(uint256 maxWaitingTime) external onlyAdmin {
    _maxWaitingTime = maxWaitingTime;
  }

  function setReceiveAddress(address receiveAddress) external onlyAdmin {
    _receiveAddress = receiveAddress;
  }

  function setAdminVerify(address admin) external onlyAdmin {
    adminVerify = admin;
  }

  function setOperator(address _operator) external onlyAdmin {
    _setupRole(OPERATOR, _operator);
  }

  function setUserManagement(address _user) external onlyAdmin {
    _setupRole(USER_MANAGEMENT, _user);
  }

  function setMarket(address _market) external onlyAdmin {
    _setupRole(MARKET, _market);
  }

  function setOfficalAddress(address _wallet) external onlyAdmin {
    _officalAddress = _wallet;
  }

  function setCommonItem(address _address) external onlyAdmin {
    _commonItem = _address;
  }

  function blockUser(address _addressBlock) external onlyUserManagement {
    require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender) || hasRole(USER_MANAGEMENT, msg.sender), "PERMISSION_DENIED");
    require(_addressBlock != address(0), "INVALID_ADDRESS");
    require(_addressLocked[_addressBlock] == false, "ADDRESS_LOCKED");
    _addressLocked[_addressBlock] = true;
  }

  function unlockUser(address _addressBlock) external onlyUserManagement {
    require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender) || hasRole(USER_MANAGEMENT, msg.sender), "PERMISSION_DENIED");
    require(_addressBlock != address(0), "INVALID_ADDRESS");
    require(_addressLocked[_addressBlock] == true, "ADDRESS_NOT_FOUND");
    _addressLocked[_addressBlock] = false;
    delete _addressLocked[_addressBlock];
  }

  function isBlockAddress(address userWallet) external view returns (bool) {
    return _addressLocked[userWallet];
  }

  function createItemOrder(
    uint256 _nftId,
    uint256 _price,
    uint256 _nftType,
    address _seller
  ) external onlyMarket nonReentrant whenNotPaused returns (OrderItem memory) {
    OrderItem memory existedOrder = orders[_nftId][_nftType];
    require(existedOrder.id == 0, "Sell order is already existed");
    _orderIds[_nftType].increment();
    uint256 orderId = _orderIds[_nftType].current();
    orders[_nftId][_nftType] = OrderItem({
      id: orderId,
      unitPrice: _price,
      nftType: _nftType,
      itemId: _nftId,
      seller: _seller,
      ranking: 0
    });
    return orders[_nftId][_nftType];
  }

  function createOrderERC1155(
    uint256 _nftId,
    uint256 _price,
    uint256 _nftType,
    uint256 _amount,
    uint256 _ranking,
    address _seller,
    IEnums.MarketType _type
  ) external onlyMarket nonReentrant whenNotPaused returns (OrderERC1155 memory) {
    _orderERC1155Ids[_type][_nftType].increment();
    uint256 orderId = _orderERC1155Ids[_type][_nftType].current();
    orderERC1155[_nftType][orderId][_nftId] = OrderERC1155({
      id: orderId,
      unitPrice: _price,
      itemId: _nftId,
      seller: _seller,
      ranking: _ranking,
      amount: _amount
    });
    return orderERC1155[_nftType][orderId][_nftId];
  }

  function deleteSellOrder(uint256 _nftId, uint256 _nftType) external onlyMarket {
    orders[_nftId][_nftType].id = 0;
    delete orders[_nftId][_nftType];
  }

  function deleteSellOrderERC1155(uint256 _nftId, uint256 _nftType, uint256 _sellOrder) external onlyMarket {
    orderERC1155[_nftType][_sellOrder][_nftId].id = 0;
    delete orderERC1155[_nftType][_sellOrder][_nftId];
  }

  function getNftAddress(uint256 _nftType) external onlyMarket view returns (IERC721) {
    return _nftAddress[_nftType];
  }

  function getCurrencyExchangeAndFee(uint256 currencyType) external onlyMarket view returns (address, uint256) {
    return (_currencyExchanges[currencyType], _feePerCurrency[currencyType]);
  }

  function getCurrencyExchange(uint256 currencyType) external view returns (address) {
    return _currencyExchanges[currencyType];
  }

  function isExecutedOrder(string memory _orderId) external onlyMarket view returns (bool) {
    return _executedOrderIds[_orderId];
  }

  function getOrder(uint256 _nftId, uint256 _nftType) external onlyMarket view returns (OrderItem memory) {
    return orders[_nftId][_nftType];
  }

  function getOrderERC1155(uint256 _nftType, uint256 _sellOrder, uint256 _nftId) external onlyMarket view returns (OrderERC1155 memory) {
    return orderERC1155[_nftType][_sellOrder][_nftId];
  }

  function setExecutedOrder(string memory _orderId, bool _status) external onlyMarket {
    _executedOrderIds[_orderId] = _status;
  }

  function getInfor() external onlyMarket view returns (StorageInfor memory) {
    StorageInfor memory info = StorageInfor({
      countNft: _nftAddress.length,
      receiveAddress: _receiveAddress,
      maxWaitingTime: _maxWaitingTime,
      adminVerify: adminVerify,
      officalAddress: _officalAddress,
      countCurrency: _currencyExchanges.length
    });
    return info;
  }
}

File 12 of 28 : TransferHelper.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library TransferHelper {
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            'TransferHelper::safeApprove: approve failed'
        );
    }
    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            'TransferHelper::safeTransfer: transfer failed'
        );
    }
    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            'TransferHelper::transferFrom: transferFrom failed'
        );
    }

    function safeEnoughTokenApproved(
        address token,
        address owner,
        address spender,
        uint256 amount
    ) internal {
        // bytes4(keccak256(bytes('allowance(address,address)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xdd62ed3e, owner, spender));
        require( success && (abi.decode(data, (uint256)) >= amount), "Exchange currency allowance of user is too low");
        safeEnoughBalance(token, owner, amount);
    }

    function safeEnoughBalance(
        address token,
        address owner,
        uint256 amount
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x70a08231, owner));
        require( success && (abi.decode(data, (uint256)) > amount), "Exchange currency balance of user is too low");
    }
}

File 13 of 28 : AccessController.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "@openzeppelin/contracts/access/AccessControl.sol";

contract AccessController is AccessControl {
  bytes32 public constant OPERATOR = keccak256("OPERATOR");

  modifier onlyAdmin() {
    require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "Caller is not the admin");
    _;
  }

  modifier onlyOperator() {
    require(hasRole(OPERATOR, _msgSender()), "Caller is not the operator");
    _;
  }

  function addOperator(address operator) external onlyAdmin {
    _setupRole(OPERATOR, operator);
  }

  function removeOperator(address operator) external onlyAdmin {
    revokeRole(OPERATOR, operator);
  }
}

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

File 16 of 28 : 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 17 of 28 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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 18 of 28 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

File 19 of 28 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 20 of 28 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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:
 *
 * ```
 * 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}:
 *
 * ```
 * 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.
 */
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(uint160(account), 20),
                        " 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 21 of 28 : CommonItem.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

contract CommonItem is ERC1155, AccessControl {
  using ECDSA for bytes32;
  bytes32 private constant OPERATOR = keccak256("OPERATOR");
  uint256[] private _mintedAddress;

  constructor() ERC1155("http://api-market.genso.game/game/{id}.json") {
    _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
  }

  modifier onlyOperator() {
    require(hasRole(OPERATOR, msg.sender), "Restricted to OPERATOR.");
    _;
  }

  modifier onlyAdmin() {
    require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Restricted to admin.");
    _;
  }

  function setOperator(address _operator) external onlyAdmin {
    _setupRole(OPERATOR, _operator);
  }

  function mintItemFromMarket(uint256 _nftId, uint256 _amount, address _wallet) external onlyOperator {
    _mint(_wallet, _nftId, _amount, "");
    if (existedId(_nftId) != true) {
      _mintedAddress.push(_nftId);
    }
  }

  function existedId(uint256 _nftId) private view returns (bool) {
    bool isExisted = false;
    for (uint256 i = 0; i < _mintedAddress.length; i++) {
      if (_mintedAddress[i] == _nftId) {
        isExisted = true;
      }
    }
    return isExisted;
  }

  function burnItem(uint256 _nftId, uint256 _amount, address _wallet) external {
    require(hasRole(OPERATOR, msg.sender) || hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "PERMISSION_DENIED");
    _burn(_wallet, _nftId, _amount);
  }

  function uri(uint256 _tokenId) override public pure returns (string memory) {
    return string(
      abi.encodePacked("http://api-market.genso.game/game/", Strings.toString(_tokenId), ".json")
    );
  }

  function name() public pure returns(string memory) {
    return "GENSOKISHI COLLECTION";
  }

  function getTokensOfUser(address _user)
    external
    view
    returns
    (uint256[] memory, uint256[] memory, string[] memory)
  {
    uint256 _counter;
    for (uint256 i = 0; i < _mintedAddress.length; i++) {
      if (balanceOf(_user, _mintedAddress[i]) != 0) {
        _counter++;
      }
    }

    uint256[] memory ticketIds = new uint256[](_counter);
    string[] memory metadata = new string[](_counter);
    uint256[] memory balances = new uint256[](_counter);
    uint256 index;

    for (uint256 i = 0; i < _mintedAddress.length; i++) {
      uint256 balance = balanceOf(_user, _mintedAddress[i]);
      if (balance != 0) {
        ticketIds[index] = _mintedAddress[i];
        metadata[index] = uri(_mintedAddress[i]);
        balances[index] = balance;
        index++;
      }
    }
    return (ticketIds, balances, metadata);
  }

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

File 22 of 28 : IEnums.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;

interface IEnums {
    enum MarketType {
        Ticket,
        Consumption
    }
    enum GachaGacha {
        Normal,
        Rare
    }
}

File 23 of 28 : 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 24 of 28 : 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 25 of 28 : ERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;

import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using Address for address;

    // Mapping from token ID to account balances
    mapping(uint256 => mapping(address => uint256)) private _balances;

    // Mapping from account to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /**
     * @dev See {_setURI}.
     */
    constructor(string memory uri_) {
        _setURI(uri_);
    }

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

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) public view virtual override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        require(account != address(0), "ERC1155: address zero is not a valid owner");
        return _balances[id][account];
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
        public
        view
        virtual
        override
        returns (uint256[] memory)
    {
        require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            batchBalances[i] = balanceOf(accounts[i], ids[i]);
        }

        return batchBalances;
    }

    /**
     * @dev See {IERC1155-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

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

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner nor approved"
        );
        _safeTransferFrom(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner nor approved"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `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 memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
        _balances[id][to] += amount;

        emit TransferSingle(operator, from, to, id, amount);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - 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[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
            _balances[id][to] += amount;
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        _balances[id][to] += amount;
        emit TransferSingle(operator, address(0), to, id, amount);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * 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 _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `amount` tokens of token type `id`.
     */
    function _burn(
        address from,
        uint256 id,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }

        emit TransferSingle(operator, from, address(0), id, amount);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(
        address from,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
        }

        emit TransferBatch(operator, from, address(0), ids, amounts);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

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

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `ids` and `amounts` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

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

        return array;
    }
}

File 26 of 28 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 27 of 28 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 28 of 28 : IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "../IERC1155.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_storage","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"orderId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftType","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"currencyType","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"transactionFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"BUYMARKETITEM","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"orderId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftType","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"CANCELSELLORDER","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":"uint256","name":"orderId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftType","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ranking","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"currencyType","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isExchangePrice","type":"bool"}],"name":"SELLORDER","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"addOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nftId","type":"uint256"},{"internalType":"uint256","name":"_ranking","type":"uint256"},{"internalType":"string","name":"_orderId","type":"string"},{"internalType":"bytes","name":"_signature","type":"bytes"},{"internalType":"uint256","name":"_nftType","type":"uint256"},{"internalType":"uint256","name":"_currencyType","type":"uint256"},{"internalType":"uint256","name":"_sellOrderId","type":"uint256"},{"components":[{"internalType":"uint256","name":"currentPrice","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"internalType":"struct GsoMarketPlace.PriceByTimestamp","name":"priceByTimestamp","type":"tuple"}],"name":"buyMartketItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nftId","type":"uint256"},{"internalType":"uint256","name":"_nftType","type":"uint256"}],"name":"cancelOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nftId","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_nftType","type":"uint256"},{"internalType":"uint256","name":"currencyType","type":"uint256"},{"internalType":"bool","name":"isExchangePrice","type":"bool"}],"name":"createMartketItem","outputs":[],"stateMutability":"nonpayable","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":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"removeOperator","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":"uint256[]","name":"_nftTypes","type":"uint256[]"},{"internalType":"address[]","name":"_commissionAddresses","type":"address[]"}],"name":"setCommissionAddressByNftType","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"currencyExchanges","type":"uint256[]"},{"internalType":"uint256[]","name":"feePerCurrency","type":"uint256[]"}],"name":"setCommissionFeeByCurrencyType","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_nftTypes","type":"uint256[]"},{"internalType":"uint256[]","name":"_creatorFees","type":"uint256[]"},{"internalType":"address[]","name":"_creatorAddresses","type":"address[]"}],"name":"setCreatorFeeByNftType","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620031f8380380620031f8833981016040819052620000349162000122565b60018055600280546001600160a81b0319166101006001600160a01b038416021790556200006b6000620000653390565b62000072565b5062000152565b6200007e828262000082565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200007e576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620000de3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006020828403121562000134578081fd5b81516001600160a01b03811681146200014b578182fd5b9392505050565b61309680620001626000396000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c806391d14854116100ad578063a8edaa8011610071578063a8edaa8014610292578063ac8a584a146102a5578063b6ed0632146102b8578063c8191904146102cb578063d547741f146102de57600080fd5b806391d148541461022a578063983d27371461023d5780639870d7fe14610264578063a0c5a5d114610277578063a217fddf1461028a57600080fd5b806336568abe116100f457806336568abe146101e95780633f4ba83a146101fc5780635c975abb1461020457806373f305241461020f5780638456cb591461022257600080fd5b806301ffc9a714610131578063150b7a0214610159578063248a9ca3146101905780632b979bcc146101c15780632f2ff15d146101d6575b600080fd5b61014461013f366004612a59565b6102f1565b60405190151581526020015b60405180910390f35b61017761016736600461288d565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610150565b6101b361019e366004612a12565b60009081526020819052604090206001015490565b604051908152602001610150565b6101d46101cf3660046128f7565b610328565b005b6101d46101e4366004612a2a565b61042e565b6101d46101f7366004612a2a565b610458565b6101d46104d6565b60025460ff16610144565b6101d461021d366004612c2f565b610507565b6101d4610a05565b610144610238366004612a2a565b610a34565b6101b37f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c81565b6101d4610272366004612855565b610a5d565b6101d4610285366004612960565b610ab1565b6101b3600081565b6101d46102a03660046128f7565b610ceb565b6101d46102b3366004612855565b610db3565b6101d46102c6366004612b55565b610e04565b6101d46102d9366004612b76565b61113f565b6101d46102ec366004612a2a565b6118c0565b60006001600160e01b03198216637965db0b60e01b148061032257506301ffc9a760e01b6001600160e01b03198316145b92915050565b610333600033610a34565b6103585760405162461bcd60e51b815260040161034f90612e18565b60405180910390fd5b8281146103775760405162461bcd60e51b815260040161034f90612e4f565b60005b83811015610427578282828181106103a257634e487b7160e01b600052603260045260246000fd5b90506020020160208101906103b79190612855565b600560008787858181106103db57634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550808061041f90612ff6565b91505061037a565b5050505050565b600082815260208190526040902060010154610449816118e5565b61045383836118ef565b505050565b6001600160a01b03811633146104c85760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161034f565b6104d28282611973565b5050565b6104e1600033610a34565b6104fd5760405162461bcd60e51b815260040161034f90612e18565b6105056119d8565b565b6002600154141561052a5760405162461bcd60e51b815260040161034f90612e76565b6002600155610537611a2a565b6000600260019054906101000a90046001600160a01b03166001600160a01b031663f2b677fe6040518163ffffffff1660e01b815260040160c06040518083038186803b15801561058757600080fd5b505afa15801561059b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105bf9190612ae2565b90508060a00151831061060c5760405162461bcd60e51b8152602060048201526015602482015274496e76616c69642063757272656e6379207479706560581b604482015260640161034f565b600254604051633a01caf560e21b81526004810186905260009161010090046001600160a01b03169063e8072bd49060240160206040518083038186803b15801561065657600080fd5b505afa15801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068e9190612871565b825190915085106106b15760405162461bcd60e51b815260040161034f90612ead565b336040516331a9108f60e11b8152600481018990526001600160a01b0391821691831690636352211e9060240160206040518083038186803b1580156106f657600080fd5b505afa15801561070a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072e9190612871565b6001600160a01b0316146107845760405162461bcd60e51b815260206004820152601760248201527f4f776e657220746f6b656e3a206e6f74206f776e657221000000000000000000604482015260640161034f565b600087116107d45760405162461bcd60e51b815260206004820152601f60248201527f546f6b656e206964206d7573742062652067726561746572207468616e203000604482015260640161034f565b60025461010090046001600160a01b031663e75658fb336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561082a57600080fd5b505afa15801561083e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086291906129f6565b1561087f5760405162461bcd60e51b815260040161034f90612dd5565b33866108d85760405162461bcd60e51b815260206004820152602260248201527f4f72646572207072696365206d7573742062652067726561746572207468616e604482015261020360f41b606482015260840161034f565b60025460405163efba9bff60e01b8152600481018a905260248101899052604481018890526001600160a01b0383811660648301526000926101009004169063efba9bff9060840160c060405180830381600087803b15801561093a57600080fd5b505af115801561094e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109729190612a81565b905061098082308b8a611a70565b805160408051918252602082018b905281018990526001600160a01b0383166060820152608081018890524260a0820152600060c082015260e081018790528515156101008201527fb7928112cb47e957db9b39427aa9def38071f3fa27d306d0036873875580dee3906101200160405180910390a150506001805550505050505050565b610a10600033610a34565b610a2c5760405162461bcd60e51b815260040161034f90612e18565b610505611b68565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b610a68600033610a34565b610a845760405162461bcd60e51b815260040161034f90612e18565b610aae7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c82611ba5565b50565b610abc600033610a34565b610ad85760405162461bcd60e51b815260040161034f90612e18565b8483148015610ae657508481145b610b3e5760405162461bcd60e51b8152602060048201526024808201527f496e76616c696420496e7075743a204172726179206c656e677468206d69736d6044820152630c2e8c6d60e31b606482015260840161034f565b60005b85811015610ce2576000858583818110610b6b57634e487b7160e01b600052603260045260246000fd5b90506020020135118015610bbd57506000838383818110610b9c57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610bb19190612855565b6001600160a01b031614155b610bd95760405162461bcd60e51b815260040161034f90612e4f565b848482818110610bf957634e487b7160e01b600052603260045260246000fd5b9050602002013560036000898985818110610c2457634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002081905550828282818110610c5d57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610c729190612855565b60046000898985818110610c9657634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508080610cda90612ff6565b915050610b41565b50505050505050565b610cf6600033610a34565b610d125760405162461bcd60e51b815260040161034f90612e18565b828114610d315760405162461bcd60e51b815260040161034f90612e4f565b60005b8381101561042757828282818110610d5c57634e487b7160e01b600052603260045260246000fd5b9050602002013560066000878785818110610d8757634e487b7160e01b600052603260045260246000fd5b905060200201358152602001908152602001600020819055508080610dab90612ff6565b915050610d34565b610dbe600033610a34565b610dda5760405162461bcd60e51b815260040161034f90612e18565b610aae7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c826118c0565b60026001541415610e275760405162461bcd60e51b815260040161034f90612e76565b60026001819055506000600260019054906101000a90046001600160a01b03166001600160a01b031663f2b677fe6040518163ffffffff1660e01b815260040160c06040518083038186803b158015610e7f57600080fd5b505afa158015610e93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb79190612ae2565b80519091508210610eda5760405162461bcd60e51b815260040161034f90612ead565b60008311610f2a5760405162461bcd60e51b815260206004820152601c60248201527f496e646578206d7573742062652067726561746572207468616e203000000000604482015260640161034f565b600033600254604051635e1a357360e01b815260048101879052602481018690529192506000916101009091046001600160a01b031690635e1a35739060440160c06040518083038186803b158015610f8257600080fd5b505afa158015610f96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fba9190612a81565b805190915015801590610fd05750848160200151145b610fec5760405162461bcd60e51b815260040161034f90612ed7565b816001600160a01b031681608001516001600160a01b0316146110515760405162461bcd60e51b815260206004820152601d60248201527f5468652073656e646572206d757374206265207468652073656c6c6572000000604482015260640161034f565b60025460405163345c3d4d60e21b815260048101879052602481018690526101009091046001600160a01b03169063d170f53490604401600060405180830381600087803b1580156110a257600080fd5b505af11580156110b6573d6000803e3d6000fd5b505050506110ca3082608001518787611a70565b805160608083015160808085015160408051958652602086018b9052858101939093526001600160a01b0316928401929092529082018690524260a0830152517f685cc92fd0fcebf7c9a7f33c658d41d580fe2202da26d23091109248decbb7449181900360c00190a1505060018055505050565b600260015414156111625760405162461bcd60e51b815260040161034f90612e76565b600260015561116f611a2a565b6000600260019054906101000a90046001600160a01b03166001600160a01b031663f2b677fe6040518163ffffffff1660e01b815260040160c06040518083038186803b1580156111bf57600080fd5b505afa1580156111d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f79190612ae2565b9050428160400151836020015161120e9190612f45565b116112515760405162461bcd60e51b81526020600482015260136024820152724558434545445f57414954494e475f54494d4560681b604482015260640161034f565b805185106112715760405162461bcd60e51b815260040161034f90612ead565b6002546040516314b0729f60e31b81526101009091046001600160a01b03169063a58394f8906112a5908a90600401612d9e565b60206040518083038186803b1580156112bd57600080fd5b505afa1580156112d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f591906129f6565b156113365760405162461bcd60e51b815260206004820152601160248201527013d491115497d254d7d1561150d5551151607a1b604482015260640161034f565b61135589848a8a8a338b89600001518a602001518d8b60600151611baf565b6113915760405162461bcd60e51b815260206004820152600d60248201526c494e56414c49445f504152414d60981b604482015260640161034f565b600089116113e15760405162461bcd60e51b815260206004820152601c60248201527f496e646578206d7573742062652067726561746572207468616e203000000000604482015260640161034f565b60025461010090046001600160a01b031663e75658fb336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561143757600080fd5b505afa15801561144b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146f91906129f6565b1561148c5760405162461bcd60e51b815260040161034f90612dd5565b600254604051631652fc0f60e01b8152339161010090046001600160a01b031690631652fc0f906114c4908b90600190600401612db1565b600060405180830381600087803b1580156114de57600080fd5b505af11580156114f2573d6000803e3d6000fd5b5050600254604051635e1a357360e01b8152600481018e9052602481018a9052600093506101009091046001600160a01b03169150635e1a35739060440160c06040518083038186803b15801561154857600080fd5b505afa15801561155c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115809190612a81565b60025460405163e7fe395160e01b8152600481018990529192506000916101009091046001600160a01b03169063e7fe39519060240160206040518083038186803b1580156115ce57600080fd5b505afa1580156115e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116069190612871565b6000888152600660205260409020548351919250908714801561162c57508c8360200151145b6116485760405162461bcd60e51b815260040161034f90612ed7565b8260a001518c10156116935760405162461bcd60e51b815260206004820152601460248201527352616e6b696e673a206e6f7420656e6f7567682160601b604482015260640161034f565b60808301516001600160a01b03166116de5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21039b2b63632b960911b604482015260640161034f565b836001600160a01b031683608001516001600160a01b031614156117345760405162461bcd60e51b815260206004820152600d60248201526c213abc90313c9039b2b63632b960991b604482015260640161034f565b855161178e5760405162461bcd60e51b8152602060048201526024808201527f43757272656e74207072696365206d75737420626520677265617465722074686044820152630616e20360e41b606482015260840161034f565b61179c823388513090611c70565b60025460405163345c3d4d60e21b8152600481018f9052602481018b90526101009091046001600160a01b03169063d170f53490604401600060405180830381600087803b1580156117ed57600080fd5b505af1158015611801573d6000803e3d6000fd5b5050505061181b8287600001518686608001518d86611dad565b61182b308585602001518c611a70565b825160208085015188516080808801516040805196875294860193909352928401526001600160a01b03908116606084015286169082015260a081018a905260c0810189905260e08101829052426101008201527fe44840f4aaeb8ec3188de39dec6b348890a47265219af27fbd656676e0599393906101200160405180910390a15050600180555050505050505050505050565b6000828152602081905260409020600101546118db816118e5565b6104538383611973565b610aae8133611e89565b6118f98282610a34565b6104d2576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561192f3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61197d8282610a34565b156104d2576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6119e0611eed565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60025460ff16156105055760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161034f565b600254604051633a01caf560e21b81526004810183905260009161010090046001600160a01b03169063e8072bd49060240160206040518083038186803b158015611aba57600080fd5b505afa158015611ace573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af29190612871565b604051632142170760e11b81526001600160a01b038781166004830152868116602483015260448201869052919250908216906342842e0e90606401600060405180830381600087803b158015611b4857600080fd5b505af1158015611b5c573d6000803e3d6000fd5b50505050505b50505050565b611b70611a2a565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611a0d3390565b6104d282826118ef565b6000808c8c8b8d8b8b8b8a8c604051602001611bd399989796959493929190612d38565b6040516020818303038152906040528051906020012090506000611c4e8a611c48846040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b90611f36565b6001600160a01b0390811690851614925050509b9a5050505050505050505050565b604080516001600160a01b03858116602483015284811660448084019190915283518084039091018152606490920183526020820180516001600160e01b0316636eb1769f60e11b1790529151600092839290881691611cd09190612ca7565b6000604051808303816000865af19150503d8060008114611d0d576040519150601f19603f3d011682016040523d82523d6000602084013e611d12565b606091505b5091509150818015611d3757508281806020019051810190611d349190612b3d565b10155b611d9a5760405162461bcd60e51b815260206004820152602e60248201527f45786368616e67652063757272656e637920616c6c6f77616e6365206f66207560448201526d73657220697320746f6f206c6f7760901b606482015260840161034f565b611da5868685611f5a565b505050505050565b60006103e8611dbc8388612f7d565b611dc69190612f5d565b600084815260056020526040902054909150611def90889087906001600160a01b031684612079565b60008381526003602052604090205415611e79576000838152600360205260408120546103e890611e209089612f7d565b611e2a9190612f5d565b600085815260046020526040902054909150611e5390899088906001600160a01b031684612079565b611e7388878784611e64878d612f9c565b611e6e9190612f9c565b612079565b50610ce2565b610ce2878686611e6e858b612f9c565b611e938282610a34565b6104d257611eab816001600160a01b031660146121af565b611eb68360206121af565b604051602001611ec7929190612cc3565b60408051601f198184030181529082905262461bcd60e51b825261034f91600401612d9e565b60025460ff166105055760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161034f565b6000806000611f458585612398565b91509150611f5281612408565b509392505050565b604080516001600160a01b0384811660248084019190915283518084039091018152604490920183526020820180516001600160e01b03166370a0823160e01b1790529151600092839290871691611fb29190612ca7565b6000604051808303816000865af19150503d8060008114611fef576040519150601f19603f3d011682016040523d82523d6000602084013e611ff4565b606091505b5091509150818015612018575082818060200190518101906120169190612b3d565b115b6104275760405162461bcd60e51b815260206004820152602c60248201527f45786368616e67652063757272656e63792062616c616e6365206f662075736560448201526b7220697320746f6f206c6f7760a01b606482015260840161034f565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908816916120dd9190612ca7565b6000604051808303816000865af19150503d806000811461211a576040519150601f19603f3d011682016040523d82523d6000602084013e61211f565b606091505b509150915081801561214957508051158061214957508080602001905181019061214991906129f6565b611da55760405162461bcd60e51b815260206004820152603160248201527f5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472604482015270185b9cd9995c919c9bdb4819985a5b1959607a1b606482015260840161034f565b606060006121be836002612f7d565b6121c9906002612f45565b67ffffffffffffffff8111156121ef57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612219576020820181803683370190505b509050600360fc1b8160008151811061224257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061227f57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006122a3846002612f7d565b6122ae906001612f45565b90505b6001811115612342576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106122f057634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061231457634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c9361233b81612fdf565b90506122b1565b5083156123915760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161034f565b9392505050565b6000808251604114156123cf5760208301516040840151606085015160001a6123c387828585612609565b94509450505050612401565b8251604014156123f957602083015160408401516123ee8683836126f6565b935093505050612401565b506000905060025b9250929050565b600081600481111561242a57634e487b7160e01b600052602160045260246000fd5b14156124335750565b600181600481111561245557634e487b7160e01b600052602160045260246000fd5b14156124a35760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161034f565b60028160048111156124c557634e487b7160e01b600052602160045260246000fd5b14156125135760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161034f565b600381600481111561253557634e487b7160e01b600052602160045260246000fd5b141561258e5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161034f565b60048160048111156125b057634e487b7160e01b600052602160045260246000fd5b1415610aae5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161034f565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561264057506000905060036126ed565b8460ff16601b1415801561265857508460ff16601c14155b1561266957506000905060046126ed565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156126bd573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166126e6576000600192509250506126ed565b9150600090505b94509492505050565b6000806001600160ff1b0383168161271360ff86901c601b612f45565b905061272187828885612609565b935093505050935093915050565b600067ffffffffffffffff8084111561274a5761274a613027565b604051601f8501601f19908116603f0116810190828211818310171561277257612772613027565b8160405280935085815286868601111561278b57600080fd5b858560208301376000602087830101525050509392505050565b60008083601f8401126127b6578182fd5b50813567ffffffffffffffff8111156127cd578182fd5b6020830191508360208260051b850101111561240157600080fd5b600082601f8301126127f8578081fd5b6123918383356020850161272f565b600060408284031215612818578081fd5b6040516040810181811067ffffffffffffffff8211171561283b5761283b613027565b604052823581526020928301359281019290925250919050565b600060208284031215612866578081fd5b81356123918161303d565b600060208284031215612882578081fd5b81516123918161303d565b600080600080608085870312156128a2578283fd5b84356128ad8161303d565b935060208501356128bd8161303d565b925060408501359150606085013567ffffffffffffffff8111156128df578182fd5b6128eb878288016127e8565b91505092959194509250565b6000806000806040858703121561290c578384fd5b843567ffffffffffffffff80821115612923578586fd5b61292f888389016127a5565b90965094506020870135915080821115612947578384fd5b50612954878288016127a5565b95989497509550505050565b60008060008060008060608789031215612978578384fd5b863567ffffffffffffffff8082111561298f578586fd5b61299b8a838b016127a5565b909850965060208901359150808211156129b3578586fd5b6129bf8a838b016127a5565b909650945060408901359150808211156129d7578384fd5b506129e489828a016127a5565b979a9699509497509295939492505050565b600060208284031215612a07578081fd5b815161239181613052565b600060208284031215612a23578081fd5b5035919050565b60008060408385031215612a3c578182fd5b823591506020830135612a4e8161303d565b809150509250929050565b600060208284031215612a6a578081fd5b81356001600160e01b031981168114612391578182fd5b600060c08284031215612a92578081fd5b612a9a612f1c565b825181526020830151602082015260408301516040820152606083015160608201526080830151612aca8161303d565b608082015260a0928301519281019290925250919050565b600060c08284031215612af3578081fd5b612afb612f1c565b825181526020830151612b0d8161303d565b6020820152604083810151908201526060830151612b2a8161303d565b60608201526080830151612aca8161303d565b600060208284031215612b4e578081fd5b5051919050565b60008060408385031215612b67578182fd5b50508035926020909101359150565b600080600080600080600080610120898b031215612b92578586fd5b8835975060208901359650604089013567ffffffffffffffff80821115612bb7578788fd5b818b0191508b601f830112612bca578788fd5b612bd98c83356020850161272f565b975060608b0135915080821115612bee578384fd5b50612bfb8b828c016127e8565b9550506080890135935060a0890135925060c08901359150612c208a60e08b01612807565b90509295985092959890939650565b600080600080600060a08688031215612c46578283fd5b853594506020860135935060408601359250606086013591506080860135612c6d81613052565b809150509295509295909350565b60008151808452612c93816020860160208601612fb3565b601f01601f19169290920160200192915050565b60008251612cb9818460208701612fb3565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612cfb816017850160208801612fb3565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612d2c816028840160208801612fb3565b01602801949350505050565b89815288602082015260008851612d56816040850160208d01612fb3565b9091016040810197909752506bffffffffffffffffffffffff19606095861b16948601949094526074850192909252609484015260b483015260d482015260f4019392505050565b6020815260006123916020830184612c7b565b604081526000612dc46040830185612c7b565b905082151560208301529392505050565b60208082526023908201527f416464726573733a20416464726573732063616e206e6f7420696d706163742060408201526269742160e81b606082015260800190565b60208082526017908201527f43616c6c6572206973206e6f74207468652061646d696e000000000000000000604082015260600190565b6020808252600d908201526c125b9d985b1a59081a5b9c1d5d609a1b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526010908201526f494e56414c49445f4e46545f5459504560801b604082015260600190565b60208082526025908201527f4f7264657220646f6573206e6f74206578697374206f7220696e76616c69642060408201526437b93232b960d91b606082015260800190565b60405160c0810167ffffffffffffffff81118282101715612f3f57612f3f613027565b60405290565b60008219821115612f5857612f58613011565b500190565b600082612f7857634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615612f9757612f97613011565b500290565b600082821015612fae57612fae613011565b500390565b60005b83811015612fce578181015183820152602001612fb6565b83811115611b625750506000910152565b600081612fee57612fee613011565b506000190190565b600060001982141561300a5761300a613011565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610aae57600080fd5b8015158114610aae57600080fdfea2646970667358221220a0fefcfc060ccb25f92635414c819565307ce3d8d17f876681ae1acd5ff84b8564736f6c634300080400330000000000000000000000004b4151c1e9ecfb837695623fe7fc7a7c5f62a9bc

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

0000000000000000000000004b4151c1e9ecfb837695623fe7fc7a7c5f62a9bc

-----Decoded View---------------
Arg [0] : _storage (address): 0x4b4151c1e9ecfb837695623fe7fc7a7c5f62a9bc

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000004b4151c1e9ecfb837695623fe7fc7a7c5f62a9bc


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.