Contract 0x5675D4c36A70A635B5a51137797E696aA40B70Cf 2

 

Contract Overview

Balance:
0.00000078 MATIC

MATIC Value:
Less Than $0.01 (@ $1.14/MATIC)

Token:
 
Txn Hash
Method
Block
From
To
Value [Txn Fee]
0x50395669989ae065874b636552e485d93712c320a1555894a5280d3af96b696cRent362064032022-11-29 8:41:28112 days 12 hrs ago0x7c4fa23516bfd05d5d3a3ffa8be5f8d9f25ac35d IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0.000001 MATIC0.009504980285 43.084016432
0xf6468ac82b653432a1a266d526bd4eb14fc3a2982ca8cec087b98fa0464c4aaaRent361594132022-11-28 4:56:32113 days 15 hrs ago0xaaff1faa6926ef9af840a4aa8f2f25e698b574db IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0.000001 MATIC0.00694937289 31.500001768
0x19c54e703bf104630a489feeb5f8efd2b18017f031857edbb8a21819dd5e806eRent361470452022-11-27 21:48:44113 days 23 hrs ago0x85e5b3ad4742c41c5a4e26d782381f431d4ccf16 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0.000001 MATIC0.010928169005 31.500000017
0x92ab902ae35c04cc8c1c8bc4873e7543372aea4a928cb16f5587f6f8b7819be9Rent361341522022-11-27 13:58:01114 days 6 hrs ago0x5efd4b32c4ccbb09912f3db83bc43fd33e239f09 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0.000001 MATIC0.01788109317 51.564557504
0x98ce287ef1ec3ee07a57b2dc2d82f17467ef530f77af98e6b46c80272abd40a2Rent361341212022-11-27 13:56:55114 days 6 hrs ago0x6a4814d56038e5ef690d2257732c1eacfce19af8 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0.000001 MATIC0.010077137268 50.125036156
0xa3b04893bf63f97d8ad4c5033d1cb32762b711ff40c7d5af99608397f99642d1Rent361292072022-11-27 11:00:12114 days 9 hrs ago0xcdaf4f9f8f9141a162f9ca7566fbacd9237718b8 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0.000001 MATIC0.010839654011 31.500000034
0xd256fec22521a4c167018e111e3ff6c8642ed7d49e03a388b6cce6e6c8653868Mint And Create ...360867782022-11-26 10:16:56115 days 10 hrs ago0x85e5b3ad4742c41c5a4e26d782381f431d4ccf16 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0 MATIC0.007762920194 30.000000751
0x761bcdba7aa81064e5440794981cee81e028982f95fbfa1cbbebcaad36dbb79cMint And Create ...360867112022-11-26 10:14:38115 days 10 hrs ago0x85e5b3ad4742c41c5a4e26d782381f431d4ccf16 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0 MATIC0.007892303035 30.500004002
0xb592bc9b34a19b83ede57608d48e036c9cd1c711c636bf9541b3a58a2db10d2bMint And Create ...360867112022-11-26 10:14:38115 days 10 hrs ago0x85e5b3ad4742c41c5a4e26d782381f431d4ccf16 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0 MATIC0.007892303035 30.500004002
0x2395ea0ba96ad4f28d50cfaf4403693c6a83a892bc978195b2f525fb67c9583cMint And Create ...360867092022-11-26 10:14:34115 days 10 hrs ago0x85e5b3ad4742c41c5a4e26d782381f431d4ccf16 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0 MATIC0.007892303035 30.500004002
0x245b4aac6d024a84fdae5753aea220fab2bd4aaf819608095136065ffcb30afbMint And Create ...360867042022-11-26 10:14:24115 days 10 hrs ago0x85e5b3ad4742c41c5a4e26d782381f431d4ccf16 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0 MATIC0.007892303035 30.500004002
0x7f3049599e6149a8ef2c8ba7de3ec8cab476c182cde8f3f62adba2da238d8a19Mint And Create ...360867032022-11-26 10:14:22115 days 10 hrs ago0x85e5b3ad4742c41c5a4e26d782381f431d4ccf16 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0 MATIC0.007892303035 30.500004002
0xd087286431d1b1948346f0e7c3afa958b2214882d7942cc2c5f9a8b105ee7a8fMint And Create ...360866952022-11-26 10:14:06115 days 10 hrs ago0x85e5b3ad4742c41c5a4e26d782381f431d4ccf16 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0 MATIC0.008643710035 33.403835291
0x5141159a4e3c470eadf1fad64536f4f18fcae2785ee97d9bf86ed41e87d69ee3Rent360849922022-11-26 9:15:33115 days 11 hrs ago0xbb9bf3cd9d43f8fe1c09e9089eadda3158e77fa1 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0.000001 MATIC0.010243830019 30.000000057
0xb065414fc54969d5095dfc9855697a5a747129769edbfb72e6c6045d4fff9d9bRent360848822022-11-26 9:11:45115 days 11 hrs ago0x4f4d74826c910e4621c465f09bd4373c6cd3d5fc IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0.000001 MATIC0.010292926276 30.37999999
0xe9f6076c154fa326f743f6e3c37645e5e704a3c99e88b203faa8b4666182addcRent360835252022-11-26 8:25:07115 days 12 hrs ago makehistory.dao  IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0.000001 MATIC0.010084530007 30.000000022
0x942120271352e207a74886eacfe4d8a3365ed4903013da331e0b271a720fe994Rent360830772022-11-26 8:09:43115 days 12 hrs ago0x386d0f7dadc9d692cd22ac8f277bcf79ab045373 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0.000001 MATIC0.010505126124 31.50000637
0x9f35ac7d74415277443fec386975d5ee6a8bdabf920331a7cb7efc912451c8c0Rent360827302022-11-26 7:57:45115 days 12 hrs ago0x386d0f7dadc9d692cd22ac8f277bcf79ab045373 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0 MATIC0.001825710028 30.000000464
0x20d2e712605b9f43f5b1fb79759e2deceb24bd9210f2f26d035d205d07931854Rent360825502022-11-26 7:51:33115 days 13 hrs ago0x386d0f7dadc9d692cd22ac8f277bcf79ab045373 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0 MATIC0.001825710002 30.000000036
0x71e3986bb3255f66b71a1cb09c67ccd803088660f650d03fd54eaf06477d355cRent360823922022-11-26 7:46:09115 days 13 hrs ago0x6a4814d56038e5ef690d2257732c1eacfce19af8 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0.000001 MATIC0.009925230008 30.000000027
0x156c73ef79745f9f201869cebb4741f6747b0c1810737e5bb2afd2c855c3bd27Rent360823402022-11-26 7:44:21115 days 13 hrs ago0x6a4814d56038e5ef690d2257732c1eacfce19af8 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0 MATIC0.001825710001 30.000000026
0x9060ee88887303d21906e864990ec244b135404a0a8d0440f8d48d4fa5c3ed23Rent360823042022-11-26 7:43:09115 days 13 hrs ago0x6a4814d56038e5ef690d2257732c1eacfce19af8 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0 MATIC0.001916995501 31.500000022
0x78158596f45e22f54ee1be07a26ac26aab700c9308ccbb872339571cb8d160adRent360822542022-11-26 7:41:25115 days 13 hrs ago0x386d0f7dadc9d692cd22ac8f277bcf79ab045373 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0 MATIC0.00182796171 30.037000018
0x0d89bf2714081074cf35fb8c7b9802c25e7fc14cd1cbb9ac916769135676b78fRent360822192022-11-26 7:40:11115 days 13 hrs ago0x386d0f7dadc9d692cd22ac8f277bcf79ab045373 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0 MATIC0.001916995501 31.500000018
0x2f3d6ecd8087de0232baf5af638087a34118b400ab2986b4f7770e94972a3e2fRent360803082022-11-26 6:34:29115 days 14 hrs ago0xf57c0eaa7e614b1a8a8f6b4a7b448ac42fce3485 IN  0x5675d4c36a70a635b5a51137797e696aa40b70cf0.000001 MATIC0.010392014317 31.665014101
[ Download CSV Export 
Latest 13 internal transactions
Parent Txn Hash Block From To Value
0x50395669989ae065874b636552e485d93712c320a1555894a5280d3af96b696c362064032022-11-29 8:41:28112 days 12 hrs ago 0x5675d4c36a70a635b5a51137797e696aa40b70cf0x85e5b3ad4742c41c5a4e26d782381f431d4ccf160.00000094 MATIC
0xf6468ac82b653432a1a266d526bd4eb14fc3a2982ca8cec087b98fa0464c4aaa361594132022-11-28 4:56:32113 days 15 hrs ago 0x5675d4c36a70a635b5a51137797e696aa40b70cf0x85e5b3ad4742c41c5a4e26d782381f431d4ccf160.00000094 MATIC
0x19c54e703bf104630a489feeb5f8efd2b18017f031857edbb8a21819dd5e806e361470452022-11-27 21:48:44113 days 23 hrs ago 0x5675d4c36a70a635b5a51137797e696aa40b70cf0x85e5b3ad4742c41c5a4e26d782381f431d4ccf160.00000094 MATIC
0x92ab902ae35c04cc8c1c8bc4873e7543372aea4a928cb16f5587f6f8b7819be9361341522022-11-27 13:58:01114 days 6 hrs ago 0x5675d4c36a70a635b5a51137797e696aa40b70cf0x85e5b3ad4742c41c5a4e26d782381f431d4ccf160.00000094 MATIC
0x98ce287ef1ec3ee07a57b2dc2d82f17467ef530f77af98e6b46c80272abd40a2361341212022-11-27 13:56:55114 days 6 hrs ago 0x5675d4c36a70a635b5a51137797e696aa40b70cf0x85e5b3ad4742c41c5a4e26d782381f431d4ccf160.00000094 MATIC
0xa3b04893bf63f97d8ad4c5033d1cb32762b711ff40c7d5af99608397f99642d1361292072022-11-27 11:00:12114 days 9 hrs ago 0x5675d4c36a70a635b5a51137797e696aa40b70cf0x85e5b3ad4742c41c5a4e26d782381f431d4ccf160.00000094 MATIC
0x5141159a4e3c470eadf1fad64536f4f18fcae2785ee97d9bf86ed41e87d69ee3360849922022-11-26 9:15:33115 days 11 hrs ago 0x5675d4c36a70a635b5a51137797e696aa40b70cf0x85e5b3ad4742c41c5a4e26d782381f431d4ccf160.00000094 MATIC
0xb065414fc54969d5095dfc9855697a5a747129769edbfb72e6c6045d4fff9d9b360848822022-11-26 9:11:45115 days 11 hrs ago 0x5675d4c36a70a635b5a51137797e696aa40b70cf0x85e5b3ad4742c41c5a4e26d782381f431d4ccf160.00000094 MATIC
0xe9f6076c154fa326f743f6e3c37645e5e704a3c99e88b203faa8b4666182addc360835252022-11-26 8:25:07115 days 12 hrs ago 0x5675d4c36a70a635b5a51137797e696aa40b70cf0x85e5b3ad4742c41c5a4e26d782381f431d4ccf160.00000094 MATIC
0x942120271352e207a74886eacfe4d8a3365ed4903013da331e0b271a720fe994360830772022-11-26 8:09:43115 days 12 hrs ago 0x5675d4c36a70a635b5a51137797e696aa40b70cf0x85e5b3ad4742c41c5a4e26d782381f431d4ccf160.00000094 MATIC
0x71e3986bb3255f66b71a1cb09c67ccd803088660f650d03fd54eaf06477d355c360823922022-11-26 7:46:09115 days 13 hrs ago 0x5675d4c36a70a635b5a51137797e696aa40b70cf0x85e5b3ad4742c41c5a4e26d782381f431d4ccf160.00000094 MATIC
0x2f3d6ecd8087de0232baf5af638087a34118b400ab2986b4f7770e94972a3e2f360803082022-11-26 6:34:29115 days 14 hrs ago 0x5675d4c36a70a635b5a51137797e696aa40b70cf0x85e5b3ad4742c41c5a4e26d782381f431d4ccf160.00000094 MATIC
0x0152029bebbf16e73cd7add476b5bf055414d8d12103dd43e2d365e1ffa5a9b8360800842022-11-26 6:26:49115 days 14 hrs ago 0x5675d4c36a70a635b5a51137797e696aa40b70cf0x85e5b3ad4742c41c5a4e26d782381f431d4ccf160.00000094 MATIC
[ Download CSV Export 
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
Market

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 5000 runs

Other Settings:
default evmVersion
File 1 of 27 : Market.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.13;

import './libraries/Detector.sol';
import './libraries/RentaFiSVG.sol';
import './libraries/Calculator.sol';
import './interfaces/IMarket.sol';
import './interfaces/IVault.sol';
import './interfaces/IERC20Detailed.sol';

import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import '@openzeppelin/contracts/security/Pausable.sol';
import '@openzeppelin/contracts/utils/Counters.sol';
import '@openzeppelin/contracts/utils/Context.sol';
import '@openzeppelin/contracts/access/Ownable.sol';

/*******************************************************************************************
 *  ERROR
 *******************************************************************************************/
error AlreadyReserved();
error overLimits();
error NotAvailable();

contract Market is ERC721, ERC721Burnable, Ownable, ReentrancyGuard, Pausable, IMarket {
  using Counters for Counters.Counter;
  using SafeERC20 for IERC20;
  using Detector for address;

  constructor() ERC721('RentaFi Yield NFT', 'RentaFi-YN') {}

  /*******************************************************************************************
   *  STORAGE
   *******************************************************************************************/
  uint256 private constant E5 = 1e5;
  Counters.Counter private totalLended;
  Counters.Counter private totalRented;

  uint256 public protocolAdminFeeRatio = 10 * 1000;
  uint256 public reservationLimits = 10 days;

  // whitelisted vault list
  address[] internal vaults;

  // lockId => LendRent
  mapping(uint256 => LendRent) public lendRent;
  // vaultAddress => allowed
  mapping(address => uint256) public vaultWhiteList;
  // lockId => paymentToken =>lenderBenefit
  mapping(uint256 => mapping(address => uint256)) public lenderBenefit; //TODO ユーザーがそれぞれのトークンでいくら収益を持っているかを取得する
  // vaultAddress => paymentToken =>collectionOwnerBenefit
  mapping(address => mapping(address => uint256)) public collectionOwnerBenefit;
  // paymentToken => protocolAdminBenefit
  mapping(address => uint256) public protocolAdminBenefit;
  // paymentToken => uint256 as a bool
  mapping(address => uint256) public paymentTokenWhiteList; //NOTE: paymentTokenの配列を削除しました

  /*******************************************************************************************
   *  MODIFIER
   *******************************************************************************************/
  modifier onlyLender(uint256 _lockId) {
    require(lendRent[_lockId].lend.lender == msg.sender, 'OnlyLender');
    _;
  }

  modifier onlyPayoutAddress(address _vaultAddress) {
    require(msg.sender == IVault(_vaultAddress).payoutAddress(), 'onlyPayoutAddress');
    _;
  }

  modifier onlyProtocolAdmin() {
    require(owner() == msg.sender, 'onlyProtocolAdmin');
    _;
  }

  modifier onlyONftOwner(uint256 _lockId) {
    require(IVault(lendRent[_lockId].lend.vault).ownerOf(_lockId) == msg.sender, 'onlyONftOwner');
    _;
  }

  modifier onlyYNftOwner(uint256 _lockId) {
    require(ownerOf(_lockId) == msg.sender, 'onlyYNftOwner');
    _;
  }

  modifier onlyBeforeLock(uint256 _lockId) {
    require(
      lendRent[_lockId].rent.length == 0 ||
        lendRent[_lockId].lend.lockStartTime == lendRent[_lockId].lend.lockExpireTime,
      'onlyBeforeLock'
    );
    _;
  }

  modifier onlyAfterLockExpired(uint256 _lockId) {
    require(block.timestamp > lendRent[_lockId].lend.lockExpireTime, 'onlyAfterLockExpired');
    _;
  }

  modifier onlyNotRentaled(uint256 _lockId) {
    Rent[] storage _rents = lendRent[_lockId].rent;
    /*unchecked {
      for (uint256 i; i < _rents.length; i++)
        _deleteLockId(renterLockIds, _rents[i].renterAddress, _lockId);
    }*/
    _deleteExpiredRent(_rents);
    require(_rents.length == 0, 'onlyNotRentaled');
    _;
  }

  /*******************************************************************************************
   *  EXTERNAL FUNCTIONS
   *******************************************************************************************/

  /***
   * @title mintAndCreateList
   * @notice Deposit the NFT into an escrow contract.
   * @param _tokenId ID of the NFT you wish to loan out
   * @param _lockDuration duration by days. if 0 is entered, NFT will no lock, but if it non-zero NFT will lock and mint yNFT
   * @param _minRentalDuration minimum consecutive duration by days. (ex) 0~
   * @param _maxRentalDuration maximum consecutive duration by day.
   * @param _amount token amount (only in the case of ERC1155)
   * @param _dailyRentalPrice price per daily unit.
   * @param _privateAddress Lend Nft for specific address. If you set 0x00..., lend will not to be reserved.
   * @param _vaultAddress The Vault address corresponding to the collection you wish to loan out
   * @param _paymentToken you can set specific payment token. (ex) 0x00 => Native token, 0xEXAMPLE => ERC20 token
   * @param _paymentMethod 0:Onetime payment, 1~3: WIP
   */
  function mintAndCreateList(
    uint256 _tokenId,
    uint256 _lockDuration,
    uint256 _minRentalDuration,
    uint256 _maxRentalDuration,
    uint256 _amount,
    uint256 _dailyRentalPrice,
    address _privateAddress,
    address _vaultAddress,
    address _paymentToken,
    PaymentMethod _paymentMethod
  ) external whenNotPaused {
    require(_amount > 0, 'NotZero');
    require(_lockDuration == 0 || _lockDuration >= _minRentalDuration, 'lockDur<minRentalDur');
    require(_lockDuration == 0 || _maxRentalDuration <= _lockDuration, 'maxRentDur>lockDur');
    require(_minRentalDuration <= _maxRentalDuration, 'minRentalDur>maxRentalDur');
    require(vaultWhiteList[_vaultAddress] >= 1, 'Notwhitelisted');
    require(IVault(_vaultAddress).getTokenIdAllowed(_tokenId), 'NotAllowedId');
    require(
      IVault(_vaultAddress).minPrices(_paymentToken) <= _dailyRentalPrice,
      'dailyRentPrice<min'
    );
    require(
      IVault(_vaultAddress).minDuration() <= _minRentalDuration * 1 days,
      'minRentDur<minDur'
    );
    require(
      IVault(_vaultAddress).maxDuration() >= _maxRentalDuration * 1 days,
      'maxRentDur>maxDur'
    );
    require(_isPaymentTokenAllowed(_vaultAddress, _paymentToken) >= 1, 'NotAllowedToken'); //NOTE: この内部関数をいじってます

    totalLended.increment();
    uint256 _lockId = totalLended.current();

    _createList(
      _lockId,
      _tokenId,
      _lockDuration,
      _minRentalDuration,
      _maxRentalDuration,
      _amount,
      _dailyRentalPrice,
      _privateAddress,
      _vaultAddress,
      _paymentToken,
      _paymentMethod
    );

    // To avoid error below, mint NFTs after creating the list
    // CompilerError: Stack too deep, try removing local variables.
    _mintNft(_lockId, _lockDuration);
  }

  /***
   * @title rent
   * @notice Lending process: On the vault side, process whether to send originalNFT or wrapNFT as mint.
   * @param _lockId increment number of listed created by executing mintAndCreateList Fx.
   * @param _rentalStartTimestamp rental start at this time. If zero, rent now.
   * @param _rentalDurationByDay how many days want to rent
   * @param _amount if you rent type of ERC1155, enter amount. if 721, just enter 1.
   */
  function rent(
    uint256 _lockId,
    uint256 _rentalStartTimestamp, // If zero, rent now
    uint256 _rentalDurationByDay,
    uint256 _amount
  ) external payable whenNotPaused nonReentrant {
    if (_rentalStartTimestamp > (block.timestamp + reservationLimits)) revert overLimits();

    Lend memory _lend = lendRent[_lockId].lend;

    {
      address _privateAddress = _lend.privateAddress;
      if (!(_privateAddress == address(0) || msg.sender == _privateAddress))
        revert AlreadyReserved();
    }

    _calcFee(
      _lockId,
      _lend.dailyRentalPrice,
      _lend.lockStartTime,
      _lend.lockExpireTime,
      _lend.lender,
      _rentalDurationByDay,
      _amount,
      _lend.vault,
      _lend.paymentToken
    );

    (uint256 _rentalStartTime, uint256 _rentalExpireTime) = Calculator.duration(
      _rentalStartTimestamp,
      _rentalDurationByDay,
      _lend.lockStartTime,
      _lend.lockExpireTime,
      _lend.maxRentalDuration,
      _lend.minRentalDuration
    );

    totalRented.increment();
    uint256 _rentId = totalRented.current();

    Rent memory _rent = Rent({
      renterAddress: msg.sender,
      rentId: _rentId,
      rentalStartTime: _rentalStartTime,
      rentalExpireTime: _rentalExpireTime,
      amount: _amount
    });

    _updateRent(_lend.vault, _lockId, _lend, _rent);

    // Pseudo Transfer WrappedNFT (if it starts later, only booking)
    IVault(_lend.vault).mintWNft(
      msg.sender,
      _rentalStartTime,
      _rentalExpireTime,
      _lockId,
      _lend.tokenId,
      _amount
    );

    emit Rented(_rentId, msg.sender, _lockId, _rent);
  }

  /***
   * @title activate
   * @notice if Non-zero is entered for rentalStartTimestamp, renter has to activate at RentalStartTime
   * @param _lockId Reserved LockId
   * @param _rentId Reserved rentId
   */
  function activate(uint256 _lockId, uint256 _rentId) external {
    require(_rentId > 0, 'InvalidRentId');
    Rent[] memory _rents = lendRent[_lockId].rent;
    uint256 _rentsLength = _rents.length;
    for (uint256 i; i < _rentsLength; ) {
      if (_rents[i].rentId == _rentId)
        IVault(lendRent[_lockId].lend.vault).activate(
          _rentId,
          _lockId,
          msg.sender,
          _rents[i].amount
        );
      unchecked {
        i++;
      }
    }
  }

  /***
   * @title cancel
   * @notice if you locked your nft, Can be cancelled if there are no renters.
   * @param _lockId your ownershipNFT's (and yieldNFT's) tokenId equals lockId
   */
  function cancel(uint256 _lockId)
    external
    onlyLender(_lockId)
    onlyBeforeLock(_lockId)
    onlyNotRentaled(_lockId)
  {
    if (lendRent[_lockId].lend.lockStartTime != lendRent[_lockId].lend.lockExpireTime)
      burn(_lockId); // burn yNFT
    _redeemNFT(_lockId); // burn oNFT and redeem original token
    emit Canceled(_lockId);
  }

  /***
   * @title claimNFT
   * @notice Burn oNFT to execute an internal function that redeems the original NFT
   * @param _lockId the ownershipNFT's tokenId what you want to burn and return original nft
   */
  function claimNFT(uint256 _lockId)
    external
    onlyONftOwner(_lockId)
    onlyAfterLockExpired(_lockId)
    onlyNotRentaled(_lockId)
  {
    _redeemNFT(_lockId);
  }

  /***
   * @title claimFee
   * @notice Burn yNFT to execute an internal function that redeems the Rental Revenue
   * @param _lockId the yieldNFT's tokenId what you want to burn and claim revenue
   */
  function claimFee(uint256 _lockId) external onlyYNftOwner(_lockId) onlyAfterLockExpired(_lockId) {
    _claimFee(_lockId);
  }

  /***
   * @title claimRoyalty
   * @notice Collection owner claim own revenue
   * @param _vaultAddress vault address paired collection
   */
  function claimRoyalty(address _vaultAddress) external onlyPayoutAddress(_vaultAddress) {
    address[] memory _allowedPaymentTokens = IVault(_vaultAddress).getPaymentTokens();
    uint256 _allowedPaymentTokensLength = _allowedPaymentTokens.length;
    for (uint256 i; i < _allowedPaymentTokensLength; ) {
      uint256 _sendAmount = collectionOwnerBenefit[_vaultAddress][_allowedPaymentTokens[i]];
      if (_allowedPaymentTokens[i] == address(0)) {
        payable(msg.sender).transfer(_sendAmount);
      } else {
        IERC20(_allowedPaymentTokens[i]).safeTransfer(msg.sender, _sendAmount);
      }
      delete collectionOwnerBenefit[_vaultAddress][_allowedPaymentTokens[i]];
      unchecked {
        i++;
      }
    }
    emit ClaimedRoyalty(IVault(_vaultAddress).originalCollection());
  }

  /***
   * @title claimProtocolFee
   * @notice Protocol owners extract revenue
   * @param _paymentTokens array of paymentToken
   * @dev Manually pass token addresses in batches
   */
  function claimProtocolFee(address[] calldata _paymentTokens) external onlyProtocolAdmin {
    uint256 _paymentTokensLength = _paymentTokens.length; //トレージから呼び出しではなく引数で渡すようにした
    for (uint256 i; i < _paymentTokensLength; ) {
      uint256 _sendAmount = protocolAdminBenefit[_paymentTokens[i]];
      if (_paymentTokens[i] == address(0)) {
        payable(msg.sender).transfer(_sendAmount);
      } else {
        IERC20(_paymentTokens[i]).safeTransfer(msg.sender, _sendAmount);
      }
      delete protocolAdminBenefit[_paymentTokens[i]];
      unchecked {
        i++;
      }
    }
  }

  /***
   * @title emergencyWithdraw
   * @notice Functions for withdrawing assets in an emergency
   * @param _lockId See o,yNFT
   * @dev this can be executed when protocol would be paused
   */
  function emergencyWithdraw(uint256 _lockId) external whenPaused onlyYNftOwner(_lockId) {
    _claimFee(_lockId);
  }

  /*******************************************************************************************
   *  GETTER FUNCTIONS
   *******************************************************************************************/

  /***
   * @title checkAvailability
   * @notice Find out how many rentals are left available
   * @param _lockId what you want to check
   * @return uint256 return amount. 0 as false
   */
  function checkAvailability(uint256 _lockId) external view returns (uint256) {
    uint256 _now = block.timestamp;
    return
      Detector.availability(
        IVault(lendRent[_lockId].lend.vault).originalCollection(),
        lendRent[_lockId].rent,
        lendRent[_lockId].lend,
        _now,
        _now
      );
  }

  /***
   * @title getLendRent
   * @notice Getters that are set automatically do not return arrays in the structure, so this must be specified explicitly
   * @param _lockId what you want to check
   * @return LendRent return structure
   */
  function getLendRent(uint256 _lockId) external view returns (LendRent memory) {
    return lendRent[_lockId];
  }

  /** @dev see {ERC721} */
  function tokenURI(uint256 _lockId) public view override returns (string memory) {
    require(_exists(_lockId), 'ERC721Metadata: URI query for nonexistent token');

    Lend memory _lend = lendRent[_lockId].lend;

    // TODO: This must be changed by deploying chain
    string memory _tokenSymbol = 'ETH';
    if (_lend.paymentToken != address(0))
      _tokenSymbol = IERC20Detailed(_lend.paymentToken).symbol();
    string memory _name = IVault(IVault(_lend.vault).originalCollection()).name();

    bytes memory json = RentaFiSVG.getYieldSVG(
      _lockId,
      _lend.tokenId,
      _lend.amount,
      lenderBenefit[_lockId][_lend.paymentToken],
      _lend.lockStartTime,
      _lend.lockExpireTime,
      IVault(_lend.vault).originalCollection(),
      _name,
      _tokenSymbol
    );
    string memory _tokenURI = string(
      abi.encodePacked('data:application/json;base64,', Base64.encode(json))
    );
    return _tokenURI;
  }

  /*******************************************************************************************
   *  GETTER FUNCTIONS
   *******************************************************************************************/

  /***
   * @title setProtocolAdminFeeRatio
   * @notice
   * @param _protocolAdminFeeRatio
   */
  function setProtocolAdminFeeRatio(uint256 _protocolAdminFeeRatio) external onlyProtocolAdmin {
    if (_protocolAdminFeeRatio > 10 * 1000) revert overLimits();
    protocolAdminFeeRatio = _protocolAdminFeeRatio;
  }

  /***
   * @title setReservationLimit
   * @notice
   * @param _days
   */
  function setReservationLimit(uint256 _days) public onlyProtocolAdmin {
    reservationLimits = _days * 1 days;
  }

  /***
   * @title setVaultWhiteList
   * @notice
   * @param _vaultAddress
   * @param _allowed
   */
  function setVaultWhiteList(address _vaultAddress, uint256 _allowed) external onlyProtocolAdmin {
    if (_allowed >= 1) {
      vaultWhiteList[_vaultAddress] = _allowed;
    } else {
      delete vaultWhiteList[_vaultAddress];
    }
    uint256 _exists;
    address[] memory local_vaults = vaults;
    uint256 local_vaultsLength = local_vaults.length;
    for (uint256 i; i < local_vaultsLength; ) {
      if (local_vaults[i] == _vaultAddress) {
        _exists = 1;
        break;
      }
      unchecked {
        i++;
      }
    }
    if (_exists < 1) vaults.push(_vaultAddress);
    emit WhiteListed(IVault(_vaultAddress).originalCollection(), _vaultAddress);
  }

  /***
   * @title setPaymentTokenWhiteList
   * @notice
   * @param _token
   * @param _bool as Uint256. 0 is false, non-zero is true
   */
  function setPaymentTokenWhiteList(address _token, uint256 _bool) external onlyProtocolAdmin {
    paymentTokenWhiteList[_token] = _bool;
  }

  /** @dev see {Pausable} */
  function pause() external onlyProtocolAdmin {
    paused() ? _unpause() : _pause();
  }

  /*******************************************************************************************
   *  PRIVATE FUNCTIONS
   *******************************************************************************************/
  function _deleteExpiredRent(Rent[] storage _rents) private {
    uint256 _now = block.timestamp;
    for (uint256 i = 1; i <= _rents.length; ) {
      if (_rents[i - 1].rentalExpireTime < _now) {
        if (_rents[_rents.length - 1].rentalExpireTime >= _now) {
          _rents[i - 1] = _rents[_rents.length - 1];
        } else {
          i--;
        }
        _rents.pop();
      }
      unchecked {
        i++;
      }
    }
  }

  function _isPaymentTokenAllowed(address _vaultAddress, address _paymentToken)
    private
    view
    returns (uint256 _allowed)
  {
    _allowed = IVault(_vaultAddress).minPrices(_paymentToken);
  }

  function _claimFee(uint256 _lockId) private {
    address[] memory _allowedPaymentTokens = IVault(lendRent[_lockId].lend.vault)
      .getPaymentTokens();
    uint256 _allowedPaymentTokensLength = _allowedPaymentTokens.length;
    for (uint256 i; i < _allowedPaymentTokensLength; ) {
      uint256 _sendAmount = lenderBenefit[_lockId][_allowedPaymentTokens[i]];
      delete lenderBenefit[_lockId][_allowedPaymentTokens[i]];
      if (_allowedPaymentTokens[i] == address(0)) {
        payable(msg.sender).transfer(_sendAmount);
      } else {
        IERC20(_allowedPaymentTokens[i]).safeTransfer(msg.sender, _sendAmount);
      }
      unchecked {
        i++;
      }
    }
    if (lendRent[_lockId].lend.lockStartTime != lendRent[_lockId].lend.lockExpireTime)
      burn(_lockId); // burn yNFT
    emit Claimed(_lockId);
  }

  function _calcFee(
    uint256 _lockId,
    uint256 _dailyRentalPrice,
    uint64 _lockStartTime,
    uint64 _lockExpireTime,
    address _lender,
    uint256 _rentalDurationByDay,
    uint256 _amount,
    address _vault,
    address _paymentToken
  ) private {
    (
      uint256 _lenderBenefit,
      uint256 _collectionOwnerBenefit,
      uint256 _protocolAdminBenefit
    ) = Calculator.fee(
        _dailyRentalPrice,
        _lockStartTime,
        _lockExpireTime,
        _lender,
        _paymentToken,
        protocolAdminFeeRatio,
        _rentalDurationByDay,
        _amount,
        IVault(_vault).collectionOwnerFeeRatio()
      );

    lenderBenefit[_lockId][_paymentToken] = lenderBenefit[_lockId][_paymentToken] + _lenderBenefit;
    collectionOwnerBenefit[_vault][_paymentToken] =
      collectionOwnerBenefit[_vault][_paymentToken] +
      _collectionOwnerBenefit;
    protocolAdminBenefit[_paymentToken] =
      protocolAdminBenefit[_paymentToken] +
      _protocolAdminBenefit;
  }

  function _updateRent(
    address _vaultAddress,
    uint256 _lockId,
    Lend memory _lend,
    Rent memory _rent
  ) private {
    _deleteExpiredRent(lendRent[_lockId].rent);

    if (
      !(Detector.availability(
        IVault(_vaultAddress).originalCollection(),
        lendRent[_lockId].rent,
        _lend,
        _rent.rentalStartTime,
        _rent.rentalExpireTime
      ) >= 1)
    ) revert NotAvailable();

    // Push new rent
    lendRent[_lockId].rent.push(_rent);
  }

  function _mintNft(uint256 _lockId, uint256 _lockDuration) private {
    _mintONft(_lockId);
    // Mint the yNFT to match the mint of the oNFT
    if (_lockDuration != 0) _mintYNft(_lockId);
  }

  // Deposit the original NFT to the Vault
  // Receive oNFT minted instead
  function _mintONft(uint256 _lockId) private {
    (address _vaultAddress, uint256 _tokenId, uint256 _amount) = (
      lendRent[_lockId].lend.vault,
      lendRent[_lockId].lend.tokenId,
      lendRent[_lockId].lend.amount
    );
    // Process the NFT to deposit it in the vault
    // Send and mint the NFT after confirming that the owner of the NFT is executing
    // Get the address of the original NFT
    // NFT sent to vault (= locked)
    _safeTransferBundle(
      IVault(_vaultAddress).originalCollection(),
      msg.sender,
      _vaultAddress,
      _tokenId,
      _amount
    );
    // Minting oNft from Vault.
    IVault(_vaultAddress).mintONft(_lockId);
  }

  // Mint the yNFT instead of listing it on the market
  function _mintYNft(uint256 _lockId) private {
    _mint(msg.sender, _lockId);
  }

  // The part that actually creates the lending board
  function _createList(
    uint256 _lockId, // Unique number for each loan
    uint256 _tokenId,
    uint256 _lockDuration,
    uint256 _minRentalDuration,
    uint256 _maxRentalDuration,
    uint256 _amount,
    uint256 _dailyRentalPrice,
    address _privateAddress,
    address _vaultAddress,
    address _paymentToken,
    PaymentMethod _paymentMethod
  ) private {
    uint256 _now = block.timestamp;
    // By the time you get here, the deposit process has been completed and the o/yNFT has been issued.
    LendRent storage _lendRent = lendRent[_lockId];

    _lendRent.lend = Lend({
      minRentalDuration: uint64(_minRentalDuration),
      maxRentalDuration: uint64(_maxRentalDuration),
      lockStartTime: uint64(_now),
      lockExpireTime: uint64(_now + (_lockDuration * 1 days)),
      dailyRentalPrice: _dailyRentalPrice,
      tokenId: _tokenId,
      amount: _amount,
      vault: _vaultAddress,
      lender: msg.sender,
      paymentToken: _paymentToken,
      privateAddress: _privateAddress,
      paymentMethod: _paymentMethod
    });

    emit Listed(_lockId, msg.sender, _lendRent.lend);
  }

  // Redeem NFTs deposited in the Vault by Burning oNFTs
  function _redeemNFT(uint256 _lockId) private {
    // Redeem NFTs deposited in the vault. wrapped NFTs are released on the vault side.
    IVault(lendRent[_lockId].lend.vault).redeem(_lockId);
    delete lendRent[_lockId];
    emit Withdrawn(_lockId);
  }

  function _safeTransferBundle(
    address _originalNftAddress,
    address _from,
    address _to,
    uint256 _tokenId,
    uint256 _amount
  ) private {
    if (_originalNftAddress.is1155()) {
      IERC1155(_originalNftAddress).safeTransferFrom(_from, _to, _tokenId, _amount, '');
    } else if (_originalNftAddress.is721()) {
      IERC721(_originalNftAddress).safeTransferFrom(_from, _to, _tokenId);
    } else {
      IVault(_originalNftAddress).transferFrom(_from, _to, _tokenId);
    }
  }
}

File 2 of 27 : RentaFiSVG.sol
// SPDX-License-Identifier: None
pragma solidity =0.8.13;

import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/utils/Base64.sol';

library RentaFiSVG {
  function weiToEther(uint256 num) public pure returns (string memory) {
    if (num == 0) return '0.0';
    bytes memory b = bytes(Strings.toString(num));
    uint256 n = b.length;
    if (n < 19) for (uint256 i = 0; i < 19 - n; i++) b = abi.encodePacked('0', b);
    n = b.length;
    uint256 k = 18;
    for (uint256 i = n - 1; i > n - 18; i--) {
      if (b[i] != '0') break;
      k--;
    }
    uint256 m = n - 18 + k + 1;
    bytes memory a = new bytes(m);
    for (uint256 i = 0; i < k; i++) a[m - 1 - i] = b[n - 19 + k - i];
    a[m - k - 1] = '.';
    for (uint256 i = 0; i < n - 18; i++) a[m - k - 2 - i] = b[n - 19 - i];
    return string(a);
  }

  function getYieldSVG(
    uint256 _lockId,
    uint256 _tokenId,
    uint256 _amount,
    uint256 _benefit,
    uint256 _lockStartTime,
    uint256 _lockExpireTime,
    address _collection,
    string memory _name,
    string memory _tokenSymbol
  ) public pure returns (bytes memory) {
    string memory parsed = weiToEther(_benefit);
    string memory svg = string(
      abi.encodePacked(
        abi.encodePacked(
          "<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill='#fff' viewBox='0 0 486 300'><rect width='485.4' height='300' fill='#fff' rx='12'/><rect width='485.4' height='300' fill='url(#a)' rx='12'/><text fill='#5A6480' font-family='Poppins' font-size='10' font-weight='400'><tspan x='28' y='40'>Yield NFT - RentaFi</tspan></text><text fill='#5A6480' font-family='Poppins' font-size='10' font-weight='400' text-anchor='end'><tspan x='465' y='150'>",
          _tokenSymbol,
          "</tspan></text><text fill='#5A6480' font-family='Inter' font-size='24' font-weight='900'><tspan x='28' y='150'>Claimable Funds</tspan></text><text fill='#5A6480' font-family='Inter' font-size='36' font-weight='900'><tspan x='440' y='150' text-anchor='end'>",
          parsed,
          "</tspan></text><text fill='#98AABE' font-family='Inter' font-size='10' font-weight='400'><tspan x='28' y='270'>"
        ),
        abi.encodePacked(
          _name,
          "</tspan></text><text fill='#98AABE' font-family='Inter' font-size='10' font-weight='400'><tspan x='28' y='283'>",
          Strings.toHexString(uint256(uint160(_collection)), 20),
          "</tspan></text><text fill='#98AABE' font-family='Inter' font-size='10' font-weight='400' text-anchor='end'><tspan x='463' y='270'>TokenID: ",
          Strings.toString(_tokenId),
          "</tspan></text><text fill='#98AABE' font-family='Inter' font-size='10' font-weight='400' text-anchor='end'><tspan x='463' y='283'>Amount: ",
          Strings.toString(_amount),
          "</tspan></text><defs><linearGradient id='a' x1='0' x2='379' y1='96' y2='353' gradientUnits='userSpaceOnUse'><stop stop-color='#7DBCFF' stop-opacity='.1'/><stop offset='1' stop-color='#FF7DC0' stop-opacity='.1'/></linearGradient></defs></svg>"
        )
      )
    );

    bytes memory json = abi.encodePacked(
      abi.encodePacked(
        '{"name": "yieldNFT #',
        Strings.toString(_lockId),
        ' - RentaFi", "description": "YieldNFT represents Rental Fee deposited by Borrower in a RentaFi Escrow. The owner of this NFT can claim rental fee after lock-time expired by burn this.", "image": "data:image/svg+xml;base64,',
        Base64.encode(bytes(svg)),
        '", "attributes":[{"display_type": "date", "trait_type": "StartDate", "value":"'
      ),
      abi.encodePacked(
        Strings.toString(_lockStartTime),
        '"},{"display_type": "date", "trait_type":"ExpireDate", "value":"',
        Strings.toString(_lockExpireTime),
        '"},{"trait_type":"FeeAmount", "value":"',
        parsed,
        '"},{"trait_type":"Collection", "value":"',
        _name,
        '"}]}'
      )
    );

    return json;
  }

  function getOwnershipSVG(
    uint256 _lockId,
    uint256 _tokenId,
    uint256 _amount,
    uint256 _lockStartTime,
    uint256 _lockExpireTime,
    address _collection,
    string memory _name
  ) public pure returns (bytes memory) {
    string memory svg = string(
      abi.encodePacked(
        abi.encodePacked(
          "<svg xmlns='http://www.w3.org/2000/svg' fill='#fff' viewBox='0 0 486 300'><rect width='485.4' height='300' fill='#fff' rx='12'/><rect width='485.4' height='300' fill='url(#a)' rx='12'/><text fill='#5A6480' font-family='Poppins' font-size='10' font-weight='400'><tspan x='28' y='40'>RentaFi Ownership NFT</tspan></text><text fill='#5A6480' font-family='Poppins' font-size='10' font-weight='400'><tspan x='280' y='270'>Until Unlock</tspan><tspan x='430' y='270'>Day</tspan></text><text fill='#5A6480' font-family='Inter' font-size='24' font-weight='900'><tspan x='28' y='150'>",
          _name,
          "</tspan></text><text fill='#5A6480' font-family='Inter' font-size='36' font-weight='900' text-anchor='end'><tspan x='425' y='270'>",
          Strings.toString((_lockExpireTime - _lockStartTime) / 1 days)
        ),
        abi.encodePacked(
          "</tspan></text><text fill='#98AABE' font-family='Inter' font-size='10' font-weight='400'><tspan x='28' y='170'>",
          Strings.toHexString(uint256(uint160(_collection)), 20),
          "</tspan></text><text fill='#98AABE' font-family='Inter' font-size='10' font-weight='400'><tspan x='28' y='185'>TokenID: ",
          Strings.toString(_tokenId),
          "</tspan></text><text fill='#98AABE' font-family='Inter' font-size='10' font-weight='400'><tspan x='28' y='200'>Amount: ",
          Strings.toString(_amount),
          "</tspan></text><defs><linearGradient id='a' x1='0' x2='379' y1='96' y2='353' gradientUnits='userSpaceOnUse'><stop stop-color='#7DBCFF' stop-opacity='.1'/><stop offset='1' stop-color='#FF7DC0' stop-opacity='.1'/></linearGradient></defs></svg>"
        )
      )
    );

    bytes memory json = abi.encodePacked(
      '{"name": "OwnershipNFT #',
      Strings.toString(_lockId),
      ' - RentaFi", "description": "OwnershipNFT represents Original NFT locked in a RentaFi Escrow. The owner of this NFT can claim original NFT after lock-time expired by burn this.", "image": "data:image/svg+xml;base64,',
      Base64.encode(bytes(svg)),
      '", "attributes":[{"display_type": "date", "trait_type": "StartDate", "value":"',
      Strings.toString(_lockStartTime),
      '"},{"display_type": "date", "trait_type":"ExpireDate", "value":"',
      Strings.toString(_lockExpireTime),
      '"},{"trait_type": "Collection", "value":"',
      _name,
      '"}]}'
    );

    return json;
  }
}

File 3 of 27 : Detector.sol
// SPDX-License-Identifier: None
pragma solidity =0.8.13;

import '../interfaces/IMarket.sol';
import '../ERC4907/IERC4907.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/token/ERC1155/IERC1155.sol';

library Detector {
  function is721(address collection) public view returns (bool) {
    return IERC165(collection).supportsInterface(type(IERC721).interfaceId);
  }

  function is1155(address collection) public view returns (bool) {
    return IERC165(collection).supportsInterface(type(IERC1155).interfaceId);
  }

  function is4907(address collection) public view returns (bool) {
    return IERC165(collection).supportsInterface(type(IERC4907).interfaceId);
  }

  function availability(
    address _originalNftAddress,
    IMarket.Rent[] calldata _rents,
    IMarket.Lend calldata _lend,
    uint256 _rentalStartTime,
    uint256 _rentalExpireTime
  ) public view returns (uint256) {
    uint256 _rentaled;
    // ERC721 availability
    if (is721(_originalNftAddress)) {
      // Check for rental availability
      unchecked {
        for (uint256 i = 0; i < _rents.length; i++) {
          // Periods A-B and C-D overlap only if A<=D && C<=B
          if (
            _rents[i].rentalStartTime <= _rentalExpireTime &&
            _rentalStartTime <= _rents[i].rentalExpireTime
          ) _rentaled += _rents[i].amount;
        }
        // Check for rental availability
        return _lend.amount - _rentaled;
      }
    }

    // ERC1155 availability
    if (is1155(_originalNftAddress)) {
      // Confirmation of the number of tokens remaining available for rent
      unchecked {
        for (uint256 i = 0; i < _rents.length; i++) {
          // Counting rent amount with overlapping periods
          // Periods A-B and C-D overlap only if A<=D && C<=B
          if (
            _rents[i].rentalStartTime <= _rentalExpireTime &&
            _rentalStartTime <= _rents[i].rentalExpireTime
          ) _rentaled += _rents[i].amount;
        }
      }
      // Check for rental availability
      return _lend.amount - _rentaled;
    }

    return 0;
  }
}

File 4 of 27 : Calculator.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.13;

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

library Calculator {
  uint256 private constant E5 = 1e5;
  using SafeERC20 for IERC20;

  function duration(
    uint256 _rentalStartTimestamp,
    uint256 _rentalDurationByDay,
    uint256 _lockStartTime,
    uint256 _lockExpireTime,
    uint256 _maxRentalDuration,
    uint256 _minRentalDuration
  ) public view returns (uint256 _rentalStartTime, uint256 _rentalExpireTime) {
    _rentalStartTime = block.timestamp;

    // Check to see if the number of days or date conditions set by lend are met.
    require(
      _rentalExpireTime < _lockExpireTime || _lockExpireTime - _lockStartTime == 0,
      'RentalExpireAfterLockExpire'
    );
    require(
      _minRentalDuration <= _rentalDurationByDay && _rentalDurationByDay <= _maxRentalDuration,
      'RentalDurationIsOutOfRange'
    );

    // For Reservation
    if (_rentalStartTimestamp != 0) {
      require(_rentalStartTimestamp > _rentalStartTime, 'rentalStartShouldBeNow/Later');
      _rentalStartTime = _rentalStartTimestamp;
    }
    // Arguments are passed in days, so they are converted to seconds
    _rentalExpireTime = _rentalStartTime + (_rentalDurationByDay * 1 days);
  }

  function fee(
    uint256 _dailyRentalPrice,
    uint64 _lockStartTime,
    uint64 _lockExpireTime,
    address _lender,
    address _paymentToken,
    uint256 _adminFeeRatio,
    uint256 _rentalDurationByDay,
    uint256 _amount,
    uint256 _collectionOwnerFeeRatio
  )
    public
    returns (
      uint256 _lenderBenefit,
      uint256 _collectionOwnerFee,
      uint256 _adminFee
    )
  {
    /*
     * If the amount is greater than 1 in ERC721,
     * the renter will only pay more than necessary,
     * so we do not revert here to save on gas costs.
     */
    //_rentalFeeは、1日あたりの価格と数量、日数によって計算される
    uint256 _rentalFee = _dailyRentalPrice * _amount * _rentalDurationByDay; // dailyRentalPrice per Unit * Rental Amount * rentalDuration(days)
    // adminFeeは、レンタル料金に対してプロトコルロイヤリティの割合で計算される
    _adminFee = (_rentalFee * _adminFeeRatio) / E5;
    // コレクションオーナーへの収益は、コレクションオーナーロイヤリティの割合と、レンタル料金で計算される
    _collectionOwnerFee = (_rentalFee * _collectionOwnerFeeRatio) / E5;
    //貸し手の収益は、上記の残額分
    uint256 _lenderFee = _rentalFee - _adminFee - _collectionOwnerFee;

    require(_rentalFee == _adminFee + _collectionOwnerFee + _lenderFee, 'invalidCalc');
    // If the lockDuration is Zero, fee is sent to lender this time
    if (_lockStartTime < _lockExpireTime) _lenderBenefit = _lenderFee;

    // Native token
    if (_paymentToken == address(0)) {
      require(msg.value >= _rentalFee, 'InsufficientFunds');
      if (msg.value > _rentalFee) payable(msg.sender).transfer(msg.value - _rentalFee);
      // If No Locked
      if (_lockStartTime == _lockExpireTime) payable(_lender).transfer(_lenderFee); //lenderに送るのは、_lenderFeeのみ。 adminFeeとCollectionOwnerFeeはmsg.valueで送られている
      // If Loked, protocol received fee by msg.value. so no method required.
    }
    //ERC20 token
    else {
      // If No Locked
      if (_lockStartTime == _lockExpireTime) {
        IERC20(_paymentToken).safeTransferFrom(msg.sender, address(_lender), _lenderFee); //lenderに送るのは、_lenderFeeのみ
        IERC20(_paymentToken).safeTransferFrom(
          msg.sender,
          address(this),
          _collectionOwnerFee + _adminFee
        );
      }
      // If Locked, pay all fee to protocol
      else {
        IERC20(_paymentToken).safeTransferFrom(msg.sender, address(this), _rentalFee);
      }
    }
  }
}

File 5 of 27 : IMarket.sol
// SPDX-License-Identifier: None
pragma solidity =0.8.13;

interface IMarket {
  event Listed(uint256 indexed lockId, address indexed lender, Lend lend);
  event Rented(uint256 indexed rentId, address indexed renter, uint256 lockId, Rent rent);
  event Canceled(uint256 indexed lockId);
  event WhiteListed(address indexed collection, address indexed vault);
  event Withdrawn(uint256 indexed lockId);
  event Claimed(uint256 indexed lockId);
  event ClaimedRoyalty(address indexed collection);

  enum LockIdTarget {
    Lender,
    Renter,
    Vault,
    Token
  }

  enum PaymentMethod {
    // 32bit
    OneTime,
    Loan,
    BNPL,
    Subscription
  }

  /*
   * Market only returns data for listings
   * Original NFT is in the Vault contract
   */
  struct Lend {
    uint64 minRentalDuration; // days
    uint64 maxRentalDuration; // days
    uint64 lockStartTime;
    uint64 lockExpireTime;
    uint256 dailyRentalPrice; // wei
    uint256 tokenId;
    uint256 amount; // for ERC1155
    address vault; //160 bit
    address paymentToken; // 160 bit
    address lender; // 160 bit
    address privateAddress;
    PaymentMethod paymentMethod; // 32bit
  }

  struct Rent {
    address renterAddress;
    uint256 rentId;
    uint256 rentalStartTime;
    uint256 rentalExpireTime;
    uint256 amount;
  }

  struct LendRent {
    Lend lend;
    Rent[] rent;
  }

  function getLendRent(uint256 _lockId) external view returns (LendRent memory);

  function paymentTokenWhiteList(address _paymentToken) external view returns (uint256);

  function protocolAdminFeeRatio() external view returns (uint256);
}

interface IMarketOwner {
  function owner() external view returns (address);
}

File 6 of 27 : IVault.sol
// SPDX-License-Identifier: None
pragma solidity =0.8.13;

interface IVault {
  function factoryContract() external view returns (address);

  function name() external view returns (string memory);

  function symbol() external view returns (string memory);

  function approve(address _to, uint256 _tokenId) external;

  function burn(uint256 _tokenId) external;

  function mintONft(uint256 _lockId) external;

  function mintWNft(
    address _renter,
    uint256 _starts,
    uint256 _expires,
    uint256 _lockId,
    uint256 _tokenId,
    uint256 _amount
  ) external;

  function activate(
    uint256 _rentId,
    uint256 _lockId,
    address _renter,
    uint256 _amount
  ) external;

  function originalCollection() external view returns (address);

  function redeem(uint256 _tokenId) external;

  function ownerOf(uint256 _tokenId) external view returns (address owner);

  function collectionOwner() external view returns (address);

  function payoutAddress() external view returns (address);

  function collectionOwnerFeeRatio() external view returns (uint256);

  function getTokenIdAllowed(uint256 _tokenId) external view returns (bool);

  function getPaymentTokens() external view returns (address[] memory);

  //function paymentTokenWhiteList(address _paymentToken) external view returns (uint256 _bool);

  function setMinPrices(uint256[] memory _minPrices, address[] memory _paymentTokens) external;

  //NOTE ホワリスの代わり
  function minPrices(address _paymentToken) external view returns (uint256);

  function minDuration() external view returns (uint256);

  function maxDuration() external view returns (uint256);

  function flashloan(
    address _tokenAddress,
    uint256 _tokenId,
    address _receiver
  ) external payable;

  function transferFrom(
    address _from,
    address _to,
    uint256 _tokenId
  ) external;
}

File 7 of 27 : IERC20Detailed.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.13;

interface IERC20Detailed {
  function symbol() external view returns (string memory);
}

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

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 10 of 27 : ERC721Burnable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721Burnable.sol)

pragma solidity ^0.8.0;

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

/**
 * @title ERC721 Burnable Token
 * @dev ERC721 Token that can be burned (destroyed).
 */
abstract contract ERC721Burnable is Context, ERC721 {
    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");
        _burn(tokenId);
    }
}

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

