ETH Price: $2,425.85 (-1.83%)
 

Overview

Max Total Supply

0 genR5

Holders

1,089

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Balance
1 genR5
0x6d1552b1Dc835394Ca32210d0E8442818F3a7c19
Loading...
Loading
Loading...
Loading
Loading...
Loading

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

Contract Source Code Verified (Exact Match)

Contract Name:
genR5

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 31 : genR5.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
pragma abicoder v2; // required to accept structs as function parameters

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./RENRoyalties.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";

import "operator-filter-registry/src/UpdatableOperatorFilterer.sol";
import "operator-filter-registry/src/RevokableDefaultOperatorFilterer.sol";

import { GelatoRelayContext } from "@gelatonetwork/relay-context/contracts/GelatoRelayContext.sol";


contract genR5 is ERC721URIStorage, Ownable, EIP712, AccessControl
, RENRoyalties
, RevokableDefaultOperatorFilterer
, GelatoRelayContext
{

  uint256 constant MAX_SUPPLY = 1972;

  bytes32 public constant WITHDRAWER_ROLE = keccak256("WITHDRAWER_ROLE");
  bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
  string private constant SIGNING_DOMAIN = "genR5-mint-voucher";
  string private constant SIGNATURE_VERSION = "1";

  string private baseURI;
  string private _contractURI;

  uint256 private pendingWithdrawals;
  uint256 private minimumFundToKeep;

  bool private _gelatoActive;

  uint256 private maxByOwner;
  uint256 private totalMinted;

  constructor(
     uint256 bps
    )
    ERC721('genR5', 'genR5')
     RENRoyalties(bps)
    EIP712(SIGNING_DOMAIN, SIGNATURE_VERSION) {
      baseURI = "";
      _contractURI = "";
      _gelatoActive = true;
      maxByOwner = 1;
      totalMinted = 0;
      _setupRole(MINTER_ROLE, _msgSender());
      _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
      _setupRole(WITHDRAWER_ROLE, _msgSender());
  }

  function setMaxByOwner(uint256 max) public onlyOwner {
      maxByOwner = max;
  }

  function setGelatoActive(bool active) public onlyOwner {
      _gelatoActive = active;
  }

  function setBaseURI(string memory _URI) public onlyOwner {
      baseURI = _URI;
  }

  function setContractURI(string memory _URI) public onlyOwner {
      _contractURI = _URI;
  }

  function contractURI() public view returns (string memory) {
        return _contractURI;
  }

  /**
     * @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 override returns (string memory) {
      return baseURI;
  }

  //Setup Royalties
  function setupRoyalties(address addr, uint256 bps) public {
      require(msg.sender == owner(), "only owner can setupRoyalties");
      super.setRoyalties(addr, bps);
  }

  function mint(address to, uint256 tokenId, string memory _tokenURI) public
  {
      require(hasRole(MINTER_ROLE, msg.sender), "only minter can mint");
      require(totalMinted < MAX_SUPPLY, "MAX_SUPPLY reached");
      require(balanceOf(to) < maxByOwner, "maxByOwner reached");

      _mint(msg.sender, tokenId);
      _setTokenURI(tokenId, _tokenURI);
      totalMinted++;

      // transfer the token
      if (msg.sender != to)
          _transfer(msg.sender, to, tokenId);
  }

  /// @notice Represents an un-minted NFT, which has not yet been recorded into the blockchain. A signed voucher can be redeemed for a real NFT using the redeem function.
  struct NFTVoucher {
    /// @notice The id of the token to be redeemed. Must be unique - if another token with this ID already exists, the redeem function will revert.
    uint256 tokenId;

    /// @notice The minimum price (in wei) that the NFT creator is willing to accept for the initial sale of this NFT.
    uint256 minPrice;

    /// @notice The metadata URI to associate with this token.
    string uri;

    /// @notice the EIP-712 signature of all other fields in the NFTVoucher struct. For a voucher to be valid, it must be signed by an account with the MINTER_ROLE.
    bytes signature;
  }


  /// @notice Redeems an NFTVoucher for an actual NFT, creating it in the process.
  /// @param redeemer The address of the account which will receive the NFT upon success.
  /// @param voucher A signed NFTVoucher that describes the NFT to be redeemed.
  function redeem(address redeemer, NFTVoucher calldata voucher) public payable returns (uint256) {

    require(totalMinted < MAX_SUPPLY, "MAX_SUPPLY reached");
    require(balanceOf(redeemer) < maxByOwner, "maxByOwner reached");

    // make sure signature is valid and get the address of the signer
    address signer = _verify(voucher);

    // make sure that the signer is authorized to mint NFTs
    require(hasRole(MINTER_ROLE, signer), "Signature invalid or unauthorized");

    // make sure that the redeemer is paying enough to cover the buyer's cost
    require(msg.value >= voucher.minPrice, "Insufficient funds to redeem");

    // first assign the token to the signer, to establish provenance on-chain
    _mint(signer, voucher.tokenId);
    _setTokenURI(voucher.tokenId, voucher.uri);
    totalMinted++;

    // transfer the token to the redeemer
    _transfer(signer, redeemer, voucher.tokenId);

    // record payment to withdrawal balance
    increasePendingWithdrawals(msg.value);

    return voucher.tokenId;
  }

  function redeemWithGelato(address redeemer, NFTVoucher calldata voucher) external payable onlyGelatoRelay returns (uint256) {
    require(_gelatoActive, "Gelato is not active");

    require(totalMinted < MAX_SUPPLY, "MAX_SUPPLY reached");
    require(balanceOf(redeemer) < maxByOwner, "maxByOwner reached");

    // make sure signature is valid and get the address of the signer
    address signer = _verify(voucher);

    // make sure that the signer is authorized to mint NFTs
    require(hasRole(MINTER_ROLE, signer), "Signature invalid or unauthorized");

    // make sure that the redeemer is paying enough to cover the buyer's cost
    require(msg.value >= voucher.minPrice, "Insufficient funds to redeem");

    //Payment to gelato
    _transferRelayFee();

    _mint(signer, voucher.tokenId);
    _setTokenURI(voucher.tokenId, voucher.uri);
    _transfer(signer, redeemer, voucher.tokenId);
    totalMinted++;

    // record payment to withdrawal balance
    increasePendingWithdrawals(msg.value);

    return voucher.tokenId;
  }

  function increasePendingWithdrawals(uint256 val) internal {
    pendingWithdrawals += val;
  }

  function setMinimumFundToKeep(uint amount) public onlyOwner {
    minimumFundToKeep = amount;
  }

  //Default receive
  receive() external payable {
    //Check overflow
    require (pendingWithdrawals + msg.value > pendingWithdrawals, "too many ethers sent");
    pendingWithdrawals += msg.value;
  }

  /// @notice Transfers pending withdrawal balance to the caller. Reverts if the caller is not an authorized withdrawer.
  function withdraw(uint amount) public {
    require(hasRole(WITHDRAWER_ROLE, msg.sender), "Only authorized withdrawers can withdraw");
    require(amount <= pendingWithdrawals, "Too much amount to withdraw");
    if (msg.sender != owner())
      require(pendingWithdrawals - amount >= minimumFundToKeep, "Too much amount to withdraw to keep minimumFundToKeep");

    // IMPORTANT: casting msg.sender to a payable address is only safe if ALL members of the withdrawer role are payable addresses.
    address payable receiver = payable(msg.sender);

    pendingWithdrawals -= amount;
    receiver.transfer(amount);
  }

  /// @notice Retuns the amount of Ether available to the caller to withdraw.
  function availableToWithdraw() public view returns (uint256) {
    //SIGNER-WITHDRAWERS-return pendingWithdrawals[msg.sender];
    return pendingWithdrawals;
  }

  /// @notice Returns a hash of the given NFTVoucher, prepared using EIP712 typed data hashing rules.
  /// @param voucher An NFTVoucher to hash.
  function _hash(NFTVoucher calldata voucher) internal view returns (bytes32) {
    return _hashTypedDataV4(keccak256(abi.encode(
      keccak256("NFTVoucher(uint256 tokenId,uint256 minPrice,string uri)"),
      voucher.tokenId,
      voucher.minPrice,
      keccak256(bytes(voucher.uri))
    )));
  }

  /// @notice Returns the chain id of the current blockchain.
  /// @dev This is used to workaround an issue with ganache returning different values from the on-chain chainid() function and
  ///  the eth_chainId RPC method. See https://github.com/protocol/nft-website/issues/121 for context.
  function getChainID() external view returns (uint256) {
    uint256 id;
    assembly {
        id := chainid()
    }
    return id;
  }

  /// @notice Verifies the signature for a given NFTVoucher, returning the address of the signer.
  /// @dev Will revert if the signature is invalid. Does not verify that the signer is authorized to mint NFTs.
  /// @param voucher An NFTVoucher describing an unminted NFT.
  function _verify(NFTVoucher calldata voucher) internal view returns (address) {
    bytes32 digest = _hash(voucher);
    return ECDSA.recover(digest, voucher.signature);
  }

  function supportsInterface(bytes4 interfaceId) public view virtual override (AccessControl, ERC721
  , RENRoyalties
  ) returns (bool) {
    return ERC721.supportsInterface(interfaceId) || AccessControl.supportsInterface(interfaceId)
    || RENRoyalties.supportsInterface(interfaceId)
    ;
  }

  function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
      super.setApprovalForAll(operator, approved);
  }

  function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) {
      super.approve(operator, tokenId);
  }

  function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
      super.transferFrom(from, to, tokenId);
  }

  function safeTransferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
      super.safeTransferFrom(from, to, tokenId);
  }

  function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
      public
      override
      onlyAllowedOperator(from)
  {
      super.safeTransferFrom(from, to, tokenId, data);
  }

  function owner() public view virtual override (Ownable, UpdatableOperatorFilterer) returns (address) {
      return Ownable.owner();
  }
}

File 2 of 31 : GelatoRelayBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;

import {GELATO_RELAY} from "../constants/GelatoRelay.sol";

abstract contract GelatoRelayBase {
    modifier onlyGelatoRelay() {
        require(_isGelatoRelay(msg.sender), "onlyGelatoRelay");
        _;
    }

    function _isGelatoRelay(address _forwarder) internal pure returns (bool) {
        return _forwarder == GELATO_RELAY;
    }
}

File 3 of 31 : GelatoRelay.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;

address constant GELATO_RELAY = 0xaBcC9b596420A9E9172FD5938620E265a0f9Df92;
address constant GELATO_RELAY_ERC2771 = 0xBf175FCC7086b4f9bd59d5EAE8eA67b8f940DE0d;

File 4 of 31 : Tokens.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;

address constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

File 5 of 31 : GelatoRelayContext.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;

import {GelatoRelayBase} from "./base/GelatoRelayBase.sol";
import {TokenUtils} from "./lib/TokenUtils.sol";

uint256 constant _FEE_COLLECTOR_START = 72; // offset: address + address + uint256
uint256 constant _FEE_TOKEN_START = 52; // offset: address + uint256
uint256 constant _FEE_START = 32; // offset: uint256

// WARNING: Do not use this free fn by itself, always inherit GelatoRelayContext
// solhint-disable-next-line func-visibility, private-vars-leading-underscore
function _getFeeCollectorRelayContext() pure returns (address feeCollector) {
    assembly {
        feeCollector := shr(
            96,
            calldataload(sub(calldatasize(), _FEE_COLLECTOR_START))
        )
    }
}

// WARNING: Do not use this free fn by itself, always inherit GelatoRelayContext
// solhint-disable-next-line func-visibility, private-vars-leading-underscore
function _getFeeTokenRelayContext() pure returns (address feeToken) {
    assembly {
        feeToken := shr(96, calldataload(sub(calldatasize(), _FEE_TOKEN_START)))
    }
}

// WARNING: Do not use this free fn by itself, always inherit GelatoRelayContext
// solhint-disable-next-line func-visibility, private-vars-leading-underscore
function _getFeeRelayContext() pure returns (uint256 fee) {
    assembly {
        fee := calldataload(sub(calldatasize(), _FEE_START))
    }
}

/**
 * @dev Context variant with feeCollector, feeToken and fee appended to msg.data
 * Expects calldata encoding:
 * abi.encodePacked( _data,
 *                   _feeCollector,
 *                   _feeToken,
 *                   _fee);
 * Therefore, we're expecting 20 + 20 + 32 = 72 bytes to be appended to normal msgData
 * 32bytes start offsets from calldatasize:
 *     feeCollector: - 72 bytes
 *     feeToken: - 52 bytes
 *     fee: - 32 bytes
 */
/// @dev Do not use with GelatoRelayFeeCollector - pick only one
abstract contract GelatoRelayContext is GelatoRelayBase {
    using TokenUtils for address;

    // DANGER! Only use with onlyGelatoRelay `_isGelatoRelay` before transferring
    function _transferRelayFee() internal {
        _getFeeToken().transfer(_getFeeCollector(), _getFee());
    }

    // DANGER! Only use with onlyGelatoRelay `_isGelatoRelay` before transferring
    function _transferRelayFeeCapped(uint256 _maxFee) internal {
        uint256 fee = _getFee();
        require(
            fee <= _maxFee,
            "GelatoRelayContext._transferRelayFeeCapped: maxFee"
        );
        _getFeeToken().transfer(_getFeeCollector(), fee);
    }

    function _getMsgData() internal view returns (bytes calldata) {
        return
            _isGelatoRelay(msg.sender)
                ? msg.data[:msg.data.length - _FEE_COLLECTOR_START]
                : msg.data;
    }

    // Only use with GelatoRelayBase onlyGelatoRelay or `_isGelatoRelay` checks
    function _getFeeCollector() internal pure returns (address) {
        return _getFeeCollectorRelayContext();
    }

    // Only use with previous onlyGelatoRelay or `_isGelatoRelay` checks
    function _getFeeToken() internal pure returns (address) {
        return _getFeeTokenRelayContext();
    }

    // Only use with previous onlyGelatoRelay or `_isGelatoRelay` checks
    function _getFee() internal pure returns (uint256) {
        return _getFeeRelayContext();
    }
}

File 6 of 31 : TokenUtils.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;

import {NATIVE_TOKEN} from "../constants/Tokens.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {
    SafeERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

library TokenUtils {
    using SafeERC20 for IERC20;

    modifier onlyERC20(address _token) {
        require(_token != NATIVE_TOKEN, "TokenUtils.onlyERC20");
        _;
    }

    function transfer(
        address _token,
        address _to,
        uint256 _amount
    ) internal {
        if (_amount == 0) return;
        _token == NATIVE_TOKEN
            ? Address.sendValue(payable(_to), _amount)
            : IERC20(_token).safeTransfer(_to, _amount);
    }

    function transferFrom(
        address _token,
        address _from,
        address _to,
        uint256 _amount
    ) internal onlyERC20(_token) {
        if (_amount == 0) return;
        IERC20(_token).safeTransferFrom(_from, _to, _amount);
    }

    function getBalance(address token, address user)
        internal
        view
        returns (uint256)
    {
        return
            token == NATIVE_TOKEN
                ? user.balance
                : IERC20(token).balanceOf(user);
    }
}

File 7 of 31 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

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

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

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

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

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

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

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

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

        _revokeRole(role, account);
    }

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 9 of 31 : 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 10 of 31 : 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 11 of 31 : 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 12 of 31 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 13 of 31 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 = _ownerOf(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 or 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 or 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 or 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @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 _ownerOf(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, 1);

        // Check that tokenId was not minted by `_beforeTokenTransfer` hook
        require(!_exists(tokenId), "ERC721: token already minted");

        unchecked {
            // Will not overflow unless all 2**256 token ids are minted to the same owner.
            // Given that tokens are minted one by one, it is impossible in practice that
            // this ever happens. Might change if we allow batch minting.
            // The ERC fails to describe this case.
            _balances[to] += 1;
        }

        _owners[tokenId] = to;

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

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

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

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

        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
        owner = ERC721.ownerOf(tokenId);

        // Clear approvals
        delete _tokenApprovals[tokenId];

        unchecked {
            // Cannot overflow, as that would require more tokens to be burned/transferred
            // out than the owner initially received through minting and transferring in.
            _balances[owner] -= 1;
        }
        delete _owners[tokenId];

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

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

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

        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");

        // Clear approvals from the previous owner
        delete _tokenApprovals[tokenId];

        unchecked {
            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
            // `from`'s balance is the number of token held, which is at least one before the current
            // transfer.
            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
            // all 2**256 token ids to be minted, which in practice is impossible.
            _balances[from] -= 1;
            _balances[to] += 1;
        }
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId, 1);
    }

    /**
     * @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. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
     * - When `from` is zero, the tokens will be minted for `to`.
     * - When `to` is zero, ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256, /* firstTokenId */
        uint256 batchSize
    ) internal virtual {
        if (batchSize > 1) {
            if (from != address(0)) {
                _balances[from] -= batchSize;
            }
            if (to != address(0)) {
                _balances[to] += batchSize;
            }
        }
    }

    /**
     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
     * - When `from` is zero, the tokens were minted for `to`.
     * - When `to` is zero, ``from``'s tokens were burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual {}
}

File 14 of 31 : ERC721URIStorage.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721URIStorage.sol)

pragma solidity ^0.8.0;

import "../ERC721.sol";

/**
 * @dev ERC721 token with storage based token URI management.
 */
