ETH Price: $3,383.99 (+0.80%)

Contract

0x1f5C1a6B9E14Bb500F1b273A86C2eFD367c483C6
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Buy Packs160214452022-11-21 22:43:11767 days ago1669070591IN
Rainicorn: Packs
0.045 ETH0.0020397452.08471354
Buy Packs160213932022-11-21 22:32:47767 days ago1669069967IN
Rainicorn: Packs
0.045 ETH0.0021495254.88797509
Withdraw Eth132595872021-09-20 1:01:371195 days ago1632099697IN
Rainicorn: Packs
0 ETH0.0025022180.89669145
Buy Packs132565382021-09-19 14:02:271196 days ago1632060147IN
Rainicorn: Packs
0.1656 ETH0.0017031541.92473378
Withdraw Eth132565342021-09-19 14:02:021196 days ago1632060122IN
Rainicorn: Packs
0 ETH0.001539649.73681614
Set Packs Contra...132565312021-09-19 14:01:261196 days ago1632060086IN
Rainicorn: Packs
0 ETH0.0014996551.77113752
Buy Packs132565302021-09-19 14:01:071196 days ago1632060067IN
Rainicorn: Packs
0.3456 ETH0.0129985347.32762424
Buy Packs132564832021-09-19 13:49:451196 days ago1632059385IN
Rainicorn: Packs
0.0045 ETH0.0078023941.58081269
Buy Packs132564592021-09-19 13:45:131196 days ago1632059113IN
Rainicorn: Packs
0.27 ETH0.0071840554.25412243
Buy Packs132564522021-09-19 13:43:181196 days ago1632058998IN
Rainicorn: Packs
0.0023 ETH0.0111098157.76551403
Buy Packs132564422021-09-19 13:39:361196 days ago1632058776IN
Rainicorn: Packs
0.54 ETH0.0091476953.77993696
Buy Packs132564002021-09-19 13:28:081196 days ago1632058088IN
Rainicorn: Packs
0.0075 ETH0.0069262838.12669141
Buy Packs132563972021-09-19 13:26:551196 days ago1632058015IN
Rainicorn: Packs
0.1824 ETH0.0211379232.05503802
Buy Packs132563422021-09-19 13:16:551196 days ago1632057415IN
Rainicorn: Packs
0.36 ETH0.0066894439.32772609
Buy Packs132563402021-09-19 13:16:461196 days ago1632057406IN
Rainicorn: Packs
0.045 ETH0.0105583245.94709339
Buy Packs132563302021-09-19 13:13:381196 days ago1632057218IN
Rainicorn: Packs
0.0756 ETH0.0051275938.15121367
Buy Packs132563262021-09-19 13:12:351196 days ago1632057155IN
Rainicorn: Packs
0.045 ETH0.0073939838.98833016
Buy Packs132563152021-09-19 13:10:111196 days ago1632057011IN
Rainicorn: Packs
0.0126 ETH0.0068627549.60575269
Buy Packs132563152021-09-19 13:10:111196 days ago1632057011IN
Rainicorn: Packs
0.045 ETH0.0066981749.83686069
Buy Packs132563102021-09-19 13:08:411196 days ago1632056921IN
Rainicorn: Packs
0.0045 ETH0.008215239.73859956
Buy Packs132563052021-09-19 13:07:541196 days ago1632056874IN
Rainicorn: Packs
0.3456 ETH0.0073937540.63932098
Buy Packs132563022021-09-19 13:07:081196 days ago1632056828IN
Rainicorn: Packs
0.0126 ETH0.0064557341.53039911
Buy Packs132563012021-09-19 13:06:461196 days ago1632056806IN
Rainicorn: Packs
0.0023 ETH0.0066549839.30996305
Buy Packs132562942021-09-19 13:05:251196 days ago1632056725IN
Rainicorn: Packs
0.0075 ETH0.0095888743.50018229
Buy Packs132562892021-09-19 13:04:141196 days ago1632056654IN
Rainicorn: Packs
0.015 ETH0.0074582540.17892426
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block
From
To
132595872021-09-20 1:01:371195 days ago1632099697
Rainicorn: Packs
0.3456 ETH
132565342021-09-19 14:02:021196 days ago1632060122
Rainicorn: Packs
6.20812711 ETH
132564522021-09-19 13:43:181196 days ago1632058998
Rainicorn: Packs
0.00005 ETH
132564422021-09-19 13:39:361196 days ago1632058776
Rainicorn: Packs
0.27 ETH
132563972021-09-19 13:26:551196 days ago1632058015
Rainicorn: Packs
0.0864 ETH
132563422021-09-19 13:16:551196 days ago1632057415
Rainicorn: Packs
0.18 ETH
132563012021-09-19 13:06:461196 days ago1632056806
Rainicorn: Packs
0.00005 ETH
132562832021-09-19 13:02:501196 days ago1632056570
Rainicorn: Packs
0.07425 ETH
132562552021-09-19 12:57:281196 days ago1632056248
Rainicorn: Packs
0.00005 ETH
132562532021-09-19 12:57:171196 days ago1632056237
Rainicorn: Packs
0.0248 ETH
132562462021-09-19 12:55:361196 days ago1632056136
Rainicorn: Packs
0.00005 ETH
132562312021-09-19 12:52:161196 days ago1632055936
Rainicorn: Packs
0.54 ETH
132561932021-09-19 12:42:201196 days ago1632055340
Rainicorn: Packs
0.01215 ETH
132561932021-09-19 12:42:201196 days ago1632055340
Rainicorn: Packs
0.0864 ETH
132561812021-09-19 12:40:191196 days ago1632055219
Rainicorn: Packs
0.4501 ETH
132561762021-09-19 12:38:421196 days ago1632055122
Rainicorn: Packs
0.54 ETH
132561662021-09-19 12:36:131196 days ago1632054973
Rainicorn: Packs
0.01215 ETH
132561662021-09-19 12:36:131196 days ago1632054973
Rainicorn: Packs
0.01215 ETH
132561662021-09-19 12:36:131196 days ago1632054973
Rainicorn: Packs
0.03375 ETH
132561662021-09-19 12:36:131196 days ago1632054973
Rainicorn: Packs
0.03375 ETH
132561662021-09-19 12:36:131196 days ago1632054973
Rainicorn: Packs
0.0405 ETH
132561662021-09-19 12:36:131196 days ago1632054973
Rainicorn: Packs
0.0405 ETH
132561662021-09-19 12:36:131196 days ago1632054973
Rainicorn: Packs
0.0405 ETH
132561662021-09-19 12:36:131196 days ago1632054973
Rainicorn: Packs
0.01215 ETH
132561632021-09-19 12:35:461196 days ago1632054946
Rainicorn: Packs
0.00005 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RainiCardsFunctions

Compiler Version
v0.8.3+commit.8d00100c

Optimization Enabled:
Yes with 200 runs

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

pragma solidity ^0.8.3;

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

interface IStakingPool {
  function balanceOf(address _owner) external view returns (uint256 balance);
  function burn(address _owner, uint256 _amount) external;
}

interface IRainiCardPacks is IERC721 {

  struct PackType {
    uint32 packClassId;
    uint64 costInUnicorns;
    uint64 costInRainbows;
    uint64 costInEth;
    uint16 maxMintsPerAddress;
    uint32 tokenIdStart;
    uint32 supply;
    uint32 mintTimeStart;
  }

  function packTypes(uint256 _id) external view returns (PackType memory);
  function numberOfPackMinted(uint256 _packTypeId) external view returns (uint256);
  function numberMintedByAddress(address _address, uint256 _packTypeId) external view returns (uint256);

  function mint(address _to, uint256 _packTypeId, uint256 _amount) external;
  function burn(uint256 _tokenId) external;
  function addToNumberMintedByAddress(address _address, uint256 _packTypeId, uint256 amount) external;
}

interface IRainiNft1155 is IERC1155 {
  struct CardLevel {
    uint64 conversionRate; // number of base tokens required to create
    uint32 numberMinted;
    uint128 tokenId; // ID of token if grouped, 0 if not
    uint32 maxStamina; // The initial and maxiumum stamina for a token
  }

  struct Card {
    uint64 costInUnicorns;
    uint64 costInRainbows;
    uint16 maxMintsPerAddress;
    uint32 maxSupply; // number of base tokens mintable
    uint32 allocation; // number of base tokens mintable with points on this contract
    uint32 mintTimeStart; // the timestamp from which the card can be minted
    bool locked;
    address subContract;
  }
  
  struct TokenVars {
    uint128 cardId;
    uint32 level;
    uint32 number; // to assign a numbering to NFTs
    bytes1 mintedContractChar;
  }

  function maxTokenId() external view returns (uint256);
  function contractChar() external view returns (bytes1);

  function numberMintedByAddress(address _address, uint256 _cardID) external view returns (uint256);

  function burn(address _owner, uint256 _tokenId, uint256 _amount, bool _isBridged) external;

  function getPathUri(uint256 _cardId) view external returns (string memory);

  function cards(uint256 _cardId) external view returns (Card memory);
  function cardLevels(uint256 _cardId, uint256 _level) external view returns (CardLevel memory);
  function tokenVars(uint256 _tokenId) external view returns (TokenVars memory);