pragma solidity ^0.8.0;

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

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

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

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

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

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

File 14 of 27 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

File 15 of 27 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

File 16 of 27 : Base64.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides a set of functions to operate with Base64 strings.
 *
 * _Available since v4.5._
 */
library Base64 {
    /**
     * @dev Base64 Encoding/Decoding Table
     */
    string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /**
     * @dev Converts a `bytes` to its Bytes64 `string` representation.
     */
    function encode(bytes memory data) internal pure returns (string memory) {
        /**
         * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
         * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
         */
        if (data.length == 0) return "";

        // Loads the table into memory
        string memory table = _TABLE;

        // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter
        // and split into 4 numbers of 6 bits.
        // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up
        // - `data.length + 2`  -> Round up
        // - `/ 3`              -> Number of 3-bytes chunks
        // - `4 *`              -> 4 characters for each chunk
        string memory result = new string(4 * ((data.length + 2) / 3));

        /// @solidity memory-safe-assembly
        assembly {
            // Prepare the lookup table (skip the first "length" byte)
            let tablePtr := add(table, 1)

            // Prepare result pointer, jump over length
            let resultPtr := add(result, 32)

            // Run over the input, 3 bytes at a time
            for {
                let dataPtr := data
                let endPtr := add(data, mload(data))
            } lt(dataPtr, endPtr) {

            } {
                // Advance 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                // To write each character, shift the 3 bytes (18 bits) chunk
                // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
                // and apply logical AND with 0x3F which is the number of
                // the previous character in the ASCII table prior to the Base64 Table
                // The result is then added to the table to get the character to write,
                // and finally write it in the result pointer but with a left shift
                // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits

                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance
            }

            // When data `bytes` is not exactly 3 bytes long
            // it is padded with `=` characters at the end
            switch mod(mload(data), 3)
            case 1 {
                mstore8(sub(resultPtr, 1), 0x3d)
                mstore8(sub(resultPtr, 2), 0x3d)
            }
            case 2 {
                mstore8(sub(resultPtr, 1), 0x3d)
            }
        }

        return result;
    }
}