abstract contract ERC721URIStorage is ERC721 {
    using Strings for uint256;

    // Optional mapping for token URIs
    mapping(uint256 => string) private _tokenURIs;

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

        string memory _tokenURI = _tokenURIs[tokenId];
        string memory base = _baseURI();

        // If there is no base URI, return the token URI.
        if (bytes(base).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(base, _tokenURI));
        }

        return super.tokenURI(tokenId);
    }

    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

    /**
     * @dev See {ERC721-_burn}. This override additionally checks to see if a
     * token-specific URI was set for the token, and if so, it deletes the token URI from
     * the storage mapping.
     */
    function _burn(uint256 tokenId) internal virtual override {
        super._burn(tokenId);

        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }
    }
}

File 15 of 31 : 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 16 of 31 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 17 of 31 : 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 18 of 31 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

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

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

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

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

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

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

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

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

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

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

File 19 of 31 : 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 20 of 31 : draft-EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/draft-EIP712.sol)

pragma solidity ^0.8.0;

// EIP-712 is Final as of 2022-08-11. This file is deprecated.

import "./EIP712.sol";

File 21 of 31 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

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

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

File 22 of 31 : EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.0;

import "./ECDSA.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;
    address private immutable _CACHED_THIS;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        bytes32 typeHash = keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
        _CACHED_CHAIN_ID = block.chainid;
        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
        _CACHED_THIS = address(this);
        _TYPE_HASH = typeHash;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
            return _CACHED_DOMAIN_SEPARATOR;
        } else {
            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
        }
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 24 of 31 : 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 25 of 31 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 26 of 31 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

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

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

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

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

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

File 27 of 31 : RENRoyalties.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

contract RENRoyalties is ERC165 {

    //Royalties info
    uint256 private _royaltyBps; // Divided per 10000
    address payable private _royaltyRecipient;

    //EIP-2981 royalties
    bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x2a55205a;

    //Rarible royalties
    bytes4 private constant _INTERFACE_ID_ROYALTIES_RARIBLE = 0xb7799584;


    //Constructor
    constructor(uint256 bps) {
        _royaltyRecipient = payable(msg.sender); // sender must be a payable address
        _royaltyBps = bps; // bps=1000 means 10% (1000 / 10000)
    }

	//Subclass can call this
	function setRoyalties(address addr, uint256 bps) internal {
		_royaltyRecipient = payable(addr);
        _royaltyBps = bps;
	}

    //Rarible royalties impl
    function getRoyalties(uint256) external view returns (address payable[] memory recipients, uint256[] memory bps) {
        if (_royaltyRecipient != address(0x0)) {
            recipients = new address payable[](1);
            recipients[0] = _royaltyRecipient;
            bps = new uint256[](1);
            bps[0] = _royaltyBps;
        }
        return (recipients, bps);
    }

    function getFeeRecipients(uint256) external view returns (address payable[] memory recipients) {
        if (_royaltyRecipient != address(0x0)) {
            recipients = new address payable[](1);
            recipients[0] = _royaltyRecipient;
        }
        return recipients;
    }

    function getFeeBps(uint256) external view returns (uint[] memory bps) {
        if (_royaltyRecipient != address(0x0)) {
            bps = new uint256[](1);
            bps[0] = _royaltyBps;
        }
        return bps;
    }

    //EIP-2981 royalties impl
    function royaltyInfo(uint256, uint256 value) external view returns (address, uint256) {
        return (_royaltyRecipient, value*_royaltyBps/10000);
    }


    // IERC165-supportsInterface.
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == _INTERFACE_ID_ROYALTIES_RARIBLE || interfaceId == _INTERFACE_ID_ROYALTIES_EIP2981 || super.supportsInterface(interfaceId);
    }
}