  function mint(address _to, uint256 _cardId, uint256 _cardLevel, uint256 _amount, bytes1 _mintedContractChar, uint256 _number, uint256[] memory _data) external;
  function addToNumberMintedByAddress(address _address, uint256 _cardId, uint256 amount) external;
}

contract RainiCardsFunctions is AccessControl, ReentrancyGuard {
  
  using ECDSA for bytes32;

  address public nftStakingPoolAddress;

  uint256 public constant POINT_COST_DECIMALS = 1000000000000000000;

  uint256 public rainbowToEth;
  uint256 public unicornToEth;
  uint256 public minPointsPercentToMint;

  mapping(address => bool) public rainbowPools;
  mapping(address => bool) public unicornPools;

  uint256 public mintingFeeBasisPoints;

  address public verifier;

  IRainiNft1155 nftContract;
  IRainiCardPacks packsContact;

  constructor(address _nftContractAddress, address _packsContact, address _contractOwner, address _verifier) {
    _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
    _setupRole(DEFAULT_ADMIN_ROLE, _contractOwner);
    nftContract = IRainiNft1155(_nftContractAddress);
    packsContact = IRainiCardPacks(_packsContact);
    verifier = _verifier;
  }

  modifier onlyOwner() {
    require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()));
    _;
  }

  function getPackBalances(address _address, uint256 _start, uint256 _end) 
    external view returns (uint256[][] memory amounts) {
      uint256[][] memory _amounts = new uint256[][](_end - _start);
      uint256 count;
      for (uint256 i = _start; i <= _end; i++) {
        try packsContact.ownerOf(i) returns (address a) {
          if (a == _address) {
            _amounts[count] = new uint256[](2);
            _amounts[count][0] = i;
            _amounts[count][1] = 1;
            count++;
          }
        } catch Error(string memory /*reason*/) {
        }
      }

      uint256[][] memory _amounts2 = new uint256[][](count);
      for (uint256 i = 0; i < count; i++) {
        _amounts2[i] = new uint256[](2);
        _amounts2[i][0] = _amounts[i][0];
        _amounts2[i][1] = _amounts[i][1];
      }

      return _amounts2;
  }

  function setPacksContract(address _packsContact)
    external onlyOwner {
      packsContact = IRainiCardPacks(_packsContact);
  }

  function setNftContract(address _nftContractAddress)
    external onlyOwner {
      nftContract = IRainiNft1155(_nftContractAddress);
  }

  function addRainbowPool(address _rainbowPool) 
    external onlyOwner {
      rainbowPools[_rainbowPool] = true;
  }

  function removeRainbowPool(address _rainbowPool) 
    external onlyOwner {
      rainbowPools[_rainbowPool] = false;
  }

  function addUnicornPool(address _unicornPool) 
    external onlyOwner {
      unicornPools[_unicornPool] = true;
  }

  function removeUnicornPool(address _unicornPool) 
    external onlyOwner {
      unicornPools[_unicornPool] = false;
  }

  function setEtherValues(uint256 _unicornToEth, uint256 _rainbowToEth, uint256 _minPointsPercentToMint)
     external onlyOwner {
      unicornToEth = _unicornToEth;
      rainbowToEth = _rainbowToEth;
      minPointsPercentToMint = _minPointsPercentToMint;
   }

  function setFees(uint256 _mintingFeeBasisPoints) 
    external onlyOwner {
      mintingFeeBasisPoints =_mintingFeeBasisPoints;
  }

  function setNftStakingPoolAddress(address _nftStakingPoolAddress)
    external onlyOwner {
      nftStakingPoolAddress = (_nftStakingPoolAddress);
  }

  function setVerifierAddress(address _verifier) 
    external onlyOwner {
      verifier = _verifier;
  }
  
  function openPacks(uint256[][] memory _cardId, uint256[][] memory _amount, bytes[] memory sig, uint256[] memory _salt, uint256[] memory _packId)
    external nonReentrant {

    for (uint256 i = 0; i < _cardId.length; i++) {
      require (packsContact.ownerOf(_packId[i]) == address(_msgSender()), 'not the owner');
      bytes memory _hashingString = abi.encode(_salt[i], _packId[i]);
      for (uint256 j = 0; j < _cardId[i].length; j++) {
        _hashingString = abi.encode(_hashingString, _cardId[i][j], _amount[i][j]);
      }
      bytes32 _hash = keccak256(_hashingString);
      address signer = ECDSA.recover(_hash.toEthSignedMessageHash(), sig[i]);
      require (signer == verifier, "Invalid sig");
    }

    for (uint256 i = 0; i < _cardId.length; i++) {
      packsContact.burn(_packId[i]);
      for (uint256 j = 0; j < _cardId[i].length; j++) {
        nftContract.mint(_msgSender(), _cardId[i][j], 0, _amount[i][j], nftContract.contractChar(), 0, new uint256[](0));
      }
    }
  }

struct BuyPacksData {
    uint256 totalPriceRainbows;
    uint256 totalPriceUnicorns;
    uint256 minCostRainbows;
    uint256 minCostUnicorns;
    uint256 fee;
    uint256 amountEthToWithdraw;
    bool success;
  }
  
  
  function buyPacks(uint256[] memory _packType, uint256[] memory _amount, bool[] memory _useUnicorns, uint256[][] memory _data, address[] memory _rainbowPools, address[] memory _unicornPools)
    external payable nonReentrant {

    BuyPacksData memory _locals = BuyPacksData({
      totalPriceRainbows: 0,
      totalPriceUnicorns: 0,
      minCostRainbows: 0,
      minCostUnicorns: 0,
      fee: 0,
      amountEthToWithdraw: 0,
      success: false
    });

    bool[] memory addToMaxMints = new bool[](_packType.length);

    for (uint256 i = 0; i < _packType.length; i++) {
      IRainiCardPacks.PackType memory packType = packsContact.packTypes(_packType[i]);

      require(block.timestamp >= packType.mintTimeStart || hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), 'too early');
      require(packType.maxMintsPerAddress == 0 || (packsContact.numberMintedByAddress(_msgSender(), _packType[i]) + _amount[i] <= packType.maxMintsPerAddress), "Max mints reached for address");
      addToMaxMints[i] = packType.maxMintsPerAddress > 0;

      uint256 numberMinted = packsContact.numberOfPackMinted(_packType[i]);
      if (numberMinted + _amount[i] > packType.supply) {
        _amount[i] = packType.supply - numberMinted;
      }

      if (packType.costInUnicorns > 0 || packType.costInRainbows > 0) {
        if (_useUnicorns[i]) {
          require(packType.costInUnicorns > 0, "unicorns not allowed");
          uint256 cost = packType.costInUnicorns * _amount[i] * POINT_COST_DECIMALS;
          _locals.totalPriceUnicorns += cost;
          if (packType.costInEth > 0) {
            _locals.minCostUnicorns += cost;
          }
        } else {
          require(packType.costInRainbows > 0, "rainbows not allowed");
          uint256 cost = packType.costInRainbows * _amount[i] * POINT_COST_DECIMALS;
          _locals.totalPriceRainbows += cost;
          if (packType.costInEth > 0) {
            _locals.minCostRainbows += cost;
          }
        }

        if (packType.costInEth == 0) {
          if (packType.costInRainbows > 0) {
            _locals.fee += (packType.costInRainbows * _amount[i] * POINT_COST_DECIMALS * mintingFeeBasisPoints) / (rainbowToEth * 10000);
          } else {
            _locals.fee += (packType.costInUnicorns * _amount[i] * POINT_COST_DECIMALS * mintingFeeBasisPoints) / (unicornToEth * 10000);
          }
        }
      }
      
      _locals.amountEthToWithdraw += packType.costInEth;
    }
    
    if (_locals.totalPriceUnicorns > 0 || _locals.totalPriceRainbows > 0 ) {
      for (uint256 n = 0; n < 2; n++) {
        bool loopTypeUnicorns = n > 0;

        uint256 totalBalance = 0;
        uint256 totalPrice = loopTypeUnicorns ? _locals.totalPriceUnicorns : _locals.totalPriceRainbows;
        uint256 remainingPrice = totalPrice;

        if (totalPrice > 0) {
          uint256 loopLength = loopTypeUnicorns ? _unicornPools.length : _rainbowPools.length;

          require(loopLength > 0, "invalid pools");

          for (uint256 i = 0; i < loopLength; i++) {
            IStakingPool pool;
            if (loopTypeUnicorns) {
              require((unicornPools[_unicornPools[i]]), "invalid unicorn pool");
              pool = IStakingPool(_unicornPools[i]);
            } else {
              require((rainbowPools[_rainbowPools[i]]), "invalid rainbow pool");
              pool = IStakingPool(_rainbowPools[i]);
            }
            uint256 _balance = pool.balanceOf(_msgSender());
            totalBalance += _balance;

            if (totalBalance >=  totalPrice) {
              pool.burn(_msgSender(), remainingPrice);
              remainingPrice = 0;
              break;
            } else {
              pool.burn(_msgSender(), _balance);
              remainingPrice -= _balance;
            }
          }

          if (remainingPrice > 0) {
            totalPrice -= loopTypeUnicorns ? _locals.minCostUnicorns : _locals.minCostRainbows;
            uint256 minPoints = (totalPrice * minPointsPercentToMint) / 100;
            require(totalPrice - remainingPrice >= minPoints, "not enough balance");
            uint256 pointsToEth = loopTypeUnicorns ? unicornToEth : rainbowToEth;
            require(msg.value * pointsToEth > remainingPrice, "not enough balance");
            _locals.amountEthToWithdraw += remainingPrice / pointsToEth;
          }
        }
      }
    }

    // Add minting fees
    _locals.amountEthToWithdraw += _locals.fee;

    require(_locals.amountEthToWithdraw <= msg.value);

    (_locals.success, ) = _msgSender().call{ value: msg.value - _locals.amountEthToWithdraw }(""); // refund excess Eth
    require(_locals.success, "transfer failed");

    bool _tokenMinted = false;
    for (uint256 i = 0; i < _packType.length; i++) {
      if (_amount[i] > 0) {
        if (addToMaxMints[i]) {
          packsContact.addToNumberMintedByAddress(_msgSender(), _packType[i], _amount[i]);
        }
        packsContact.mint(_msgSender(), _packType[i], _amount[i]);
        _tokenMinted = true;
      }
    }
    require(_tokenMinted, 'Allocation exhausted');
  }



  // Allow the owner to withdraw Ether payed into the contract
  function withdrawEth(uint256 _amount)
    external onlyOwner {
      require(_amount <= address(this).balance, "not enough balance");
      (bool success, ) = _msgSender().call{ value: _amount }("");
      require(success, "transfer failed");
  }
}