File 17 of 27 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 18 of 27 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

File 20 of 27 : IERC4907.sol
// SPDX-License-Identifier: CC0-1.0
pragma solidity =0.8.13;

interface IERC4907 {
    // Logged when the user of a token assigns a new user or updates expires
    /// @notice Emitted when the `user` of an NFT or the `expires` of the `user` is changed
    /// The zero address for user indicates that there is no user address
    event UpdateUser(uint256 indexed tokenId, address indexed user, uint64 expires);

    /// @notice set the user and expires of a NFT
    /// @dev The zero address indicates there is no user
    /// Throws if `tokenId` is not valid NFT
    /// @param user  The new user of the NFT
    /// @param expires  UNIX timestamp, The new user could use the NFT before expires
    function setUser(
        uint256 tokenId,
        address user,
        uint64 expires
    ) external;

    /// @notice Get the user address of an NFT
    /// @dev The zero address indicates that there is no user or the user is expired
    /// @param tokenId The NFT to get the user address for
    /// @return The user address for this NFT
    function userOf(uint256 tokenId) external view returns (address);

    /// @notice Get the user expires of an NFT
    /// @dev The zero value indicates that there is no user
    /// @param tokenId The NFT to get the user expires for
    /// @return The user expires for this NFT
    function userExpires(uint256 tokenId) external view returns (uint256);
}