File 28 of 31 : IOperatorFilterRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface IOperatorFilterRegistry {
    function isOperatorAllowed(address registrant, address operator) external view returns (bool);
    function register(address registrant) external;
    function registerAndSubscribe(address registrant, address subscription) external;
    function registerAndCopyEntries(address registrant, address registrantToCopy) external;
    function unregister(address addr) external;
    function updateOperator(address registrant, address operator, bool filtered) external;
    function updateOperators(address registrant, address[] calldata operators, bool filtered) external;
    function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
    function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;
    function subscribe(address registrant, address registrantToSubscribe) external;
    function unsubscribe(address registrant, bool copyExistingEntries) external;
    function subscriptionOf(address addr) external returns (address registrant);
    function subscribers(address registrant) external returns (address[] memory);
    function subscriberAt(address registrant, uint256 index) external returns (address);
    function copyEntriesOf(address registrant, address registrantToCopy) external;
    function isOperatorFiltered(address registrant, address operator) external returns (bool);
    function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);
    function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);
    function filteredOperators(address addr) external returns (address[] memory);
    function filteredCodeHashes(address addr) external returns (bytes32[] memory);
    function filteredOperatorAt(address registrant, uint256 index) external returns (address);
    function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);
    function isRegistered(address addr) external returns (bool);
    function codeHashOf(address addr) external returns (bytes32);
}

File 29 of 31 : RevokableDefaultOperatorFilterer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import {RevokableOperatorFilterer} from "./RevokableOperatorFilterer.sol";

/**
 * @title  RevokableDefaultOperatorFilterer
 * @notice Inherits from RevokableOperatorFilterer and automatically subscribes to the default OpenSea subscription.
 *         Note that OpenSea will disable creator fee enforcement if filtered operators begin fulfilling orders
 *         on-chain, eg, if the registry is revoked or bypassed.
 */
abstract contract RevokableDefaultOperatorFilterer is RevokableOperatorFilterer {
    address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);

    constructor() RevokableOperatorFilterer(0x000000000000AAeB6D7670E522A718067333cd4E, DEFAULT_SUBSCRIPTION, true) {}
}

File 30 of 31 : RevokableOperatorFilterer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import {UpdatableOperatorFilterer} from "./UpdatableOperatorFilterer.sol";
import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";

/**
 * @title  RevokableOperatorFilterer
 * @notice This contract is meant to allow contracts to permanently skip OperatorFilterRegistry checks if desired. The
 *         Registry itself has an "unregister" function, but if the contract is ownable, the owner can re-register at
 *         any point. As implemented, this abstract contract allows the contract owner to permanently skip the
 *         OperatorFilterRegistry checks by calling revokeOperatorFilterRegistry. Once done, the registry
 *         address cannot be further updated.
 *         Note that OpenSea will still disable creator fee enforcement if filtered operators begin fulfilling orders
 *         on-chain, eg, if the registry is revoked or bypassed.
 */
abstract contract RevokableOperatorFilterer is UpdatableOperatorFilterer {
    error RegistryHasBeenRevoked();
    error InitialRegistryAddressCannotBeZeroAddress();

    bool public isOperatorFilterRegistryRevoked;

    constructor(address _registry, address subscriptionOrRegistrantToCopy, bool subscribe)
        UpdatableOperatorFilterer(_registry, subscriptionOrRegistrantToCopy, subscribe)
    {
        // don't allow creating a contract with a permanently revoked registry
        if (_registry == address(0)) {
            revert InitialRegistryAddressCannotBeZeroAddress();
        }
    }

    function _checkFilterOperator(address operator) internal view virtual override {
        if (address(operatorFilterRegistry) != address(0)) {
            super._checkFilterOperator(operator);
        }
    }

    /**
     * @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero
     *         address, checks will be permanently bypassed, and the address cannot be updated again. OnlyOwner.
     */
    function updateOperatorFilterRegistryAddress(address newRegistry) public override {
        if (msg.sender != owner()) {
            revert OnlyOwner();
        }
        // if registry has been revoked, do not allow further updates
        if (isOperatorFilterRegistryRevoked) {
            revert RegistryHasBeenRevoked();
        }

        operatorFilterRegistry = IOperatorFilterRegistry(newRegistry);
    }

    /**
     * @notice Revoke the OperatorFilterRegistry address, permanently bypassing checks. OnlyOwner.
     */
    function revokeOperatorFilterRegistry() public {
        if (msg.sender != owner()) {
            revert OnlyOwner();
        }
        // if registry has been revoked, do not allow further updates
        if (isOperatorFilterRegistryRevoked) {
            revert RegistryHasBeenRevoked();
        }

        // set to zero address to bypass checks
        operatorFilterRegistry = IOperatorFilterRegistry(address(0));
        isOperatorFilterRegistryRevoked = true;
    }
}

File 31 of 31 : UpdatableOperatorFilterer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";

/**
 * @title  UpdatableOperatorFilterer
 * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another
 *         registrant's entries in the OperatorFilterRegistry. This contract allows the Owner to update the
 *         OperatorFilterRegistry address via updateOperatorFilterRegistryAddress, including to the zero address,
 *         which will bypass registry checks.
 *         Note that OpenSea will still disable creator fee enforcement if filtered operators begin fulfilling orders
 *         on-chain, eg, if the registry is revoked or bypassed.
 * @dev    This smart contract is meant to be inherited by token contracts so they can use the following:
 *         - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.
 *         - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
 */