File 2 of 15 : AccessControl.sol
// SPDX-License-Identifier: MIT

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, _msgSender());
        _;
    }

    /**
     * @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 override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @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 {
        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 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.
     */
    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.
     */
    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 granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    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.
     *
     * [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}.
     * ====
     */
    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);
    }

    function _grantRole(bytes32 role, address account) private {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 3 of 15 : IAccessControl.sol
// SPDX-License-Identifier: MIT

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 4 of 15 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

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 make 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 5 of 15 : ERC1155.sol
// SPDX-License-Identifier: MIT

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: balance query for the zero address");
        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 {
        require(_msgSender() != operator, "ERC1155: setting approval status for self");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_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 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: transfer caller is not 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();

        _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), 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);

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

        _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 `account`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address account,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(account != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);

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

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

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * 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);

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

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

        address operator = _msgSender();

        _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");

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

        emit TransferSingle(operator, account, address(0), id, amount);
    }

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

        address operator = _msgSender();

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

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

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

        emit TransferBatch(operator, account, address(0), ids, amounts);
    }

    /**
     * @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 `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 _beforeTokenTransfer(
        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 6 of 15 : IERC1155.sol
// SPDX-License-Identifier: MIT

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 be 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 7 of 15 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT

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.
        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. 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 8 of 15 : IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT

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

File 9 of 15 : IERC721.sol
// SPDX-License-Identifier: MIT

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`, 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 be 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 Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

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

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

File 10 of 15 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 11 of 15 : Context.sol
// SPDX-License-Identifier: MIT

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 12 of 15 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

File 13 of 15 : ECDSA.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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.
            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.
            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;
        uint8 v;
        assembly {
            s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
            v := add(shr(255, vs), 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 Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 14 of 15 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

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

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

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "istanbul",
  "libraries": {},
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_nftContractAddress","type":"address"},{"internalType":"address","name":"_packsContact","type":"address"},{"internalType":"address","name":"_contractOwner","type":"address"},{"internalType":"address","name":"_verifier","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POINT_COST_DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rainbowPool","type":"address"}],"name":"addRainbowPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_unicornPool","type":"address"}],"name":"addUnicornPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_packType","type":"uint256[]"},{"internalType":"uint256[]","name":"_amount","type":"uint256[]"},{"internalType":"bool[]","name":"_useUnicorns","type":"bool[]"},{"internalType":"uint256[][]","name":"_data","type":"uint256[][]"},{"internalType":"address[]","name":"_rainbowPools","type":"address[]"},{"internalType":"address[]","name":"_unicornPools","type":"address[]"}],"name":"buyPacks","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_end","type":"uint256"}],"name":"getPackBalances","outputs":[{"internalType":"uint256[][]","name":"amounts","type":"uint256[][]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minPointsPercentToMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintingFeeBasisPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftStakingPoolAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[][]","name":"_cardId","type":"uint256[][]"},{"internalType":"uint256[][]","name":"_amount","type":"uint256[][]"},{"internalType":"bytes[]","name":"sig","type":"bytes[]"},{"internalType":"uint256[]","name":"_salt","type":"uint256[]"},{"internalType":"uint256[]","name":"_packId","type":"uint256[]"}],"name":"openPacks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rainbowPools","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rainbowToEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rainbowPool","type":"address"}],"name":"removeRainbowPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_unicornPool","type":"address"}],"name":"removeUnicornPool","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":"_unicornToEth","type":"uint256"},{"internalType":"uint256","name":"_rainbowToEth","type":"uint256"},{"internalType":"uint256","name":"_minPointsPercentToMint","type":"uint256"}],"name":"setEtherValues","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintingFeeBasisPoints","type":"uint256"}],"name":"setFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nftContractAddress","type":"address"}],"name":"setNftContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nftStakingPoolAddress","type":"address"}],"name":"setNftStakingPoolAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_packsContact","type":"address"}],"name":"setPacksContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_verifier","type":"address"}],"name":"setVerifierAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"unicornPools","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unicornToEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"verifier","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawEth","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620038fe380380620038fe833981016040819052620000349162000164565b600180556200004560003362000097565b6200005260008362000097565b600a80546001600160a01b03199081166001600160a01b0396871617909155600b805482169486169490941790935560098054909316931692909217905550620001c0565b620000a38282620000a7565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000a3576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001033390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b80516001600160a01b03811681146200015f57600080fd5b919050565b600080600080608085870312156200017a578384fd5b620001858562000147565b9350620001956020860162000147565b9250620001a56040860162000147565b9150620001b56060860162000147565b905092959194509250565b61372e80620001d06000396000f3fe6080604052600436106101cd5760003560e01c806354a7d0a9116100f75780639d15f5c211610095578063d096144a11610064578063d096144a14610552578063d547741f14610572578063e0e5120d14610592578063f7e177de146105b2576101cd565b80639d15f5c2146104e1578063a217fddf14610501578063ae3068c114610516578063c311d04914610532576101cd565b806390236637116100d1578063902366371461046157806391d1485414610474578063928cb148146104945780639961fc18146104b4576101cd565b806354a7d0a91461040b578063582f706f1461042b5780635a3b336c14610441576101cd565b80631d9083f31161016f5780632f2ff15d1161013e5780632f2ff15d1461038b57806336568abe146103ab5780633d18678e146103cb57806352f5ad77146103eb576101cd565b80631d9083f3146102fb578063248a9ca31461031b578063257ea0ab1461034b5780632b7ac3f31461036b576101cd565b806313f43160116101ab57806313f431601461026f57806315d21e111461029f57806317e95526146102c35780631c513339146102e5576101cd565b806301ffc9a7146101d257806308a55a6e146102075780630c02477614610237575b600080fd5b3480156101de57600080fd5b506101f26101ed3660046131de565b6105c8565b60405190151581526020015b60405180910390f35b34801561021357600080fd5b506101f2610222366004612f4b565b60066020526000908152604090205460ff1681565b34801561024357600080fd5b50600254610257906001600160a01b031681565b6040516001600160a01b0390911681526020016101fe565b34801561027b57600080fd5b506101f261028a366004612f4b565b60076020526000908152604090205460ff1681565b3480156102ab57600080fd5b506102b560045481565b6040519081526020016101fe565b3480156102cf57600080fd5b506102e36102de366004612f4b565b610601565b005b3480156102f157600080fd5b506102b560035481565b34801561030757600080fd5b506102e3610316366004612f4b565b610639565b34801561032757600080fd5b506102b5610336366004613197565b60009081526020819052604090206001015490565b34801561035757600080fd5b506102e3610366366004612f4b565b610671565b34801561037757600080fd5b50600954610257906001600160a01b031681565b34801561039757600080fd5b506102e36103a63660046131af565b6106a8565b3480156103b757600080fd5b506102e36103c63660046131af565b6106da565b3480156103d757600080fd5b506102e36103e6366004613197565b61076d565b3480156103f757600080fd5b506102e3610406366004612f4b565b610788565b34801561041757600080fd5b506102e36104263660046132d3565b6107c0565b34801561043757600080fd5b506102b560085481565b34801561044d57600080fd5b506102e361045c366004612f4b565b6107e4565b6102e361046f366004613082565b61081e565b34801561048057600080fd5b506101f261048f3660046131af565b6118c2565b3480156104a057600080fd5b506102e36104af366004612f4b565b6118eb565b3480156104c057600080fd5b506104d46104cf366004612f83565b611925565b6040516101fe919061342b565b3480156104ed57600080fd5b506102e36104fc366004612fb7565b611d96565b34801561050d57600080fd5b506102b5600081565b34801561052257600080fd5b506102b5670de0b6b3a764000081565b34801561053e57600080fd5b506102e361054d366004613197565b612429565b34801561055e57600080fd5b506102e361056d366004612f4b565b6124fb565b34801561057e57600080fd5b506102e361058d3660046131af565b612533565b34801561059e57600080fd5b506102e36105ad366004612f4b565b61255b565b3480156105be57600080fd5b506102b560055481565b60006001600160e01b03198216637965db0b60e01b14806105f957506301ffc9a760e01b6001600160e01b03198316145b90505b919050565b61060e600061048f612592565b61061757600080fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b610646600061048f612592565b61064f57600080fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b61067e600061048f612592565b61068757600080fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000828152602081905260409020600101546106cb816106c6612592565b612597565b6106d583836125fb565b505050565b6106e2612592565b6001600160a01b0316816001600160a01b03161461075f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6107698282612680565b5050565b61077a600061048f612592565b61078357600080fd5b600855565b610795600061048f612592565b61079e57600080fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6107cd600061048f612592565b6107d657600080fd5b600492909255600355600555565b6107f1600061048f612592565b6107fa57600080fd5b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b600260015414156108715760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610756565b600260018190555060006040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600015158152509050600087516001600160401b038111156108e257634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561090b578160200160208202803683370190505b50905060005b88518110156110a857600b5489516000916001600160a01b031690637ffae846908c908590811061095257634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b815260040161097891815260200190565b6101006040518083038186803b15801561099157600080fd5b505afa1580156109a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c99190613206565b90508060e0015163ffffffff16421015806109ec57506109ec600061048f612592565b610a245760405162461bcd60e51b8152602060048201526009602482015268746f6f206561726c7960b81b6044820152606401610756565b608081015161ffff161580610b375750806080015161ffff16898381518110610a5d57634e487b7160e01b600052603260045260246000fd5b6020908102919091010151600b546001600160a01b0316630a3de451610a81612592565b8e8781518110610aa157634e487b7160e01b600052603260045260246000fd5b60200260200101516040518363ffffffff1660e01b8152600401610ada9291906001600160a01b03929092168252602082015260400190565b60206040518083038186803b158015610af257600080fd5b505afa158015610b06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2a91906132bb565b610b349190613513565b11155b610b835760405162461bcd60e51b815260206004820152601d60248201527f4d6178206d696e7473207265616368656420666f7220616464726573730000006044820152606401610756565b6000816080015161ffff1611838381518110610baf57634e487b7160e01b600052603260045260246000fd5b91151560209283029190910190910152600b548a516000916001600160a01b0316906344cf562f908d9086908110610bf757634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610c1d91815260200190565b60206040518083038186803b158015610c3557600080fd5b505afa158015610c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6d91906132bb565b90508160c0015163ffffffff168a8481518110610c9a57634e487b7160e01b600052603260045260246000fd5b602002602001015182610cad9190613513565b1115610cf657808260c0015163ffffffff16610cc9919061356a565b8a8481518110610ce957634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505b600082602001516001600160401b03161180610d1f5750600082604001516001600160401b0316115b1561107057888381518110610d4457634e487b7160e01b600052603260045260246000fd5b602002602001015115610e4057600082602001516001600160401b031611610da55760405162461bcd60e51b81526020600482015260146024820152731d5b9a58dbdc9b9cc81b9bdd08185b1b1bddd95960621b6044820152606401610756565b6000670de0b6b3a76400008b8581518110610dd057634e487b7160e01b600052603260045260246000fd5b602002602001015184602001516001600160401b0316610df0919061354b565b610dfa919061354b565b90508086602001818151610e0e9190613513565b90525060608301516001600160401b031615610e3a578086606001818151610e369190613513565b9052505b50610f2b565b600082604001516001600160401b031611610e945760405162461bcd60e51b81526020600482015260146024820152731c985a5b989bdddcc81b9bdd08185b1b1bddd95960621b6044820152606401610756565b6000670de0b6b3a76400008b8581518110610ebf57634e487b7160e01b600052603260045260246000fd5b602002602001015184604001516001600160401b0316610edf919061354b565b610ee9919061354b565b90508086600001818151610efd9190613513565b90525060608301516001600160401b031615610f29578086604001818151610f259190613513565b9052505b505b60608201516001600160401b03166110705760408201516001600160401b031615610fe257600354610f5f9061271061354b565b600854670de0b6b3a76400008c8681518110610f8b57634e487b7160e01b600052603260045260246000fd5b602002602001015185604001516001600160401b0316610fab919061354b565b610fb5919061354b565b610fbf919061354b565b610fc9919061352b565b85608001818151610fda9190613513565b905250611070565b600454610ff19061271061354b565b600854670de0b6b3a76400008c868151811061101d57634e487b7160e01b600052603260045260246000fd5b602002602001015185602001516001600160401b031661103d919061354b565b611047919061354b565b611051919061354b565b61105b919061352b565b8560800181815161106c9190613513565b9052505b81606001516001600160401b03168560a00181815161108f9190613513565b9052508291506110a09050816135f4565b915050610911565b506000826020015111806110bc5750815115155b156115735760005b600281101561157157801515600080826110df5785516110e5565b85602001515b905080801561155a576000846110fc5789516110ff565b88515b9050600081116111415760405162461bcd60e51b815260206004820152600d60248201526c696e76616c696420706f6f6c7360981b6044820152606401610756565b60005b8181101561148b576000861561121157600760008c848151811061117857634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff166111e25760405162461bcd60e51b81526020600482015260146024820152731a5b9d985b1a59081d5b9a58dbdc9b881c1bdbdb60621b6044820152606401610756565b8a828151811061120257634e487b7160e01b600052603260045260246000fd5b602002602001015190506112ca565b600660008d848151811061123557634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff1661129f5760405162461bcd60e51b81526020600482015260146024820152731a5b9d985b1a59081c985a5b989bddc81c1bdbdb60621b6044820152606401610756565b8b82815181106112bf57634e487b7160e01b600052603260045260246000fd5b602002602001015190505b6000816001600160a01b03166370a082316112e3612592565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561132257600080fd5b505afa158015611336573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135a91906132bb565b90506113668188613513565b96508587106113f157816001600160a01b0316639dc29fac611386612592565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101889052604401600060405180830381600087803b1580156113ce57600080fd5b505af11580156113e2573d6000803e3d6000fd5b5050505060009450505061148b565b816001600160a01b0316639dc29fac611408612592565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b15801561145057600080fd5b505af1158015611464573d6000803e3d6000fd5b505050508085611474919061356a565b945050508080611483906135f4565b915050611144565b50811561155857846114a15787604001516114a7565b87606001515b6114b1908461356a565b925060006064600554856114c5919061354b565b6114cf919061352b565b9050806114dc848661356a565b10156114fa5760405162461bcd60e51b8152600401610756906134c4565b6000866115095760035461150d565b6004545b90508361151a823461354b565b116115375760405162461bcd60e51b8152600401610756906134c4565b611541818561352b565b8a60a0018181516115529190613513565b90525050505b505b505050508080611569906135f4565b9150506110c4565b505b81608001518260a0018181516115899190613513565b90525060a082015134101561159d57600080fd5b6115a5612592565b6001600160a01b03168260a00151346115be919061356a565b604051600081818185875af1925050503d80600081146115fa576040519150601f19603f3d011682016040523d82523d6000602084013e6115ff565b606091505b5050151560c083018190526116485760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610756565b6000805b895181101561186e57600089828151811061167757634e487b7160e01b600052603260045260246000fd5b6020026020010151111561185c578281815181106116a557634e487b7160e01b600052603260045260246000fd5b60200260200101511561178557600b546001600160a01b031663c2fa40196116cb612592565b8c84815181106116eb57634e487b7160e01b600052603260045260246000fd5b60200260200101518c858151811061171357634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091526044820152606401600060405180830381600087803b15801561176c57600080fd5b505af1158015611780573d6000803e3d6000fd5b505050505b600b546001600160a01b031663156e29f661179e612592565b8c84815181106117be57634e487b7160e01b600052603260045260246000fd5b60200260200101518c85815181106117e657634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091526044820152606401600060405180830381600087803b15801561183f57600080fd5b505af1158015611853573d6000803e3d6000fd5b50505050600191505b80611866816135f4565b91505061164c565b50806118b35760405162461bcd60e51b8152602060048201526014602482015273105b1b1bd8d85d1a5bdb88195e1a185d5cdd195960621b6044820152606401610756565b50506001805550505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6118f8600061048f612592565b61190157600080fd5b6001600160a01b03166000908152600760205260409020805460ff19166001179055565b60606000611933848461356a565b6001600160401b0381111561195857634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561198b57816020015b60608152602001906001900390816119765790505b5090506000845b848111611b7f57600b546040516331a9108f60e11b8152600481018390526001600160a01b0390911690636352211e9060240160206040518083038186803b1580156119dd57600080fd5b505afa925050508015611a0d575060408051601f3d908101601f19168201909252611a0a91810190612f67565b60015b611a5057611a1961363b565b806308c379a01415611a3f5750611a2e613652565b80611a395750611a41565b50611a4b565b505b3d6000803e3d6000fd5b611b6d565b876001600160a01b0316816001600160a01b03161415611b6b57604080516002808252606082018352909160208301908036833701905050848481518110611aa857634e487b7160e01b600052603260045260246000fd5b602002602001018190525081848481518110611ad457634e487b7160e01b600052603260045260246000fd5b6020026020010151600081518110611afc57634e487b7160e01b600052603260045260246000fd5b6020026020010181815250506001848481518110611b2a57634e487b7160e01b600052603260045260246000fd5b6020026020010151600181518110611b5257634e487b7160e01b600052603260045260246000fd5b602090810291909101015282611b67816135f4565b9350505b505b80611b77816135f4565b915050611992565b506000816001600160401b03811115611ba857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611bdb57816020015b6060815260200190600190039081611bc65790505b50905060005b82811015611d8b57604080516002808252606082018352909160208301908036833701905050828281518110611c2757634e487b7160e01b600052603260045260246000fd5b6020026020010181905250838181518110611c5257634e487b7160e01b600052603260045260246000fd5b6020026020010151600081518110611c7a57634e487b7160e01b600052603260045260246000fd5b6020026020010151828281518110611ca257634e487b7160e01b600052603260045260246000fd5b6020026020010151600081518110611cca57634e487b7160e01b600052603260045260246000fd5b602002602001018181525050838181518110611cf657634e487b7160e01b600052603260045260246000fd5b6020026020010151600181518110611d1e57634e487b7160e01b600052603260045260246000fd5b6020026020010151828281518110611d4657634e487b7160e01b600052603260045260246000fd5b6020026020010151600181518110611d6e57634e487b7160e01b600052603260045260246000fd5b602090810291909101015280611d83816135f4565b915050611be1565b509695505050505050565b60026001541415611de95760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610756565b600260015560005b855181101561218557611e02612592565b6001600160a01b0316600b60009054906101000a90046001600160a01b03166001600160a01b0316636352211e848481518110611e4f57634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401611e7591815260200190565b60206040518083038186803b158015611e8d57600080fd5b505afa158015611ea1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ec59190612f67565b6001600160a01b031614611f0b5760405162461bcd60e51b815260206004820152600d60248201526c3737ba103a34329037bbb732b960991b6044820152606401610756565b6000838281518110611f2d57634e487b7160e01b600052603260045260246000fd5b6020026020010151838381518110611f5557634e487b7160e01b600052603260045260246000fd5b6020026020010151604051602001611f77929190918252602082015260400190565b604051602081830303815290604052905060005b878381518110611fab57634e487b7160e01b600052603260045260246000fd5b6020026020010151518110156120905781888481518110611fdc57634e487b7160e01b600052603260045260246000fd5b6020026020010151828151811061200357634e487b7160e01b600052603260045260246000fd5b602002602001015188858151811061202b57634e487b7160e01b600052603260045260246000fd5b6020026020010151838151811061205257634e487b7160e01b600052603260045260246000fd5b602002602001015160405160200161206c9392919061348c565b60405160208183030381529060405291508080612088906135f4565b915050611f8b565b508051602082012060006121216120f4836040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b88868151811061211457634e487b7160e01b600052603260045260246000fd5b6020026020010151612703565b6009549091506001600160a01b0380831691161461216f5760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610756565b505050808061217d906135f4565b915050611df1565b5060005b855181101561241d57600b5482516001600160a01b03909116906342966c68908490849081106121c957634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b81526004016121ef91815260200190565b600060405180830381600087803b15801561220957600080fd5b505af115801561221d573d6000803e3d6000fd5b5050505060005b86828151811061224457634e487b7160e01b600052603260045260246000fd5b60200260200101515181101561240a57600a546001600160a01b031663a39501df61226d612592565b89858151811061228d57634e487b7160e01b600052603260045260246000fd5b602002602001015184815181106122b457634e487b7160e01b600052603260045260246000fd5b602002602001015160008a87815181106122de57634e487b7160e01b600052603260045260246000fd5b6020026020010151868151811061230557634e487b7160e01b600052603260045260246000fd5b6020026020010151600a60009054906101000a90046001600160a01b03166001600160a01b0316636bb2e32d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561235b57600080fd5b505afa15801561236f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612393919061316f565b604080516000808252602082019092526040518863ffffffff1660e01b81526004016123c597969594939291906133d9565b600060405180830381600087803b1580156123df57600080fd5b505af11580156123f3573d6000803e3d6000fd5b505050508080612402906135f4565b915050612224565b5080612415816135f4565b915050612189565b50506001805550505050565b612436600061048f612592565b61243f57600080fd5b4781111561245f5760405162461bcd60e51b8152600401610756906134c4565b6000612469612592565b6001600160a01b03168260405160006040518083038185875af1925050503d80600081146124b3576040519150601f19603f3d011682016040523d82523d6000602084013e6124b8565b606091505b50509050806107695760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610756565b612508600061048f612592565b61251157600080fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b600082815260208190526040902060010154612551816106c6612592565b6106d58383612680565b612568600061048f612592565b61257157600080fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b335b90565b6125a182826118c2565b610769576125b9816001600160a01b03166014612727565b6125c4836020612727565b6040516020016125d5929190613364565b60408051601f198184030181529082905262461bcd60e51b8252610756916004016134b1565b61260582826118c2565b610769576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561263c612592565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61268a82826118c2565b15610769576000828152602081815260408083206001600160a01b03851684529091529020805460ff191690556126bf612592565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b6000806000612712858561290f565b9150915061271f8161297f565b509392505050565b6060600061273683600261354b565b612741906002613513565b6001600160401b0381111561276657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612790576020820181803683370190505b509050600360fc1b816000815181106127b957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106127f657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600061281a84600261354b565b612825906001613513565b90505b60018111156128b9576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061286757634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061288b57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c936128b2816135b1565b9050612828565b5083156129085760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610756565b9392505050565b6000808251604114156129465760208301516040840151606085015160001a61293a87828585612b85565b94509450505050612978565b8251604014156129705760208301516040840151612965868383612c72565b935093505050612978565b506000905060025b9250929050565b60008160048111156129a157634e487b7160e01b600052602160045260246000fd5b14156129ac57612b82565b60018160048111156129ce57634e487b7160e01b600052602160045260246000fd5b1415612a1c5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610756565b6002816004811115612a3e57634e487b7160e01b600052602160045260246000fd5b1415612a8c5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610756565b6003816004811115612aae57634e487b7160e01b600052602160045260246000fd5b1415612b075760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610756565b6004816004811115612b2957634e487b7160e01b600052602160045260246000fd5b1415612b825760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610756565b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612bbc5750600090506003612c69565b8460ff16601b14158015612bd457508460ff16601c14155b15612be55750600090506004612c69565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612c39573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612c6257600060019250925050612c69565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b01612c9387828885612b85565b935093505050935093915050565b600082601f830112612cb1578081fd5b81356020612cbe826134f0565b604051612ccb82826135c8565b8381528281019150858301600585901b87018401881015612cea578586fd5b855b85811015612d11578135612cff816136e3565b84529284019290840190600101612cec565b5090979650505050505050565b600082601f830112612d2e578081fd5b81356020612d3b826134f0565b604051612d4882826135c8565b8381528281019150858301855b85811015612d1157612d6c898684358b0101612eb9565b84529284019290840190600101612d55565b600082601f830112612d8e578081fd5b81356020612d9b826134f0565b604051612da882826135c8565b8381528281019150858301600585901b87018401881015612dc7578586fd5b855b85811015612d115781358015158114612de0578788fd5b84529284019290840190600101612dc9565b6000601f8381840112612e03578182fd5b82356020612e10826134f0565b60408051612e1e83826135c8565b8481528381019250878401875b86811015612eaa5781358a018b603f820112612e4557898afd5b868101356001600160401b03811115612e6057612e60613625565b8551612e74828c01601f19168a01826135c8565b8181528d87838501011115612e87578b8cfd5b818784018a83013790810188018b90528652509385019390850190600101612e2b565b50909998505050505050505050565b600082601f830112612ec9578081fd5b81356020612ed6826134f0565b604051612ee382826135c8565b8381528281019150858301600585901b87018401881015612f02578586fd5b855b85811015612d1157813584529284019290840190600101612f04565b805163ffffffff811681146105fc57600080fd5b80516001600160401b03811681146105fc57600080fd5b600060208284031215612f5c578081fd5b8135612908816136e3565b600060208284031215612f78578081fd5b8151612908816136e3565b600080600060608486031215612f97578182fd5b8335612fa2816136e3565b95602085013595506040909401359392505050565b600080600080600060a08688031215612fce578283fd5b85356001600160401b0380821115612fe4578485fd5b612ff089838a01612d1e565b96506020880135915080821115613005578485fd5b61301189838a01612d1e565b95506040880135915080821115613026578485fd5b61303289838a01612df2565b94506060880135915080821115613047578283fd5b61305389838a01612eb9565b93506080880135915080821115613068578283fd5b5061307588828901612eb9565b9150509295509295909350565b60008060008060008060c0878903121561309a578384fd5b86356001600160401b03808211156130b0578586fd5b6130bc8a838b01612eb9565b975060208901359150808211156130d1578586fd5b6130dd8a838b01612eb9565b965060408901359150808211156130f2578586fd5b6130fe8a838b01612d7e565b95506060890135915080821115613113578283fd5b61311f8a838b01612d1e565b94506080890135915080821115613134578283fd5b6131408a838b01612ca1565b935060a0890135915080821115613155578283fd5b5061316289828a01612ca1565b9150509295509295509295565b600060208284031215613180578081fd5b81516001600160f81b031981168114612908578182fd5b6000602082840312156131a8578081fd5b5035919050565b600080604083850312156131c1578182fd5b8235915060208301356131d3816136e3565b809150509250929050565b6000602082840312156131ef578081fd5b81356001600160e01b031981168114612908578182fd5b6000610100808385031215613219578182fd5b60405161322682826135c8565b61322f84612f20565b815261323d60208501612f34565b602082015261324e60408501612f34565b604082015261325f60608501612f34565b60608201526080840151915061ffff8216821461327a578283fd5b81608082015261328c60a08501612f20565b60a082015261329d60c08501612f20565b60c08201526132ae60e08501612f20565b60e0820152949350505050565b6000602082840312156132cc578081fd5b5051919050565b6000806000606084860312156132e7578081fd5b505081359360208301359350604090920135919050565b6000815180845260208085019450808401835b8381101561332d57815187529582019590820190600101613311565b509495945050505050565b60008151808452613350816020860160208601613581565b601f01601f19169290920160200192915050565b60007f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008252835161339c816017850160208801613581565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516133cd816028840160208801613581565b01602801949350505050565b600060018060a01b038916825287602083015286604083015285606083015260ff60f81b851660808301528360a083015260e060c083015261341e60e08301846132fe565b9998505050505050505050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b8281101561347f57603f1988860301845261346d8583516132fe565b94509285019290850190600101613451565b5092979650505050505050565b60006060825261349f6060830186613338565b60208301949094525060400152919050565b6000602082526129086020830184613338565b6020808252601290820152716e6f7420656e6f7567682062616c616e636560701b604082015260600190565b60006001600160401b0382111561350957613509613625565b5060051b60200190565b600082198211156135265761352661360f565b500190565b60008261354657634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156135655761356561360f565b500290565b60008282101561357c5761357c61360f565b500390565b60005b8381101561359c578181015183820152602001613584565b838111156135ab576000848401525b50505050565b6000816135c0576135c061360f565b506000190190565b601f8201601f191681016001600160401b03811182821017156135ed576135ed613625565b6040525050565b60006000198214156136085761360861360f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600060033d111561259457600481823e5160e01c90565b600060443d101561366257612594565b6040516003193d81016004833e81513d6001600160401b038160248401118184111715613693575050505050612594565b82850191508151818111156136ad57505050505050612594565b843d87010160208285010111156136c957505050505050612594565b6136d8602082860101876135c8565b509094505050505090565b6001600160a01b0381168114612b8257600080fdfea264697066735822122044929120d89b2784bfd4f7fb500188421dda8d046d7e249381df869533e3ff0a64736f6c634300080300330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ad628a5515a1ee56088ac188633e2aeeaae474d600000000000000000000000082f9d5fe6c46990f3c2536e83b2b4e1c0a91f27f00000000000000000000000082f9d5fe6c46990f3c2536e83b2b4e1c0a91f27f

Deployed Bytecode

0x6080604052600436106101cd5760003560e01c806354a7d0a9116100f75780639d15f5c211610095578063d096144a11610064578063d096144a14610552578063d547741f14610572578063e0e5120d14610592578063f7e177de146105b2576101cd565b80639d15f5c2146104e1578063a217fddf14610501578063ae3068c114610516578063c311d04914610532576101cd565b806390236637116100d1578063902366371461046157806391d1485414610474578063928cb148146104945780639961fc18146104b4576101cd565b806354a7d0a91461040b578063582f706f1461042b5780635a3b336c14610441576101cd565b80631d9083f31161016f5780632f2ff15d1161013e5780632f2ff15d1461038b57806336568abe146103ab5780633d18678e146103cb57806352f5ad77146103eb576101cd565b80631d9083f3146102fb578063248a9ca31461031b578063257ea0ab1461034b5780632b7ac3f31461036b576101cd565b806313f43160116101ab57806313f431601461026f57806315d21e111461029f57806317e95526146102c35780631c513339146102e5576101cd565b806301ffc9a7146101d257806308a55a6e146102075780630c02477614610237575b600080fd5b3480156101de57600080fd5b506101f26101ed3660046131de565b6105c8565b60405190151581526020015b60405180910390f35b34801561021357600080fd5b506101f2610222366004612f4b565b60066020526000908152604090205460ff1681565b34801561024357600080fd5b50600254610257906001600160a01b031681565b6040516001600160a01b0390911681526020016101fe565b34801561027b57600080fd5b506101f261028a366004612f4b565b60076020526000908152604090205460ff1681565b3480156102ab57600080fd5b506102b560045481565b6040519081526020016101fe565b3480156102cf57600080fd5b506102e36102de366004612f4b565b610601565b005b3480156102f157600080fd5b506102b560035481565b34801561030757600080fd5b506102e3610316366004612f4b565b610639565b34801561032757600080fd5b506102b5610336366004613197565b60009081526020819052604090206001015490565b34801561035757600080fd5b506102e3610366366004612f4b565b610671565b34801561037757600080fd5b50600954610257906001600160a01b031681565b34801561039757600080fd5b506102e36103a63660046131af565b6106a8565b3480156103b757600080fd5b506102e36103c63660046131af565b6106da565b3480156103d757600080fd5b506102e36103e6366004613197565b61076d565b3480156103f757600080fd5b506102e3610406366004612f4b565b610788565b34801561041757600080fd5b506102e36104263660046132d3565b6107c0565b34801561043757600080fd5b506102b560085481565b34801561044d57600080fd5b506102e361045c366004612f4b565b6107e4565b6102e361046f366004613082565b61081e565b34801561048057600080fd5b506101f261048f3660046131af565b6118c2565b3480156104a057600080fd5b506102e36104af366004612f4b565b6118eb565b3480156104c057600080fd5b506104d46104cf366004612f83565b611925565b6040516101fe919061342b565b3480156104ed57600080fd5b506102e36104fc366004612fb7565b611d96565b34801561050d57600080fd5b506102b5600081565b34801561052257600080fd5b506102b5670de0b6b3a764000081565b34801561053e57600080fd5b506102e361054d366004613197565b612429565b34801561055e57600080fd5b506102e361056d366004612f4b565b6124fb565b34801561057e57600080fd5b506102e361058d3660046131af565b612533565b34801561059e57600080fd5b506102e36105ad366004612f4b565b61255b565b3480156105be57600080fd5b506102b560055481565b60006001600160e01b03198216637965db0b60e01b14806105f957506301ffc9a760e01b6001600160e01b03198316145b90505b919050565b61060e600061048f612592565b61061757600080fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b610646600061048f612592565b61064f57600080fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b61067e600061048f612592565b61068757600080fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000828152602081905260409020600101546106cb816106c6612592565b612597565b6106d583836125fb565b505050565b6106e2612592565b6001600160a01b0316816001600160a01b03161461075f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6107698282612680565b5050565b61077a600061048f612592565b61078357600080fd5b600855565b610795600061048f612592565b61079e57600080fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6107cd600061048f612592565b6107d657600080fd5b600492909255600355600555565b6107f1600061048f612592565b6107fa57600080fd5b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b600260015414156108715760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610756565b600260018190555060006040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600015158152509050600087516001600160401b038111156108e257634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561090b578160200160208202803683370190505b50905060005b88518110156110a857600b5489516000916001600160a01b031690637ffae846908c908590811061095257634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b815260040161097891815260200190565b6101006040518083038186803b15801561099157600080fd5b505afa1580156109a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c99190613206565b90508060e0015163ffffffff16421015806109ec57506109ec600061048f612592565b610a245760405162461bcd60e51b8152602060048201526009602482015268746f6f206561726c7960b81b6044820152606401610756565b608081015161ffff161580610b375750806080015161ffff16898381518110610a5d57634e487b7160e01b600052603260045260246000fd5b6020908102919091010151600b546001600160a01b0316630a3de451610a81612592565b8e8781518110610aa157634e487b7160e01b600052603260045260246000fd5b60200260200101516040518363ffffffff1660e01b8152600401610ada9291906001600160a01b03929092168252602082015260400190565b60206040518083038186803b158015610af257600080fd5b505afa158015610b06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2a91906132bb565b610b349190613513565b11155b610b835760405162461bcd60e51b815260206004820152601d60248201527f4d6178206d696e7473207265616368656420666f7220616464726573730000006044820152606401610756565b6000816080015161ffff1611838381518110610baf57634e487b7160e01b600052603260045260246000fd5b91151560209283029190910190910152600b548a516000916001600160a01b0316906344cf562f908d9086908110610bf757634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610c1d91815260200190565b60206040518083038186803b158015610c3557600080fd5b505afa158015610c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6d91906132bb565b90508160c0015163ffffffff168a8481518110610c9a57634e487b7160e01b600052603260045260246000fd5b602002602001015182610cad9190613513565b1115610cf657808260c0015163ffffffff16610cc9919061356a565b8a8481518110610ce957634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505b600082602001516001600160401b03161180610d1f5750600082604001516001600160401b0316115b1561107057888381518110610d4457634e487b7160e01b600052603260045260246000fd5b602002602001015115610e4057600082602001516001600160401b031611610da55760405162461bcd60e51b81526020600482015260146024820152731d5b9a58dbdc9b9cc81b9bdd08185b1b1bddd95960621b6044820152606401610756565b6000670de0b6b3a76400008b8581518110610dd057634e487b7160e01b600052603260045260246000fd5b602002602001015184602001516001600160401b0316610df0919061354b565b610dfa919061354b565b90508086602001818151610e0e9190613513565b90525060608301516001600160401b031615610e3a578086606001818151610e369190613513565b9052505b50610f2b565b600082604001516001600160401b031611610e945760405162461bcd60e51b81526020600482015260146024820152731c985a5b989bdddcc81b9bdd08185b1b1bddd95960621b6044820152606401610756565b6000670de0b6b3a76400008b8581518110610ebf57634e487b7160e01b600052603260045260246000fd5b602002602001015184604001516001600160401b0316610edf919061354b565b610ee9919061354b565b90508086600001818151610efd9190613513565b90525060608301516001600160401b031615610f29578086604001818151610f259190613513565b9052505b505b60608201516001600160401b03166110705760408201516001600160401b031615610fe257600354610f5f9061271061354b565b600854670de0b6b3a76400008c8681518110610f8b57634e487b7160e01b600052603260045260246000fd5b602002602001015185604001516001600160401b0316610fab919061354b565b610fb5919061354b565b610fbf919061354b565b610fc9919061352b565b85608001818151610fda9190613513565b905250611070565b600454610ff19061271061354b565b600854670de0b6b3a76400008c868151811061101d57634e487b7160e01b600052603260045260246000fd5b602002602001015185602001516001600160401b031661103d919061354b565b611047919061354b565b611051919061354b565b61105b919061352b565b8560800181815161106c9190613513565b9052505b81606001516001600160401b03168560a00181815161108f9190613513565b9052508291506110a09050816135f4565b915050610911565b506000826020015111806110bc5750815115155b156115735760005b600281101561157157801515600080826110df5785516110e5565b85602001515b905080801561155a576000846110fc5789516110ff565b88515b9050600081116111415760405162461bcd60e51b815260206004820152600d60248201526c696e76616c696420706f6f6c7360981b6044820152606401610756565b60005b8181101561148b576000861561121157600760008c848151811061117857634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff166111e25760405162461bcd60e51b81526020600482015260146024820152731a5b9d985b1a59081d5b9a58dbdc9b881c1bdbdb60621b6044820152606401610756565b8a828151811061120257634e487b7160e01b600052603260045260246000fd5b602002602001015190506112ca565b600660008d848151811061123557634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff1661129f5760405162461bcd60e51b81526020600482015260146024820152731a5b9d985b1a59081c985a5b989bddc81c1bdbdb60621b6044820152606401610756565b8b82815181106112bf57634e487b7160e01b600052603260045260246000fd5b602002602001015190505b6000816001600160a01b03166370a082316112e3612592565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561132257600080fd5b505afa158015611336573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135a91906132bb565b90506113668188613513565b96508587106113f157816001600160a01b0316639dc29fac611386612592565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101889052604401600060405180830381600087803b1580156113ce57600080fd5b505af11580156113e2573d6000803e3d6000fd5b5050505060009450505061148b565b816001600160a01b0316639dc29fac611408612592565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b15801561145057600080fd5b505af1158015611464573d6000803e3d6000fd5b505050508085611474919061356a565b945050508080611483906135f4565b915050611144565b50811561155857846114a15787604001516114a7565b87606001515b6114b1908461356a565b925060006064600554856114c5919061354b565b6114cf919061352b565b9050806114dc848661356a565b10156114fa5760405162461bcd60e51b8152600401610756906134c4565b6000866115095760035461150d565b6004545b90508361151a823461354b565b116115375760405162461bcd60e51b8152600401610756906134c4565b611541818561352b565b8a60a0018181516115529190613513565b90525050505b505b505050508080611569906135f4565b9150506110c4565b505b81608001518260a0018181516115899190613513565b90525060a082015134101561159d57600080fd5b6115a5612592565b6001600160a01b03168260a00151346115be919061356a565b604051600081818185875af1925050503d80600081146115fa576040519150601f19603f3d011682016040523d82523d6000602084013e6115ff565b606091505b5050151560c083018190526116485760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610756565b6000805b895181101561186e57600089828151811061167757634e487b7160e01b600052603260045260246000fd5b6020026020010151111561185c578281815181106116a557634e487b7160e01b600052603260045260246000fd5b60200260200101511561178557600b546001600160a01b031663c2fa40196116cb612592565b8c84815181106116eb57634e487b7160e01b600052603260045260246000fd5b60200260200101518c858151811061171357634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091526044820152606401600060405180830381600087803b15801561176c57600080fd5b505af1158015611780573d6000803e3d6000fd5b505050505b600b546001600160a01b031663156e29f661179e612592565b8c84815181106117be57634e487b7160e01b600052603260045260246000fd5b60200260200101518c85815181106117e657634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091526044820152606401600060405180830381600087803b15801561183f57600080fd5b505af1158015611853573d6000803e3d6000fd5b50505050600191505b80611866816135f4565b91505061164c565b50806118b35760405162461bcd60e51b8152602060048201526014602482015273105b1b1bd8d85d1a5bdb88195e1a185d5cdd195960621b6044820152606401610756565b50506001805550505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6118f8600061048f612592565b61190157600080fd5b6001600160a01b03166000908152600760205260409020805460ff19166001179055565b60606000611933848461356a565b6001600160401b0381111561195857634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561198b57816020015b60608152602001906001900390816119765790505b5090506000845b848111611b7f57600b546040516331a9108f60e11b8152600481018390526001600160a01b0390911690636352211e9060240160206040518083038186803b1580156119dd57600080fd5b505afa925050508015611a0d575060408051601f3d908101601f19168201909252611a0a91810190612f67565b60015b611a5057611a1961363b565b806308c379a01415611a3f5750611a2e613652565b80611a395750611a41565b50611a4b565b505b3d6000803e3d6000fd5b611b6d565b876001600160a01b0316816001600160a01b03161415611b6b57604080516002808252606082018352909160208301908036833701905050848481518110611aa857634e487b7160e01b600052603260045260246000fd5b602002602001018190525081848481518110611ad457634e487b7160e01b600052603260045260246000fd5b6020026020010151600081518110611afc57634e487b7160e01b600052603260045260246000fd5b6020026020010181815250506001848481518110611b2a57634e487b7160e01b600052603260045260246000fd5b6020026020010151600181518110611b5257634e487b7160e01b600052603260045260246000fd5b602090810291909101015282611b67816135f4565b9350505b505b80611b77816135f4565b915050611992565b506000816001600160401b03811115611ba857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611bdb57816020015b6060815260200190600190039081611bc65790505b50905060005b82811015611d8b57604080516002808252606082018352909160208301908036833701905050828281518110611c2757634e487b7160e01b600052603260045260246000fd5b6020026020010181905250838181518110611c5257634e487b7160e01b600052603260045260246000fd5b6020026020010151600081518110611c7a57634e487b7160e01b600052603260045260246000fd5b6020026020010151828281518110611ca257634e487b7160e01b600052603260045260246000fd5b6020026020010151600081518110611cca57634e487b7160e01b600052603260045260246000fd5b602002602001018181525050838181518110611cf657634e487b7160e01b600052603260045260246000fd5b6020026020010151600181518110611d1e57634e487b7160e01b600052603260045260246000fd5b6020026020010151828281518110611d4657634e487b7160e01b600052603260045260246000fd5b6020026020010151600181518110611d6e57634e487b7160e01b600052603260045260246000fd5b602090810291909101015280611d83816135f4565b915050611be1565b509695505050505050565b60026001541415611de95760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610756565b600260015560005b855181101561218557611e02612592565b6001600160a01b0316600b60009054906101000a90046001600160a01b03166001600160a01b0316636352211e848481518110611e4f57634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401611e7591815260200190565b60206040518083038186803b158015611e8d57600080fd5b505afa158015611ea1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ec59190612f67565b6001600160a01b031614611f0b5760405162461bcd60e51b815260206004820152600d60248201526c3737ba103a34329037bbb732b960991b6044820152606401610756565b6000838281518110611f2d57634e487b7160e01b600052603260045260246000fd5b6020026020010151838381518110611f5557634e487b7160e01b600052603260045260246000fd5b6020026020010151604051602001611f77929190918252602082015260400190565b604051602081830303815290604052905060005b878381518110611fab57634e487b7160e01b600052603260045260246000fd5b6020026020010151518110156120905781888481518110611fdc57634e487b7160e01b600052603260045260246000fd5b6020026020010151828151811061200357634e487b7160e01b600052603260045260246000fd5b602002602001015188858151811061202b57634e487b7160e01b600052603260045260246000fd5b6020026020010151838151811061205257634e487b7160e01b600052603260045260246000fd5b602002602001015160405160200161206c9392919061348c565b60405160208183030381529060405291508080612088906135f4565b915050611f8b565b508051602082012060006121216120f4836040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b88868151811061211457634e487b7160e01b600052603260045260246000fd5b6020026020010151612703565b6009549091506001600160a01b0380831691161461216f5760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610756565b505050808061217d906135f4565b915050611df1565b5060005b855181101561241d57600b5482516001600160a01b03909116906342966c68908490849081106121c957634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b81526004016121ef91815260200190565b600060405180830381600087803b15801561220957600080fd5b505af115801561221d573d6000803e3d6000fd5b5050505060005b86828151811061224457634e487b7160e01b600052603260045260246000fd5b60200260200101515181101561240a57600a546001600160a01b031663a39501df61226d612592565b89858151811061228d57634e487b7160e01b600052603260045260246000fd5b602002602001015184815181106122b457634e487b7160e01b600052603260045260246000fd5b602002602001015160008a87815181106122de57634e487b7160e01b600052603260045260246000fd5b6020026020010151868151811061230557634e487b7160e01b600052603260045260246000fd5b6020026020010151600a60009054906101000a90046001600160a01b03166001600160a01b0316636bb2e32d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561235b57600080fd5b505afa15801561236f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612393919061316f565b604080516000808252602082019092526040518863ffffffff1660e01b81526004016123c597969594939291906133d9565b600060405180830381600087803b1580156123df57600080fd5b505af11580156123f3573d6000803e3d6000fd5b505050508080612402906135f4565b915050612224565b5080612415816135f4565b915050612189565b50506001805550505050565b612436600061048f612592565b61243f57600080fd5b4781111561245f5760405162461bcd60e51b8152600401610756906134c4565b6000612469612592565b6001600160a01b03168260405160006040518083038185875af1925050503d80600081146124b3576040519150601f19603f3d011682016040523d82523d6000602084013e6124b8565b606091505b50509050806107695760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610756565b612508600061048f612592565b61251157600080fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b600082815260208190526040902060010154612551816106c6612592565b6106d58383612680565b612568600061048f612592565b61257157600080fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b335b90565b6125a182826118c2565b610769576125b9816001600160a01b03166014612727565b6125c4836020612727565b6040516020016125d5929190613364565b60408051601f198184030181529082905262461bcd60e51b8252610756916004016134b1565b61260582826118c2565b610769576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561263c612592565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61268a82826118c2565b15610769576000828152602081815260408083206001600160a01b03851684529091529020805460ff191690556126bf612592565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b6000806000612712858561290f565b9150915061271f8161297f565b509392505050565b6060600061273683600261354b565b612741906002613513565b6001600160401b0381111561276657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612790576020820181803683370190505b509050600360fc1b816000815181106127b957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106127f657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600061281a84600261354b565b612825906001613513565b90505b60018111156128b9576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061286757634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061288b57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c936128b2816135b1565b9050612828565b5083156129085760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610756565b9392505050565b6000808251604114156129465760208301516040840151606085015160001a61293a87828585612b85565b94509450505050612978565b8251604014156129705760208301516040840151612965868383612c72565b935093505050612978565b506000905060025b9250929050565b60008160048111156129a157634e487b7160e01b600052602160045260246000fd5b14156129ac57612b82565b60018160048111156129ce57634e487b7160e01b600052602160045260246000fd5b1415612a1c5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610756565b6002816004811115612a3e57634e487b7160e01b600052602160045260246000fd5b1415612a8c5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610756565b6003816004811115612aae57634e487b7160e01b600052602160045260246000fd5b1415612b075760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610756565b6004816004811115612b2957634e487b7160e01b600052602160045260246000fd5b1415612b825760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610756565b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612bbc5750600090506003612c69565b8460ff16601b14158015612bd457508460ff16601c14155b15612be55750600090506004612c69565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612c39573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612c6257600060019250925050612c69565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b01612c9387828885612b85565b935093505050935093915050565b600082601f830112612cb1578081fd5b81356020612cbe826134f0565b604051612ccb82826135c8565b8381528281019150858301600585901b87018401881015612cea578586fd5b855b85811015612d11578135612cff816136e3565b84529284019290840190600101612cec565b5090979650505050505050565b600082601f830112612d2e578081fd5b81356020612d3b826134f0565b604051612d4882826135c8565b8381528281019150858301855b85811015612d1157612d6c898684358b0101612eb9565b84529284019290840190600101612d55565b600082601f830112612d8e578081fd5b81356020612d9b826134f0565b604051612da882826135c8565b8381528281019150858301600585901b87018401881015612dc7578586fd5b855b85811015612d115781358015158114612de0578788fd5b84529284019290840190600101612dc9565b6000601f8381840112612e03578182fd5b82356020612e10826134f0565b60408051612e1e83826135c8565b8481528381019250878401875b86811015612eaa5781358a018b603f820112612e4557898afd5b868101356001600160401b03811115612e6057612e60613625565b8551612e74828c01601f19168a01826135c8565b8181528d87838501011115612e87578b8cfd5b818784018a83013790810188018b90528652509385019390850190600101612e2b565b50909998505050505050505050565b600082601f830112612ec9578081fd5b81356020612ed6826134f0565b604051612ee382826135c8565b8381528281019150858301600585901b87018401881015612f02578586fd5b855b85811015612d1157813584529284019290840190600101612f04565b805163ffffffff811681146105fc57600080fd5b80516001600160401b03811681146105fc57600080fd5b600060208284031215612f5c578081fd5b8135612908816136e3565b600060208284031215612f78578081fd5b8151612908816136e3565b600080600060608486031215612f97578182fd5b8335612fa2816136e3565b95602085013595506040909401359392505050565b600080600080600060a08688031215612fce578283fd5b85356001600160401b0380821115612fe4578485fd5b612ff089838a01612d1e565b96506020880135915080821115613005578485fd5b61301189838a01612d1e565b95506040880135915080821115613026578485fd5b61303289838a01612df2565b94506060880135915080821115613047578283fd5b61305389838a01612eb9565b93506080880135915080821115613068578283fd5b5061307588828901612eb9565b9150509295509295909350565b60008060008060008060c0878903121561309a578384fd5b86356001600160401b03808211156130b0578586fd5b6130bc8a838b01612eb9565b975060208901359150808211156130d1578586fd5b6130dd8a838b01612eb9565b965060408901359150808211156130f2578586fd5b6130fe8a838b01612d7e565b95506060890135915080821115613113578283fd5b61311f8a838b01612d1e565b94506080890135915080821115613134578283fd5b6131408a838b01612ca1565b935060a0890135915080821115613155578283fd5b5061316289828a01612ca1565b9150509295509295509295565b600060208284031215613180578081fd5b81516001600160f81b031981168114612908578182fd5b6000602082840312156131a8578081fd5b5035919050565b600080604083850312156131c1578182fd5b8235915060208301356131d3816136e3565b809150509250929050565b6000602082840312156131ef578081fd5b81356001600160e01b031981168114612908578182fd5b6000610100808385031215613219578182fd5b60405161322682826135c8565b61322f84612f20565b815261323d60208501612f34565b602082015261324e60408501612f34565b604082015261325f60608501612f34565b60608201526080840151915061ffff8216821461327a578283fd5b81608082015261328c60a08501612f20565b60a082015261329d60c08501612f20565b60c08201526132ae60e08501612f20565b60e0820152949350505050565b6000602082840312156132cc578081fd5b5051919050565b6000806000606084860312156132e7578081fd5b505081359360208301359350604090920135919050565b6000815180845260208085019450808401835b8381101561332d57815187529582019590820190600101613311565b509495945050505050565b60008151808452613350816020860160208601613581565b601f01601f19169290920160200192915050565b60007f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008252835161339c816017850160208801613581565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516133cd816028840160208801613581565b01602801949350505050565b600060018060a01b038916825287602083015286604083015285606083015260ff60f81b851660808301528360a083015260e060c083015261341e60e08301846132fe565b9998505050505050505050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b8281101561347f57603f1988860301845261346d8583516132fe565b94509285019290850190600101613451565b5092979650505050505050565b60006060825261349f6060830186613338565b60208301949094525060400152919050565b6000602082526129086020830184613338565b6020808252601290820152716e6f7420656e6f7567682062616c616e636560701b604082015260600190565b60006001600160401b0382111561350957613509613625565b5060051b60200190565b600082198211156135265761352661360f565b500190565b60008261354657634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156135655761356561360f565b500290565b60008282101561357c5761357c61360f565b500390565b60005b8381101561359c578181015183820152602001613584565b838111156135ab576000848401525b50505050565b6000816135c0576135c061360f565b506000190190565b601f8201601f191681016001600160401b03811182821017156135ed576135ed613625565b6040525050565b60006000198214156136085761360861360f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600060033d111561259457600481823e5160e01c90565b600060443d101561366257612594565b6040516003193d81016004833e81513d6001600160401b038160248401118184111715613693575050505050612594565b82850191508151818111156136ad57505050505050612594565b843d87010160208285010111156136c957505050505050612594565b6136d8602082860101876135c8565b509094505050505090565b6001600160a01b0381168114612b8257600080fdfea264697066735822122044929120d89b2784bfd4f7fb500188421dda8d046d7e249381df869533e3ff0a64736f6c63430008030033

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

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ad628a5515a1ee56088ac188633e2aeeaae474d600000000000000000000000082f9d5fe6c46990f3c2536e83b2b4e1c0a91f27f00000000000000000000000082f9d5fe6c46990f3c2536e83b2b4e1c0a91f27f

-----Decoded View---------------
Arg [0] : _nftContractAddress (address): 0x0000000000000000000000000000000000000000
Arg [1] : _packsContact (address): 0xad628A5515A1eE56088aC188633E2AEEaAe474d6
Arg [2] : _contractOwner (address): 0x82F9d5FE6C46990f3C2536e83b2B4e1c0a91F27f
Arg [3] : _verifier (address): 0x82F9d5FE6C46990f3C2536e83b2B4e1c0a91F27f

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 000000000000000000000000ad628a5515a1ee56088ac188633e2aeeaae474d6
Arg [2] : 00000000000000000000000082f9d5fe6c46990f3c2536e83b2b4e1c0a91f27f
Arg [3] : 00000000000000000000000082f9d5fe6c46990f3c2536e83b2b4e1c0a91f27f


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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