File 21 of 27 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

File 22 of 27 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 23 of 27 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 25 of 27 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");

        _transfer(from, to, tokenId);
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");
        _safeTransfer(from, to, tokenId, data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

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

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

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

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

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

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

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

pragma solidity ^0.8.0;

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

File 27 of 27 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 5000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {
    "contracts/libraries/Calculator.sol": {
      "Calculator": "0x4c99432045a8e70b3864fec4fa35f5c293a56186"
    },
    "contracts/libraries/Detector.sol": {
      "Detector": "0x1911172c61877aca9ebebf45b9003dd67f667d81"
    },
    "contracts/libraries/RentaFiSVG.sol": {
      "RentaFiSVG": "0x1176a964a06b2b268f5965583e7c8246783f82aa"
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyReserved","type":"error"},{"inputs":[],"name":"NotAvailable","type":"error"},{"inputs":[],"name":"overLimits","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"lockId","type":"uint256"}],"name":"Canceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"lockId","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"}],"name":"ClaimedRoyalty","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"lockId","type":"uint256"},{"indexed":true,"internalType":"address","name":"lender","type":"address"},{"components":[{"internalType":"uint64","name":"minRentalDuration","type":"uint64"},{"internalType":"uint64","name":"maxRentalDuration","type":"uint64"},{"internalType":"uint64","name":"lockStartTime","type":"uint64"},{"internalType":"uint64","name":"lockExpireTime","type":"uint64"},{"internalType":"uint256","name":"dailyRentalPrice","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"privateAddress","type":"address"},{"internalType":"enum IMarket.PaymentMethod","name":"paymentMethod","type":"uint8"}],"indexed":false,"internalType":"struct IMarket.Lend","name":"lend","type":"tuple"}],"name":"Listed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"rentId","type":"uint256"},{"indexed":true,"internalType":"address","name":"renter","type":"address"},{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"},{"components":[{"internalType":"address","name":"renterAddress","type":"address"},{"internalType":"uint256","name":"rentId","type":"uint256"},{"internalType":"uint256","name":"rentalStartTime","type":"uint256"},{"internalType":"uint256","name":"rentalExpireTime","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct IMarket.Rent","name":"rent","type":"tuple"}],"name":"Rented","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":true,"internalType":"address","name":"vault","type":"address"}],"name":"WhiteListed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"lockId","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"uint256","name":"_rentId","type":"uint256"}],"name":"activate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"}],"name":"cancel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"}],"name":"checkAvailability","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"}],"name":"claimFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"}],"name":"claimNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_paymentTokens","type":"address[]"}],"name":"claimProtocolFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultAddress","type":"address"}],"name":"claimRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"collectionOwnerBenefit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"}],"name":"getLendRent","outputs":[{"components":[{"components":[{"internalType":"uint64","name":"minRentalDuration","type":"uint64"},{"internalType":"uint64","name":"maxRentalDuration","type":"uint64"},{"internalType":"uint64","name":"lockStartTime","type":"uint64"},{"internalType":"uint64","name":"lockExpireTime","type":"uint64"},{"internalType":"uint256","name":"dailyRentalPrice","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"privateAddress","type":"address"},{"internalType":"enum IMarket.PaymentMethod","name":"paymentMethod","type":"uint8"}],"internalType":"struct IMarket.Lend","name":"lend","type":"tuple"},{"components":[{"internalType":"address","name":"renterAddress","type":"address"},{"internalType":"uint256","name":"rentId","type":"uint256"},{"internalType":"uint256","name":"rentalStartTime","type":"uint256"},{"internalType":"uint256","name":"rentalExpireTime","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct IMarket.Rent[]","name":"rent","type":"tuple[]"}],"internalType":"struct IMarket.LendRent","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lendRent","outputs":[{"components":[{"internalType":"uint64","name":"minRentalDuration","type":"uint64"},{"internalType":"uint64","name":"maxRentalDuration","type":"uint64"},{"internalType":"uint64","name":"lockStartTime","type":"uint64"},{"internalType":"uint64","name":"lockExpireTime","type":"uint64"},{"internalType":"uint256","name":"dailyRentalPrice","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"address","name":"lender","type":"address"},{"internalType":"address","name":"privateAddress","type":"address"},{"internalType":"enum IMarket.PaymentMethod","name":"paymentMethod","type":"uint8"}],"internalType":"struct IMarket.Lend","name":"lend","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"lenderBenefit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_lockDuration","type":"uint256"},{"internalType":"uint256","name":"_minRentalDuration","type":"uint256"},{"internalType":"uint256","name":"_maxRentalDuration","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_dailyRentalPrice","type":"uint256"},{"internalType":"address","name":"_privateAddress","type":"address"},{"internalType":"address","name":"_vaultAddress","type":"address"},{"internalType":"address","name":"_paymentToken","type":"address"},{"internalType":"enum IMarket.PaymentMethod","name":"_paymentMethod","type":"uint8"}],"name":"mintAndCreateList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"paymentTokenWhiteList","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"protocolAdminBenefit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolAdminFeeRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"uint256","name":"_rentalStartTimestamp","type":"uint256"},{"internalType":"uint256","name":"_rentalDurationByDay","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"rent","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"reservationLimits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_bool","type":"uint256"}],"name":"setPaymentTokenWhiteList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_protocolAdminFeeRatio","type":"uint256"}],"name":"setProtocolAdminFeeRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_days","type":"uint256"}],"name":"setReservationLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultAddress","type":"address"},{"internalType":"uint256","name":"_allowed","type":"uint256"}],"name":"setVaultWhiteList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"vaultWhiteList","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