abstract contract UpdatableOperatorFilterer {
    error OperatorNotAllowed(address operator);
    error OnlyOwner();

    IOperatorFilterRegistry public operatorFilterRegistry;

    constructor(address _registry, address subscriptionOrRegistrantToCopy, bool subscribe) {
        IOperatorFilterRegistry registry = IOperatorFilterRegistry(_registry);
        operatorFilterRegistry = registry;
        // If an inheriting token contract is deployed to a network without the registry deployed, the modifier
        // will not revert, but the contract will need to be registered with the registry once it is deployed in
        // order for the modifier to filter addresses.
        if (address(registry).code.length > 0) {
            if (subscribe) {
                registry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
            } else {
                if (subscriptionOrRegistrantToCopy != address(0)) {
                    registry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
                } else {
                    registry.register(address(this));
                }
            }
        }
    }

    modifier onlyAllowedOperator(address from) virtual {
        // Allow spending tokens from addresses with balance
        // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
        // from an EOA.
        if (from != msg.sender) {
            _checkFilterOperator(msg.sender);
        }
        _;
    }

    modifier onlyAllowedOperatorApproval(address operator) virtual {
        _checkFilterOperator(operator);
        _;
    }

    /**
     * @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero
     *         address, checks will be bypassed. OnlyOwner.
     */
    function updateOperatorFilterRegistryAddress(address newRegistry) public virtual {
        if (msg.sender != owner()) {
            revert OnlyOwner();
        }
        operatorFilterRegistry = IOperatorFilterRegistry(newRegistry);
    }

    /**
     * @dev assume the contract has an owner, but leave specific Ownable implementation up to inheriting contract
     */
    function owner() public view virtual returns (address);

    function _checkFilterOperator(address operator) internal view virtual {
        IOperatorFilterRegistry registry = operatorFilterRegistry;
        // Check registry code length to facilitate testing in environments without a deployed registry.
        if (address(registry) != address(0) && address(registry).code.length > 0) {
            if (!registry.isOperatorAllowed(address(this), operator)) {
                revert OperatorNotAllowed(operator);
            }
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"bps","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InitialRegistryAddressCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"OnlyOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"RegistryHasBeenRevoked","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":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAWER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"availableToWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getFeeBps","outputs":[{"internalType":"uint256[]","name":"bps","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getFeeRecipients","outputs":[{"internalType":"address payable[]","name":"recipients","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getRoyalties","outputs":[{"internalType":"address payable[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"bps","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isOperatorFilterRegistryRevoked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorFilterRegistry","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"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":[{"internalType":"address","name":"redeemer","type":"address"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"minPrice","type":"uint256"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct genR5.NFTVoucher","name":"voucher","type":"tuple"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"redeemer","type":"address"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"minPrice","type":"uint256"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct genR5.NFTVoucher","name":"voucher","type":"tuple"}],"name":"redeemWithGelato","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revokeOperatorFilterRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"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":"string","name":"_URI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_URI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"active","type":"bool"}],"name":"setGelatoActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"max","type":"uint256"}],"name":"setMaxByOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setMinimumFundToKeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"bps","type":"uint256"}],"name":"setupRoyalties","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":"tokenId","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":"newRegistry","type":"address"}],"name":"updateOperatorFilterRegistryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101406040523480156200001257600080fd5b506040516200466f3803806200466f8339810160408190526200003591620005b4565b6daaeb6d7670e522a718067333cd4e733cc6cdda760b79bafa08df41ecfa224f810dceb66001828282866040518060400160405280601281526020017133b2b7291a96b6b4b73a16bb37bab1b432b960711b815250604051806040016040528060018152602001603160f81b8152506040518060400160405280600581526020016467656e523560d81b8152506040518060400160405280600581526020016467656e523560d81b8152508160009080519060200190620000f89291906200050e565b5080516200010e9060019060208401906200050e565b5050506200012b620001256200040460201b60201c565b62000408565b815160208084019190912082518383012060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81880181905281830187905260608201869052608082019490945230818401528151808203909301835260c00190528051940193909320919290916080523060c052610120525050600a80546001600160a01b031990811633179091556009939093555050600b80546001600160a01b03861692168217905583903b15620003065781156200026557604051633e9f1edf60e11b81523060048201526001600160a01b038481166024830152821690637d3e3dbe906044015b600060405180830381600087803b1580156200024657600080fd5b505af11580156200025b573d6000803e3d6000fd5b5050505062000306565b6001600160a01b03831615620002aa5760405163a0af290360e01b81523060048201526001600160a01b03848116602483015282169063a0af2903906044016200022b565b604051632210724360e11b81523060048201526001600160a01b03821690634420e48690602401600060405180830381600087803b158015620002ec57600080fd5b505af115801562000301573d6000803e3d6000fd5b505050505b5050506001600160a01b0384169050620003335760405163c49d17ad60e01b815260040160405180910390fd5b5050604080516020810191829052600090819052620003579250600c91906200050e565b506040805160208101918290526000908190526200037891600d916200050e565b506010805460ff191660019081179091556011556000601255620003c47f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6620003be3390565b6200045a565b620003d16000336200045a565b620003fd7f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e4336200045a565b506200060a565b3390565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6200046682826200046a565b5050565b60008281526008602090815260408083206001600160a01b038516845290915290205460ff16620004665760008281526008602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620004ca3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b8280546200051c90620005ce565b90600052602060002090601f0160209004810192826200054057600085556200058b565b82601f106200055b57805160ff19168380011785556200058b565b828001600101855582156200058b579182015b828111156200058b5782518255916020019190600101906200056e565b50620005999291506200059d565b5090565b5b808211156200059957600081556001016200059e565b600060208284031215620005c757600080fd5b5051919050565b600181811c90821680620005e357607f821691505b6020821081036200060457634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e05161010051610120516140156200065a60003960006134390152600061348801526000613463015260006133bc015260006133e60152600061341001526140156000f3fe6080604052600436106102f65760003560e01c806391d148541161018f578063b9c4d9fb116100e1578063d547741f1161008a578063e985e9c511610064578063e985e9c514610929578063ecba222a14610972578063f2fde38b1461099357600080fd5b8063d547741f146108df578063e322ad2b146108ff578063e8a3d4851461091457600080fd5b8063c87b56dd116100bb578063c87b56dd1461086b578063d3fc98641461088b578063d5391393146108ab57600080fd5b8063b9c4d9fb146107f0578063bb3bafd61461081d578063c57cdcfe1461084b57600080fd5b80639d2dd7c411610143578063b0ccc31e1161011d578063b0ccc31e14610790578063b88d4fde146107b0578063b8d1e532146107d057600080fd5b80639d2dd7c41461073b578063a217fddf1461075b578063a22cb4651461077057600080fd5b806395d89b411161017457806395d89b41146106e6578063960850b7146106fb5780639b85e23a1461071b57600080fd5b806391d1485414610680578063938e3d7b146106c657600080fd5b806336568abe116102485780636352211e116101fc57806385f438c1116101d657806385f438c1146106245780638a9a72b8146106585780638da5cb5b1461066b57600080fd5b80636352211e146105cf57806370a08231146105ef578063715018a61461060f57600080fd5b806355f804b31161022d57806355f804b314610587578063564b81ef146105a75780635ef9432a146105ba57600080fd5b806336568abe1461054757806342842e0e1461056757600080fd5b80630ebd4c7f116102aa5780632a55205a116102845780632a55205a146104c85780632e1a7d4d146105075780632f2ff15d1461052757600080fd5b80630ebd4c7f1461044b57806323b872dd14610478578063248a9ca31461049857600080fd5b8063081812fc116102db578063081812fc146103d057806308708a7814610408578063095ea7b31461042957600080fd5b806301ffc9a71461037957806306fdde03146103ae57600080fd5b3661037457600e546103083482613851565b1161035a5760405162461bcd60e51b815260206004820152601460248201527f746f6f206d616e79206574686572732073656e7400000000000000000000000060448201526064015b60405180910390fd5b34600e600082825461036c9190613851565b925050819055005b600080fd5b34801561038557600080fd5b5061039961039436600461387f565b6109b3565b60405190151581526020015b60405180910390f35b3480156103ba57600080fd5b506103c36109e2565b6040516103a591906138f4565b3480156103dc57600080fd5b506103f06103eb366004613907565b610a74565b6040516001600160a01b0390911681526020016103a5565b61041b610416366004613937565b610a9b565b6040519081526020016103a5565b34801561043557600080fd5b5061044961044436600461398c565b610cb0565b005b34801561045757600080fd5b5061046b610466366004613907565b610cc9565b6040516103a591906139f1565b34801561048457600080fd5b50610449610493366004613a04565b610d25565b3480156104a457600080fd5b5061041b6104b3366004613907565b60009081526008602052604090206001015490565b3480156104d457600080fd5b506104e86104e3366004613a40565b610d50565b604080516001600160a01b0390931683526020830191909152016103a5565b34801561051357600080fd5b50610449610522366004613907565b610d8b565b34801561053357600080fd5b50610449610542366004613a62565b610f78565b34801561055357600080fd5b50610449610562366004613a62565b610f9d565b34801561057357600080fd5b50610449610582366004613a04565b611029565b34801561059357600080fd5b506104496105a2366004613b3a565b61104e565b3480156105b357600080fd5b504661041b565b3480156105c657600080fd5b50610449611069565b3480156105db57600080fd5b506103f06105ea366004613907565b6110fd565b3480156105fb57600080fd5b5061041b61060a366004613b6f565b611162565b34801561061b57600080fd5b506104496111fc565b34801561063057600080fd5b5061041b7f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e481565b61041b610666366004613937565b611210565b34801561067757600080fd5b506103f061149f565b34801561068c57600080fd5b5061039961069b366004613a62565b60009182526008602090815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156106d257600080fd5b506104496106e1366004613b3a565b6114b8565b3480156106f257600080fd5b506103c36114d3565b34801561070757600080fd5b50610449610716366004613907565b6114e2565b34801561072757600080fd5b50610449610736366004613b98565b6114ef565b34801561074757600080fd5b50610449610756366004613907565b61150a565b34801561076757600080fd5b5061041b600081565b34801561077c57600080fd5b5061044961078b366004613bb5565b611517565b34801561079c57600080fd5b50600b546103f0906001600160a01b031681565b3480156107bc57600080fd5b506104496107cb366004613be1565b61152b565b3480156107dc57600080fd5b506104496107eb366004613b6f565b611558565b3480156107fc57600080fd5b5061081061080b366004613907565b6115de565b6040516103a59190613c96565b34801561082957600080fd5b5061083d610838366004613907565b611657565b6040516103a5929190613ca9565b34801561085757600080fd5b5061044961086636600461398c565b61170b565b34801561087757600080fd5b506103c3610886366004613907565b611797565b34801561089757600080fd5b506104496108a6366004613cd7565b61189a565b3480156108b757600080fd5b5061041b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b3480156108eb57600080fd5b506104496108fa366004613a62565b6119f2565b34801561090b57600080fd5b50600e5461041b565b34801561092057600080fd5b506103c3611a17565b34801561093557600080fd5b50610399610944366004613d2e565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561097e57600080fd5b50600b5461039990600160a01b900460ff1681565b34801561099f57600080fd5b506104496109ae366004613b6f565b611a26565b60006109be82611ab6565b806109cd57506109cd82611b51565b806109dc57506109dc82611b8f565b92915050565b6060600080546109f190613d58565b80601f0160208091040260200160405190810160405280929190818152602001828054610a1d90613d58565b8015610a6a5780601f10610a3f57610100808354040283529160200191610a6a565b820191906000526020600020905b815481529060010190602001808311610a4d57829003601f168201915b5050505050905090565b6000610a7f82611c01565b506000908152600460205260409020546001600160a01b031690565b60006107b460125410610ae55760405162461bcd60e51b815260206004820152601260248201527113505617d4d554141316481c995858da195960721b6044820152606401610351565b601154610af184611162565b10610b335760405162461bcd60e51b81526020600482015260126024820152711b585e109e53dddb995c881c995858da195960721b6044820152606401610351565b6000610b3e83611c65565b6001600160a01b03811660009081527f51a495916474fe1a0c0fcfb65a8a97682b84a054118858cdd1f5dfd7fc0919eb602052604090205490915060ff16610bd25760405162461bcd60e51b815260206004820152602160248201527f5369676e617475726520696e76616c6964206f7220756e617574686f72697a656044820152601960fa1b6064820152608401610351565b8260200135341015610c265760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e742066756e647320746f2072656465656d000000006044820152606401610351565b610c31818435611cc5565b610c7d8335610c436040860186613d92565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611e5e92505050565b60128054906000610c8d83613dd9565b90915550610c9f905081858535611f07565b610ca83461210d565b505035919050565b81610cba81612127565b610cc48383612141565b505050565b600a546060906001600160a01b031615610d2057604080516001808252818301909252906020808301908036833701905050905060095481600081518110610d1357610d13613df2565b6020026020010181815250505b919050565b826001600160a01b0381163314610d3f57610d3f33612127565b610d4a84848461226d565b50505050565b600a5460095460009182916001600160a01b039091169061271090610d759086613e08565b610d7f9190613e27565b915091505b9250929050565b3360009081527f3bccf5cb189214c07c3848da21cada043fa2ea5f6dfe1e4a6054ec3141f2d3d4602052604090205460ff16610e2f5760405162461bcd60e51b815260206004820152602860248201527f4f6e6c7920617574686f72697a65642077697468647261776572732063616e2060448201527f77697468647261770000000000000000000000000000000000000000000000006064820152608401610351565b600e54811115610e815760405162461bcd60e51b815260206004820152601b60248201527f546f6f206d75636820616d6f756e7420746f20776974686472617700000000006044820152606401610351565b610e8961149f565b6001600160a01b0316336001600160a01b031614610f2657600f5481600e54610eb29190613e49565b1015610f265760405162461bcd60e51b815260206004820152603560248201527f546f6f206d75636820616d6f756e7420746f20776974686472617720746f206b60448201527f656570206d696e696d756d46756e64546f4b65657000000000000000000000006064820152608401610351565b600033905081600e6000828254610f3d9190613e49565b90915550506040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015610cc4573d6000803e3d6000fd5b600082815260086020526040902060010154610f93816122e4565b610cc483836122ee565b6001600160a01b038116331461101b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610351565b6110258282612390565b5050565b826001600160a01b03811633146110435761104333612127565b610d4a848484612413565b61105661242e565b805161102590600c9060208401906137a2565b61107161149f565b6001600160a01b0316336001600160a01b0316146110a257604051635fc483c560e01b815260040160405180910390fd5b600b54600160a01b900460ff16156110cd57604051631551a48f60e11b815260040160405180910390fd5b600b80547fffffffffffffffffffffff00000000000000000000000000000000000000000016600160a01b179055565b6000818152600260205260408120546001600160a01b0316806109dc5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610351565b60006001600160a01b0382166111e05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e657200000000000000000000000000000000000000000000006064820152608401610351565b506001600160a01b031660009081526003602052604090205490565b61120461242e565b61120e600061248d565b565b600073abcc9b596420a9e9172fd5938620e265a0f9df9233146112755760405162461bcd60e51b815260206004820152600f60248201527f6f6e6c7947656c61746f52656c617900000000000000000000000000000000006044820152606401610351565b60105460ff166112c75760405162461bcd60e51b815260206004820152601460248201527f47656c61746f206973206e6f74206163746976650000000000000000000000006044820152606401610351565b6107b46012541061130f5760405162461bcd60e51b815260206004820152601260248201527113505617d4d554141316481c995858da195960721b6044820152606401610351565b60115461131b84611162565b1061135d5760405162461bcd60e51b81526020600482015260126024820152711b585e109e53dddb995c881c995858da195960721b6044820152606401610351565b600061136883611c65565b6001600160a01b03811660009081527f51a495916474fe1a0c0fcfb65a8a97682b84a054118858cdd1f5dfd7fc0919eb602052604090205490915060ff166113fc5760405162461bcd60e51b815260206004820152602160248201527f5369676e617475726520696e76616c6964206f7220756e617574686f72697a656044820152601960fa1b6064820152608401610351565b82602001353410156114505760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e742066756e647320746f2072656465656d000000006044820152606401610351565b6114586124df565b611463818435611cc5565b6114758335610c436040860186613d92565b61148181858535611f07565b6012805490600061149183613dd9565b9190505550610ca83461210d565b60006114b36007546001600160a01b031690565b905090565b6114c061242e565b805161102590600d9060208401906137a2565b6060600180546109f190613d58565b6114ea61242e565b601155565b6114f761242e565b6010805460ff1916911515919091179055565b61151261242e565b600f55565b8161152181612127565b610cc4838361250a565b836001600160a01b03811633146115455761154533612127565b61155185858585612515565b5050505050565b61156061149f565b6001600160a01b0316336001600160a01b03161461159157604051635fc483c560e01b815260040160405180910390fd5b600b54600160a01b900460ff16156115bc57604051631551a48f60e11b815260040160405180910390fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b600a546060906001600160a01b031615610d205760408051600180825281830190925290602080830190803683375050600a5482519293506001600160a01b03169183915060009061163257611632613df2565b60200260200101906001600160a01b031690816001600160a01b031681525050919050565b600a5460609081906001600160a01b0316156117065760408051600180825281830190925290602080830190803683375050600a5482519294506001600160a01b0316918491506000906116ad576116ad613df2565b6001600160a01b0392909216602092830291909101820152604080516001808252818301909252918281019080368337019050509050600954816000815181106116f9576116f9613df2565b6020026020010181815250505b915091565b61171361149f565b6001600160a01b0316336001600160a01b0316146117735760405162461bcd60e51b815260206004820152601d60248201527f6f6e6c79206f776e65722063616e207365747570526f79616c746965730000006044820152606401610351565b600a80546001600160a01b0319166001600160a01b03841617905560098190555050565b60606117a282611c01565b600082815260066020526040812080546117bb90613d58565b80601f01602080910402602001604051908101604052809291908181526020018280546117e790613d58565b80156118345780601f1061180957610100808354040283529160200191611834565b820191906000526020600020905b81548152906001019060200180831161181757829003601f168201915b50505050509050600061184561258d565b90508051600003611857575092915050565b815115611889578082604051602001611871929190613e60565b60405160208183030381529060405292505050919050565b6118928461259c565b949350505050565b3360009081527f51a495916474fe1a0c0fcfb65a8a97682b84a054118858cdd1f5dfd7fc0919eb602052604090205460ff166119185760405162461bcd60e51b815260206004820152601460248201527f6f6e6c79206d696e7465722063616e206d696e740000000000000000000000006044820152606401610351565b6107b4601254106119605760405162461bcd60e51b815260206004820152601260248201527113505617d4d554141316481c995858da195960721b6044820152606401610351565b60115461196c84611162565b106119ae5760405162461bcd60e51b81526020600482015260126024820152711b585e109e53dddb995c881c995858da195960721b6044820152606401610351565b6119b83383611cc5565b6119c28282611e5e565b601280549060006119d283613dd9565b9091555050336001600160a01b03841614610cc457610cc4338484611f07565b600082815260086020526040902060010154611a0d816122e4565b610cc48383612390565b6060600d80546109f190613d58565b611a2e61242e565b6001600160a01b038116611aaa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610351565b611ab38161248d565b50565b60006001600160e01b031982167f80ac58cd000000000000000000000000000000000000000000000000000000001480611b1957506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b806109dc57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146109dc565b60006001600160e01b031982167f7965db0b0000000000000000000000000000000000000000000000000000000014806109dc57506109dc82611ab6565b60006001600160e01b031982167fb7799584000000000000000000000000000000000000000000000000000000001480611bf257506001600160e01b031982167f2a55205a00000000000000000000000000000000000000000000000000000000145b806109dc57506109dc82611b51565b6000818152600260205260409020546001600160a01b0316611ab35760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610351565b600080611c7183612602565b9050611cbe81611c846060860186613d92565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061269392505050565b9392505050565b6001600160a01b038216611d1b5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610351565b6000818152600260205260409020546001600160a01b031615611d805760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610351565b611d8e6000838360016126b7565b6000818152600260205260409020546001600160a01b031615611df35760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610351565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000828152600260205260409020546001600160a01b0316611ee85760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201527f6578697374656e7420746f6b656e0000000000000000000000000000000000006064820152608401610351565b60008281526006602090815260409091208251610cc4928401906137a2565b826001600160a01b0316611f1a826110fd565b6001600160a01b031614611f7e5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610351565b6001600160a01b038216611ff95760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610351565b61200683838360016126b7565b826001600160a01b0316612019826110fd565b6001600160a01b03161461207d5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610351565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b80600e600082825461211f9190613851565b909155505050565b600b546001600160a01b031615611ab357611ab38161273f565b600061214c826110fd565b9050806001600160a01b0316836001600160a01b0316036121d55760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610351565b336001600160a01b03821614806121f157506121f18133610944565b6122635760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610351565b610cc48383612833565b61227733826128a1565b6122d95760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608401610351565b610cc4838383611f07565b611ab3813361291f565b60008281526008602090815260408083206001600160a01b038516845290915290205460ff166110255760008281526008602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561234c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526008602090815260408083206001600160a01b038516845290915290205460ff16156110255760008281526008602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610cc48383836040518060200160405280600081525061152b565b3361243761149f565b6001600160a01b03161461120e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610351565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61120e36604719013560601c36601f19013536603319013560601c6001600160a01b03169190612994565b6110253383836129e3565b61251f33836128a1565b6125815760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608401610351565b610d4a84848484612ab1565b6060600c80546109f190613d58565b60606125a782611c01565b60006125b161258d565b905060008151116125d15760405180602001604052806000815250611cbe565b806125db84612b3a565b6040516020016125ec929190613e60565b6040516020818303038152906040529392505050565b60006109dc7f6316f9ddd4d59a364f3b95c26bab9d392c3380ace0fff15e91ed76f0d8bcd15a8335602085013561263c6040870187613d92565b60405161264a929190613e8f565b6040519081900381206126789493929160200193845260208401929092526040830152606082015260800190565b60405160208183030381529060405280519060200120612bda565b60008060006126a28585612c43565b915091506126af81612c85565b509392505050565b6001811115610d4a576001600160a01b038416156126fd576001600160a01b038416600090815260036020526040812080548392906126f7908490613e49565b90915550505b6001600160a01b03831615610d4a576001600160a01b03831660009081526003602052604081208054839290612734908490613851565b909155505050505050565b600b546001600160a01b0316801580159061276457506000816001600160a01b03163b115b15611025576040517fc61711340000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015282169063c617113490604401602060405180830381865afa1580156127ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127f29190613e9f565b611025576040517fede71dcc0000000000000000000000000000000000000000000000000000000081526001600160a01b0383166004820152602401610351565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612868826110fd565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806128ad836110fd565b9050806001600160a01b0316846001600160a01b031614806128f457506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806118925750836001600160a01b031661290d84610a74565b6001600160a01b031614949350505050565b60008281526008602090815260408083206001600160a01b038516845290915290205460ff166110255761295281612dea565b61295d836020612dfc565b60405160200161296e929190613ebc565b60408051601f198184030181529082905262461bcd60e51b8252610351916004016138f4565b806000036129a157505050565b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146129d957610cc46001600160a01b0384168383612fdd565b610cc4828261305d565b816001600160a01b0316836001600160a01b031603612a445760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610351565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612abc848484611f07565b612ac884848484613176565b610d4a5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610351565b60606000612b47836132cd565b600101905060008167ffffffffffffffff811115612b6757612b67613a8e565b6040519080825280601f01601f191660200182016040528015612b91576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084612b9b57509392505050565b60006109dc612be76133af565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000808251604103612c795760208301516040840151606085015160001a612c6d878285856134d6565b94509450505050610d84565b50600090506002610d84565b6000816004811115612c9957612c99613f3d565b03612ca15750565b6001816004811115612cb557612cb5613f3d565b03612d025760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610351565b6002816004811115612d1657612d16613f3d565b03612d635760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610351565b6003816004811115612d7757612d77613f3d565b03611ab35760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610351565b60606109dc6001600160a01b03831660145b60606000612e0b836002613e08565b612e16906002613851565b67ffffffffffffffff811115612e2e57612e2e613a8e565b6040519080825280601f01601f191660200182016040528015612e58576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110612e8f57612e8f613df2565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612eda57612eda613df2565b60200101906001600160f81b031916908160001a9053506000612efe846002613e08565b612f09906001613851565b90505b6001811115612f8e577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110612f4a57612f4a613df2565b1a60f81b828281518110612f6057612f60613df2565b60200101906001600160f81b031916908160001a90535060049490941c93612f8781613f53565b9050612f0c565b508315611cbe5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610351565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610cc490849061359a565b804710156130ad5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610351565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146130fa576040519150601f19603f3d011682016040523d82523d6000602084013e6130ff565b606091505b5050905080610cc45760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610351565b60006001600160a01b0384163b156132c257604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906131ba903390899088908890600401613f6a565b6020604051808303816000875af19250505080156131f5575060408051601f3d908101601f191682019092526131f291810190613fa6565b60015b6132a8573d808015613223576040519150601f19603f3d011682016040523d82523d6000602084013e613228565b606091505b5080516000036132a05760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610351565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611892565b506001949350505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310613316577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310613342576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061336057662386f26fc10000830492506010015b6305f5e1008310613378576305f5e100830492506008015b612710831061338c57612710830492506004015b6064831061339e576064830492506002015b600a83106109dc5760010192915050565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561340857507f000000000000000000000000000000000000000000000000000000000000000046145b1561343257507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561350d5750600090506003613591565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613561573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661358a57600060019250925050613591565b9150600090505b94509492505050565b60006135ef826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661367f9092919063ffffffff16565b805190915015610cc4578080602001905181019061360d9190613e9f565b610cc45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610351565b6060611892848460008585600080866001600160a01b031685876040516136a69190613fc3565b60006040518083038185875af1925050503d80600081146136e3576040519150601f19603f3d011682016040523d82523d6000602084013e6136e8565b606091505b50915091506136f987838387613704565b979650505050505050565b6060831561377357825160000361376c576001600160a01b0385163b61376c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610351565b5081611892565b61189283838151156137885781518083602001fd5b8060405162461bcd60e51b815260040161035191906138f4565b8280546137ae90613d58565b90600052602060002090601f0160209004810192826137d05760008555613816565b82601f106137e957805160ff1916838001178555613816565b82800160010185558215613816579182015b828111156138165782518255916020019190600101906137fb565b50613822929150613826565b5090565b5b808211156138225760008155600101613827565b634e487b7160e01b600052601160045260246000fd5b600082198211156138645761386461383b565b500190565b6001600160e01b031981168114611ab357600080fd5b60006020828403121561389157600080fd5b8135611cbe81613869565b60005b838110156138b757818101518382015260200161389f565b83811115610d4a5750506000910152565b600081518084526138e081602086016020860161389c565b601f01601f19169290920160200192915050565b602081526000611cbe60208301846138c8565b60006020828403121561391957600080fd5b5035919050565b80356001600160a01b0381168114610d2057600080fd5b6000806040838503121561394a57600080fd5b61395383613920565b9150602083013567ffffffffffffffff81111561396f57600080fd5b83016080818603121561398157600080fd5b809150509250929050565b6000806040838503121561399f57600080fd5b6139a883613920565b946020939093013593505050565b600081518084526020808501945080840160005b838110156139e6578151875295820195908201906001016139ca565b509495945050505050565b602081526000611cbe60208301846139b6565b600080600060608486031215613a1957600080fd5b613a2284613920565b9250613a3060208501613920565b9150604084013590509250925092565b60008060408385031215613a5357600080fd5b50508035926020909101359150565b60008060408385031215613a7557600080fd5b82359150613a8560208401613920565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115613abf57613abf613a8e565b604051601f8501601f19908116603f01168101908282118183101715613ae757613ae7613a8e565b81604052809350858152868686011115613b0057600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112613b2b57600080fd5b611cbe83833560208501613aa4565b600060208284031215613b4c57600080fd5b813567ffffffffffffffff811115613b6357600080fd5b61189284828501613b1a565b600060208284031215613b8157600080fd5b611cbe82613920565b8015158114611ab357600080fd5b600060208284031215613baa57600080fd5b8135611cbe81613b8a565b60008060408385031215613bc857600080fd5b613bd183613920565b9150602083013561398181613b8a565b60008060008060808587031215613bf757600080fd5b613c0085613920565b9350613c0e60208601613920565b925060408501359150606085013567ffffffffffffffff811115613c3157600080fd5b8501601f81018713613c4257600080fd5b613c5187823560208401613aa4565b91505092959194509250565b600081518084526020808501945080840160005b838110156139e65781516001600160a01b031687529582019590820190600101613c71565b602081526000611cbe6020830184613c5d565b604081526000613cbc6040830185613c5d565b8281036020840152613cce81856139b6565b95945050505050565b600080600060608486031215613cec57600080fd5b613cf584613920565b925060208401359150604084013567ffffffffffffffff811115613d1857600080fd5b613d2486828701613b1a565b9150509250925092565b60008060408385031215613d4157600080fd5b613d4a83613920565b9150613a8560208401613920565b600181811c90821680613d6c57607f821691505b602082108103613d8c57634e487b7160e01b600052602260045260246000fd5b50919050565b6000808335601e19843603018112613da957600080fd5b83018035915067ffffffffffffffff821115613dc457600080fd5b602001915036819003821315610d8457600080fd5b600060018201613deb57613deb61383b565b5060010190565b634e487b7160e01b600052603260045260246000fd5b6000816000190483118215151615613e2257613e2261383b565b500290565b600082613e4457634e487b7160e01b600052601260045260246000fd5b500490565b600082821015613e5b57613e5b61383b565b500390565b60008351613e7281846020880161389c565b835190830190613e8681836020880161389c565b01949350505050565b8183823760009101908152919050565b600060208284031215613eb157600080fd5b8151611cbe81613b8a565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613ef481601785016020880161389c565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351613f3181602884016020880161389c565b01602801949350505050565b634e487b7160e01b600052602160045260246000fd5b600081613f6257613f6261383b565b506000190190565b60006001600160a01b03808716835280861660208401525083604083015260806060830152613f9c60808301846138c8565b9695505050505050565b600060208284031215613fb857600080fd5b8151611cbe81613869565b60008251613fd581846020870161389c565b919091019291505056fea2646970667358221220f717534e84e197a96732096d2ec349f7b7f8a7fa98117603210ede119403409764736f6c634300080d003300000000000000000000000000000000000000000000000000000000000001f4

Deployed Bytecode

0x6080604052600436106102f65760003560e01c806391d148541161018f578063b9c4d9fb116100e1578063d547741f1161008a578063e985e9c511610064578063e985e9c514610929578063ecba222a14610972578063f2fde38b1461099357600080fd5b8063d547741f146108df578063e322ad2b146108ff578063e8a3d4851461091457600080fd5b8063c87b56dd116100bb578063c87b56dd1461086b578063d3fc98641461088b578063d5391393146108ab57600080fd5b8063b9c4d9fb146107f0578063bb3bafd61461081d578063c57cdcfe1461084b57600080fd5b80639d2dd7c411610143578063b0ccc31e1161011d578063b0ccc31e14610790578063b88d4fde146107b0578063b8d1e532146107d057600080fd5b80639d2dd7c41461073b578063a217fddf1461075b578063a22cb4651461077057600080fd5b806395d89b411161017457806395d89b41146106e6578063960850b7146106fb5780639b85e23a1461071b57600080fd5b806391d1485414610680578063938e3d7b146106c657600080fd5b806336568abe116102485780636352211e116101fc57806385f438c1116101d657806385f438c1146106245780638a9a72b8146106585780638da5cb5b1461066b57600080fd5b80636352211e146105cf57806370a08231146105ef578063715018a61461060f57600080fd5b806355f804b31161022d57806355f804b314610587578063564b81ef146105a75780635ef9432a146105ba57600080fd5b806336568abe1461054757806342842e0e1461056757600080fd5b80630ebd4c7f116102aa5780632a55205a116102845780632a55205a146104c85780632e1a7d4d146105075780632f2ff15d1461052757600080fd5b80630ebd4c7f1461044b57806323b872dd14610478578063248a9ca31461049857600080fd5b8063081812fc116102db578063081812fc146103d057806308708a7814610408578063095ea7b31461042957600080fd5b806301ffc9a71461037957806306fdde03146103ae57600080fd5b3661037457600e546103083482613851565b1161035a5760405162461bcd60e51b815260206004820152601460248201527f746f6f206d616e79206574686572732073656e7400000000000000000000000060448201526064015b60405180910390fd5b34600e600082825461036c9190613851565b925050819055005b600080fd5b34801561038557600080fd5b5061039961039436600461387f565b6109b3565b60405190151581526020015b60405180910390f35b3480156103ba57600080fd5b506103c36109e2565b6040516103a591906138f4565b3480156103dc57600080fd5b506103f06103eb366004613907565b610a74565b6040516001600160a01b0390911681526020016103a5565b61041b610416366004613937565b610a9b565b6040519081526020016103a5565b34801561043557600080fd5b5061044961044436600461398c565b610cb0565b005b34801561045757600080fd5b5061046b610466366004613907565b610cc9565b6040516103a591906139f1565b34801561048457600080fd5b50610449610493366004613a04565b610d25565b3480156104a457600080fd5b5061041b6104b3366004613907565b60009081526008602052604090206001015490565b3480156104d457600080fd5b506104e86104e3366004613a40565b610d50565b604080516001600160a01b0390931683526020830191909152016103a5565b34801561051357600080fd5b50610449610522366004613907565b610d8b565b34801561053357600080fd5b50610449610542366004613a62565b610f78565b34801561055357600080fd5b50610449610562366004613a62565b610f9d565b34801561057357600080fd5b50610449610582366004613a04565b611029565b34801561059357600080fd5b506104496105a2366004613b3a565b61104e565b3480156105b357600080fd5b504661041b565b3480156105c657600080fd5b50610449611069565b3480156105db57600080fd5b506103f06105ea366004613907565b6110fd565b3480156105fb57600080fd5b5061041b61060a366004613b6f565b611162565b34801561061b57600080fd5b506104496111fc565b34801561063057600080fd5b5061041b7f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e481565b61041b610666366004613937565b611210565b34801561067757600080fd5b506103f061149f565b34801561068c57600080fd5b5061039961069b366004613a62565b60009182526008602090815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156106d257600080fd5b506104496106e1366004613b3a565b6114b8565b3480156106f257600080fd5b506103c36114d3565b34801561070757600080fd5b50610449610716366004613907565b6114e2565b34801561072757600080fd5b50610449610736366004613b98565b6114ef565b34801561074757600080fd5b50610449610756366004613907565b61150a565b34801561076757600080fd5b5061041b600081565b34801561077c57600080fd5b5061044961078b366004613bb5565b611517565b34801561079c57600080fd5b50600b546103f0906001600160a01b031681565b3480156107bc57600080fd5b506104496107cb366004613be1565b61152b565b3480156107dc57600080fd5b506104496107eb366004613b6f565b611558565b3480156107fc57600080fd5b5061081061080b366004613907565b6115de565b6040516103a59190613c96565b34801561082957600080fd5b5061083d610838366004613907565b611657565b6040516103a5929190613ca9565b34801561085757600080fd5b5061044961086636600461398c565b61170b565b34801561087757600080fd5b506103c3610886366004613907565b611797565b34801561089757600080fd5b506104496108a6366004613cd7565b61189a565b3480156108b757600080fd5b5061041b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b3480156108eb57600080fd5b506104496108fa366004613a62565b6119f2565b34801561090b57600080fd5b50600e5461041b565b34801561092057600080fd5b506103c3611a17565b34801561093557600080fd5b50610399610944366004613d2e565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561097e57600080fd5b50600b5461039990600160a01b900460ff1681565b34801561099f57600080fd5b506104496109ae366004613b6f565b611a26565b60006109be82611ab6565b806109cd57506109cd82611b51565b806109dc57506109dc82611b8f565b92915050565b6060600080546109f190613d58565b80601f0160208091040260200160405190810160405280929190818152602001828054610a1d90613d58565b8015610a6a5780601f10610a3f57610100808354040283529160200191610a6a565b820191906000526020600020905b815481529060010190602001808311610a4d57829003601f168201915b5050505050905090565b6000610a7f82611c01565b506000908152600460205260409020546001600160a01b031690565b60006107b460125410610ae55760405162461bcd60e51b815260206004820152601260248201527113505617d4d554141316481c995858da195960721b6044820152606401610351565b601154610af184611162565b10610b335760405162461bcd60e51b81526020600482015260126024820152711b585e109e53dddb995c881c995858da195960721b6044820152606401610351565b6000610b3e83611c65565b6001600160a01b03811660009081527f51a495916474fe1a0c0fcfb65a8a97682b84a054118858cdd1f5dfd7fc0919eb602052604090205490915060ff16610bd25760405162461bcd60e51b815260206004820152602160248201527f5369676e617475726520696e76616c6964206f7220756e617574686f72697a656044820152601960fa1b6064820152608401610351565b8260200135341015610c265760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e742066756e647320746f2072656465656d000000006044820152606401610351565b610c31818435611cc5565b610c7d8335610c436040860186613d92565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611e5e92505050565b60128054906000610c8d83613dd9565b90915550610c9f905081858535611f07565b610ca83461210d565b505035919050565b81610cba81612127565b610cc48383612141565b505050565b600a546060906001600160a01b031615610d2057604080516001808252818301909252906020808301908036833701905050905060095481600081518110610d1357610d13613df2565b6020026020010181815250505b919050565b826001600160a01b0381163314610d3f57610d3f33612127565b610d4a84848461226d565b50505050565b600a5460095460009182916001600160a01b039091169061271090610d759086613e08565b610d7f9190613e27565b915091505b9250929050565b3360009081527f3bccf5cb189214c07c3848da21cada043fa2ea5f6dfe1e4a6054ec3141f2d3d4602052604090205460ff16610e2f5760405162461bcd60e51b815260206004820152602860248201527f4f6e6c7920617574686f72697a65642077697468647261776572732063616e2060448201527f77697468647261770000000000000000000000000000000000000000000000006064820152608401610351565b600e54811115610e815760405162461bcd60e51b815260206004820152601b60248201527f546f6f206d75636820616d6f756e7420746f20776974686472617700000000006044820152606401610351565b610e8961149f565b6001600160a01b0316336001600160a01b031614610f2657600f5481600e54610eb29190613e49565b1015610f265760405162461bcd60e51b815260206004820152603560248201527f546f6f206d75636820616d6f756e7420746f20776974686472617720746f206b60448201527f656570206d696e696d756d46756e64546f4b65657000000000000000000000006064820152608401610351565b600033905081600e6000828254610f3d9190613e49565b90915550506040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015610cc4573d6000803e3d6000fd5b600082815260086020526040902060010154610f93816122e4565b610cc483836122ee565b6001600160a01b038116331461101b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610351565b6110258282612390565b5050565b826001600160a01b03811633146110435761104333612127565b610d4a848484612413565b61105661242e565b805161102590600c9060208401906137a2565b61107161149f565b6001600160a01b0316336001600160a01b0316146110a257604051635fc483c560e01b815260040160405180910390fd5b600b54600160a01b900460ff16156110cd57604051631551a48f60e11b815260040160405180910390fd5b600b80547fffffffffffffffffffffff00000000000000000000000000000000000000000016600160a01b179055565b6000818152600260205260408120546001600160a01b0316806109dc5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610351565b60006001600160a01b0382166111e05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e657200000000000000000000000000000000000000000000006064820152608401610351565b506001600160a01b031660009081526003602052604090205490565b61120461242e565b61120e600061248d565b565b600073abcc9b596420a9e9172fd5938620e265a0f9df9233146112755760405162461bcd60e51b815260206004820152600f60248201527f6f6e6c7947656c61746f52656c617900000000000000000000000000000000006044820152606401610351565b60105460ff166112c75760405162461bcd60e51b815260206004820152601460248201527f47656c61746f206973206e6f74206163746976650000000000000000000000006044820152606401610351565b6107b46012541061130f5760405162461bcd60e51b815260206004820152601260248201527113505617d4d554141316481c995858da195960721b6044820152606401610351565b60115461131b84611162565b1061135d5760405162461bcd60e51b81526020600482015260126024820152711b585e109e53dddb995c881c995858da195960721b6044820152606401610351565b600061136883611c65565b6001600160a01b03811660009081527f51a495916474fe1a0c0fcfb65a8a97682b84a054118858cdd1f5dfd7fc0919eb602052604090205490915060ff166113fc5760405162461bcd60e51b815260206004820152602160248201527f5369676e617475726520696e76616c6964206f7220756e617574686f72697a656044820152601960fa1b6064820152608401610351565b82602001353410156114505760405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e742066756e647320746f2072656465656d000000006044820152606401610351565b6114586124df565b611463818435611cc5565b6114758335610c436040860186613d92565b61148181858535611f07565b6012805490600061149183613dd9565b9190505550610ca83461210d565b60006114b36007546001600160a01b031690565b905090565b6114c061242e565b805161102590600d9060208401906137a2565b6060600180546109f190613d58565b6114ea61242e565b601155565b6114f761242e565b6010805460ff1916911515919091179055565b61151261242e565b600f55565b8161152181612127565b610cc4838361250a565b836001600160a01b03811633146115455761154533612127565b61155185858585612515565b5050505050565b61156061149f565b6001600160a01b0316336001600160a01b03161461159157604051635fc483c560e01b815260040160405180910390fd5b600b54600160a01b900460ff16156115bc57604051631551a48f60e11b815260040160405180910390fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b600a546060906001600160a01b031615610d205760408051600180825281830190925290602080830190803683375050600a5482519293506001600160a01b03169183915060009061163257611632613df2565b60200260200101906001600160a01b031690816001600160a01b031681525050919050565b600a5460609081906001600160a01b0316156117065760408051600180825281830190925290602080830190803683375050600a5482519294506001600160a01b0316918491506000906116ad576116ad613df2565b6001600160a01b0392909216602092830291909101820152604080516001808252818301909252918281019080368337019050509050600954816000815181106116f9576116f9613df2565b6020026020010181815250505b915091565b61171361149f565b6001600160a01b0316336001600160a01b0316146117735760405162461bcd60e51b815260206004820152601d60248201527f6f6e6c79206f776e65722063616e207365747570526f79616c746965730000006044820152606401610351565b600a80546001600160a01b0319166001600160a01b03841617905560098190555050565b60606117a282611c01565b600082815260066020526040812080546117bb90613d58565b80601f01602080910402602001604051908101604052809291908181526020018280546117e790613d58565b80156118345780601f1061180957610100808354040283529160200191611834565b820191906000526020600020905b81548152906001019060200180831161181757829003601f168201915b50505050509050600061184561258d565b90508051600003611857575092915050565b815115611889578082604051602001611871929190613e60565b60405160208183030381529060405292505050919050565b6118928461259c565b949350505050565b3360009081527f51a495916474fe1a0c0fcfb65a8a97682b84a054118858cdd1f5dfd7fc0919eb602052604090205460ff166119185760405162461bcd60e51b815260206004820152601460248201527f6f6e6c79206d696e7465722063616e206d696e740000000000000000000000006044820152606401610351565b6107b4601254106119605760405162461bcd60e51b815260206004820152601260248201527113505617d4d554141316481c995858da195960721b6044820152606401610351565b60115461196c84611162565b106119ae5760405162461bcd60e51b81526020600482015260126024820152711b585e109e53dddb995c881c995858da195960721b6044820152606401610351565b6119b83383611cc5565b6119c28282611e5e565b601280549060006119d283613dd9565b9091555050336001600160a01b03841614610cc457610cc4338484611f07565b600082815260086020526040902060010154611a0d816122e4565b610cc48383612390565b6060600d80546109f190613d58565b611a2e61242e565b6001600160a01b038116611aaa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610351565b611ab38161248d565b50565b60006001600160e01b031982167f80ac58cd000000000000000000000000000000000000000000000000000000001480611b1957506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b806109dc57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146109dc565b60006001600160e01b031982167f7965db0b0000000000000000000000000000000000000000000000000000000014806109dc57506109dc82611ab6565b60006001600160e01b031982167fb7799584000000000000000000000000000000000000000000000000000000001480611bf257506001600160e01b031982167f2a55205a00000000000000000000000000000000000000000000000000000000145b806109dc57506109dc82611b51565b6000818152600260205260409020546001600160a01b0316611ab35760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610351565b600080611c7183612602565b9050611cbe81611c846060860186613d92565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061269392505050565b9392505050565b6001600160a01b038216611d1b5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610351565b6000818152600260205260409020546001600160a01b031615611d805760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610351565b611d8e6000838360016126b7565b6000818152600260205260409020546001600160a01b031615611df35760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610351565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000828152600260205260409020546001600160a01b0316611ee85760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201527f6578697374656e7420746f6b656e0000000000000000000000000000000000006064820152608401610351565b60008281526006602090815260409091208251610cc4928401906137a2565b826001600160a01b0316611f1a826110fd565b6001600160a01b031614611f7e5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610351565b6001600160a01b038216611ff95760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610351565b61200683838360016126b7565b826001600160a01b0316612019826110fd565b6001600160a01b03161461207d5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610351565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b80600e600082825461211f9190613851565b909155505050565b600b546001600160a01b031615611ab357611ab38161273f565b600061214c826110fd565b9050806001600160a01b0316836001600160a01b0316036121d55760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610351565b336001600160a01b03821614806121f157506121f18133610944565b6122635760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610351565b610cc48383612833565b61227733826128a1565b6122d95760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608401610351565b610cc4838383611f07565b611ab3813361291f565b60008281526008602090815260408083206001600160a01b038516845290915290205460ff166110255760008281526008602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561234c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526008602090815260408083206001600160a01b038516845290915290205460ff16156110255760008281526008602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610cc48383836040518060200160405280600081525061152b565b3361243761149f565b6001600160a01b03161461120e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610351565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61120e36604719013560601c36601f19013536603319013560601c6001600160a01b03169190612994565b6110253383836129e3565b61251f33836128a1565b6125815760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608401610351565b610d4a84848484612ab1565b6060600c80546109f190613d58565b60606125a782611c01565b60006125b161258d565b905060008151116125d15760405180602001604052806000815250611cbe565b806125db84612b3a565b6040516020016125ec929190613e60565b6040516020818303038152906040529392505050565b60006109dc7f6316f9ddd4d59a364f3b95c26bab9d392c3380ace0fff15e91ed76f0d8bcd15a8335602085013561263c6040870187613d92565b60405161264a929190613e8f565b6040519081900381206126789493929160200193845260208401929092526040830152606082015260800190565b60405160208183030381529060405280519060200120612bda565b60008060006126a28585612c43565b915091506126af81612c85565b509392505050565b6001811115610d4a576001600160a01b038416156126fd576001600160a01b038416600090815260036020526040812080548392906126f7908490613e49565b90915550505b6001600160a01b03831615610d4a576001600160a01b03831660009081526003602052604081208054839290612734908490613851565b909155505050505050565b600b546001600160a01b0316801580159061276457506000816001600160a01b03163b115b15611025576040517fc61711340000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015282169063c617113490604401602060405180830381865afa1580156127ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127f29190613e9f565b611025576040517fede71dcc0000000000000000000000000000000000000000000000000000000081526001600160a01b0383166004820152602401610351565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612868826110fd565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806128ad836110fd565b9050806001600160a01b0316846001600160a01b031614806128f457506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806118925750836001600160a01b031661290d84610a74565b6001600160a01b031614949350505050565b60008281526008602090815260408083206001600160a01b038516845290915290205460ff166110255761295281612dea565b61295d836020612dfc565b60405160200161296e929190613ebc565b60408051601f198184030181529082905262461bcd60e51b8252610351916004016138f4565b806000036129a157505050565b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146129d957610cc46001600160a01b0384168383612fdd565b610cc4828261305d565b816001600160a01b0316836001600160a01b031603612a445760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610351565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612abc848484611f07565b612ac884848484613176565b610d4a5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610351565b60606000612b47836132cd565b600101905060008167ffffffffffffffff811115612b6757612b67613a8e565b6040519080825280601f01601f191660200182016040528015612b91576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084612b9b57509392505050565b60006109dc612be76133af565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000808251604103612c795760208301516040840151606085015160001a612c6d878285856134d6565b94509450505050610d84565b50600090506002610d84565b6000816004811115612c9957612c99613f3d565b03612ca15750565b6001816004811115612cb557612cb5613f3d565b03612d025760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610351565b6002816004811115612d1657612d16613f3d565b03612d635760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610351565b6003816004811115612d7757612d77613f3d565b03611ab35760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610351565b60606109dc6001600160a01b03831660145b60606000612e0b836002613e08565b612e16906002613851565b67ffffffffffffffff811115612e2e57612e2e613a8e565b6040519080825280601f01601f191660200182016040528015612e58576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110612e8f57612e8f613df2565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612eda57612eda613df2565b60200101906001600160f81b031916908160001a9053506000612efe846002613e08565b612f09906001613851565b90505b6001811115612f8e577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110612f4a57612f4a613df2565b1a60f81b828281518110612f6057612f60613df2565b60200101906001600160f81b031916908160001a90535060049490941c93612f8781613f53565b9050612f0c565b508315611cbe5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610351565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610cc490849061359a565b804710156130ad5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610351565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146130fa576040519150601f19603f3d011682016040523d82523d6000602084013e6130ff565b606091505b5050905080610cc45760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610351565b60006001600160a01b0384163b156132c257604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906131ba903390899088908890600401613f6a565b6020604051808303816000875af19250505080156131f5575060408051601f3d908101601f191682019092526131f291810190613fa6565b60015b6132a8573d808015613223576040519150601f19603f3d011682016040523d82523d6000602084013e613228565b606091505b5080516000036132a05760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610351565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611892565b506001949350505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310613316577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310613342576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061336057662386f26fc10000830492506010015b6305f5e1008310613378576305f5e100830492506008015b612710831061338c57612710830492506004015b6064831061339e576064830492506002015b600a83106109dc5760010192915050565b6000306001600160a01b037f0000000000000000000000003e0256e99a6c6034f2d82b08eeaa747fb6d7f1031614801561340857507f000000000000000000000000000000000000000000000000000000000000000146145b1561343257507fcd1dea4664288c30bab0c5b62e8e7dfe4106e8bae5843770f1b7e495dec6efee90565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f5d54b22f9d51b5a7839adb6aefb67d812eb7096045b72ad4dd08cb6bcffa52e3828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561350d5750600090506003613591565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613561573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661358a57600060019250925050613591565b9150600090505b94509492505050565b60006135ef826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661367f9092919063ffffffff16565b805190915015610cc4578080602001905181019061360d9190613e9f565b610cc45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610351565b6060611892848460008585600080866001600160a01b031685876040516136a69190613fc3565b60006040518083038185875af1925050503d80600081146136e3576040519150601f19603f3d011682016040523d82523d6000602084013e6136e8565b606091505b50915091506136f987838387613704565b979650505050505050565b6060831561377357825160000361376c576001600160a01b0385163b61376c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610351565b5081611892565b61189283838151156137885781518083602001fd5b8060405162461bcd60e51b815260040161035191906138f4565b8280546137ae90613d58565b90600052602060002090601f0160209004810192826137d05760008555613816565b82601f106137e957805160ff1916838001178555613816565b82800160010185558215613816579182015b828111156138165782518255916020019190600101906137fb565b50613822929150613826565b5090565b5b808211156138225760008155600101613827565b634e487b7160e01b600052601160045260246000fd5b600082198211156138645761386461383b565b500190565b6001600160e01b031981168114611ab357600080fd5b60006020828403121561389157600080fd5b8135611cbe81613869565b60005b838110156138b757818101518382015260200161389f565b83811115610d4a5750506000910152565b600081518084526138e081602086016020860161389c565b601f01601f19169290920160200192915050565b602081526000611cbe60208301846138c8565b60006020828403121561391957600080fd5b5035919050565b80356001600160a01b0381168114610d2057600080fd5b6000806040838503121561394a57600080fd5b61395383613920565b9150602083013567ffffffffffffffff81111561396f57600080fd5b83016080818603121561398157600080fd5b809150509250929050565b6000806040838503121561399f57600080fd5b6139a883613920565b946020939093013593505050565b600081518084526020808501945080840160005b838110156139e6578151875295820195908201906001016139ca565b509495945050505050565b602081526000611cbe60208301846139b6565b600080600060608486031215613a1957600080fd5b613a2284613920565b9250613a3060208501613920565b9150604084013590509250925092565b60008060408385031215613a5357600080fd5b50508035926020909101359150565b60008060408385031215613a7557600080fd5b82359150613a8560208401613920565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115613abf57613abf613a8e565b604051601f8501601f19908116603f01168101908282118183101715613ae757613ae7613a8e565b81604052809350858152868686011115613b0057600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112613b2b57600080fd5b611cbe83833560208501613aa4565b600060208284031215613b4c57600080fd5b813567ffffffffffffffff811115613b6357600080fd5b61189284828501613b1a565b600060208284031215613b8157600080fd5b611cbe82613920565b8015158114611ab357600080fd5b600060208284031215613baa57600080fd5b8135611cbe81613b8a565b60008060408385031215613bc857600080fd5b613bd183613920565b9150602083013561398181613b8a565b60008060008060808587031215613bf757600080fd5b613c0085613920565b9350613c0e60208601613920565b925060408501359150606085013567ffffffffffffffff811115613c3157600080fd5b8501601f81018713613c4257600080fd5b613c5187823560208401613aa4565b91505092959194509250565b600081518084526020808501945080840160005b838110156139e65781516001600160a01b031687529582019590820190600101613c71565b602081526000611cbe6020830184613c5d565b604081526000613cbc6040830185613c5d565b8281036020840152613cce81856139b6565b95945050505050565b600080600060608486031215613cec57600080fd5b613cf584613920565b925060208401359150604084013567ffffffffffffffff811115613d1857600080fd5b613d2486828701613b1a565b9150509250925092565b60008060408385031215613d4157600080fd5b613d4a83613920565b9150613a8560208401613920565b600181811c90821680613d6c57607f821691505b602082108103613d8c57634e487b7160e01b600052602260045260246000fd5b50919050565b6000808335601e19843603018112613da957600080fd5b83018035915067ffffffffffffffff821115613dc457600080fd5b602001915036819003821315610d8457600080fd5b600060018201613deb57613deb61383b565b5060010190565b634e487b7160e01b600052603260045260246000fd5b6000816000190483118215151615613e2257613e2261383b565b500290565b600082613e4457634e487b7160e01b600052601260045260246000fd5b500490565b600082821015613e5b57613e5b61383b565b500390565b60008351613e7281846020880161389c565b835190830190613e8681836020880161389c565b01949350505050565b8183823760009101908152919050565b600060208284031215613eb157600080fd5b8151611cbe81613b8a565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613ef481601785016020880161389c565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351613f3181602884016020880161389c565b01602801949350505050565b634e487b7160e01b600052602160045260246000fd5b600081613f6257613f6261383b565b506000190190565b60006001600160a01b03808716835280861660208401525083604083015260806060830152613f9c60808301846138c8565b9695505050505050565b600060208284031215613fb857600080fd5b8151611cbe81613869565b60008251613fd581846020870161389c565b919091019291505056fea2646970667358221220f717534e84e197a96732096d2ec349f7b7f8a7fa98117603210ede119403409764736f6c634300080d0033

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

00000000000000000000000000000000000000000000000000000000000001f4

-----Decoded View---------------
Arg [0] : bps (uint256): 500

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000001f4


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.