6080604052612710600b55620d2f00600c553480156200001e57600080fd5b50604080518082018252601181527014995b9d18519a48165a595b1908139195607a1b60208083019182528351808501909452600a8452692932b73a30a33496aca760b11b9084015281519192916200007a9160009162000118565b5080516200009090600190602084019062000118565b505050620000ad620000a7620000c260201b60201c565b620000c6565b60016007556008805460ff19169055620001fa565b3390565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8280546200012690620001be565b90600052602060002090601f0160209004810192826200014a576000855562000195565b82601f106200016557805160ff191683800117855562000195565b8280016001018555821562000195579182015b828111156200019557825182559160200191906001019062000178565b50620001a3929150620001a7565b5090565b5b80821115620001a35760008155600101620001a8565b600181811c90821680620001d357607f821691505b602082108103620001f457634e487b7160e01b600052602260045260246000fd5b50919050565b615e8e806200020a6000396000f3fe6080604052600436106102d15760003560e01c8063753999ef11610179578063b88d4fde116100d6578063e1b09b761161008a578063f2fde38b11610064578063f2fde38b14610843578063f667526a14610863578063fe5c873a1461088357600080fd5b8063e1b09b76146107a0578063e985e9c5146107cd578063ed756fef1461081657600080fd5b8063cbb71877116100bb578063cbb7187714610726578063d7734de814610753578063db08e5d71461078057600080fd5b8063b88d4fde146106e6578063c87b56dd1461070657600080fd5b80638ea8f83c1161012d57806395d89b411161011257806395d89b41146106795780639e21d6a91461068e578063a22cb465146106c657600080fd5b80638ea8f83c1461063957806390b055691461065957600080fd5b8063816f7f101161015e578063816f7f10146105e65780638456cb59146106065780638da5cb5b1461061b57600080fd5b8063753999ef146105b05780638027d2fc146105d057600080fd5b806342842e0e116102325780635c975abb116101e6578063703f8489116101c0578063703f84891461056557806370a082311461057b578063715018a61461059b57600080fd5b80635c975abb1461050d5780636352211e1461052557806364515bdd1461054557600080fd5b80634ef6148f116102175780634ef6148f146104955780634f9a08f2146104b55780635312ea8e146104ed57600080fd5b806342842e0e1461045557806342966c681461047557600080fd5b806310c44d42116102895780631d252f901161026e5780631d252f90146103f557806323b872dd1461041557806340e58ee51461043557600080fd5b806310c44d42146103c257806312aa4f74146103e257600080fd5b8063081812fc116102ba578063081812fc1461032d578063095ea7b3146103655780630fcee7b01461038757600080fd5b806301ffc9a7146102d657806306fdde031461030b575b600080fd5b3480156102e257600080fd5b506102f66102f13660046151fc565b6108a3565b60405190151581526020015b60405180910390f35b34801561031757600080fd5b50610320610988565b6040516103029190615271565b34801561033957600080fd5b5061034d610348366004615284565b610a1a565b6040516001600160a01b039091168152602001610302565b34801561037157600080fd5b506103856103803660046152b2565b610a41565b005b34801561039357600080fd5b506103b46103a23660046152de565b60136020526000908152604090205481565b604051908152602001610302565b3480156103ce57600080fd5b506103856103dd3660046152de565b610b95565b6103856103f03660046152fb565b610ec2565b34801561040157600080fd5b50610385610410366004615284565b611329565b34801561042157600080fd5b5061038561043036600461532d565b6113a5565b34801561044157600080fd5b50610385610450366004615284565b61142d565b34801561046157600080fd5b5061038561047036600461532d565b611625565b34801561048157600080fd5b50610385610490366004615284565b611640565b3480156104a157600080fd5b506103856104b036600461536e565b6116c7565b3480156104c157600080fd5b506103b46104d03660046153e3565b601060209081526000928352604080842090915290825290205481565b3480156104f957600080fd5b50610385610508366004615284565b611881565b34801561051957600080fd5b5060085460ff166102f6565b34801561053157600080fd5b5061034d610540366004615284565b6118f7565b34801561055157600080fd5b506103856105603660046152b2565b61195c565b34801561057157600080fd5b506103b4600b5481565b34801561058757600080fd5b506103b46105963660046152de565b6119e1565b3480156105a757600080fd5b50610385611a7b565b3480156105bc57600080fd5b506103b46105cb366004615284565b611a8f565b3480156105dc57600080fd5b506103b4600c5481565b3480156105f257600080fd5b50610385610601366004615413565b611bdb565b34801561061257600080fd5b50610385612159565b34801561062757600080fd5b506006546001600160a01b031661034d565b34801561064557600080fd5b506103856106543660046154b1565b6121dc565b34801561066557600080fd5b50610385610674366004615284565b6123c5565b34801561068557600080fd5b5061032061246f565b34801561069a57600080fd5b506103b46106a93660046154d3565b601160209081526000928352604080842090915290825290205481565b3480156106d257600080fd5b506103856106e136600461550f565b61247e565b3480156106f257600080fd5b506103856107013660046155ac565b612489565b34801561071257600080fd5b50610320610721366004615284565b612511565b34801561073257600080fd5b506103b46107413660046152de565b60126020526000908152604090205481565b34801561075f57600080fd5b5061077361076e366004615284565b6129ae565b6040516103029190615775565b34801561078c57600080fd5b5061038561079b3660046152b2565b612ac6565b3480156107ac57600080fd5b506103b46107bb3660046152de565b600f6020526000908152604090205481565b3480156107d957600080fd5b506102f66107e83660046154d3565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561082257600080fd5b50610836610831366004615284565b612d2e565b6040516103029190615784565b34801561084f57600080fd5b5061038561085e3660046152de565b612f54565b34801561086f57600080fd5b5061038561087e366004615284565b612fe1565b34801561088f57600080fd5b5061038561089e366004615284565b6130bb565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd00000000000000000000000000000000000000000000000000000000148061093657507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061098257507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60606000805461099790615823565b80601f01602080910402602001604051908101604052809291908181526020018280546109c390615823565b8015610a105780601f106109e557610100808354040283529160200191610a10565b820191906000526020600020905b8154815290600101906020018083116109f357829003601f168201915b5050505050905090565b6000610a2582613290565b506000908152600460205260409020546001600160a01b031690565b6000610a4c826118f7565b9050806001600160a01b0316836001600160a01b031603610ada5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b0382161480610b1457506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b610b865760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610ad1565b610b9083836132f4565b505050565b80806001600160a01b0316635b8d02d76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf8919061585d565b6001600160a01b0316336001600160a01b031614610c585760405162461bcd60e51b815260206004820152601160248201527f6f6e6c795061796f7574416464726573730000000000000000000000000000006044820152606401610ad1565b6000826001600160a01b031663ca5e553e6040518163ffffffff1660e01b8152600401600060405180830381865afa158015610c98573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610cc0919081019061587a565b805190915060005b81811015610e24576001600160a01b038516600090815260116020526040812084518290869085908110610cfe57610cfe61592c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054905060006001600160a01b0316848381518110610d4657610d4661592c565b60200260200101516001600160a01b031603610d8f57604051339082156108fc029083906000818181858888f19350505050158015610d89573d6000803e3d6000fd5b50610dc6565b610dc63382868581518110610da657610da661592c565b60200260200101516001600160a01b031661336f9092919063ffffffff16565b6001600160a01b03861660009081526011602052604081208551909190869085908110610df557610df561592c565b6020908102919091018101516001600160a01b0316825281019190915260400160009081205550600101610cc8565b50836001600160a01b03166361dd277e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e87919061585d565b6001600160a01b03167fc8aa9fdc354459b01b7a030780ca7900da9a25dc1988b2fbe7aa8bda635d277f60405160405180910390a250505050565b610eca6133ef565b600260075403610f1c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610ad1565b6002600755600c54610f2e9042615958565b831115610f67576040517f564637a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848152600e60209081526040808320815161018081018352815467ffffffffffffffff80821683526801000000000000000082048116958301959095527001000000000000000000000000000000008104851693820193909352600160c01b909204909216606082015260018201546080820152600282015460a082015260038083015460c083015260048301546001600160a01b0390811660e0840152600584015481166101008401526006840154811661012084015260078401549081166101408401529192916101608401917401000000000000000000000000000000000000000090910460ff16908111156110645761106461565b565b60038111156110755761107561565b565b9052506101408101519091506001600160a01b038116158061109f5750336001600160a01b038216145b6110d5576040517f87b34a0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506111018582608001518360400151846060015185610120015188888860e00151896101000151613442565b60408181015160608301516020840151845193517f065943c4000000000000000000000000000000000000000000000000000000008152600481018990526024810188905267ffffffffffffffff9384166044820152918316606483015282166084820152911660a48201526000908190734c99432045a8e70b3864fec4fa35f5c293a561869063065943c49060c4016040805180830381865af41580156111ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d19190615970565b915091506111e3600a80546001019055565b60006111ee600a5490565b905060006040518060a00160405280336001600160a01b031681526020018381526020018581526020018481526020018781525090506112348560e001518a8784613674565b60e085015160a08601516040517f280ec4c40000000000000000000000000000000000000000000000000000000081523360048201526024810187905260448101869052606481018c9052608481019190915260a481018890526001600160a01b039091169063280ec4c49060c401600060405180830381600087803b1580156112bd57600080fd5b505af11580156112d1573d6000803e3d6000fd5b50505050336001600160a01b0316827f618f3bc4be6fe0e81a8af8b2a949d2a2d7ae3614c8de4f45a1fd9992ea11efbc8b84604051611311929190615994565b60405180910390a35050600160075550505050505050565b3361133c6006546001600160a01b031690565b6001600160a01b0316146113925760405162461bcd60e51b815260206004820152601160248201527f6f6e6c7950726f746f636f6c41646d696e0000000000000000000000000000006044820152606401610ad1565b61139f81620151806159dc565b600c5550565b6113b0335b8261384a565b6114225760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f7665640000000000000000000000000000000000006064820152608401610ad1565b610b908383836138c9565b6000818152600e602052604090206006015481906001600160a01b031633146114985760405162461bcd60e51b815260206004820152600a60248201527f4f6e6c794c656e646572000000000000000000000000000000000000000000006044820152606401610ad1565b6000828152600e6020526040902060080154829015806114ed57506000818152600e6020526040902054700100000000000000000000000000000000810467ffffffffffffffff908116600160c01b90920416145b6115395760405162461bcd60e51b815260206004820152600e60248201527f6f6e6c794265666f72654c6f636b0000000000000000000000000000000000006044820152606401610ad1565b6000838152600e60205260409020839060080161155581613aa3565b8054156115a45760405162461bcd60e51b815260206004820152600f60248201527f6f6e6c794e6f7452656e74616c656400000000000000000000000000000000006044820152606401610ad1565b6000858152600e6020526040902054700100000000000000000000000000000000810467ffffffffffffffff908116600160c01b90920416146115ea576115ea85611640565b6115f385613c43565b60405185907f829a8683c544ad289ce92d3ce06e9ebad69b18a6916e60ec766c2c217461d8e990600090a25050505050565b610b9083838360405180602001604052806000815250612489565b611649336113aa565b6116bb5760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f7665640000000000000000000000000000000000006064820152608401610ad1565b6116c481613d90565b50565b336116da6006546001600160a01b031690565b6001600160a01b0316146117305760405162461bcd60e51b815260206004820152601160248201527f6f6e6c7950726f746f636f6c41646d696e0000000000000000000000000000006044820152606401610ad1565b8060005b8181101561187b576000601260008686858181106117545761175461592c565b905060200201602081019061176991906152de565b6001600160a01b03168152602081019190915260400160009081205491508585848181106117995761179961592c565b90506020020160208101906117ae91906152de565b6001600160a01b0316036117ef57604051339082156108fc029083906000818181858888f193505050501580156117e9573d6000803e3d6000fd5b5061182b565b61182b33828787868181106118065761180661592c565b905060200201602081019061181b91906152de565b6001600160a01b0316919061336f565b601260008686858181106118415761184161592c565b905060200201602081019061185691906152de565b6001600160a01b03168152602081019190915260400160009081205550600101611734565b50505050565b611889613e38565b8033611894826118f7565b6001600160a01b0316146118ea5760405162461bcd60e51b815260206004820152600d60248201527f6f6e6c79594e66744f776e6572000000000000000000000000000000000000006044820152606401610ad1565b6118f382613e8a565b5050565b6000818152600260205260408120546001600160a01b0316806109825760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610ad1565b3361196f6006546001600160a01b031690565b6001600160a01b0316146119c55760405162461bcd60e51b815260206004820152601160248201527f6f6e6c7950726f746f636f6c41646d696e0000000000000000000000000000006044820152606401610ad1565b6001600160a01b03909116600090815260136020526040902055565b60006001600160a01b038216611a5f5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e657200000000000000000000000000000000000000000000006064820152608401610ad1565b506001600160a01b031660009081526003602052604090205490565b611a836140d1565b611a8d600061412b565b565b6000818152600e6020908152604080832060049081015482517f61dd277e00000000000000000000000000000000000000000000000000000000815292514294731911172c61877aca9ebebf45b9003dd67f667d8194639780c240946001600160a01b03909416936361dd277e9382820193929091908290030181865afa158015611b1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b42919061585d565b6000868152600e60205260409081902090517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152611b939291600881019187908190600401615b17565b602060405180830381865af4158015611bb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd49190615b5f565b9392505050565b611be36133ef565b60008611611c335760405162461bcd60e51b815260206004820152600760248201527f4e6f745a65726f000000000000000000000000000000000000000000000000006044820152606401610ad1565b881580611c405750878910155b611c8c5760405162461bcd60e51b815260206004820152601460248201527f6c6f636b4475723c6d696e52656e74616c4475720000000000000000000000006044820152606401610ad1565b881580611c995750888711155b611ce55760405162461bcd60e51b815260206004820152601260248201527f6d617852656e744475723e6c6f636b44757200000000000000000000000000006044820152606401610ad1565b86881115611d355760405162461bcd60e51b815260206004820152601960248201527f6d696e52656e74616c4475723e6d617852656e74616c447572000000000000006044820152606401610ad1565b6001600160a01b0383166000908152600f602052604090205460011115611d9e5760405162461bcd60e51b815260206004820152600e60248201527f4e6f7477686974656c69737465640000000000000000000000000000000000006044820152606401610ad1565b6040517fc8f7243d000000000000000000000000000000000000000000000000000000008152600481018b90526001600160a01b0384169063c8f7243d90602401602060405180830381865afa158015611dfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e209190615b78565b611e6c5760405162461bcd60e51b815260206004820152600c60248201527f4e6f74416c6c6f776564496400000000000000000000000000000000000000006044820152606401610ad1565b6040517f96201cc50000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528691908516906396201cc590602401602060405180830381865afa158015611ece573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ef29190615b5f565b1115611f405760405162461bcd60e51b815260206004820152601260248201527f6461696c7952656e7450726963653c6d696e00000000000000000000000000006044820152606401610ad1565b611f4d88620151806159dc565b836001600160a01b031663567157616040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611faf9190615b5f565b1115611ffd5760405162461bcd60e51b815260206004820152601160248201527f6d696e52656e744475723c6d696e4475720000000000000000000000000000006044820152606401610ad1565b61200a87620151806159dc565b836001600160a01b0316636db5c8fd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612048573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206c9190615b5f565b10156120ba5760405162461bcd60e51b815260206004820152601160248201527f6d617852656e744475723e6d61784475720000000000000000000000000000006044820152606401610ad1565b60016120c6848461418a565b10156121145760405162461bcd60e51b815260206004820152600f60248201527f4e6f74416c6c6f776564546f6b656e00000000000000000000000000000000006044820152606401610ad1565b612122600980546001019055565b600061212d60095490565b9050612142818c8c8c8c8c8c8c8c8c8c6141ed565b61214c818b6144c4565b5050505050505050505050565b3361216c6006546001600160a01b031690565b6001600160a01b0316146121c25760405162461bcd60e51b815260206004820152601160248201527f6f6e6c7950726f746f636f6c41646d696e0000000000000000000000000000006044820152606401610ad1565b60085460ff166121d457611a8d6144dc565b611a8d614536565b6000811161222c5760405162461bcd60e51b815260206004820152600d60248201527f496e76616c696452656e744964000000000000000000000000000000000000006044820152606401610ad1565b6000828152600e6020908152604080832060080180548251818502810185019093528083529192909190849084015b828210156122c25760008481526020908190206040805160a0810182526005860290920180546001600160a01b031683526001808201548486015260028201549284019290925260038101546060840152600401546080830152908352909201910161225b565b5050825192935060009150505b818110156123be57838382815181106122ea576122ea61592c565b602002602001015160200151036123b6576000858152600e602052604090206004015483516001600160a01b0390911690638b8b1408908690889033908890879081106123395761233961592c565b6020026020010151608001516040518563ffffffff1660e01b8152600401612383949392919093845260208401929092526001600160a01b03166040830152606082015260800190565b600060405180830381600087803b15801561239d57600080fd5b505af11580156123b1573d6000803e3d6000fd5b505050505b6001016122cf565b5050505050565b336123d86006546001600160a01b031690565b6001600160a01b03161461242e5760405162461bcd60e51b815260206004820152601160248201527f6f6e6c7950726f746f636f6c41646d696e0000000000000000000000000000006044820152606401610ad1565b61271081111561246a576040517f564637a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b55565b60606001805461099790615823565b6118f333838361456f565b612493338361384a565b6125055760405162461bcd60e51b815260206004820152602e60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206e6f7220617070726f7665640000000000000000000000000000000000006064820152608401610ad1565b61187b8484848461463d565b6000818152600260205260409020546060906001600160a01b031661259e5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006064820152608401610ad1565b6000828152600e60209081526040808320815161018081018352815467ffffffffffffffff80821683526801000000000000000082048116958301959095527001000000000000000000000000000000008104851693820193909352600160c01b909204909216606082015260018201546080820152600282015460a082015260038083015460c083015260048301546001600160a01b0390811660e0840152600584015481166101008401526006840154811661012084015260078401549081166101408401529192916101608401917401000000000000000000000000000000000000000090910460ff169081111561269b5761269b61565b565b60038111156126ac576126ac61565b565b90525060408051808201909152600381527f45544800000000000000000000000000000000000000000000000000000000006020820152610100820151919250906001600160a01b031615612769578161010001516001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801561273e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526127669190810190615bc5565b90505b60008260e001516001600160a01b03166361dd277e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d1919061585d565b6001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa15801561280e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526128369190810190615bc5565b90506000731176a964a06b2b268f5965583e7c8246783f82aa6301fcd47d878660a001518760c00151601060008c815260200190815260200160002060008a61010001516001600160a01b03166001600160a01b031681526020019081526020016000205489604001518a606001518b60e001516001600160a01b03166361dd277e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156128e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061290b919061585d565b8a8c6040518a63ffffffff1660e01b815260040161293199989796959493929190615c0e565b600060405180830381865af415801561294e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526129769190810190615bc5565b90506000612983826146c6565b6040516020016129939190615c88565b60408051601f19818403018152919052979650505050505050565b600e60209081526000918252604091829020825161018081018452815467ffffffffffffffff80821683526801000000000000000082048116948301949094527001000000000000000000000000000000008104841694820194909452600160c01b909304909116606083015260018101546080830152600281015460a083015260038082015460c084015260048201546001600160a01b0390811660e085015260058301548116610100850152600683015481166101208501526007830154908116610140850152919291839161016084019174010000000000000000000000000000000000000000900460ff1690811115612aad57612aad61565b565b6003811115612abe57612abe61565b565b905250905081565b33612ad96006546001600160a01b031690565b6001600160a01b031614612b2f5760405162461bcd60e51b815260206004820152601160248201527f6f6e6c7950726f746f636f6c41646d696e0000000000000000000000000000006044820152606401610ad1565b60018110612b57576001600160a01b0382166000908152600f60205260409020819055612b71565b6001600160a01b0382166000908152600f60205260408120555b600080600d805480602002602001604051908101604052809291908181526020018280548015612bca57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612bac575b505083519394506000925050505b81811015612c2357856001600160a01b0316838281518110612bfc57612bfc61592c565b60200260200101516001600160a01b031603612c1b5760019350612c23565b600101612bd8565b506001831015612c8657600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb501805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0387161790555b846001600160a01b0316856001600160a01b03166361dd277e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612cce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cf2919061585d565b6001600160a01b03167f9e197ecce1a48c9006a4407354d94248a9217e9a915569f72928899f3f9b913a60405160405180910390a35050505050565b604080516101c081018252600091810182815260608083018490526080830184905260a0830184905260c0830184905260e08301849052610100830184905261012083018490526101408301849052610160830184905261018083018490526101a0830193909352815260208101919091526000828152600e60205260409081902081516101c081018352815467ffffffffffffffff80821694830194855268010000000000000000820481166060840152700100000000000000000000000000000000820481166080840152600160c01b9091041660a0820152600182015460c0820152600282015460e082015260038083015461010083015260048301546001600160a01b039081166101208401526005840154811661014084015260068401548116610160840152600784015490811661018084015291938492909184916101a08501917401000000000000000000000000000000000000000090910460ff1690811115612ea157612ea161565b565b6003811115612eb257612eb261565b565b81525050815260200160088201805480602002602001604051908101604052809291908181526020016000905b82821015612f465760008481526020908190206040805160a0810182526005860290920180546001600160a01b0316835260018082015484860152600282015492840192909252600381015460608401526004015460808301529083529092019101612edf565b505050915250909392505050565b612f5c6140d1565b6001600160a01b038116612fd85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610ad1565b6116c48161412b565b8033612fec826118f7565b6001600160a01b0316146130425760405162461bcd60e51b815260206004820152600d60248201527f6f6e6c79594e66744f776e6572000000000000000000000000000000000000006044820152606401610ad1565b6000828152600e60205260409020548290600160c01b900467ffffffffffffffff1642116130b25760405162461bcd60e51b815260206004820152601460248201527f6f6e6c7941667465724c6f636b457870697265640000000000000000000000006044820152606401610ad1565b610b9083613e8a565b6000818152600e60205260409081902060049081015491517f6352211e000000000000000000000000000000000000000000000000000000008152908101839052829133916001600160a01b0390911690636352211e90602401602060405180830381865afa158015613132573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613156919061585d565b6001600160a01b0316146131ac5760405162461bcd60e51b815260206004820152600d60248201527f6f6e6c794f4e66744f776e6572000000000000000000000000000000000000006044820152606401610ad1565b6000828152600e60205260409020548290600160c01b900467ffffffffffffffff16421161321c5760405162461bcd60e51b815260206004820152601460248201527f6f6e6c7941667465724c6f636b457870697265640000000000000000000000006044820152606401610ad1565b6000838152600e60205260409020839060080161323881613aa3565b8054156132875760405162461bcd60e51b815260206004820152600f60248201527f6f6e6c794e6f7452656e74616c656400000000000000000000000000000000006044820152606401610ad1565b6123be85613c43565b6000818152600260205260409020546001600160a01b03166116c45760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610ad1565b6000818152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091558190613336826118f7565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610b90908490614819565b60085460ff1615611a8d5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610ad1565b6000806000734c99432045a8e70b3864fec4fa35f5c293a5618663dff515ff8c8c8c8c89600b548e8e8e6001600160a01b031663210249816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156134a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134cd9190615b5f565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e08c901b168152600481019990995267ffffffffffffffff97881660248a01529690951660448801526001600160a01b03938416606488015292909116608486015260a485015260c484015260e483015261010482015261012401606060405180830381865af415801561356a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061358e9190615ccd565b60008f81526010602090815260408083206001600160a01b038b16845290915290205492955090935091506135c4908490615958565b60008d81526010602090815260408083206001600160a01b03808a1680865291845282852095909555938916835260118252808320938352929052205461360c908390615958565b6001600160a01b038087166000908152601160209081526040808320938916835292815282822093909355601290925290205461364a908290615958565b6001600160a01b039094166000908152601260205260409020939093555050505050505050505050565b6000838152600e6020526040902061368e90600801613aa3565b6001731911172c61877aca9ebebf45b9003dd67f667d81639780c240866001600160a01b03166361dd277e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156136e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061370c919061585d565b600e600088815260200190815260200160002060080186866040015187606001516040518663ffffffff1660e01b815260040161374d959493929190615cfb565b602060405180830381865af415801561376a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061378e9190615b5f565b10156137c6576040517fd9b9141900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000928352600e60209081526040808520600801805460018082018355918752958390208451600590970201805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039097169690961786559183015191850191909155810151600284015560608101516003840155608001516004909201919091555050565b600080613856836118f7565b9050806001600160a01b0316846001600160a01b0316148061389d57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806138c15750836001600160a01b03166138b684610a1a565b6001600160a01b0316145b949350505050565b826001600160a01b03166138dc826118f7565b6001600160a01b0316146139585760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610ad1565b6001600160a01b0382166139d35760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610ad1565b6139de6000826132f4565b6001600160a01b0383166000908152600360205260408120805460019290613a07908490615d2e565b90915550506001600160a01b0382166000908152600360205260408120805460019290613a35908490615958565b9091555050600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b4260015b82548111610b90578183613abc600184615d2e565b81548110613acc57613acc61592c565b9060005260206000209060050201600301541015613c3b57825482908490613af690600190615d2e565b81548110613b0657613b0661592c565b90600052602060002090600502016003015410613bd15782548390613b2d90600190615d2e565b81548110613b3d57613b3d61592c565b906000526020600020906005020183600183613b599190615d2e565b81548110613b6957613b6961592c565b600091825260209091208254600590920201805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091178155600180830154908201556002808301549082015560038083015490820155600491820154910155613bdf565b80613bdb81615d45565b9150505b82805480613bef57613bef615d5c565b600082815260208120600560001990930192830201805473ffffffffffffffffffffffffffffffffffffffff191681556001810182905560028101829055600381018290556004015590555b600101613aa7565b6000818152600e60205260409081902060049081015491517fdb006a750000000000000000000000000000000000000000000000000000000081529081018390526001600160a01b039091169063db006a7590602401600060405180830381600087803b158015613cb357600080fd5b505af1158015613cc7573d6000803e3d6000fd5b5050506000828152600e6020526040812081815560018101829055600281018290556003810182905560048101805473ffffffffffffffffffffffffffffffffffffffff199081169091556005820180548216905560068201805490911690556007810180547fffffffffffffffffffffff0000000000000000000000000000000000000000001690559150613d606008830182615166565b505060405181907f430648de173157e069201c943adb2d4e340e7cf5b27b1b09c9cb852f03d63b5690600090a250565b6000613d9b826118f7565b9050613da86000836132f4565b6001600160a01b0381166000908152600360205260408120805460019290613dd1908490615d2e565b9091555050600082815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60085460ff16611a8d5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610ad1565b6000818152600e602052604080822060049081015482517fca5e553e00000000000000000000000000000000000000000000000000000000815292516001600160a01b039091169263ca5e553e928181019286929091908290030181865afa158015613efa573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f22919081019061587a565b805190915060005b8181101561405a57600084815260106020526040812084518290869085908110613f5657613f5661592c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020549050601060008681526020019081526020016000206000858481518110613fa857613fa861592c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000905560006001600160a01b0316848381518110613ff157613ff161592c565b60200260200101516001600160a01b03160361403a57604051339082156108fc029083906000818181858888f19350505050158015614034573d6000803e3d6000fd5b50614051565b6140513382868581518110610da657610da661592c565b50600101613f2a565b506000838152600e6020526040902054700100000000000000000000000000000000810467ffffffffffffffff908116600160c01b90920416146140a1576140a183611640565b60405183907f7a355715549cfe7c1cba26304350343fbddc4b4f72d3ce3e7c27117dd20b5cb890600090a2505050565b6006546001600160a01b03163314611a8d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ad1565b600680546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040517f96201cc50000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152600091908416906396201cc590602401602060405180830381865afa158015611bb0573d6000803e3d6000fd5b60004290506000600e60008e815260200190815260200160002090506040518061018001604052808b67ffffffffffffffff1681526020018a67ffffffffffffffff1681526020018367ffffffffffffffff1681526020018c6201518061425491906159dc565b61425e9085615958565b67ffffffffffffffff1681526020018881526020018d8152602001898152602001866001600160a01b03168152602001856001600160a01b03168152602001336001600160a01b03168152602001876001600160a01b031681526020018460038111156142cd576142cd61565b565b90528051825460208301516040840151606085015167ffffffffffffffff908116600160c01b0277ffffffffffffffffffffffffffffffffffffffffffffffff92821670010000000000000000000000000000000002929092166fffffffffffffffffffffffffffffffff93821668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000000000000000000090951691909516179290921716919091171782556080810151600183015560a0810151600283015560c081015160038084019190915560e08201516004840180546001600160a01b0392831673ffffffffffffffffffffffffffffffffffffffff1991821617909155610100840151600586018054918416918316919091179055610120840151600686018054918416918316919091179055610140840151600786018054919093169181168217835561016085015186949093927fffffffffffffffffffffff00000000000000000000000000000000000000000090921690911790740100000000000000000000000000000000000000009084908111156144725761447261565b565b0217905550506040513391508e907f5fb494437edf927cb36342f274168a5ae79a30f510d3dd93c4a7737029552bc8906144ad908590615d72565b60405180910390a350505050505050505050505050565b6144cd826148fe565b80156118f3576118f382614a2a565b6144e46133ef565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586145193390565b6040516001600160a01b03909116815260200160405180910390a1565b61453e613e38565b6008805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33614519565b816001600160a01b0316836001600160a01b0316036145d05760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610ad1565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6146488484846138c9565b61465484848484614a34565b61187b5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610ad1565b606081516000036146e557505060408051602081019091526000815290565b6000604051806060016040528060408152602001615e1960409139905060006003845160026147149190615958565b61471e9190615d81565b6147299060046159dc565b67ffffffffffffffff8111156147415761474161553d565b6040519080825280601f01601f19166020018201604052801561476b576020820181803683370190505b509050600182016020820185865187015b808210156147d7576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f811685015184535060018301925061477c565b50506003865106600181146147f357600281146148065761480e565b603d6001830353603d600283035361480e565b603d60018303535b509195945050505050565b600061486e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614bd59092919063ffffffff16565b805190915015610b90578080602001905181019061488c9190615b78565b610b905760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610ad1565b6000818152600e6020908152604091829020600480820154600283015460039093015485517f61dd277e00000000000000000000000000000000000000000000000000000000815295516001600160a01b0390921695939490936149b19387936361dd277e93838301939092908290030181865afa158015614984573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906149a8919061585d565b33858585614be4565b6040517fd6bca516000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b0384169063d6bca51690602401600060405180830381600087803b158015614a0c57600080fd5b505af1158015614a20573d6000803e3d6000fd5b5050505050505050565b6116c43382614e96565b60006001600160a01b0384163b15614bca576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063150b7a0290614a91903390899088908890600401615da3565b6020604051808303816000875af1925050508015614acc575060408051601f3d908101601f19168201909252614ac991810190615ddf565b60015b614b7f573d808015614afa576040519150601f19603f3d011682016040523d82523d6000602084013e614aff565b606091505b508051600003614b775760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610ad1565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a02000000000000000000000000000000000000000000000000000000001490506138c1565b506001949350505050565b60606138c18484600085614fe5565b6040517f04811f5a0000000000000000000000000000000000000000000000000000000081526001600160a01b0386166004820152731911172c61877aca9ebebf45b9003dd67f667d81906304811f5a90602401602060405180830381865af4158015614c55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614c799190615b78565b15614d1c576040517ff242432a0000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528481166024830152604482018490526064820183905260a06084830152600060a483015286169063f242432a9060c4015b600060405180830381600087803b158015614cff57600080fd5b505af1158015614d13573d6000803e3d6000fd5b505050506123be565b6040517f61f335250000000000000000000000000000000000000000000000000000000081526001600160a01b0386166004820152731911172c61877aca9ebebf45b9003dd67f667d81906361f3352590602401602060405180830381865af4158015614d8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614db19190615b78565b15614e0c576040517f42842e0e0000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528481166024830152604482018490528616906342842e0e90606401614ce5565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528481166024830152604482018490528616906323b872dd90606401600060405180830381600087803b158015614e7757600080fd5b505af1158015614e8b573d6000803e3d6000fd5b505050505050505050565b6001600160a01b038216614eec5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610ad1565b6000818152600260205260409020546001600160a01b031615614f515760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610ad1565b6001600160a01b0382166000908152600360205260408120805460019290614f7a908490615958565b9091555050600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60608247101561505d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610ad1565b6001600160a01b0385163b6150b45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610ad1565b600080866001600160a01b031685876040516150d09190615dfc565b60006040518083038185875af1925050503d806000811461510d576040519150601f19603f3d011682016040523d82523d6000602084013e615112565b606091505b509150915061512282828661512d565b979650505050505050565b6060831561513c575081611bd4565b82511561514c5782518084602001fd5b8160405162461bcd60e51b8152600401610ad19190615271565b50805460008255600502906000526020600020908101906116c491905b808211156151ca57805473ffffffffffffffffffffffffffffffffffffffff1916815560006001820181905560028201819055600382018190556004820155600501615183565b5090565b7fffffffff00000000000000000000000000000000000000000000000000000000811681146116c457600080fd5b60006020828403121561520e57600080fd5b8135611bd4816151ce565b60005b8381101561523457818101518382015260200161521c565b8381111561187b5750506000910152565b6000815180845261525d816020860160208601615219565b601f01601f19169290920160200192915050565b602081526000611bd46020830184615245565b60006020828403121561529657600080fd5b5035919050565b6001600160a01b03811681146116c457600080fd5b600080604083850312156152c557600080fd5b82356152d08161529d565b946020939093013593505050565b6000602082840312156152f057600080fd5b8135611bd48161529d565b6000806000806080858703121561531157600080fd5b5050823594602084013594506040840135936060013592509050565b60008060006060848603121561534257600080fd5b833561534d8161529d565b9250602084013561535d8161529d565b929592945050506040919091013590565b6000806020838503121561538157600080fd5b823567ffffffffffffffff8082111561539957600080fd5b818501915085601f8301126153ad57600080fd5b8135818111156153bc57600080fd5b8660208260051b85010111156153d157600080fd5b60209290920196919550909350505050565b600080604083850312156153f657600080fd5b8235915060208301356154088161529d565b809150509250929050565b6000806000806000806000806000806101408b8d03121561543357600080fd5b8a35995060208b0135985060408b0135975060608b0135965060808b0135955060a08b0135945060c08b01356154688161529d565b935060e08b01356154788161529d565b92506101008b01356154898161529d565b91506101208b01356004811061549e57600080fd5b809150509295989b9194979a5092959850565b600080604083850312156154c457600080fd5b50508035926020909101359150565b600080604083850312156154e657600080fd5b82356154f18161529d565b915060208301356154088161529d565b80151581146116c457600080fd5b6000806040838503121561552257600080fd5b823561552d8161529d565b9150602083013561540881615501565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561557c5761557c61553d565b604052919050565b600067ffffffffffffffff82111561559e5761559e61553d565b50601f01601f191660200190565b600080600080608085870312156155c257600080fd5b84356155cd8161529d565b935060208501356155dd8161529d565b925060408501359150606085013567ffffffffffffffff81111561560057600080fd5b8501601f8101871361561157600080fd5b803561562461561f82615584565b615553565b81815288602083850101111561563957600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b634e487b7160e01b600052602160045260246000fd5b6004811061568f57634e487b7160e01b600052602160045260246000fd5b9052565b805167ffffffffffffffff16825260208101516156bc602084018267ffffffffffffffff169052565b5060408101516156d8604084018267ffffffffffffffff169052565b5060608101516156f4606084018267ffffffffffffffff169052565b506080810151608083015260a081015160a083015260c081015160c083015260e081015161572d60e08401826001600160a01b03169052565b50610100818101516001600160a01b03908116918401919091526101208083015182169084015261014080830151909116908301526101608082015161187b82850182615671565b61018081016109828284615693565b600060208083526101c0830161579d8285018651615693565b848201516101a0858101528051918290528201906000906101e08601905b80831015615818576158028285516001600160a01b038151168252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b60a08201915084840193506001830192506157bb565b509695505050505050565b600181811c9082168061583757607f821691505b60208210810361585757634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561586f57600080fd5b8151611bd48161529d565b6000602080838503121561588d57600080fd5b825167ffffffffffffffff808211156158a557600080fd5b818501915085601f8301126158b957600080fd5b8151818111156158cb576158cb61553d565b8060051b91506158dc848301615553565b81815291830184019184810190888411156158f657600080fd5b938501935b8385101561592057845192506159108361529d565b82825293850193908501906158fb565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000821982111561596b5761596b615942565b500190565b6000806040838503121561598357600080fd5b505080516020909101519092909150565b82815260c08101611bd460208301846001600160a01b038151168252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b60008160001904831182151516156159f6576159f6615942565b500290565b6000815480845260208085019450836000528060002060005b83811015615a635781546001600160a01b031687526001808301548489015260028301546040890152600383015460608901526004830154608089015260a09097019660059092019101615a14565b509495945050505050565b805467ffffffffffffffff8082168452604082811c82166020860152608083901c8216908501525060c090811c606084015260018201546080840152600282015460a08085019190915260038301549184019190915260048201546001600160a01b0390811660e08501526005830154811661010085015260068301548116610120850152600783015490811661014085015290610b909061016085019083901c60ff16615671565b60006102006001600160a01b0388168352806020840152615b3a818401886159fb565b915050615b4a6040830186615a6e565b6101c08201939093526101e001529392505050565b600060208284031215615b7157600080fd5b5051919050565b600060208284031215615b8a57600080fd5b8151611bd481615501565b6000615ba361561f84615584565b9050828152838383011115615bb757600080fd5b611bd4836020830184615219565b600060208284031215615bd757600080fd5b815167ffffffffffffffff811115615bee57600080fd5b8201601f81018413615bff57600080fd5b6138c184825160208401615b95565b60006101208b83528a602084015289604084015288606084015267ffffffffffffffff808916608085015280881660a0850152506001600160a01b03861660c08401528060e0840152615c6381840186615245565b9050828103610100840152615c788185615245565b9c9b505050505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251615cc081601d850160208701615219565b91909101601d0192915050565b600080600060608486031215615ce257600080fd5b8351925060208401519150604084015190509250925092565b60006102006001600160a01b0388168352806020840152615d1e818401886159fb565b915050615b4a6040830186615693565b600082821015615d4057615d40615942565b500390565b600081615d5457615d54615942565b506000190190565b634e487b7160e01b600052603160045260246000fd5b61018081016109828284615a6e565b600082615d9e57634e487b7160e01b600052601260045260246000fd5b500490565b60006001600160a01b03808716835280861660208401525083604083015260806060830152615dd56080830184615245565b9695505050505050565b600060208284031215615df157600080fd5b8151611bd4816151ce565b60008251615e0e818460208701615219565b919091019291505056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220406aea02c901524115eaf2e3b539572e7e1a6cb3c78d23813c12f344f179f90d64736f6c634300080d0033

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