ETH Price: $2,949.42 (+0.29%)

Contract

0xa2d952a377d611e0B79F55011F7f2c89D3f0d327

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Approve4182425392026-01-05 18:25:4519 days ago1767637545IN
0xa2d952a3...9D3f0d327
0 ETH0.000000460.01

Parent Transaction Hash Block From To
View All Internal Transactions

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Fiat24CNH

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 1 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./Fiat24Token.sol";

contract Fiat24CNH is Fiat24Token {

  function initialize(address fiat24AccountProxyAddress, uint256 limitWalkin, uint256 chfRate, uint256 withdrawCharge) public initializer {
      __Fiat24Token_init_(fiat24AccountProxyAddress, "Fiat24 CNH", "CNH24", limitWalkin, chfRate, withdrawCharge);
  }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
 * supported.
 */
library EnumerableUintToUintMapUpgradeable {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.

    struct MapEntry {
        bytes32 _key;
        bytes32 _value;
    }

    struct Map {
        // Storage of map keys and values
        MapEntry[] _entries;

        // Position of the entry defined by a key in the `entries` array, plus 1
        // because index 0 means a key is not in the map.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
        // We read and store the key's index to prevent multiple reads from the same storage slot
        uint256 keyIndex = map._indexes[key];

        if (keyIndex == 0) { // Equivalent to !contains(map, key)
            map._entries.push(MapEntry({ _key: key, _value: value }));
            // The entry is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            map._indexes[key] = map._entries.length;
            return true;
        } else {
            map._entries[keyIndex - 1]._value = value;
            return false;
        }
    }

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

        if (keyIndex != 0) { // Equivalent to contains(map, key)
            // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one
            // in the array, and then remove the last entry (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = keyIndex - 1;
            uint256 lastIndex = map._entries.length - 1;

            // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            MapEntry storage lastEntry = map._entries[lastIndex];

            // Move the last entry to the index where the entry to delete is
            map._entries[toDeleteIndex] = lastEntry;
            // Update the index for the moved entry
            map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved entry was stored
            map._entries.pop();

            // Delete the index for the deleted slot
            delete map._indexes[key];

            return true;
        } else {
            return false;
        }
    }

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

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function _length(Map storage map) private view returns (uint256) {
        return map._entries.length;
    }

   /**
    * @dev Returns the key-value pair stored at position `index` in the map. O(1).
    *
    * Note that there are no guarantees on the ordering of entries inside the
    * array, and it may change when more entries are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {
        require(map._entries.length > index, "EnumerableMap: index out of bounds");

        MapEntry storage entry = map._entries[index];
        return (entry._key, entry._value);
    }

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     */
    function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) {
        uint256 keyIndex = map._indexes[key];
        if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key)
        return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function _get(Map storage map, bytes32 key) private view returns (bytes32) {
        uint256 keyIndex = map._indexes[key];
        require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key)
        return map._entries[keyIndex - 1]._value; // All indexes are 1-based
    }

    /**
     * @dev Same as {_get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {_tryGet}.
     */
    function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {
        uint256 keyIndex = map._indexes[key];
        require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key)
        return map._entries[keyIndex - 1]._value; // All indexes are 1-based
    }

    // UintToUintMap

    struct UintToUintMap {
        Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) {
        return _set(map._inner, bytes32(key), bytes32(value));
    }

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

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

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

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

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     *
     * _Available since v3.4._
     */
    function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));
        return (success, uint256(value));
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) {
        return uint256(_get(map._inner, bytes32(key)));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(UintToUintMap storage map, uint256 key, string memory errorMessage) internal view returns (uint256) {
        return uint256(_get(map._inner, bytes32(key), errorMessage));
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";

library DigitsOfUint {
    using SafeMathUpgradeable for uint256;
    function numDigits(uint256 _number) internal pure returns (uint256) {
        uint256 number = _number;
        uint256 digits = 0;
        while (number != 0) {
            number = number.div(10);
            digits = digits.add(1);
        }
        return digits;
    }
    function hasFirstDigit(uint256 _accountId, uint _firstDigit) internal pure returns (bool) {
        uint256 number = _accountId;
        while (number >= 10) {
            number = number.div(10);
        }
        return number == _firstDigit;
    }


}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface SanctionsList {
    function isSanctioned(address addr) external view returns (bool);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;


interface IFiat24Lock {
    function lock(uint256 tokenId_, address currency_, uint256 amount_) external; 
    function claim(address currency_, uint256 amount_) external;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IF24Sales {
    enum Status { Na, SoftBlocked, Tourist, Blocked, Closed, Live }
    function quotePerEther() external view returns(uint256);
    function buy() external payable returns(uint256);
}

// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/nitro/blob/master/LICENSE
// SPDX-License-Identifier: BUSL-1.1

pragma solidity >=0.4.21 <0.9.0;

/**
 * @title System level functionality
 * @notice For use by contracts to interact with core L2-specific functionality.
 * Precompiled contract that exists in every Arbitrum chain at address(100), 0x0000000000000000000000000000000000000064.
 */
interface ArbSys {
    /**
     * @notice Get Arbitrum block number (distinct from L1 block number; Arbitrum genesis block has block number 0)
     * @return block number as int
     */
    function arbBlockNumber() external view returns (uint256);

    /**
     * @notice Get Arbitrum block hash (reverts unless currentBlockNum-256 <= arbBlockNum < currentBlockNum)
     * @return block hash
     */
    function arbBlockHash(uint256 arbBlockNum) external view returns (bytes32);

    /**
     * @notice Gets the rollup's unique chain identifier
     * @return Chain identifier as int
     */
    function arbChainID() external view returns (uint256);

    /**
     * @notice Get internal version number identifying an ArbOS build
     * @return version number as int
     */
    function arbOSVersion() external view returns (uint256);

    /**
     * @notice Returns 0 since Nitro has no concept of storage gas
     * @return uint 0
     */
    function getStorageGasAvailable() external view returns (uint256);

    /**
     * @notice (deprecated) check if current call is top level (meaning it was triggered by an EoA or a L1 contract)
     * @dev this call has been deprecated and may be removed in a future release
     * @return true if current execution frame is not a call by another L2 contract
     */
    function isTopLevelCall() external view returns (bool);

    /**
     * @notice map L1 sender contract address to its L2 alias
     * @param sender sender address
     * @param unused argument no longer used
     * @return aliased sender address
     */
    function mapL1SenderContractAddressToL2Alias(address sender, address unused)
        external
        pure
        returns (address);

    /**
     * @notice check if the caller (of this caller of this) is an aliased L1 contract address
     * @return true iff the caller's address is an alias for an L1 contract address
     */
    function wasMyCallersAddressAliased() external view returns (bool);

    /**
     * @notice return the address of the caller (of this caller of this), without applying L1 contract address aliasing
     * @return address of the caller's caller, without applying L1 contract address aliasing
     */
    function myCallersAddressWithoutAliasing() external view returns (address);

    /**
     * @notice Send given amount of Eth to dest from sender.
     * This is a convenience function, which is equivalent to calling sendTxToL1 with empty data.
     * @param destination recipient address on L1
     * @return unique identifier for this L2-to-L1 transaction.
     */
    function withdrawEth(address destination) external payable returns (uint256);

    /**
     * @notice Send a transaction to L1
     * @dev it is not possible to execute on the L1 any L2-to-L1 transaction which contains data
     * to a contract address without any code (as enforced by the Bridge contract).
     * @param destination recipient address on L1
     * @param data (optional) calldata for L1 contract call
     * @return a unique identifier for this L2-to-L1 transaction.
     */
    function sendTxToL1(address destination, bytes calldata data)
        external
        payable
        returns (uint256);

    /**
     * @notice Get send Merkle tree state
     * @return size number of sends in the history
     * @return root root hash of the send history
     * @return partials hashes of partial subtrees in the send history tree
     */
    function sendMerkleTreeState()
        external
        view
        returns (
            uint256 size,
            bytes32 root,
            bytes32[] memory partials
        );

    /**
     * @notice creates a send txn from L2 to L1
     * @param position = (level << 192) + leaf = (0 << 192) + leaf = leaf
     */
    event L2ToL1Tx(
        address caller,
        address indexed destination,
        uint256 indexed hash,
        uint256 indexed position,
        uint256 arbBlockNum,
        uint256 ethBlockNum,
        uint256 timestamp,
        uint256 callvalue,
        bytes data
    );

    /// @dev DEPRECATED in favour of the new L2ToL1Tx event above after the nitro upgrade
    event L2ToL1Transaction(
        address caller,
        address indexed destination,
        uint256 indexed uniqueId,
        uint256 indexed batchNumber,
        uint256 indexInBatch,
        uint256 arbBlockNum,
        uint256 ethBlockNum,
        uint256 timestamp,
        uint256 callvalue,
        bytes data
    );

    /**
     * @notice logs a merkle branch for proof synthesis
     * @param reserved an index meant only to align the 4th index with L2ToL1Transaction's 4th event
     * @param hash the merkle hash
     * @param position = (level << 192) + leaf
     */
    event SendMerkleUpdate(
        uint256 indexed reserved,
        bytes32 indexed hash,
        uint256 indexed position
    );

    error InvalidBlockNumber(uint256 requested, uint256 current);
}

File 8 of 54 : Fiat24Token.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "./Fiat24Account.sol";
import "./interfaces/SanctionsList.sol";
import "./interfaces/IFiat24Lock.sol";
import "./interfaces/ArbSys.sol";

contract Fiat24Token is ERC20PausableUpgradeable, AccessControlUpgradeable {
    using SafeMathUpgradeable for uint256;

    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
    bytes32 public constant RATES_UPDATER_OPERATOR_ROLE = keccak256("RATES_UPDATER_OPERATOR_ROLE");
    bytes32 public constant CASH_OPERATOR_ROLE = keccak256("CASH_OPERATOR_ROLE");

    uint256 constant ORIGIN_YEAR = 1970;
    uint256 constant DAY_IN_SECONDS = 86400;
    uint256 constant YEAR_IN_SECONDS = 31536000;
    uint256 constant LEAP_YEAR_IN_SECONDS = 31622400;

    uint256 public ChfRate;
    uint256 public LimitWalkin;
    uint256 public WithdrawCharge;
    uint256 public constant MINIMALCOMMISIONFEE = 10;
    Fiat24Account fiat24account;

    bool public sanctionCheck;
    address public sanctionContract;

    mapping (string => uint256) public pacs008;
    address public fiat24lockAddress;

    uint256 public minimalPayoutAmount;

    event CashDeposit(uint256 indexed recipientAccountId, address indexed recipientAddress, uint256 depositAccount, string exaccId, string bankId, string trxId);
    event CashDepositNOK(uint256 indexed recipientAccountId, uint256 depositAccount, string exaccId, string bankId, string trxId);
    event CashLocked(uint256 indexed recipientAccountId, address indexed recipientAddress, string exaccId, string bankId, string trxId);
    event CashPayout(uint256 indexed senderAccountId, address indexed senderAddress, uint256 payoutAccount, string bankId, string trxId);
    event ClientPayout(uint256 indexed tokenId, address indexed sender, uint256 payoutAccount, uint256 amount, string contactId, string txid);
    event ClientPayoutRef(uint256 indexed tokenId, address indexed sender, uint256 payoutAccount, uint256 amount, string contactId, string txid, uint256 purposeId, string ref);

    function __Fiat24Token_init_(address fiat24accountProxyAddress,
                               string memory name_,
                               string memory symbol_,
                               uint256 limitWalkin,
                               uint256 chfRate,
                               uint256 withdrawCharge) internal initializer {
      __Context_init_unchained();
      __AccessControl_init_unchained();
      __ERC20_init_unchained(name_, symbol_);
      _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
      _setupRole(OPERATOR_ROLE, _msgSender());
      fiat24account = Fiat24Account(fiat24accountProxyAddress);
      LimitWalkin = limitWalkin;
      ChfRate = chfRate;
      WithdrawCharge = withdrawCharge;
  }

  function mint(uint256 amount) public {
    require(hasRole(OPERATOR_ROLE, msg.sender), "Fiat24Token: Not an operator");
    _mint(fiat24account.ownerOf(9101), amount);
  }

  function burn(uint256 amount) public {
    require(hasRole(OPERATOR_ROLE, msg.sender), "Fiat24Token: Not an operator");
    _burn(fiat24account.ownerOf(9104), amount);
  }

  function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
    _transfer(_msgSender(), recipient, amount);
    return true;
  }

  function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
    _transfer(sender, recipient, amount);

    uint256 currentAllowance = allowance(sender, _msgSender());
    require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
    unchecked {
        _approve(sender, _msgSender(), currentAllowance - amount);
    }

    return true;
  }

  function cashDepositOK(uint256 recipientAccountId, uint256 amount, string memory exaccId, string memory bankId, string memory trxId) external {
    require(hasRole(CASH_OPERATOR_ROLE, _msgSender()), "Fiat24Token: Not a Cash Operator");
    bytes32 key = keccak256(abi.encodePacked(bankId, "-", trxId));
    require(pacs008[bytes32ToString(key)] == 0, "Fiat24Token: pacs008 already processed");
    pacs008[bytes32ToString(key)] = ArbSys(address(100)).arbBlockNumber();
    if ((fiat24account.status(recipientAccountId) == Fiat24Account.Status.Live || fiat24account.status(recipientAccountId) == Fiat24Account.Status.SoftBlocked) &&
        fiat24account.checkLimit(recipientAccountId, convertToChf(amount))) {
        transferFrom(fiat24account.ownerOf(9101), fiat24account.ownerOf(recipientAccountId), amount);
        emit CashDeposit(recipientAccountId, fiat24account.ownerOf(recipientAccountId), recipientAccountId, exaccId, bankId, trxId);
    } else {
        IFiat24Lock(fiat24lockAddress).lock(recipientAccountId, address(this), amount);
        emit CashLocked(recipientAccountId, fiat24account.ownerOf(recipientAccountId), exaccId, bankId, trxId);
    }
  }

  function cashDepositNOK(uint256 recipientAccountId, uint256 amount, string memory exaccId, string memory bankId, string memory trxId) external {
    require(hasRole(CASH_OPERATOR_ROLE, _msgSender()), "Fiat24Token: Not a Cash Operator");
    bytes32 key = keccak256(abi.encodePacked(bankId, "-", trxId));
    require(pacs008[bytes32ToString(key)] == 0, "Fiat24Token: pacs008 already processed");
    pacs008[bytes32ToString(key)] = ArbSys(address(100)).arbBlockNumber();
    transferFrom(fiat24account.ownerOf(9101), fiat24account.ownerOf(9103), amount);
    emit CashDepositNOK(recipientAccountId, 9103, exaccId, bankId, trxId);
  }

  function cashPayoutOK(uint256 senderAccountId, uint256 amount, string memory bankId, string memory trxId) external {
    require(hasRole(CASH_OPERATOR_ROLE, _msgSender()), "Fiat24Token: Not a Cash Operator");
    bytes32 key = keccak256(abi.encodePacked(bankId, "-", trxId));
    require(pacs008[bytes32ToString(key)] == 0, "Fiat24Token: pacs008 already processed");
    pacs008[bytes32ToString(key)] = ArbSys(address(100)).arbBlockNumber();
    transferFrom(fiat24account.ownerOf(9102), fiat24account.ownerOf(9104), amount);
    emit CashPayout(senderAccountId, fiat24account.ownerOf(senderAccountId), 9104, bankId, trxId);
  }

  function cashPayoutNOK(uint256 senderAccountId, uint256 amount, string memory bankId,string memory trxId) external {
    require(hasRole(CASH_OPERATOR_ROLE, _msgSender()), "Fiat24Token: Not a Cash Operator");
    bytes32 key = keccak256(abi.encodePacked(bankId, "-", trxId));
    require(pacs008[bytes32ToString(key)] == 0, "Fiat24Token: pacs008 already processed");
    pacs008[bytes32ToString(key)] = ArbSys(address(100)).arbBlockNumber();
    transferFrom(fiat24account.ownerOf(9102), fiat24account.ownerOf(9103), amount);
    emit CashPayout(senderAccountId, fiat24account.ownerOf(senderAccountId), 9103, bankId, trxId);
  }

  function getPacs008(string memory bankId, string memory trxId) public view returns (uint256) {
    bytes32 bytesKey = keccak256(abi.encodePacked(bankId, "-", trxId));
    return pacs008[bytes32ToString(bytesKey)];
  }

  function clientPayout(uint256 amount, string memory contactId) external {
    require(amount >= minimalPayoutAmount, "Fiat24Token: amount < minimal payout amount");
    uint256 tokenId = fiat24account.tokenOfOwnerByIndex(msg.sender, 0);
    string memory txid = string(abi.encodePacked(uintToString(tokenId), "-", uintToString(ArbSys(address(100)).arbBlockNumber())));
    transferByAccountId(9102, amount);
    emit ClientPayout(tokenId, msg.sender, 9102, amount, contactId, txid);
  }

  function clientPayoutRef(uint256 amount, string memory contactId, uint256 purposeId, string memory ref) external {
    require(amount >= minimalPayoutAmount, "Fiat24Token: amount < minimal payout amount");
    uint256 tokenId = fiat24account.tokenOfOwnerByIndex(msg.sender, 0);
    string memory txid = string(abi.encodePacked(uintToString(tokenId), "-", uintToString(ArbSys(address(100)).arbBlockNumber())));
    transferByAccountId(9102, amount);
    emit ClientPayoutRef(tokenId, msg.sender, 9102, amount, contactId, txid, purposeId, ref);
  }

  function transferByAccountId(uint256 recipientAccountId, uint256 amount) public returns(bool){
    return transfer(fiat24account.ownerOf(recipientAccountId), amount);
  }

  function balanceOfByAccountId(uint256 accountId) public view returns(uint256) {
    return balanceOf(fiat24account.ownerOf(accountId));
  }

  function tokenTransferAllowed(address from, address to, uint256 amount) public view returns(bool){
    require(!fiat24account.paused(), "Fiat24Token: All account transfers are paused");
    require(!paused(), "Fiat24Token: All account transfers of this currency are paused");
    if(sanctionCheck) {
      SanctionsList sanctionsList = SanctionsList(sanctionContract);
      bool toIsSanctioned = sanctionsList.isSanctioned(to);
      require(!toIsSanctioned, "Fiat24Token: Transfer to sanctioned address");
      bool fromIsSanctioned = sanctionsList.isSanctioned(from);
      require(!fromIsSanctioned, "Fiat24Token: Transfer from sanctioned address");
    }
    if(from != address(0) && to != address(0)){
      if(balanceOf(from) < amount) {
          return false;
      }
      uint256 toAmount = amount + balanceOf(to);
      Fiat24Account.Status fromClientStatus;
      uint256 accountIdFrom = fiat24account.historicOwnership(from);
      if(accountIdFrom != 0) {
        fromClientStatus = fiat24account.status(accountIdFrom);
      } else if(from != address(0) && fiat24account.balanceOf(from) > 0) {
        fromClientStatus = Fiat24Account.Status.Tourist;
        accountIdFrom = fiat24account.tokenOfOwnerByIndex(from, 0);
      } else {
        fromClientStatus = Fiat24Account.Status.Na;
      }
      Fiat24Account.Status toClientStatus;
      uint256 accountIdTo = fiat24account.historicOwnership(to);
      if(accountIdTo != 0) {
        toClientStatus = fiat24account.status(accountIdTo);
      } else if(to != address(0) && fiat24account.balanceOf(to) > 0) {
        toClientStatus = Fiat24Account.Status.Tourist;
        accountIdTo = fiat24account.tokenOfOwnerByIndex(to, 0);
      } else {
        toClientStatus = Fiat24Account.Status.Na;
      }
      uint256 amountInChf = convertToChf(amount);
      bool fromLimitCheck = fiat24account.checkLimit(accountIdFrom, amountInChf);
      bool toLimitCheck = fiat24account.checkLimit(accountIdTo, amountInChf);
      return (fromClientStatus == Fiat24Account.Status.Live &&
            (toClientStatus == Fiat24Account.Status.Live || toClientStatus == Fiat24Account.Status.SoftBlocked) &&
            fromLimitCheck && toLimitCheck) ||
            (fromClientStatus == Fiat24Account.Status.Live &&
            fromLimitCheck &&
            ((toClientStatus == Fiat24Account.Status.Na || toClientStatus == Fiat24Account.Status.Tourist) && toAmount <= LimitWalkin));
    }
    return false;
  }

  function convertToChf(uint256 amount) public view returns(uint256) {
    return amount.mul(ChfRate).div(1000);
  }

  function convertFromChf(uint256 amount) public view returns(uint256) {
    return amount.mul(1000).div(ChfRate);
  }

  function updateChfRate(uint256 _chfRate) external {
    require(hasRole(RATES_UPDATER_OPERATOR_ROLE, msg.sender), "Fiat24Token: Not a rate updater operator");
    ChfRate = _chfRate;
  }

  function setWithdrawCharge(uint256 withdrawCharge) public {
    require(hasRole(OPERATOR_ROLE, msg.sender), "Fiat24Token: Not an operator");
    WithdrawCharge = withdrawCharge;
  }

  function setMinimalPayoutAmount(uint256 minimalPayoutAmount_) public {
    require(hasRole(OPERATOR_ROLE, msg.sender), "Fiat24Token: Not an operator");
    minimalPayoutAmount = minimalPayoutAmount_;
  }

  function sendToSundry(address from, uint256 amount) public {
    require(hasRole(OPERATOR_ROLE, msg.sender), "Fiat24Token: Not an operator");
    _transfer(from, fiat24account.ownerOf(9103), amount);
  }

  function setWalkinLimit(uint256 newLimitWalkin) external {
    require(hasRole(OPERATOR_ROLE, msg.sender), "Fiat24Token: Not an operator");
    LimitWalkin = newLimitWalkin;
  }

  function setSanctionCheck(bool sanctionCheck_) external {
    require(hasRole(OPERATOR_ROLE, msg.sender), "Fiat24Token: Not an operator");
    sanctionCheck = sanctionCheck_;
  }

  function setSanctionCheckContract(address sanctionContract_) external {
    require(hasRole(OPERATOR_ROLE, msg.sender), "Fiat24Token: Not an operator");
    sanctionContract = sanctionContract_;
  }

  function setFiat24LockAddress(address fiat24lockAddress_) external {
    require(hasRole(OPERATOR_ROLE, msg.sender), "Fiat24Token: Not an operator");
    fiat24lockAddress = fiat24lockAddress_;
  }

  function decimals() public view virtual override returns (uint8) {
    return 2;
  }


  function createTxId(uint256 tokenId_) public view returns (string memory) {
      string memory prefix = "F24-";
      string memory tokenId = uintToString(tokenId_);
      uint256 timestamp = block.timestamp;
      uint256 year;
      uint256 month;
      uint256 day;
      uint256 hour;
      uint256 minute;
      uint256 second;

      (year, month, day, hour, minute, second) = getDateTimeComponents(timestamp);

      string memory timestampStr = string(
          abi.encodePacked(
              uintToString(year),
              padZero(month, 2),  // Pad month with zero if needed
              padZero(day, 2)     // Pad day with zero if needed
              /*
              padZero(hour, 2),    // Pad hour with zero if needed
              padZero(minute, 2),  // Pad minute with zero if needed
              padZero(second, 2)   // Pad second with zero if needed
              */
          )
      );

      // Concatenate the strings
      return string(abi.encodePacked(prefix, tokenId, "-", timestampStr, "-", uintToString(ArbSys(address(100)).arbBlockNumber())/*,"-", randomFourDigitNumber*/));
  }

  function getDateTimeComponents(uint256 timestamp) internal pure returns (uint256, uint256, uint256, uint256, uint256, uint256) {
      uint256 year;
      uint256 month;
      uint256 day;
      uint256 hour;
      uint256 minute;
      uint256 second;

      year = ORIGIN_YEAR;
      while (timestamp >= YEAR_IN_SECONDS) {
          uint256 secondsInYear = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? LEAP_YEAR_IN_SECONDS : YEAR_IN_SECONDS;
          if (timestamp >= secondsInYear) {
              timestamp -= secondsInYear;
              year++;
          } else {
              break;
          }
      }

      month = 1;
      while (true) {
          uint8[12] memory monthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
          if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) {
              monthDays[1] = 29; // Leap year
          }

          uint256 secondsInMonth = uint256(monthDays[month - 1]) * DAY_IN_SECONDS;

          if (timestamp < secondsInMonth) {
              break;
          }

          timestamp -= secondsInMonth;
          month++;
      }

      day = timestamp / DAY_IN_SECONDS + 1;
      timestamp %= DAY_IN_SECONDS;
      hour = timestamp / 3600;
      timestamp %= 3600;
      minute = timestamp / 60;
      second = timestamp % 60;

      return (year, month, day, hour, minute, second);
  }

    function uintToString(uint _i) internal pure returns (string memory _uintAsString) {
        if (_i == 0)
        {
            return "0";
        }
        uint256 j = _i;
        uint256 length;
        while (j != 0)
        {
            length++;
            j /= 10;
        }
        bytes memory bstr = new bytes(length);
        uint256 k = length;
        j = _i;
        while (j != 0)
        {
            bstr[--k] = bytes1(uint8(48 + j % 10));
            j /= 10;
        }
        return string(bstr);
  }
  
  function padZero(uint256 number, uint256 width) internal pure returns (string memory) {
      if (width == 0) {
          return "";
      }
      
      uint256 tempNumber = number;
      uint256 digits;
      while (tempNumber != 0) {
          digits++;
          tempNumber /= 10;
      }
      
      if (digits >= width) {
          return uintToString(number);
      } else {
          bytes memory buffer = new bytes(width);
          uint256 index = width;
          tempNumber = number;
          while (tempNumber != 0) {
              index--;
              buffer[index] = bytes1(uint8(48 + tempNumber % 10)); // Convert to ASCII
              tempNumber /= 10;
          }
          
          while (index > 0) {
              index--;
              buffer[index] = bytes1(uint8(48)); // Pad with zero
          }
          
          return string(buffer);
      }
  }

  function bytes32ToString(bytes32 _bytes32) internal pure returns (string memory) {
    bytes memory bytesArray = new bytes(32);
    uint256 bytesArrayIndex = 0;
    for (uint256 i = 0; i < 32; i++) {
        if (_bytes32[i] != 0) {
            bytesArray[bytesArrayIndex] = _bytes32[i];
            bytesArrayIndex++;
        }
    }
    bytes memory trimmedBytes = new bytes(bytesArrayIndex);
    for (uint256 j = 0; j < bytesArrayIndex; j++) {
        trimmedBytes[j] = bytesArray[j];
    }
    return string(trimmedBytes);
  }

  function pause() public {
    require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Fiat24Token: Not an admin");
    _pause();
  }

  function unpause() public {
    require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Fiat24Token: Not an admin");
    _unpause();
  }

  function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
    require(!fiat24account.paused(), "Fiat24Token: all account transfers are paused");
    require(!paused(), "Fiat24Token: all account transfers of this currency are paused");
    if(from != address(0) && to != address(0) && to != fiat24account.ownerOf(9103) && from != fiat24account.ownerOf(9103)){
      require(tokenTransferAllowed(from, to, amount), "Fiat24Token: Transfer not allowed for various reason");
    }
    super._beforeTokenTransfer(from, to, amount);
  }

  function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual override {
    if(from != address(0) && to != address(0) && to != fiat24account.ownerOf(9103) && from != fiat24account.ownerOf(9103)){
      uint256 accountIdFrom = fiat24account.historicOwnership(from);
      if(accountIdFrom == 0 && fiat24account.balanceOf(from) > 0) {
        accountIdFrom = fiat24account.tokenOfOwnerByIndex(from, 0);
      }
      uint256 accountIdTo = fiat24account.historicOwnership(to);
      if(accountIdTo == 0 && fiat24account.balanceOf(to) > 0) {
        accountIdTo = fiat24account.tokenOfOwnerByIndex(to, 0);
      }
      fiat24account.updateLimit(accountIdFrom, convertToChf(amount));
      fiat24account.updateLimit(accountIdTo, convertToChf(amount));
    }
    super._afterTokenTransfer(from, to, amount);
  }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "./libraries/EnumerableUintToUintMapUpgradeable.sol";

import "./libraries/DigitsOfUint.sol";

contract Fiat24PriceList is Initializable, AccessControlUpgradeable {
    using DigitsOfUint for uint256;

    uint8 public constant MERCHANTDIGIT = 8;
    uint8 public constant MAXDIGITFORSALE = 5;

    function initialize() public initializer {
        __AccessControl_init_unchained();
    }

    function getPrice(uint256 accountNumber) external pure returns(uint256) {
        bool merchantAccountId = accountNumber.hasFirstDigit(MERCHANTDIGIT);
        // 1-8 => F24 1'500'000.00
        if(accountNumber >= 1 && accountNumber <= 8) {
            return 150000000;
        // 10-89 => F24 150'000.00
        } else if(accountNumber >= 10 && accountNumber <= 89) {
            return 15000000;
        // 100-899 => F24 15'000.00
        } else if (accountNumber >= 100 && accountNumber <= 899) {
            return 1500000;
        // 1000-8999 => F24 1'500.00
        } else if (accountNumber >= 1000 && accountNumber <= 8999) {
            return 150000;
        // account number of digits > 5 and merchant account => F24 500.00
        } else if(merchantAccountId) {
            return 50000;
        // base cost for account number of digits >= 5 and non-merchant
        } else {
            return 100;
        }
    }
}

File 10 of 54 : Fiat24Account.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";

import "./F24.sol";
import "./Fiat24PriceList.sol";
import "./interfaces/IF24Sales.sol";
import "./libraries/DigitsOfUint.sol";

contract Fiat24Account is ERC721EnumerableUpgradeable, ERC721PausableUpgradeable, AccessControlUpgradeable {
    using DigitsOfUint for uint256;
    using SafeERC20Upgradeable for IERC20Upgradeable;

    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
    bytes32 public constant LIMITUPDATER_ROLE = keccak256("LIMITUPDATER_ROLE");
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant CLIENTSTATUSCHANGE_ROLE = keccak256("CLIENTSTATUSCHANGE_ROLE");
    uint256 public constant DEFAULT_MERCHANT_RATE = 55;

    enum Status { Na, SoftBlocked, Tourist, Blocked, Closed, Live }

    struct WalletProvider {
        string walletProvider;
        bool isAvailable;
    }

    uint8 public constant MERCHANTDIGIT = 8;
    uint8 public constant INTERNALDIGIT = 9;

    struct Limit {
        uint256 usedLimit;
        uint256 clientLimit;
        uint256 startLimitDate;
    }

    uint256 public constant LIMITLIVEDEFAULT = 100000;
    uint256 public limitTourist;

    uint256 public constant THIRTYDAYS = 2592000;

    mapping (address => uint256) public historicOwnership;
    mapping (uint256 => string) public nickNames;
    mapping (uint256 => bool) public isMerchant;
    mapping (uint256 => uint256) public merchantRate;
    mapping (uint256 => Status) public status;
    mapping (uint256 => Limit) public limit;

    uint8 public minDigitForSale; //maxDigitForMint
    uint8 public maxDigitForSale;

    F24 f24;
    Fiat24PriceList fiat24PriceList;
    bool f24IsActive;

    mapping (uint256 => uint256) public walletProvider;
    mapping (uint256 => WalletProvider) public walletProviderMap;

    mapping (uint256 => string) public nftAvatar;

    mapping (uint256 => uint256) public oldTokenId;
    address public F24SalesAddress;

    event activatedWithReferral(uint256 indexed tokenId, uint256 indexed referrer);

    function initialize() public initializer {
        __Context_init_unchained();
        __ERC721_init_unchained("Fiat24 Account", "Fiat24");
        __AccessControl_init_unchained();
        minDigitForSale = 5;
        maxDigitForSale = 5;
        f24IsActive = false;
        limitTourist = 100000;
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
        _setupRole(OPERATOR_ROLE, _msgSender());
    }

    function mint(address _to, uint256 _tokenId) public {
        require(hasRole(OPERATOR_ROLE, msg.sender) || hasRole(MINTER_ROLE, msg.sender), "Not an operator/minter");
        require(_mintAllowed(_to, _tokenId), "mint not allowed");
        _mint(_to, _tokenId);
        status[_tokenId] = Status.Tourist;
        initilizeTouristLimit(_tokenId);
        nickNames[_tokenId] = string(abi.encodePacked("Account ", StringsUpgradeable.toString(_tokenId)));
    }

    function mintByClient(uint256 _tokenId) external {
        _mintByClient(_tokenId);
        uint256 accountPrice = fiat24PriceList.getPrice(_tokenId);
        f24.burnFrom(_msgSender(), accountPrice);
    }

    function mintByClientWithETH(uint256 _tokenId) external payable {
        _mintByClient(_tokenId);
        uint256 accountPrice = fiat24PriceList.getPrice(_tokenId);
        uint256 priceETH;
        uint256 quotePerETH = IF24Sales(F24SalesAddress).quotePerEther();
        if(quotePerETH < accountPrice) {
            priceETH = (accountPrice / quotePerETH) * 10**18;
        } else {
            priceETH = 10**18 / (quotePerETH / accountPrice); 
        }
        require(msg.value >= priceETH, "Not sufficient msg.value for F24 purchase");
        uint256 f24Amount = IF24Sales(F24SalesAddress).buy{value: msg.value}();
        f24.burn(accountPrice);
        uint256 f24Diff = f24Amount - accountPrice;
        if(f24Diff > 0) {
            f24.transfer(_msgSender(), f24Diff);
        }
    }

    function _mintByClient(uint256 _tokenId) internal {
        require(f24IsActive, "F24 is inactive");
        require(!_tokenId.hasFirstDigit(INTERNALDIGIT), "9xx cannot be mint by client");
        require(_tokenId.numDigits() <= maxDigitForSale, "Number of digits of accountId > max. digits");
        require(_mintAllowed(_msgSender(), _tokenId), "Not allowed. The address has/had another NFT.");
        _mint(_msgSender(), _tokenId);
        status[_tokenId] = Status.Tourist;
        initilizeTouristLimit(_tokenId);
        nickNames[_tokenId] = string(abi.encodePacked("Account ", StringsUpgradeable.toString(_tokenId)));
    }

    function mintByWallet(address to, uint256 _tokenId) external {
        require(this.balanceOf(_msgSender()) > 0, "Minting address has no account");
        uint256 minterTokenId = this.tokenOfOwnerByIndex(_msgSender(), 0);
        require(minterTokenId.hasFirstDigit(MERCHANTDIGIT) && (minterTokenId >= 8 && minterTokenId <= 8999), "Incorrect account id for wallet");
        require(walletProviderMap[minterTokenId].isAvailable, "Account not wallet provider");
        require(_tokenId.numDigits() >= 5, "mintByWallet only for 5+ digits tokens");
        require(_tokenId.numDigits() <= maxDigitForSale, "Number of digits of accountId > max. digits");
        require(!_tokenId.hasFirstDigit(MERCHANTDIGIT),"Merchant account cannot be minted by wallet");
        require(_mintAllowed(to, _tokenId),
        "Not allowed. The target address has an account or once had another account.");
        walletProvider[_tokenId] = minterTokenId;
        status[_tokenId] = Status.Tourist;
        _mint(to, _tokenId);
        f24.burnFrom(_msgSender(), 100);
    }

    function upgradeWithF24(uint256 _tokenId) external {
        uint256 _oldTokenId = this.tokenOfOwnerByIndex(_msgSender(), 0);
        require(status[_oldTokenId] == Status.Live, "Not Live client");
        require(f24IsActive, "This function is inactive");
        require(_tokenId.numDigits() < 5 , "Only premium number for upgrade");
        require(!_tokenId.hasFirstDigit(INTERNALDIGIT), "Internal accountId cannot be mint by client");
        if(_tokenId.hasFirstDigit(MERCHANTDIGIT)) {
            require(_oldTokenId.hasFirstDigit(MERCHANTDIGIT), "Old token must be a merchant");
        }
        if(_oldTokenId.hasFirstDigit(MERCHANTDIGIT)) {
            require(_tokenId.hasFirstDigit(MERCHANTDIGIT), "New token must be a merchant");
        }
        
        uint256 accountPrice = fiat24PriceList.getPrice(_tokenId);
        require(accountPrice != 0, "AccountId not available for sale");
        
        status[_oldTokenId] = Status.Closed;
        _transfer(ownerOf(_oldTokenId), ownerOf(9106), _oldTokenId);
        
        _mint(_msgSender(), _tokenId);
        status[_tokenId] = Status.Live;
        historicOwnership[_msgSender()] = _tokenId;
        walletProvider[_tokenId] = walletProvider[_oldTokenId]; 
        Limit storage limitOld = limit[_oldTokenId];
        Limit storage limitNew = limit[_tokenId];
        limitNew.clientLimit = limitOld.clientLimit;
        limitNew.usedLimit = limitOld.usedLimit;
        limitNew.startLimitDate = limitOld.startLimitDate;
        
        oldTokenId[_tokenId] = _oldTokenId;

        f24.burnFrom(_msgSender(), accountPrice);
    }

    function burn(uint256 tokenId) public {
        require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
        delete limit[tokenId];
        _burn(tokenId);
    }

    function transferFrom(address from, address to, uint256 tokenId) public virtual override (ERC721Upgradeable, IERC721Upgradeable)  {
        super.transferFrom(from, to, tokenId);
        if(status[tokenId] != Status.Tourist) {
            historicOwnership[to] = tokenId;
        }
    }

    function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override (ERC721Upgradeable, IERC721Upgradeable)  {
        super.safeTransferFrom(from, to, tokenId);
        if(status[tokenId] != Status.Tourist) {
            historicOwnership[to] = tokenId;
        }
    }

    function exists(uint256 tokenId) public view returns(bool) {
        return _exists(tokenId);
    }

    function removeHistoricOwnership(address owner) external {
        require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
        delete historicOwnership[owner];
    }

    function changeClientStatus(uint256 tokenId, Status _status) external {
        require(hasRole(OPERATOR_ROLE, msg.sender) || hasRole(CLIENTSTATUSCHANGE_ROLE, msg.sender), "Not an operator/clientstatuschange");
        if(_status == Status.Live && status[tokenId] == Status.Tourist) {
            historicOwnership[this.ownerOf(tokenId)] = tokenId;
            initializeLiveLimit(tokenId);
        }
        status[tokenId] = _status;
    }

    function close(uint256 tokenId) external {
        require(_msgSender() == this.ownerOf(tokenId), "Not account owner");
        require(status[tokenId] == Status.Live, "Not live client");

        status[tokenId] = Status.Closed;
    }

    function activateWithReferral(uint256 tokenId, uint256 referrer) external {
        require(hasRole(OPERATOR_ROLE, msg.sender) || hasRole(CLIENTSTATUSCHANGE_ROLE, msg.sender), "Not an operator/clientstatuschange");
        require(status[tokenId] == Status.Tourist, "Not Tourist");
        
        historicOwnership[this.ownerOf(tokenId)] = tokenId;
        initializeLiveLimit(tokenId);
        status[tokenId] = Status.Live;
        
        address treasury = this.ownerOf(9100);
        // ARB Mainnet
        address arbAddress = 0x912CE59144191C1204E64559FE8253a0e49E6548;
        //F24 Sepolia
        //address arbAddress = 0x9f4950dedBBE79E2BAD0a5807D25A5A1482d101B;
        // //ARB Mainnet
        uint256 decimals = 10**18;
        //F24 Sepolia
        //uint256 decimals = 10**2;
        // Only send ARB when treasury has sufficient ARB and Referrer is in Live status
        if (IERC20Upgradeable(arbAddress).balanceOf(treasury) >= 20 * decimals && this.status(referrer) == Status.Live) {    
            IERC20Upgradeable(arbAddress).safeTransferFrom(treasury, this.ownerOf(referrer), 15 * decimals);
            IERC20Upgradeable(arbAddress).safeTransferFrom(treasury, this.ownerOf(tokenId), 5 * decimals);
        }
        emit activatedWithReferral(tokenId, referrer);
    }

    function setMinDigitForSale(uint8 minDigit) external {
        require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
        minDigitForSale = minDigit;
    }

    function setMaxDigitForSale(uint8 maxDigit) external {
        require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
        maxDigitForSale = maxDigit;
    }

    function setMerchantRate(uint256 tokenId, uint256 _merchantRate) external {
        require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
        merchantRate[tokenId] = _merchantRate;
    }
    
    function initilizeTouristLimit(uint256 tokenId) private {
        Limit storage limit_ = limit[tokenId];
        limit_.usedLimit = 0;
        limit_.startLimitDate = block.timestamp;
    }

    function initializeLiveLimit(uint256 tokenId) private {
        Limit storage limit_ = limit[tokenId];
        limit_.usedLimit = 0;
        limit_.clientLimit = LIMITLIVEDEFAULT;
        limit_.startLimitDate = block.timestamp;
    }

    function setClientLimit(uint256 tokenId, uint256 clientLimit) external {
        require(hasRole(CLIENTSTATUSCHANGE_ROLE, msg.sender) || hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
        require(_exists(tokenId), "Token does not exist");
        require(status[tokenId] != Status.Tourist && status[tokenId] != Status.Na, "Not in correct status for limit control");
        Limit storage limit_ = limit[tokenId];
        limit_.clientLimit = clientLimit;
    }

    function resetUsedLimit(uint256 tokenId) external {
        require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
        require(_exists(tokenId), "Token does not exist");
        Limit storage limit_ = limit[tokenId];
        limit_.usedLimit = 0;
    }

    function setTouristLimit(uint256 newLimitTourist) external {
        require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
        limitTourist = newLimitTourist;
    }

    function checkLimit(uint256 tokenId, uint256 amount) external view returns(bool) {
        if(_exists(tokenId)) {
            if(tokenId >= 9100 && tokenId <= 9299) {
                return true;
            }
            Limit storage limit_ = limit[tokenId];
            uint256 lastLimitPeriodEnd = limit_.startLimitDate + THIRTYDAYS;
            if(status[tokenId] == Status.Tourist) {
                return (lastLimitPeriodEnd < block.timestamp && amount <= limitTourist)
                    || (lastLimitPeriodEnd >= block.timestamp && (limit_.usedLimit + amount) <= limitTourist);
            } else {
                return (lastLimitPeriodEnd < block.timestamp && amount <= limit_.clientLimit)
                    || (lastLimitPeriodEnd >= block.timestamp && (limit_.usedLimit + amount) <= limit_.clientLimit);
            }
        } else {
            return false;
        }
    }

    function updateLimit(uint256 tokenId, uint256 amount) external {
        require(hasRole(LIMITUPDATER_ROLE, msg.sender), "Not a limit-updater");
        if(tokenId >= 9100 && tokenId <= 9299) {
            return;
        }
        if(status[tokenId] == Status.Live || status[tokenId] == Status.Tourist) {
            Limit storage limit_ = limit[tokenId];
            uint256 lastLimitPeriodEnd = limit_.startLimitDate + THIRTYDAYS;
            if(lastLimitPeriodEnd < block.timestamp) {
                limit_.startLimitDate = block.timestamp;
                limit_.usedLimit = amount;
            } else {
                limit_.usedLimit += amount;
            }
        }
    }

    function setNickname(uint256 tokenId, string memory nickname) public {
        require(_msgSender() == this.ownerOf(tokenId), "Not account owner");
        nickNames[tokenId] = nickname;
    }

    function activateF24(address f24Address, address fiat24PriceListAddress) external {
        require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
        f24 = F24(f24Address);
        fiat24PriceList = Fiat24PriceList(fiat24PriceListAddress);
        f24IsActive = true;
    }

    function setF24SalesAddress(address _f24SalesAddress) external {
        require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
        F24SalesAddress = _f24SalesAddress;
    }

    function addWalletProvider(uint256 number, string memory name) external {
        require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
        walletProviderMap[number].walletProvider = name;
        walletProviderMap[number].isAvailable = true;
    }

    function removeWalletProvider(uint256 number) external {
        require(hasRole(OPERATOR_ROLE, msg.sender), "Not an operator");
        delete walletProviderMap[number];
    }

    function setNftAvatar(string memory url) external {
        require(this.balanceOf(_msgSender()) > 0, "Address has no account");
        uint256 tokenId = this.tokenOfOwnerByIndex(_msgSender(), 0);
        nftAvatar[tokenId] = url;
    }

    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        string memory uriStatusParam = _uriStatusParam();
        string memory uriWalletParam = _uriWalletParam();
        return bytes(baseURI).length > 0
        ? string(abi.encodePacked(baseURI, StringsUpgradeable.toString(tokenId), uriStatusParam, StringsUpgradeable.toString(uint256(status[tokenId])), uriWalletParam, StringsUpgradeable.toString(walletProvider[tokenId])))
        : "";
    }

    function _baseURI() internal view virtual override returns (string memory) {
        return 'https://api.defi.saphirstein.com/metadata?tokenid=';
    }

    function _uriStatusParam() internal pure returns (string memory) {
        return '&status=';
    }

    function _uriWalletParam() internal pure returns (string memory) {
        return '&wallet=';
    }

    function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlUpgradeable, ERC721Upgradeable, ERC721EnumerableUpgradeable) returns (bool) {
        return
            interfaceId == type(IERC721Upgradeable).interfaceId ||
            interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    function pause() public {
        require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not an admin");
        _pause();
    }

    function unpause() public {
        require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not an admin");
        _unpause();
    }

    function _mintAllowed(address to, uint256 tokenId) internal view returns(bool){
        return (this.balanceOf(to) < 1 && (historicOwnership[to] == 0 || historicOwnership[to] == tokenId));
    }

    function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override(ERC721EnumerableUpgradeable, ERC721PausableUpgradeable) {
        require(!paused(), "Account transfers suspended");
        if(AddressUpgradeable.isContract(to) && (from != address(0))) {
            require(this.status(tokenId) == Status.Tourist, "Not allowed to transfer account");
        } else {
            if((from != address(0) && to != address(0))) {
                if(_exists(9106)){
                    require((balanceOf(to) < 1 && (historicOwnership[to] == 0 || historicOwnership[to] == tokenId)) ||  (tokenOfOwnerByIndex(to, 0) == 9106 && this.status(tokenId) == Status.Closed),
                    "Not allowed. The target address has an account or once had another account.");
                    require((this.status(tokenId) == Status.Live || this.status(tokenId) == Status.Tourist) || (balanceOf(to) > 0 && tokenOfOwnerByIndex(to, 0) == 9106 && this.status(tokenId) == Status.Closed), 
                    "Transfer not allowed in this status");
                } else {
                    require(balanceOf(to) < 1 && (historicOwnership[to] == 0 || historicOwnership[to] == tokenId),
                    "Not allowed. The target address has an account or once had another account.");
                    require(this.status(tokenId) == Status.Live || this.status(tokenId) == Status.Tourist, 
                    "Transfer not allowed in this status");
                }
            }
        }
        super._beforeTokenTransfer(from, to, tokenId);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./Fiat24Account.sol";

contract F24 is ERC20, ERC20Permit, ERC20Votes, ERC20Pausable, ERC20Burnable, AccessControl {
    using SafeMath for uint256;
    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");

    uint256 public maxSupply;
    uint256 public airdropEndTime; // Timestamp
    uint256 public airdropClaim;

    mapping(uint256 => uint256) public claim;
    Fiat24Account fiat24account;

    constructor(address fiat24accountProxyAddress,
                uint256 maxSupply_,
                uint256 airdropTotal_,
                uint256 airdropEndTime_,
                uint256 airdropClaim_) ERC20("Fiat24", "F24") ERC20Permit("Fiat24") {
        require(airdropTotal_ <= maxSupply_, "F24: Airdrop higher than max supply - free supply");
        maxSupply = maxSupply_;
        _mint(msg.sender, maxSupply_ - airdropTotal_);
        _mint(address(this), airdropTotal_);

        airdropEndTime = airdropEndTime_;
        airdropClaim = airdropClaim_;

        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _setupRole(OPERATOR_ROLE, msg.sender);

        fiat24account = Fiat24Account(fiat24accountProxyAddress);
    }

    function claimToken(uint256 tokenId) external {
        require(block.timestamp <= airdropEndTime, "F24: Airdrop expired");
        require(fiat24account.ownerOf(tokenId) == msg.sender ||
                fiat24account.historicOwnership(msg.sender) == tokenId, "F24: Not owner of token");
        require(fiat24account.status(tokenId) == Fiat24Account.Status.Live ||
                fiat24account.status(tokenId) == Fiat24Account.Status.Tourist,"F24: Not Live or Tourist");

        uint256 amount = eligibleClaimAmount(tokenId);
        if(amount > 0) {
            claim[tokenId] += amount;
            _transfer(address(this), msg.sender, amount);
        }
    }

    function eligibleClaimAmount(uint256 tokenId) public view returns(uint256) {
        require(block.timestamp <= airdropEndTime, "F24: Airdrop expired");
        uint256 amount = 0;
        bool success = true;
        if(fiat24account.exists(tokenId)) {
            if(fiat24account.status(tokenId) == Fiat24Account.Status.Live ||
               fiat24account.status(tokenId) == Fiat24Account.Status.Tourist ) {
                (success, amount) = airdropClaim.trySub(claim[tokenId]);
            }
        } else {
            success = false;
        }
        return success ? amount : 0;
    }

    function sweep(address dest) external {
        require(hasRole(OPERATOR_ROLE, msg.sender), "F24: Not an operator");
        require(block.timestamp > airdropEndTime, "F24: Claim period not yet ended");
        _transfer(address(this), dest, balanceOf(address(this)));
    }

    function decimals() public view virtual override returns (uint8) {
        return 2;
    }

    function _mint(address account, uint256 amount) internal virtual override(ERC20, ERC20Votes) {
        super._mint(account, amount);
    }

    function _burn(address account, uint256 amount) internal virtual override(ERC20, ERC20Votes) {
        super._burn(account, amount);
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual override(ERC20, ERC20Pausable) {
       super._beforeTokenTransfer(from, to, amount);

    }

    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual override(ERC20, ERC20Votes) {
        super._afterTokenTransfer(from, to, amount);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol)

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128) {
        require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits");
        return int128(value);
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64) {
        require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits");
        return int64(value);
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32) {
        require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits");
        return int32(value);
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16) {
        require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits");
        return int16(value);
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8) {
        require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits");
        return int8(value);
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @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 / b + (a % b == 0 ? 0 : 1);
    }
}

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-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);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

    /**
     * @dev Returns an Ethereum Signed 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));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-ERC20Permit.sol)

pragma solidity ^0.8.0;

import "./draft-IERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/cryptography/draft-EIP712.sol";
import "../../../utils/cryptography/ECDSA.sol";
import "../../../utils/Counters.sol";

/**
 * @dev Implementation 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.
 *
 * _Available since v3.4._
 */
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
    using Counters for Counters.Counter;

    mapping(address => Counters.Counter) private _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 private immutable _PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    constructor(string memory name) EIP712(name, "1") {}

    /**
     * @dev See {IERC20Permit-permit}.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSA.recover(hash, v, r, s);
        require(signer == owner, "ERC20Permit: invalid signature");

        _approve(owner, spender, value);
    }

    /**
     * @dev See {IERC20Permit-nonces}.
     */
    function nonces(address owner) public view virtual override returns (uint256) {
        return _nonces[owner].current();
    }

    /**
     * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view override returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
     * @dev "Consume a nonce": return the current value and increment.
     *
     * _Available since v4.1._
     */
    function _useNonce(address owner) internal virtual returns (uint256 current) {
        Counters.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Votes.sol)

pragma solidity ^0.8.0;

import "./draft-ERC20Permit.sol";
import "../../../utils/math/Math.sol";
import "../../../utils/math/SafeCast.sol";
import "../../../utils/cryptography/ECDSA.sol";

/**
 * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,
 * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.
 *
 * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.
 *
 * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either
 * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting
 * power can be queried through the public accessors {getVotes} and {getPastVotes}.
 *
 * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it
 * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.
 * Enabling self-delegation can easily be done by overriding the {delegates} function. Keep in mind however that this
 * will significantly increase the base gas cost of transfers.
 *
 * _Available since v4.2._
 */
abstract contract ERC20Votes is ERC20Permit {
    struct Checkpoint {
        uint32 fromBlock;
        uint224 votes;
    }

    bytes32 private constant _DELEGATION_TYPEHASH =
        keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");

    mapping(address => address) private _delegates;
    mapping(address => Checkpoint[]) private _checkpoints;
    Checkpoint[] private _totalSupplyCheckpoints;

    /**
     * @dev Emitted when an account changes their delegate.
     */
    event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

    /**
     * @dev Emitted when a token transfer or delegate change results in changes to an account's voting power.
     */
    event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);

    /**
     * @dev Get the `pos`-th checkpoint for `account`.
     */
    function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {
        return _checkpoints[account][pos];
    }

    /**
     * @dev Get number of checkpoints for `account`.
     */
    function numCheckpoints(address account) public view virtual returns (uint32) {
        return SafeCast.toUint32(_checkpoints[account].length);
    }

    /**
     * @dev Get the address `account` is currently delegating to.
     */
    function delegates(address account) public view virtual returns (address) {
        return _delegates[account];
    }

    /**
     * @dev Gets the current votes balance for `account`
     */
    function getVotes(address account) public view returns (uint256) {
        uint256 pos = _checkpoints[account].length;
        return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;
    }

    /**
     * @dev Retrieve the number of votes for `account` at the end of `blockNumber`.
     *
     * Requirements:
     *
     * - `blockNumber` must have been already mined
     */
    function getPastVotes(address account, uint256 blockNumber) public view returns (uint256) {
        require(blockNumber < block.number, "ERC20Votes: block not yet mined");
        return _checkpointsLookup(_checkpoints[account], blockNumber);
    }

    /**
     * @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.
     * It is but NOT the sum of all the delegated votes!
     *
     * Requirements:
     *
     * - `blockNumber` must have been already mined
     */
    function getPastTotalSupply(uint256 blockNumber) public view returns (uint256) {
        require(blockNumber < block.number, "ERC20Votes: block not yet mined");
        return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);
    }

    /**
     * @dev Lookup a value in a list of (sorted) checkpoints.
     */
    function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {
        // We run a binary search to look for the earliest checkpoint taken after `blockNumber`.
        //
        // During the loop, the index of the wanted checkpoint remains in the range [low-1, high).
        // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.
        // - If the middle checkpoint is after `blockNumber`, we look in [low, mid)
        // - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high)
        // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not
        // out of bounds (in which case we're looking too far in the past and the result is 0).
        // Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is
        // past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out
        // the same.
        uint256 high = ckpts.length;
        uint256 low = 0;
        while (low < high) {
            uint256 mid = Math.average(low, high);
            if (ckpts[mid].fromBlock > blockNumber) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        return high == 0 ? 0 : ckpts[high - 1].votes;
    }

    /**
     * @dev Delegate votes from the sender to `delegatee`.
     */
    function delegate(address delegatee) public virtual {
        _delegate(_msgSender(), delegatee);
    }

    /**
     * @dev Delegates votes from signer to `delegatee`
     */
    function delegateBySig(
        address delegatee,
        uint256 nonce,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(block.timestamp <= expiry, "ERC20Votes: signature expired");
        address signer = ECDSA.recover(
            _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),
            v,
            r,
            s
        );
        require(nonce == _useNonce(signer), "ERC20Votes: invalid nonce");
        _delegate(signer, delegatee);
    }

    /**
     * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).
     */
    function _maxSupply() internal view virtual returns (uint224) {
        return type(uint224).max;
    }

    /**
     * @dev Snapshots the totalSupply after it has been increased.
     */
    function _mint(address account, uint256 amount) internal virtual override {
        super._mint(account, amount);
        require(totalSupply() <= _maxSupply(), "ERC20Votes: total supply risks overflowing votes");

        _writeCheckpoint(_totalSupplyCheckpoints, _add, amount);
    }

    /**
     * @dev Snapshots the totalSupply after it has been decreased.
     */
    function _burn(address account, uint256 amount) internal virtual override {
        super._burn(account, amount);

        _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);
    }

    /**
     * @dev Move voting power when tokens are transferred.
     *
     * Emits a {DelegateVotesChanged} event.
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual override {
        super._afterTokenTransfer(from, to, amount);

        _moveVotingPower(delegates(from), delegates(to), amount);
    }

    /**
     * @dev Change delegation for `delegator` to `delegatee`.
     *
     * Emits events {DelegateChanged} and {DelegateVotesChanged}.
     */
    function _delegate(address delegator, address delegatee) internal virtual {
        address currentDelegate = delegates(delegator);
        uint256 delegatorBalance = balanceOf(delegator);
        _delegates[delegator] = delegatee;

        emit DelegateChanged(delegator, currentDelegate, delegatee);

        _moveVotingPower(currentDelegate, delegatee, delegatorBalance);
    }

    function _moveVotingPower(
        address src,
        address dst,
        uint256 amount
    ) private {
        if (src != dst && amount > 0) {
            if (src != address(0)) {
                (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);
                emit DelegateVotesChanged(src, oldWeight, newWeight);
            }

            if (dst != address(0)) {
                (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);
                emit DelegateVotesChanged(dst, oldWeight, newWeight);
            }
        }
    }

    function _writeCheckpoint(
        Checkpoint[] storage ckpts,
        function(uint256, uint256) view returns (uint256) op,
        uint256 delta
    ) private returns (uint256 oldWeight, uint256 newWeight) {
        uint256 pos = ckpts.length;
        oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;
        newWeight = op(oldWeight, delta);

        if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {
            ckpts[pos - 1].votes = SafeCast.toUint224(newWeight);
        } else {
            ckpts.push(Checkpoint({fromBlock: SafeCast.toUint32(block.number), votes: SafeCast.toUint224(newWeight)}));
        }
    }

    function _add(uint256 a, uint256 b) private pure returns (uint256) {
        return a + b;
    }

    function _subtract(uint256 a, uint256 b) private pure returns (uint256) {
        return a - b;
    }
}

File 26 of 54 : ERC20Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)

pragma solidity ^0.8.0;

import "../ERC20.sol";
import "../../../security/Pausable.sol";

/**
 * @dev ERC20 token with pausable token transfers, minting and burning.
 *
 * Useful for scenarios such as preventing trades until the end of an evaluation
 * period, or having an emergency switch for freezing all token transfers in the
 * event of a large bug.
 */
abstract contract ERC20Pausable is ERC20, Pausable {
    /**
     * @dev See {ERC20-_beforeTokenTransfer}.
     *
     * Requirements:
     *
     * - the contract must not be paused.
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, amount);

        require(!paused(), "ERC20Pausable: token transfer while paused");
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Burnable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) public virtual {
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) public virtual {
        uint256 currentAllowance = allowance(account, _msgSender());
        require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
        unchecked {
            _approve(account, _msgSender(), currentAllowance - amount);
        }
        _burn(account, amount);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

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

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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, _msgSender());
        _;
    }

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

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

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

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

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

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

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

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * 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.
     */
    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.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
        __ERC165_init_unchained();
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }
    uint256[50] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
        __Context_init_unchained();
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
    /**
     * @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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721EnumerableUpgradeable is IERC721Upgradeable {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Pausable.sol)

pragma solidity ^0.8.0;

import "../ERC721Upgradeable.sol";
import "../../../security/PausableUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev ERC721 token with pausable token transfers, minting and burning.
 *
 * Useful for scenarios such as preventing trades until the end of an evaluation
 * period, or having an emergency switch for freezing all token transfers in the
 * event of a large bug.
 */
abstract contract ERC721PausableUpgradeable is Initializable, ERC721Upgradeable, PausableUpgradeable {
    function __ERC721Pausable_init() internal onlyInitializing {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __Pausable_init_unchained();
        __ERC721Pausable_init_unchained();
    }

    function __ERC721Pausable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {ERC721-_beforeTokenTransfer}.
     *
     * Requirements:
     *
     * - the contract must not be paused.
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        require(!paused(), "ERC721Pausable: token transfer while paused");
    }
    uint256[50] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../ERC721Upgradeable.sol";
import "./IERC721EnumerableUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {
    function __ERC721Enumerable_init() internal onlyInitializing {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __ERC721Enumerable_init_unchained();
    }

    function __ERC721Enumerable_init_unchained() internal onlyInitializing {
    }
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Upgradeable.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721EnumerableUpgradeable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

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

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721Upgradeable.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
    uint256[46] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 44 of 54 : IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 IERC721ReceiverUpgradeable {
    /**
     * @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 `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721Upgradeable.sol";
import "./IERC721ReceiverUpgradeable.sol";
import "./extensions/IERC721MetadataUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/StringsUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
    using AddressUpgradeable for address;
    using StringsUpgradeable 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.
     */
    function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __ERC721_init_unchained(name_, symbol_);
    }

    function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
    }

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

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

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        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) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        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 overriden 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 = ERC721Upgradeable.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

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

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        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: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @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(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);
    }

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

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {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 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
    using AddressUpgradeable for address;

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

    function safeTransferFrom(
        IERC20Upgradeable 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(
        IERC20Upgradeable 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(
        IERC20Upgradeable 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(
        IERC20Upgradeable 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));
        }
    }

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)

pragma solidity ^0.8.0;

import "../ERC20Upgradeable.sol";
import "../../../security/PausableUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev ERC20 token with pausable token transfers, minting and burning.
 *
 * Useful for scenarios such as preventing trades until the end of an evaluation
 * period, or having an emergency switch for freezing all token transfers in the
 * event of a large bug.
 */
abstract contract ERC20PausableUpgradeable is Initializable, ERC20Upgradeable, PausableUpgradeable {
    function __ERC20Pausable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Pausable_init_unchained();
        __ERC20Pausable_init_unchained();
    }

    function __ERC20Pausable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {ERC20-_beforeTokenTransfer}.
     *
     * Requirements:
     *
     * - the contract must not be paused.
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, amount);

        require(!paused(), "ERC20Pausable: token transfer while paused");
    }
    uint256[50] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __Context_init_unchained();
        __ERC20_init_unchained(name_, symbol_);
    }

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

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

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

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

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

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

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

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

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

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

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

File 52 of 54 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __AccessControl_init_unchained();
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

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

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

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

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

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * 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.
     */
    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.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
    uint256[49] private __gap;
}

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

Contract Security Audit

Contract ABI

API
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"recipientAccountId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipientAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"depositAccount","type":"uint256"},{"indexed":false,"internalType":"string","name":"exaccId","type":"string"},{"indexed":false,"internalType":"string","name":"bankId","type":"string"},{"indexed":false,"internalType":"string","name":"trxId","type":"string"}],"name":"CashDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"recipientAccountId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"depositAccount","type":"uint256"},{"indexed":false,"internalType":"string","name":"exaccId","type":"string"},{"indexed":false,"internalType":"string","name":"bankId","type":"string"},{"indexed":false,"internalType":"string","name":"trxId","type":"string"}],"name":"CashDepositNOK","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"recipientAccountId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipientAddress","type":"address"},{"indexed":false,"internalType":"string","name":"exaccId","type":"string"},{"indexed":false,"internalType":"string","name":"bankId","type":"string"},{"indexed":false,"internalType":"string","name":"trxId","type":"string"}],"name":"CashLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"senderAccountId","type":"uint256"},{"indexed":true,"internalType":"address","name":"senderAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"payoutAccount","type":"uint256"},{"indexed":false,"internalType":"string","name":"bankId","type":"string"},{"indexed":false,"internalType":"string","name":"trxId","type":"string"}],"name":"CashPayout","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"payoutAccount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"string","name":"contactId","type":"string"},{"indexed":false,"internalType":"string","name":"txid","type":"string"}],"name":"ClientPayout","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"payoutAccount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"string","name":"contactId","type":"string"},{"indexed":false,"internalType":"string","name":"txid","type":"string"},{"indexed":false,"internalType":"uint256","name":"purposeId","type":"uint256"},{"indexed":false,"internalType":"string","name":"ref","type":"string"}],"name":"ClientPayoutRef","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"CASH_OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ChfRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LimitWalkin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINIMALCOMMISIONFEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RATES_UPDATER_OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WithdrawCharge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"accountId","type":"uint256"}],"name":"balanceOfByAccountId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"recipientAccountId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"exaccId","type":"string"},{"internalType":"string","name":"bankId","type":"string"},{"internalType":"string","name":"trxId","type":"string"}],"name":"cashDepositNOK","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"recipientAccountId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"exaccId","type":"string"},{"internalType":"string","name":"bankId","type":"string"},{"internalType":"string","name":"trxId","type":"string"}],"name":"cashDepositOK","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"senderAccountId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"bankId","type":"string"},{"internalType":"string","name":"trxId","type":"string"}],"name":"cashPayoutNOK","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"senderAccountId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"bankId","type":"string"},{"internalType":"string","name":"trxId","type":"string"}],"name":"cashPayoutOK","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"contactId","type":"string"}],"name":"clientPayout","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"contactId","type":"string"},{"internalType":"uint256","name":"purposeId","type":"uint256"},{"internalType":"string","name":"ref","type":"string"}],"name":"clientPayoutRef","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"convertFromChf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"convertToChf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"createTxId","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fiat24lockAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"bankId","type":"string"},{"internalType":"string","name":"trxId","type":"string"}],"name":"getPacs008","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"fiat24AccountProxyAddress","type":"address"},{"internalType":"uint256","name":"limitWalkin","type":"uint256"},{"internalType":"uint256","name":"chfRate","type":"uint256"},{"internalType":"uint256","name":"withdrawCharge","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minimalPayoutAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"pacs008","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sanctionCheck","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sanctionContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"sendToSundry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"fiat24lockAddress_","type":"address"}],"name":"setFiat24LockAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minimalPayoutAmount_","type":"uint256"}],"name":"setMinimalPayoutAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"sanctionCheck_","type":"bool"}],"name":"setSanctionCheck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sanctionContract_","type":"address"}],"name":"setSanctionCheckContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newLimitWalkin","type":"uint256"}],"name":"setWalkinLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"withdrawCharge","type":"uint256"}],"name":"setWithdrawCharge","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":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"tokenTransferAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"recipientAccountId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferByAccountId","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_chfRate","type":"uint256"}],"name":"updateChfRate","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061519b806100206000396000f3fe608060405234801561001057600080fd5b50600436106102925760003560e01c806218a8d61461029757806301ffc9a7146102ac57806306fdde03146102d4578063095ea7b3146102e95780630e108445146102fc57806310876e441461031d57806318160ddd1461034957806320a4d14c1461035157806323b872dd14610364578063248a9ca3146103775780632f2ff15d1461038a578063313ce5671461039d57806336568abe146103ac578063382121e5146103bf57806339509351146103c75780633f4ba83a146103da57806342966c68146103e257806348f6adef146103f55780634ec81af11461040857806353012e5c1461041b57806355275af5146104305780635c975abb146104455780635f758201146104505780636446b912146104655780636b3fc8b61461048657806370a082311461049957806372d5417c146104ac5780638456cb59146104b65780638c04b2f6146104be5780638c1ecb93146104d15780638c286d7c146104e45780638e2036ac146104f757806391d148541461050a57806395d89b411461051d5780639710c90714610525578063a0712d6814610538578063a1c309ed1461054b578063a217fddf1461055e578063a36158ef14610566578063a457c2d714610579578063a58a03411461058c578063a9059cbb1461059f578063ad67c582146105b2578063b5112dfb146105c5578063b5c9ee0f146105d8578063cd244643146105ec578063ce02e831146105ff578063d547741f14610612578063d69a745c14610625578063d6dfdec91461062f578063dd62ed3e14610639578063e0a50d0f14610672578063e11f2df714610685578063e89082b314610698578063eb6d2d71146106ab578063f08df8c9146106be578063f5b541a6146106c8575b600080fd5b6102aa6102a5366004614400565b6106dd565b005b6102bf6102ba36600461441d565b610739565b60405190151581526020015b60405180910390f35b6102dc610770565b6040516102cb9190614497565b6102bf6102f73660046144bf565b610802565b61030f61030a36600461458d565b610818565b6040519081526020016102cb565b61030f61032b3660046145f0565b80516020818301810180516101328252928201919093012091525481565b60355461030f565b6102dc61035f36600461462c565b610877565b6102bf610372366004614645565b6109a7565b61030f61038536600461462c565b610a3d565b6102aa610398366004614686565b610a52565b604051600281526020016102cb565b6102aa6103ba366004614686565b610a74565b61030f600a81565b6102bf6103d53660046144bf565b610af2565b6102aa610b2e565b6102aa6103f036600461462c565b610b5f565b6102aa6104033660046146b6565b610c0d565b6102aa6104163660046146f2565b610d73565b61030f60008051602061514683398151915281565b61030f6000805160206150a683398151915281565b60655460ff166102bf565b610130546102bf90600160a01b900460ff1681565b61013354610479906001600160a01b031681565b6040516102cb919061472d565b6102aa61049436600461462c565b610e36565b61030f6104a7366004614741565b610e70565b61030f6101345481565b6102aa610e8b565b6102bf6104cc366004614645565b610eba565b6102aa6104df36600461462c565b6117da565b6102aa6104f2366004614741565b611814565b6102aa61050536600461462c565b61186b565b6102bf610518366004614686565b6118a5565b6102dc6118d0565b6102aa61053336600461462c565b6118df565b6102aa61054636600461462c565b61195a565b61030f61055936600461462c565b611a05565b61030f600081565b6102aa61057436600461475e565b611a7a565b6102bf6105873660046144bf565b611d42565b6102aa61059a3660046147d4565b611ddb565b6102bf6105ad3660046144bf565b612041565b6102aa6105c036600461475e565b61204e565b6102aa6105d33660046147d4565b6122c4565b61013154610479906001600160a01b031681565b6102aa6105fa3660046144bf565b61280e565b61030f61060d36600461462c565b6128bd565b6102aa610620366004614686565b6128e1565b61030f61012e5481565b61030f61012d5481565b61030f61064736600461486f565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b6102aa610680366004614741565b6128fe565b61030f61069336600461462c565b612955565b6102bf6106a636600461489d565b61296c565b6102aa6106b93660046148bf565b6129e7565b61030f61012f5481565b61030f6000805160206150e683398151915281565b6106f56000805160206150e6833981519152336118a5565b61071a5760405162461bcd60e51b81526004016107119061491c565b60405180910390fd5b6101308054911515600160a01b0260ff60a01b19909216919091179055565b60006001600160e01b03198216637965db0b60e01b148061076a57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606036805461077f90614952565b80601f01602080910402602001604051908101604052809291908181526020018280546107ab90614952565b80156107f85780601f106107cd576101008083540402835291602001916107f8565b820191906000526020600020905b8154815290600101906020018083116107db57829003601f168201915b5050505050905090565b600061080f338484612b43565b50600192915050565b600080838360405160200161082e92919061498c565b60405160208183030381529060405280519060200120905061013261085282612c67565b60405161085f91906149c8565b90815260200160405180910390205491505092915050565b6040805180820190915260048152634632342d60e01b602082015260609060006108a084612dd1565b905042600080808080806108b387612ed3565b949a5092985090965094509250905060006108cd87612dd1565b6108d88760026130ec565b6108e38760026130ec565b6040516020016108f5939291906149e4565b604051602081830303815290604052905089898261097460646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561094b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096f9190614a27565b612dd1565b6040516020016109879493929190614a40565b6040516020818303038152906040529a5050505050505050505050919050565b60006109b4848484613253565b60006109c08533610647565b905082811015610a235760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610711565b610a308533858403612b43565b60019150505b9392505050565b600090815260fb602052604090206001015490565b610a5b82610a3d565b610a658133613426565b610a6f838361348a565b505050565b6001600160a01b0381163314610ae45760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610711565b610aee8282613510565b5050565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909161080f918590610b29908690614ac5565b612b43565b610b396000336118a5565b610b555760405162461bcd60e51b815260040161071190614ad8565b610b5d613577565b565b610b776000805160206150e6833981519152336118a5565b610b935760405162461bcd60e51b81526004016107119061491c565b610130546040516331a9108f60e11b81526123906004820152610c0a916001600160a01b031690636352211e90602401602060405180830381865afa158015610be0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c049190614b0b565b82613604565b50565b61013454821015610c305760405162461bcd60e51b815260040161071190614b28565b61013054604051632f745c5960e01b81526000916001600160a01b031690632f745c5990610c649033908590600401614b73565b602060405180830381865afa158015610c81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca59190614a27565b90506000610cb282612dd1565b610cf460646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561094b573d6000803e3d6000fd5b604051602001610d0592919061498c565b6040516020818303038152906040529050610d2261238e8561296c565b50336001600160a01b0316827f45e2fe7040990afae36f39a1293f66228009bf8dd3eaf17fc636987a31d2632961238e878786604051610d659493929190614b8c565b60405180910390a350505050565b600054610100900460ff16610d8e5760005460ff1615610d92565b303b155b610dae5760405162461bcd60e51b815260040161071190614bc8565b600054610100900460ff16158015610dd0576000805461ffff19166101011790555b610e1d856040518060400160405280600a81526020016908cd2c2e8646840869c960b31b8152506040518060400160405280600581526020016410d3920c8d60da1b815250878787613753565b8015610e2f576000805461ff00191690555b5050505050565b610e4e6000805160206150e6833981519152336118a5565b610e6a5760405162461bcd60e51b81526004016107119061491c565b61012e55565b6001600160a01b031660009081526033602052604090205490565b610e966000336118a5565b610eb25760405162461bcd60e51b815260040161071190614ad8565b610b5d613836565b6101305460408051635c975abb60e01b815290516000926001600160a01b031691635c975abb9160048083019260209291908290030181865afa158015610f05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f299190614c16565b15610f7a5760405162461bcd60e51b815260206004820152602d602482015260008051602061506683398151915260448201526c1c9cc8185c99481c185d5cd959609a1b6064820152608401610711565b60655460ff1615610fcf5760405162461bcd60e51b815260206004820152603e602482015260008051602061506683398151915260448201526000805160206150c68339815191526064820152608401610711565b61013054600160a01b900460ff1615611197576101315460405163df592f7d60e01b81526001600160a01b0390911690600090829063df592f7d9061101890889060040161472d565b602060405180830381865afa158015611035573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110599190614c16565b905080156110bd5760405162461bcd60e51b815260206004820152602b60248201527f466961743234546f6b656e3a205472616e7366657220746f2073616e6374696f60448201526a6e6564206164647265737360a81b6064820152608401610711565b60405163df592f7d60e01b81526000906001600160a01b0384169063df592f7d906110ec908a9060040161472d565b602060405180830381865afa158015611109573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112d9190614c16565b905080156111935760405162461bcd60e51b815260206004820152602d60248201527f466961743234546f6b656e3a205472616e736665722066726f6d2073616e637460448201526c696f6e6564206164647265737360981b6064820152608401610711565b5050505b6001600160a01b038416158015906111b757506001600160a01b03831615155b156117d057816111c685610e70565b10156111d457506000610a36565b60006111df84610e70565b6111e99084614ac5565b610130546040516302af047960e41b815291925060009182916001600160a01b031690632af0479090611220908a9060040161472d565b602060405180830381865afa15801561123d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112619190614a27565b905080156112de57610130546040516342d21ef760e01b8152600481018390526001600160a01b03909116906342d21ef790602401602060405180830381865afa1580156112b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d79190614c33565b91506113f0565b6001600160a01b038716158015906113665750610130546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611323908b9060040161472d565b602060405180830381865afa158015611340573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113649190614a27565b115b156113eb5761013054604051632f745c5960e01b8152600293506001600160a01b0390911690632f745c59906113a3908a90600090600401614b73565b602060405180830381865afa1580156113c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e49190614a27565b90506113f0565b600091505b610130546040516302af047960e41b815260009182916001600160a01b0390911690632af0479090611426908b9060040161472d565b602060405180830381865afa158015611443573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114679190614a27565b905080156114e457610130546040516342d21ef760e01b8152600481018390526001600160a01b03909116906342d21ef790602401602060405180830381865afa1580156114b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114dd9190614c33565b91506115f6565b6001600160a01b0388161580159061156c5750610130546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611529908c9060040161472d565b602060405180830381865afa158015611546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156a9190614a27565b115b156115f15761013054604051632f745c5960e01b8152600293506001600160a01b0390911690632f745c59906115a9908b90600090600401614b73565b602060405180830381865afa1580156115c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ea9190614a27565b90506115f6565b600091505b6000611601886128bd565b6101305460405163186dddd560e31b81529192506000916001600160a01b039091169063c36eeea89061163a9088908690600401614c54565b602060405180830381865afa158015611657573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167b9190614c16565b6101305460405163186dddd560e31b81529192506000916001600160a01b039091169063c36eeea8906116b49087908790600401614c54565b602060405180830381865afa1580156116d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f59190614c16565b9050600587600581111561170b5761170b614c62565b1480156117445750600585600581111561172757611727614c62565b14806117445750600185600581111561174257611742614c62565b145b801561174d5750815b80156117565750805b806117c15750600587600581111561177057611770614c62565b14801561177a5750815b80156117c15750600085600581111561179557611795614c62565b14806117b2575060028560058111156117b0576117b0614c62565b145b80156117c1575061012e548811155b98505050505050505050610a36565b5060009392505050565b6117f26000805160206150e6833981519152336118a5565b61180e5760405162461bcd60e51b81526004016107119061491c565b61012f55565b61182c6000805160206150e6833981519152336118a5565b6118485760405162461bcd60e51b81526004016107119061491c565b61013180546001600160a01b0319166001600160a01b0392909216919091179055565b6118836000805160206150e6833981519152336118a5565b61189f5760405162461bcd60e51b81526004016107119061491c565b61013455565b600091825260fb602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606037805461077f90614952565b6118f76000805160206150a6833981519152336118a5565b6119545760405162461bcd60e51b815260206004820152602860248201527f466961743234546f6b656e3a204e6f742061207261746520757064617465722060448201526737b832b930ba37b960c11b6064820152608401610711565b61012d55565b6119726000805160206150e6833981519152336118a5565b61198e5760405162461bcd60e51b81526004016107119061491c565b610130546040516331a9108f60e11b815261238d6004820152610c0a916001600160a01b031690636352211e90602401602060405180830381865afa1580156119db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ff9190614b0b565b826138b1565b610130546040516331a9108f60e11b81526004810183905260009161076a916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611a56573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a79190614b0b565b611a92600080516020615146833981519152336118a5565b611aae5760405162461bcd60e51b815260040161071190614c78565b60008282604051602001611ac392919061498c565b604051602081830303815290604052805190602001209050610132611ae782612c67565b604051611af491906149c8565b908152602001604051809103902054600014611b225760405162461bcd60e51b815260040161071190614cad565b60646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b859190614a27565b610132611b9183612c67565b604051611b9e91906149c8565b90815260405190819003602001812091909155610130546331a9108f60e11b825261238e6004830152611c97916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611bfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c219190614b0b565b610130546040516331a9108f60e11b815261239060048201526001600160a01b0390911690636352211e906024015b602060405180830381865afa158015611c6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c919190614b0b565b866109a7565b50610130546040516331a9108f60e11b8152600481018790526001600160a01b0390911690636352211e90602401602060405180830381865afa158015611ce2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d069190614b0b565b6001600160a01b0316856000805160206150868339815191526123908686604051611d3393929190614cf3565b60405180910390a35050505050565b3360009081526034602090815260408083206001600160a01b038616845290915281205482811015611dc45760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610711565b611dd13385858403612b43565b5060019392505050565b611df3600080516020615146833981519152336118a5565b611e0f5760405162461bcd60e51b815260040161071190614c78565b60008282604051602001611e2492919061498c565b604051602081830303815290604052805190602001209050610132611e4882612c67565b604051611e5591906149c8565b908152602001604051809103902054600014611e835760405162461bcd60e51b815260040161071190614cad565b60646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ec2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee69190614a27565b610132611ef283612c67565b604051611eff91906149c8565b90815260405190819003602001812091909155610130546331a9108f60e11b825261238d6004830152611ff8916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611f5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f829190614b0b565b610130546040516331a9108f60e11b815261238f60048201526001600160a01b0390911690636352211e906024015b602060405180830381865afa158015611fce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ff29190614b0b565b876109a7565b50857fb7c0e9377f7b7b3a99eeff545086c68afe0f2d0c812a2f1104b85b9c1a9ff67361238f8686866040516120319493929190614d28565b60405180910390a2505050505050565b600061080f338484613253565b612066600080516020615146833981519152336118a5565b6120825760405162461bcd60e51b815260040161071190614c78565b6000828260405160200161209792919061498c565b6040516020818303038152906040528051906020012090506101326120bb82612c67565b6040516120c891906149c8565b9081526020016040518091039020546000146120f65760405162461bcd60e51b815260040161071190614cad565b60646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612135573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121599190614a27565b61013261216583612c67565b60405161217291906149c8565b90815260405190819003602001812091909155610130546331a9108f60e11b825261238e6004830152612228916001600160a01b0390911690636352211e90602401602060405180830381865afa1580156121d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121f59190614b0b565b610130546040516331a9108f60e11b815261238f60048201526001600160a01b0390911690636352211e90602401611c50565b50610130546040516331a9108f60e11b8152600481018790526001600160a01b0390911690636352211e90602401602060405180830381865afa158015612273573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122979190614b0b565b6001600160a01b03168560008051602061508683398151915261238f8686604051611d3393929190614cf3565b6122dc600080516020615146833981519152336118a5565b6122f85760405162461bcd60e51b815260040161071190614c78565b6000828260405160200161230d92919061498c565b60405160208183030381529060405280519060200120905061013261233182612c67565b60405161233e91906149c8565b90815260200160405180910390205460001461236c5760405162461bcd60e51b815260040161071190614cad565b60646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123cf9190614a27565b6101326123db83612c67565b6040516123e891906149c8565b908152604051908190036020019020556005610130546040516342d21ef760e01b8152600481018990526001600160a01b03909116906342d21ef790602401602060405180830381865afa158015612444573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124689190614c33565b600581111561247957612479614c62565b14806125025750610130546040516342d21ef760e01b8152600481018890526001916001600160a01b0316906342d21ef790602401602060405180830381865afa1580156124cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ef9190614c33565b600581111561250057612500614c62565b145b80156125835750610130546001600160a01b031663c36eeea887612525886128bd565b6040518363ffffffff1660e01b8152600401612542929190614c54565b602060405180830381865afa15801561255f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125839190614c16565b156126e657610130546040516331a9108f60e11b815261238d600482015261262b916001600160a01b031690636352211e90602401602060405180830381865afa1580156125d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f99190614b0b565b610130546040516331a9108f60e11b8152600481018a90526001600160a01b0390911690636352211e90602401611fb1565b50610130546040516331a9108f60e11b8152600481018890526001600160a01b0390911690636352211e90602401602060405180830381865afa158015612676573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061269a9190614b0b565b6001600160a01b0316867f5cdb709c6198a116498170c22013ce75b77a91000367ae320550e291f463ee6b888787876040516126d99493929190614d28565b60405180910390a3612806565b610133546040516333c9f3f160e21b815260048101889052306024820152604481018790526001600160a01b039091169063cf27cfc490606401600060405180830381600087803b15801561273a57600080fd5b505af115801561274e573d6000803e3d6000fd5b5050610130546040516331a9108f60e11b8152600481018a90526001600160a01b039091169250636352211e9150602401602060405180830381865afa15801561279c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c09190614b0b565b6001600160a01b0316867f396a681c4a25f9658cb95bfad7f402803fff63e11a018bb3c260315c29f45d4a8686866040516127fd93929190614d67565b60405180910390a35b505050505050565b6128266000805160206150e6833981519152336118a5565b6128425760405162461bcd60e51b81526004016107119061491c565b610130546040516331a9108f60e11b815261238f6004820152610aee9184916001600160a01b0390911690636352211e90602401602060405180830381865afa158015612893573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b79190614b0b565b83613253565b600061076a6103e86128db61012d548561399290919063ffffffff16565b9061399e565b6128ea82610a3d565b6128f48133613426565b610a6f8383613510565b6129166000805160206150e6833981519152336118a5565b6129325760405162461bcd60e51b81526004016107119061491c565b61013380546001600160a01b0319166001600160a01b0392909216919091179055565b61012d5460009061076a906128db846103e8613992565b610130546040516331a9108f60e11b815260048101849052600091610a36916001600160a01b0390911690636352211e90602401602060405180830381865afa1580156129bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129e19190614b0b565b83612041565b61013454841015612a0a5760405162461bcd60e51b815260040161071190614b28565b61013054604051632f745c5960e01b81526000916001600160a01b031690632f745c5990612a3e9033908590600401614b73565b602060405180830381865afa158015612a5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7f9190614a27565b90506000612a8c82612dd1565b612ace60646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561094b573d6000803e3d6000fd5b604051602001612adf92919061498c565b6040516020818303038152906040529050612afc61238e8761296c565b50336001600160a01b0316827fb0edd2920d8642e5a9d1e38c772e65fabe13c83a27cef8f6929a7740b9041d3661238e8989868a8a6040516127fd96959493929190614da0565b6001600160a01b038316612ba55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610711565b6001600160a01b038216612c065760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610711565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b604080516020808252818301909252606091600091906020820181803683370190505090506000805b6020811015612d1d57848160208110612cab57612cab614df8565b1a60f81b6001600160f81b03191615612d0b57848160208110612cd057612cd0614df8565b1a60f81b838381518110612ce657612ce6614df8565b60200101906001600160f81b031916908160001a90535081612d0781614e0e565b9250505b80612d1581614e0e565b915050612c90565b506000816001600160401b03811115612d3857612d386144eb565b6040519080825280601f01601f191660200182016040528015612d62576020820181803683370190505b50905060005b82811015612dc857838181518110612d8257612d82614df8565b602001015160f81c60f81b828281518110612d9f57612d9f614df8565b60200101906001600160f81b031916908160001a90535080612dc081614e0e565b915050612d68565b50949350505050565b606081600003612df85750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612e225780612e0c81614e0e565b9150612e1b9050600a83614e3d565b9150612dfc565b6000816001600160401b03811115612e3c57612e3c6144eb565b6040519080825280601f01601f191660200182016040528015612e66576020820181803683370190505b508593509050815b8315612dc857612e7f600a85614e51565b612e8a906030614ac5565b60f81b82612e9783614e65565b92508281518110612eaa57612eaa614df8565b60200101906001600160f81b031916908160001a905350612ecc600a85614e3d565b9350612e6e565b600080808080806107b281808080805b6301e133808d10612f6b576000612efb600488614e51565b158015612f245750612f0e606488614e51565b151580612f245750612f2261019088614e51565b155b612f32576301e13380612f38565b6301e285005b9050808e10612f5f57612f4b818f614e7c565b9d5086612f5781614e0e565b975050612f65565b50612f6b565b50612ee3565b600194505b6040805161018081018252601f808252601c6020830152918101829052601e606082018190526080820183905260a0820181905260c0820183905260e0820183905261010082018190526101208201839052610140820152610160810191909152612fdc600488614e51565b1580156130055750612fef606488614e51565b151580613005575061300361019088614e51565b155b1561301257601d60208201525b6000620151808261302460018a614e7c565b600c811061303457613034614df8565b602002015160ff166130469190614e8f565b9050808f1015613057575050613079565b808f6130639190614e7c565b9e508661306f81614e0e565b9750505050612f70565b613086620151808e614e3d565b613091906001614ac5565b93506130a0620151808e614e51565b9c506130ae610e108e614e3d565b92506130bc610e108e614e51565b9c506130c9603c8e614e3d565b91506130d6603c8e614e51565b959d949c50929a50909850965091945092505050565b60608160000361310b575060408051602081019091526000815261076a565b8260005b8115613135578061311f81614e0e565b915061312e9050600a83614e3d565b915061310f565b83811061314e5761314585612dd1565b9250505061076a565b6000846001600160401b03811115613168576131686144eb565b6040519080825280601f01601f191660200182016040528015613192576020820181803683370190505b508693509050845b831561320257806131aa81614e65565b91506131b99050600a85614e51565b6131c4906030614ac5565b60f81b8282815181106131d9576131d9614df8565b60200101906001600160f81b031916908160001a9053506131fb600a85614e3d565b935061319a565b8015613248578061321281614e65565b915050603060f81b82828151811061322c5761322c614df8565b60200101906001600160f81b031916908160001a905350613202565b50925061076a915050565b6001600160a01b0383166132b75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610711565b6001600160a01b0382166133195760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610711565b6133248383836139aa565b6001600160a01b0383166000908152603360205260409020548181101561339c5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610711565b6001600160a01b038085166000908152603360205260408082208585039055918516815290812080548492906133d3908490614ac5565b92505081905550826001600160a01b0316846001600160a01b03166000805160206151068339815191528460405161340d91815260200190565b60405180910390a3613420848484613c84565b50505050565b61343082826118a5565b610aee57613448816001600160a01b03166014614180565b613453836020614180565b604051602001613464929190614ea6565b60408051601f198184030181529082905262461bcd60e51b825261071191600401614497565b61349482826118a5565b610aee57600082815260fb602090815260408083206001600160a01b03851684529091529020805460ff191660011790556134cc3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61351a82826118a5565b15610aee57600082815260fb602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60655460ff166135c05760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610711565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516135fa919061472d565b60405180910390a1565b6001600160a01b0382166136645760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610711565b613670826000836139aa565b6001600160a01b038216600090815260336020526040902054818110156136e45760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610711565b6001600160a01b0383166000908152603360205260408120838303905560358054849290613713908490614e7c565b90915550506040518281526000906001600160a01b038516906000805160206151068339815191529060200160405180910390a3610a6f83600084613c84565b600054610100900460ff1661376e5760005460ff1615613772565b303b155b61378e5760405162461bcd60e51b815260040161071190614bc8565b600054610100900460ff161580156137b0576000805461ffff19166101011790555b6137b861431b565b6137c061431b565b6137ca8686614342565b6137d5600033614382565b6137ed6000805160206150e683398151915233614382565b61013080546001600160a01b0319166001600160a01b03891617905561012e84905561012d83905561012f829055801561382d576000805461ff00191690555b50505050505050565b60655460ff161561387c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610711565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586135ed3390565b6001600160a01b0382166139075760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610711565b613913600083836139aa565b80603560008282546139259190614ac5565b90915550506001600160a01b03821660009081526033602052604081208054839290613952908490614ac5565b90915550506040518181526001600160a01b038316906000906000805160206151068339815191529060200160405180910390a3610aee60008383613c84565b6000610a368284614e8f565b6000610a368284614e3d565b61013060009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156139fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a229190614c16565b15613a735760405162461bcd60e51b815260206004820152602d602482015260008051602061512683398151915260448201526c1c9cc8185c99481c185d5cd959609a1b6064820152608401610711565b60655460ff1615613ac85760405162461bcd60e51b815260206004820152603e602482015260008051602061512683398151915260448201526000805160206150c68339815191526064820152608401610711565b6001600160a01b03831615801590613ae857506001600160a01b03821615155b8015613b745750610130546040516331a9108f60e11b815261238f60048201526001600160a01b0390911690636352211e90602401602060405180830381865afa158015613b3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b5e9190614b0b565b6001600160a01b0316826001600160a01b031614155b8015613c005750610130546040516331a9108f60e11b815261238f60048201526001600160a01b0390911690636352211e90602401602060405180830381865afa158015613bc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bea9190614b0b565b6001600160a01b0316836001600160a01b031614155b15613c7957613c10838383610eba565b613c795760405162461bcd60e51b815260206004820152603460248201527f466961743234546f6b656e3a205472616e73666572206e6f7420616c6c6f776560448201527332103337b9103b30b934b7bab9903932b0b9b7b760611b6064820152608401610711565b610a6f83838361438c565b6001600160a01b03831615801590613ca457506001600160a01b03821615155b8015613d305750610130546040516331a9108f60e11b815261238f60048201526001600160a01b0390911690636352211e90602401602060405180830381865afa158015613cf6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d1a9190614b0b565b6001600160a01b0316826001600160a01b031614155b8015613dbc5750610130546040516331a9108f60e11b815261238f60048201526001600160a01b0390911690636352211e90602401602060405180830381865afa158015613d82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613da69190614b0b565b6001600160a01b0316836001600160a01b031614155b15610a6f57610130546040516302af047960e41b81526000916001600160a01b031690632af0479090613df390879060040161472d565b602060405180830381865afa158015613e10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e349190614a27565b905080158015613eb45750610130546040516370a0823160e01b81526000916001600160a01b0316906370a0823190613e7190889060040161472d565b602060405180830381865afa158015613e8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613eb29190614a27565b115b15613f315761013054604051632f745c5960e01b81526001600160a01b0390911690632f745c5990613eed908790600090600401614b73565b602060405180830381865afa158015613f0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f2e9190614a27565b90505b610130546040516302af047960e41b81526000916001600160a01b031690632af0479090613f6390879060040161472d565b602060405180830381865afa158015613f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fa49190614a27565b9050801580156140245750610130546040516370a0823160e01b81526000916001600160a01b0316906370a0823190613fe190889060040161472d565b602060405180830381865afa158015613ffe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140229190614a27565b115b156140a15761013054604051632f745c5960e01b81526001600160a01b0390911690632f745c599061405d908790600090600401614b73565b602060405180830381865afa15801561407a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061409e9190614a27565b90505b610130546001600160a01b0316634bedccf4836140bd866128bd565b6040518363ffffffff1660e01b81526004016140da929190614c54565b600060405180830381600087803b1580156140f457600080fd5b505af1158015614108573d6000803e3d6000fd5b5050610130546001600160a01b03169150634bedccf490508261412a866128bd565b6040518363ffffffff1660e01b8152600401614147929190614c54565b600060405180830381600087803b15801561416157600080fd5b505af1158015614175573d6000803e3d6000fd5b505050505050505050565b6060600061418f836002614e8f565b61419a906002614ac5565b6001600160401b038111156141b1576141b16144eb565b6040519080825280601f01601f1916602001820160405280156141db576020820181803683370190505b509050600360fc1b816000815181106141f6576141f6614df8565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061422557614225614df8565b60200101906001600160f81b031916908160001a9053506000614249846002614e8f565b614254906001614ac5565b90505b60018111156142cc576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061428857614288614df8565b1a60f81b82828151811061429e5761429e614df8565b60200101906001600160f81b031916908160001a90535060049490941c936142c581614e65565b9050614257565b508315610a365760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610711565b600054610100900460ff16610b5d5760405162461bcd60e51b815260040161071190614f15565b600054610100900460ff166143695760405162461bcd60e51b815260040161071190614f15565b60366143758382614fa6565b506037610a6f8282614fa6565b610aee828261348a565b60655460ff1615610a6f5760405162461bcd60e51b815260206004820152602a60248201527f45524332305061757361626c653a20746f6b656e207472616e736665722077686044820152691a5b19481c185d5cd95960b21b6064820152608401610711565b8015158114610c0a57600080fd5b60006020828403121561441257600080fd5b8135610a36816143f2565b60006020828403121561442f57600080fd5b81356001600160e01b031981168114610a3657600080fd5b60005b8381101561446257818101518382015260200161444a565b50506000910152565b60008151808452614483816020860160208601614447565b601f01601f19169290920160200192915050565b602081526000610a36602083018461446b565b6001600160a01b0381168114610c0a57600080fd5b600080604083850312156144d257600080fd5b82356144dd816144aa565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261451257600080fd5b81356001600160401b038082111561452c5761452c6144eb565b604051601f8301601f19908116603f01168101908282118183101715614554576145546144eb565b8160405283815286602085880101111561456d57600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080604083850312156145a057600080fd5b82356001600160401b03808211156145b757600080fd5b6145c386838701614501565b935060208501359150808211156145d957600080fd5b506145e685828601614501565b9150509250929050565b60006020828403121561460257600080fd5b81356001600160401b0381111561461857600080fd5b61462484828501614501565b949350505050565b60006020828403121561463e57600080fd5b5035919050565b60008060006060848603121561465a57600080fd5b8335614665816144aa565b92506020840135614675816144aa565b929592945050506040919091013590565b6000806040838503121561469957600080fd5b8235915060208301356146ab816144aa565b809150509250929050565b600080604083850312156146c957600080fd5b8235915060208301356001600160401b038111156146e657600080fd5b6145e685828601614501565b6000806000806080858703121561470857600080fd5b8435614713816144aa565b966020860135965060408601359560600135945092505050565b6001600160a01b0391909116815260200190565b60006020828403121561475357600080fd5b8135610a36816144aa565b6000806000806080858703121561477457600080fd5b843593506020850135925060408501356001600160401b038082111561479957600080fd5b6147a588838901614501565b935060608701359150808211156147bb57600080fd5b506147c887828801614501565b91505092959194509250565b600080600080600060a086880312156147ec57600080fd5b853594506020860135935060408601356001600160401b038082111561481157600080fd5b61481d89838a01614501565b9450606088013591508082111561483357600080fd5b61483f89838a01614501565b9350608088013591508082111561485557600080fd5b5061486288828901614501565b9150509295509295909350565b6000806040838503121561488257600080fd5b823561488d816144aa565b915060208301356146ab816144aa565b600080604083850312156148b057600080fd5b50508035926020909101359150565b600080600080608085870312156148d557600080fd5b8435935060208501356001600160401b03808211156148f357600080fd5b6148ff88838901614501565b94506040870135935060608701359150808211156147bb57600080fd5b6020808252601c908201527b2334b0ba191a2a37b5b2b71d102737ba1030b71037b832b930ba37b960211b604082015260600190565b600181811c9082168061496657607f821691505b60208210810361498657634e487b7160e01b600052602260045260246000fd5b50919050565b6000835161499e818460208801614447565b602d60f81b90830190815283516149bc816001840160208801614447565b01600101949350505050565b600082516149da818460208701614447565b9190910192915050565b600084516149f6818460208901614447565b845190830190614a0a818360208901614447565b8451910190614a1d818360208801614447565b0195945050505050565b600060208284031215614a3957600080fd5b5051919050565b60008551614a52818460208a01614447565b855190830190614a66818360208a01614447565b602d60f81b91018181528551909190614a86816001850160208a01614447565b60019201918201528351614aa1816002840160208801614447565b016002019695505050505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561076a5761076a614aaf565b6020808252601990820152782334b0ba191a2a37b5b2b71d102737ba1030b71030b236b4b760391b604082015260600190565b600060208284031215614b1d57600080fd5b8151610a36816144aa565b6020808252602b908201527f466961743234546f6b656e3a20616d6f756e74203c206d696e696d616c20706160408201526a1e5bdd5d08185b5bdd5b9d60aa1b606082015260800190565b6001600160a01b03929092168252602082015260400190565b848152836020820152608060408201526000614bab608083018561446b565b8281036060840152614bbd818561446b565b979650505050505050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b600060208284031215614c2857600080fd5b8151610a36816143f2565b600060208284031215614c4557600080fd5b815160068110610a3657600080fd5b918252602082015260400190565b634e487b7160e01b600052602160045260246000fd5b6020808252818101527f466961743234546f6b656e3a204e6f7420612043617368204f70657261746f72604082015260600190565b60208082526026908201527f466961743234546f6b656e3a207061637330303820616c72656164792070726f60408201526518d95cdcd95960d21b606082015260800190565b838152606060208201526000614d0c606083018561446b565b8281036040840152614d1e818561446b565b9695505050505050565b848152608060208201526000614d41608083018661446b565b8281036040840152614d53818661446b565b90508281036060840152614bbd818561446b565b606081526000614d7a606083018661446b565b8281036020840152614d8c818661446b565b90508281036040840152614d1e818561446b565b86815285602082015260c060408201526000614dbf60c083018761446b565b8281036060840152614dd1818761446b565b905084608084015282810360a0840152614deb818561446b565b9998505050505050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201614e2057614e20614aaf565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082614e4c57614e4c614e27565b500490565b600082614e6057614e60614e27565b500690565b600081614e7457614e74614aaf565b506000190190565b8181038181111561076a5761076a614aaf565b808202811582820484141761076a5761076a614aaf565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351614ed8816017850160208801614447565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614f09816028840160208801614447565b01602801949350505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b601f821115610a6f57600081815260208120601f850160051c81016020861015614f875750805b601f850160051c820191505b8181101561280657828155600101614f93565b81516001600160401b03811115614fbf57614fbf6144eb565b614fd381614fcd8454614952565b84614f60565b602080601f8311600181146150085760008415614ff05750858301515b600019600386901b1c1916600185901b178555612806565b600085815260208120601f198616915b8281101561503757888601518255948401946001909101908401615018565b50858210156150555787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fe466961743234546f6b656e3a20416c6c206163636f756e74207472616e73666561b5aec2618015d8ed22811fd54e1879a653e6ed114e9a9aeff7c53e4bf0ec60dc8b1416a064e54e8fcba3f3bc78e3cce2f7fdb81752ac1a2e9b70b7acaf194f7273206f6620746869732063757272656e63792061726520706175736564000097667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef466961743234546f6b656e3a20616c6c206163636f756e74207472616e7366654fde3dfe3090fae85f62f8d63bf4c5b6a33f0bc579a46c4e5af6407837a11171a264697066735822122053b1a0c29d7cbb1cdfc4e2e4a4a857995485de83012323b2a0d9b933a510d8e464736f6c63430008120033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102925760003560e01c806218a8d61461029757806301ffc9a7146102ac57806306fdde03146102d4578063095ea7b3146102e95780630e108445146102fc57806310876e441461031d57806318160ddd1461034957806320a4d14c1461035157806323b872dd14610364578063248a9ca3146103775780632f2ff15d1461038a578063313ce5671461039d57806336568abe146103ac578063382121e5146103bf57806339509351146103c75780633f4ba83a146103da57806342966c68146103e257806348f6adef146103f55780634ec81af11461040857806353012e5c1461041b57806355275af5146104305780635c975abb146104455780635f758201146104505780636446b912146104655780636b3fc8b61461048657806370a082311461049957806372d5417c146104ac5780638456cb59146104b65780638c04b2f6146104be5780638c1ecb93146104d15780638c286d7c146104e45780638e2036ac146104f757806391d148541461050a57806395d89b411461051d5780639710c90714610525578063a0712d6814610538578063a1c309ed1461054b578063a217fddf1461055e578063a36158ef14610566578063a457c2d714610579578063a58a03411461058c578063a9059cbb1461059f578063ad67c582146105b2578063b5112dfb146105c5578063b5c9ee0f146105d8578063cd244643146105ec578063ce02e831146105ff578063d547741f14610612578063d69a745c14610625578063d6dfdec91461062f578063dd62ed3e14610639578063e0a50d0f14610672578063e11f2df714610685578063e89082b314610698578063eb6d2d71146106ab578063f08df8c9146106be578063f5b541a6146106c8575b600080fd5b6102aa6102a5366004614400565b6106dd565b005b6102bf6102ba36600461441d565b610739565b60405190151581526020015b60405180910390f35b6102dc610770565b6040516102cb9190614497565b6102bf6102f73660046144bf565b610802565b61030f61030a36600461458d565b610818565b6040519081526020016102cb565b61030f61032b3660046145f0565b80516020818301810180516101328252928201919093012091525481565b60355461030f565b6102dc61035f36600461462c565b610877565b6102bf610372366004614645565b6109a7565b61030f61038536600461462c565b610a3d565b6102aa610398366004614686565b610a52565b604051600281526020016102cb565b6102aa6103ba366004614686565b610a74565b61030f600a81565b6102bf6103d53660046144bf565b610af2565b6102aa610b2e565b6102aa6103f036600461462c565b610b5f565b6102aa6104033660046146b6565b610c0d565b6102aa6104163660046146f2565b610d73565b61030f60008051602061514683398151915281565b61030f6000805160206150a683398151915281565b60655460ff166102bf565b610130546102bf90600160a01b900460ff1681565b61013354610479906001600160a01b031681565b6040516102cb919061472d565b6102aa61049436600461462c565b610e36565b61030f6104a7366004614741565b610e70565b61030f6101345481565b6102aa610e8b565b6102bf6104cc366004614645565b610eba565b6102aa6104df36600461462c565b6117da565b6102aa6104f2366004614741565b611814565b6102aa61050536600461462c565b61186b565b6102bf610518366004614686565b6118a5565b6102dc6118d0565b6102aa61053336600461462c565b6118df565b6102aa61054636600461462c565b61195a565b61030f61055936600461462c565b611a05565b61030f600081565b6102aa61057436600461475e565b611a7a565b6102bf6105873660046144bf565b611d42565b6102aa61059a3660046147d4565b611ddb565b6102bf6105ad3660046144bf565b612041565b6102aa6105c036600461475e565b61204e565b6102aa6105d33660046147d4565b6122c4565b61013154610479906001600160a01b031681565b6102aa6105fa3660046144bf565b61280e565b61030f61060d36600461462c565b6128bd565b6102aa610620366004614686565b6128e1565b61030f61012e5481565b61030f61012d5481565b61030f61064736600461486f565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b6102aa610680366004614741565b6128fe565b61030f61069336600461462c565b612955565b6102bf6106a636600461489d565b61296c565b6102aa6106b93660046148bf565b6129e7565b61030f61012f5481565b61030f6000805160206150e683398151915281565b6106f56000805160206150e6833981519152336118a5565b61071a5760405162461bcd60e51b81526004016107119061491c565b60405180910390fd5b6101308054911515600160a01b0260ff60a01b19909216919091179055565b60006001600160e01b03198216637965db0b60e01b148061076a57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606036805461077f90614952565b80601f01602080910402602001604051908101604052809291908181526020018280546107ab90614952565b80156107f85780601f106107cd576101008083540402835291602001916107f8565b820191906000526020600020905b8154815290600101906020018083116107db57829003601f168201915b5050505050905090565b600061080f338484612b43565b50600192915050565b600080838360405160200161082e92919061498c565b60405160208183030381529060405280519060200120905061013261085282612c67565b60405161085f91906149c8565b90815260200160405180910390205491505092915050565b6040805180820190915260048152634632342d60e01b602082015260609060006108a084612dd1565b905042600080808080806108b387612ed3565b949a5092985090965094509250905060006108cd87612dd1565b6108d88760026130ec565b6108e38760026130ec565b6040516020016108f5939291906149e4565b604051602081830303815290604052905089898261097460646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561094b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096f9190614a27565b612dd1565b6040516020016109879493929190614a40565b6040516020818303038152906040529a5050505050505050505050919050565b60006109b4848484613253565b60006109c08533610647565b905082811015610a235760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610711565b610a308533858403612b43565b60019150505b9392505050565b600090815260fb602052604090206001015490565b610a5b82610a3d565b610a658133613426565b610a6f838361348a565b505050565b6001600160a01b0381163314610ae45760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610711565b610aee8282613510565b5050565b3360008181526034602090815260408083206001600160a01b0387168452909152812054909161080f918590610b29908690614ac5565b612b43565b610b396000336118a5565b610b555760405162461bcd60e51b815260040161071190614ad8565b610b5d613577565b565b610b776000805160206150e6833981519152336118a5565b610b935760405162461bcd60e51b81526004016107119061491c565b610130546040516331a9108f60e11b81526123906004820152610c0a916001600160a01b031690636352211e90602401602060405180830381865afa158015610be0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c049190614b0b565b82613604565b50565b61013454821015610c305760405162461bcd60e51b815260040161071190614b28565b61013054604051632f745c5960e01b81526000916001600160a01b031690632f745c5990610c649033908590600401614b73565b602060405180830381865afa158015610c81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca59190614a27565b90506000610cb282612dd1565b610cf460646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561094b573d6000803e3d6000fd5b604051602001610d0592919061498c565b6040516020818303038152906040529050610d2261238e8561296c565b50336001600160a01b0316827f45e2fe7040990afae36f39a1293f66228009bf8dd3eaf17fc636987a31d2632961238e878786604051610d659493929190614b8c565b60405180910390a350505050565b600054610100900460ff16610d8e5760005460ff1615610d92565b303b155b610dae5760405162461bcd60e51b815260040161071190614bc8565b600054610100900460ff16158015610dd0576000805461ffff19166101011790555b610e1d856040518060400160405280600a81526020016908cd2c2e8646840869c960b31b8152506040518060400160405280600581526020016410d3920c8d60da1b815250878787613753565b8015610e2f576000805461ff00191690555b5050505050565b610e4e6000805160206150e6833981519152336118a5565b610e6a5760405162461bcd60e51b81526004016107119061491c565b61012e55565b6001600160a01b031660009081526033602052604090205490565b610e966000336118a5565b610eb25760405162461bcd60e51b815260040161071190614ad8565b610b5d613836565b6101305460408051635c975abb60e01b815290516000926001600160a01b031691635c975abb9160048083019260209291908290030181865afa158015610f05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f299190614c16565b15610f7a5760405162461bcd60e51b815260206004820152602d602482015260008051602061506683398151915260448201526c1c9cc8185c99481c185d5cd959609a1b6064820152608401610711565b60655460ff1615610fcf5760405162461bcd60e51b815260206004820152603e602482015260008051602061506683398151915260448201526000805160206150c68339815191526064820152608401610711565b61013054600160a01b900460ff1615611197576101315460405163df592f7d60e01b81526001600160a01b0390911690600090829063df592f7d9061101890889060040161472d565b602060405180830381865afa158015611035573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110599190614c16565b905080156110bd5760405162461bcd60e51b815260206004820152602b60248201527f466961743234546f6b656e3a205472616e7366657220746f2073616e6374696f60448201526a6e6564206164647265737360a81b6064820152608401610711565b60405163df592f7d60e01b81526000906001600160a01b0384169063df592f7d906110ec908a9060040161472d565b602060405180830381865afa158015611109573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112d9190614c16565b905080156111935760405162461bcd60e51b815260206004820152602d60248201527f466961743234546f6b656e3a205472616e736665722066726f6d2073616e637460448201526c696f6e6564206164647265737360981b6064820152608401610711565b5050505b6001600160a01b038416158015906111b757506001600160a01b03831615155b156117d057816111c685610e70565b10156111d457506000610a36565b60006111df84610e70565b6111e99084614ac5565b610130546040516302af047960e41b815291925060009182916001600160a01b031690632af0479090611220908a9060040161472d565b602060405180830381865afa15801561123d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112619190614a27565b905080156112de57610130546040516342d21ef760e01b8152600481018390526001600160a01b03909116906342d21ef790602401602060405180830381865afa1580156112b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d79190614c33565b91506113f0565b6001600160a01b038716158015906113665750610130546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611323908b9060040161472d565b602060405180830381865afa158015611340573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113649190614a27565b115b156113eb5761013054604051632f745c5960e01b8152600293506001600160a01b0390911690632f745c59906113a3908a90600090600401614b73565b602060405180830381865afa1580156113c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e49190614a27565b90506113f0565b600091505b610130546040516302af047960e41b815260009182916001600160a01b0390911690632af0479090611426908b9060040161472d565b602060405180830381865afa158015611443573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114679190614a27565b905080156114e457610130546040516342d21ef760e01b8152600481018390526001600160a01b03909116906342d21ef790602401602060405180830381865afa1580156114b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114dd9190614c33565b91506115f6565b6001600160a01b0388161580159061156c5750610130546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611529908c9060040161472d565b602060405180830381865afa158015611546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156a9190614a27565b115b156115f15761013054604051632f745c5960e01b8152600293506001600160a01b0390911690632f745c59906115a9908b90600090600401614b73565b602060405180830381865afa1580156115c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ea9190614a27565b90506115f6565b600091505b6000611601886128bd565b6101305460405163186dddd560e31b81529192506000916001600160a01b039091169063c36eeea89061163a9088908690600401614c54565b602060405180830381865afa158015611657573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167b9190614c16565b6101305460405163186dddd560e31b81529192506000916001600160a01b039091169063c36eeea8906116b49087908790600401614c54565b602060405180830381865afa1580156116d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f59190614c16565b9050600587600581111561170b5761170b614c62565b1480156117445750600585600581111561172757611727614c62565b14806117445750600185600581111561174257611742614c62565b145b801561174d5750815b80156117565750805b806117c15750600587600581111561177057611770614c62565b14801561177a5750815b80156117c15750600085600581111561179557611795614c62565b14806117b2575060028560058111156117b0576117b0614c62565b145b80156117c1575061012e548811155b98505050505050505050610a36565b5060009392505050565b6117f26000805160206150e6833981519152336118a5565b61180e5760405162461bcd60e51b81526004016107119061491c565b61012f55565b61182c6000805160206150e6833981519152336118a5565b6118485760405162461bcd60e51b81526004016107119061491c565b61013180546001600160a01b0319166001600160a01b0392909216919091179055565b6118836000805160206150e6833981519152336118a5565b61189f5760405162461bcd60e51b81526004016107119061491c565b61013455565b600091825260fb602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606037805461077f90614952565b6118f76000805160206150a6833981519152336118a5565b6119545760405162461bcd60e51b815260206004820152602860248201527f466961743234546f6b656e3a204e6f742061207261746520757064617465722060448201526737b832b930ba37b960c11b6064820152608401610711565b61012d55565b6119726000805160206150e6833981519152336118a5565b61198e5760405162461bcd60e51b81526004016107119061491c565b610130546040516331a9108f60e11b815261238d6004820152610c0a916001600160a01b031690636352211e90602401602060405180830381865afa1580156119db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ff9190614b0b565b826138b1565b610130546040516331a9108f60e11b81526004810183905260009161076a916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611a56573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a79190614b0b565b611a92600080516020615146833981519152336118a5565b611aae5760405162461bcd60e51b815260040161071190614c78565b60008282604051602001611ac392919061498c565b604051602081830303815290604052805190602001209050610132611ae782612c67565b604051611af491906149c8565b908152602001604051809103902054600014611b225760405162461bcd60e51b815260040161071190614cad565b60646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b859190614a27565b610132611b9183612c67565b604051611b9e91906149c8565b90815260405190819003602001812091909155610130546331a9108f60e11b825261238e6004830152611c97916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611bfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c219190614b0b565b610130546040516331a9108f60e11b815261239060048201526001600160a01b0390911690636352211e906024015b602060405180830381865afa158015611c6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c919190614b0b565b866109a7565b50610130546040516331a9108f60e11b8152600481018790526001600160a01b0390911690636352211e90602401602060405180830381865afa158015611ce2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d069190614b0b565b6001600160a01b0316856000805160206150868339815191526123908686604051611d3393929190614cf3565b60405180910390a35050505050565b3360009081526034602090815260408083206001600160a01b038616845290915281205482811015611dc45760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610711565b611dd13385858403612b43565b5060019392505050565b611df3600080516020615146833981519152336118a5565b611e0f5760405162461bcd60e51b815260040161071190614c78565b60008282604051602001611e2492919061498c565b604051602081830303815290604052805190602001209050610132611e4882612c67565b604051611e5591906149c8565b908152602001604051809103902054600014611e835760405162461bcd60e51b815260040161071190614cad565b60646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ec2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee69190614a27565b610132611ef283612c67565b604051611eff91906149c8565b90815260405190819003602001812091909155610130546331a9108f60e11b825261238d6004830152611ff8916001600160a01b0390911690636352211e90602401602060405180830381865afa158015611f5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f829190614b0b565b610130546040516331a9108f60e11b815261238f60048201526001600160a01b0390911690636352211e906024015b602060405180830381865afa158015611fce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ff29190614b0b565b876109a7565b50857fb7c0e9377f7b7b3a99eeff545086c68afe0f2d0c812a2f1104b85b9c1a9ff67361238f8686866040516120319493929190614d28565b60405180910390a2505050505050565b600061080f338484613253565b612066600080516020615146833981519152336118a5565b6120825760405162461bcd60e51b815260040161071190614c78565b6000828260405160200161209792919061498c565b6040516020818303038152906040528051906020012090506101326120bb82612c67565b6040516120c891906149c8565b9081526020016040518091039020546000146120f65760405162461bcd60e51b815260040161071190614cad565b60646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612135573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121599190614a27565b61013261216583612c67565b60405161217291906149c8565b90815260405190819003602001812091909155610130546331a9108f60e11b825261238e6004830152612228916001600160a01b0390911690636352211e90602401602060405180830381865afa1580156121d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121f59190614b0b565b610130546040516331a9108f60e11b815261238f60048201526001600160a01b0390911690636352211e90602401611c50565b50610130546040516331a9108f60e11b8152600481018790526001600160a01b0390911690636352211e90602401602060405180830381865afa158015612273573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122979190614b0b565b6001600160a01b03168560008051602061508683398151915261238f8686604051611d3393929190614cf3565b6122dc600080516020615146833981519152336118a5565b6122f85760405162461bcd60e51b815260040161071190614c78565b6000828260405160200161230d92919061498c565b60405160208183030381529060405280519060200120905061013261233182612c67565b60405161233e91906149c8565b90815260200160405180910390205460001461236c5760405162461bcd60e51b815260040161071190614cad565b60646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123cf9190614a27565b6101326123db83612c67565b6040516123e891906149c8565b908152604051908190036020019020556005610130546040516342d21ef760e01b8152600481018990526001600160a01b03909116906342d21ef790602401602060405180830381865afa158015612444573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124689190614c33565b600581111561247957612479614c62565b14806125025750610130546040516342d21ef760e01b8152600481018890526001916001600160a01b0316906342d21ef790602401602060405180830381865afa1580156124cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ef9190614c33565b600581111561250057612500614c62565b145b80156125835750610130546001600160a01b031663c36eeea887612525886128bd565b6040518363ffffffff1660e01b8152600401612542929190614c54565b602060405180830381865afa15801561255f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125839190614c16565b156126e657610130546040516331a9108f60e11b815261238d600482015261262b916001600160a01b031690636352211e90602401602060405180830381865afa1580156125d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f99190614b0b565b610130546040516331a9108f60e11b8152600481018a90526001600160a01b0390911690636352211e90602401611fb1565b50610130546040516331a9108f60e11b8152600481018890526001600160a01b0390911690636352211e90602401602060405180830381865afa158015612676573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061269a9190614b0b565b6001600160a01b0316867f5cdb709c6198a116498170c22013ce75b77a91000367ae320550e291f463ee6b888787876040516126d99493929190614d28565b60405180910390a3612806565b610133546040516333c9f3f160e21b815260048101889052306024820152604481018790526001600160a01b039091169063cf27cfc490606401600060405180830381600087803b15801561273a57600080fd5b505af115801561274e573d6000803e3d6000fd5b5050610130546040516331a9108f60e11b8152600481018a90526001600160a01b039091169250636352211e9150602401602060405180830381865afa15801561279c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c09190614b0b565b6001600160a01b0316867f396a681c4a25f9658cb95bfad7f402803fff63e11a018bb3c260315c29f45d4a8686866040516127fd93929190614d67565b60405180910390a35b505050505050565b6128266000805160206150e6833981519152336118a5565b6128425760405162461bcd60e51b81526004016107119061491c565b610130546040516331a9108f60e11b815261238f6004820152610aee9184916001600160a01b0390911690636352211e90602401602060405180830381865afa158015612893573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b79190614b0b565b83613253565b600061076a6103e86128db61012d548561399290919063ffffffff16565b9061399e565b6128ea82610a3d565b6128f48133613426565b610a6f8383613510565b6129166000805160206150e6833981519152336118a5565b6129325760405162461bcd60e51b81526004016107119061491c565b61013380546001600160a01b0319166001600160a01b0392909216919091179055565b61012d5460009061076a906128db846103e8613992565b610130546040516331a9108f60e11b815260048101849052600091610a36916001600160a01b0390911690636352211e90602401602060405180830381865afa1580156129bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129e19190614b0b565b83612041565b61013454841015612a0a5760405162461bcd60e51b815260040161071190614b28565b61013054604051632f745c5960e01b81526000916001600160a01b031690632f745c5990612a3e9033908590600401614b73565b602060405180830381865afa158015612a5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7f9190614a27565b90506000612a8c82612dd1565b612ace60646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561094b573d6000803e3d6000fd5b604051602001612adf92919061498c565b6040516020818303038152906040529050612afc61238e8761296c565b50336001600160a01b0316827fb0edd2920d8642e5a9d1e38c772e65fabe13c83a27cef8f6929a7740b9041d3661238e8989868a8a6040516127fd96959493929190614da0565b6001600160a01b038316612ba55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610711565b6001600160a01b038216612c065760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610711565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b604080516020808252818301909252606091600091906020820181803683370190505090506000805b6020811015612d1d57848160208110612cab57612cab614df8565b1a60f81b6001600160f81b03191615612d0b57848160208110612cd057612cd0614df8565b1a60f81b838381518110612ce657612ce6614df8565b60200101906001600160f81b031916908160001a90535081612d0781614e0e565b9250505b80612d1581614e0e565b915050612c90565b506000816001600160401b03811115612d3857612d386144eb565b6040519080825280601f01601f191660200182016040528015612d62576020820181803683370190505b50905060005b82811015612dc857838181518110612d8257612d82614df8565b602001015160f81c60f81b828281518110612d9f57612d9f614df8565b60200101906001600160f81b031916908160001a90535080612dc081614e0e565b915050612d68565b50949350505050565b606081600003612df85750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612e225780612e0c81614e0e565b9150612e1b9050600a83614e3d565b9150612dfc565b6000816001600160401b03811115612e3c57612e3c6144eb565b6040519080825280601f01601f191660200182016040528015612e66576020820181803683370190505b508593509050815b8315612dc857612e7f600a85614e51565b612e8a906030614ac5565b60f81b82612e9783614e65565b92508281518110612eaa57612eaa614df8565b60200101906001600160f81b031916908160001a905350612ecc600a85614e3d565b9350612e6e565b600080808080806107b281808080805b6301e133808d10612f6b576000612efb600488614e51565b158015612f245750612f0e606488614e51565b151580612f245750612f2261019088614e51565b155b612f32576301e13380612f38565b6301e285005b9050808e10612f5f57612f4b818f614e7c565b9d5086612f5781614e0e565b975050612f65565b50612f6b565b50612ee3565b600194505b6040805161018081018252601f808252601c6020830152918101829052601e606082018190526080820183905260a0820181905260c0820183905260e0820183905261010082018190526101208201839052610140820152610160810191909152612fdc600488614e51565b1580156130055750612fef606488614e51565b151580613005575061300361019088614e51565b155b1561301257601d60208201525b6000620151808261302460018a614e7c565b600c811061303457613034614df8565b602002015160ff166130469190614e8f565b9050808f1015613057575050613079565b808f6130639190614e7c565b9e508661306f81614e0e565b9750505050612f70565b613086620151808e614e3d565b613091906001614ac5565b93506130a0620151808e614e51565b9c506130ae610e108e614e3d565b92506130bc610e108e614e51565b9c506130c9603c8e614e3d565b91506130d6603c8e614e51565b959d949c50929a50909850965091945092505050565b60608160000361310b575060408051602081019091526000815261076a565b8260005b8115613135578061311f81614e0e565b915061312e9050600a83614e3d565b915061310f565b83811061314e5761314585612dd1565b9250505061076a565b6000846001600160401b03811115613168576131686144eb565b6040519080825280601f01601f191660200182016040528015613192576020820181803683370190505b508693509050845b831561320257806131aa81614e65565b91506131b99050600a85614e51565b6131c4906030614ac5565b60f81b8282815181106131d9576131d9614df8565b60200101906001600160f81b031916908160001a9053506131fb600a85614e3d565b935061319a565b8015613248578061321281614e65565b915050603060f81b82828151811061322c5761322c614df8565b60200101906001600160f81b031916908160001a905350613202565b50925061076a915050565b6001600160a01b0383166132b75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610711565b6001600160a01b0382166133195760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610711565b6133248383836139aa565b6001600160a01b0383166000908152603360205260409020548181101561339c5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610711565b6001600160a01b038085166000908152603360205260408082208585039055918516815290812080548492906133d3908490614ac5565b92505081905550826001600160a01b0316846001600160a01b03166000805160206151068339815191528460405161340d91815260200190565b60405180910390a3613420848484613c84565b50505050565b61343082826118a5565b610aee57613448816001600160a01b03166014614180565b613453836020614180565b604051602001613464929190614ea6565b60408051601f198184030181529082905262461bcd60e51b825261071191600401614497565b61349482826118a5565b610aee57600082815260fb602090815260408083206001600160a01b03851684529091529020805460ff191660011790556134cc3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61351a82826118a5565b15610aee57600082815260fb602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60655460ff166135c05760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610711565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516135fa919061472d565b60405180910390a1565b6001600160a01b0382166136645760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610711565b613670826000836139aa565b6001600160a01b038216600090815260336020526040902054818110156136e45760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610711565b6001600160a01b0383166000908152603360205260408120838303905560358054849290613713908490614e7c565b90915550506040518281526000906001600160a01b038516906000805160206151068339815191529060200160405180910390a3610a6f83600084613c84565b600054610100900460ff1661376e5760005460ff1615613772565b303b155b61378e5760405162461bcd60e51b815260040161071190614bc8565b600054610100900460ff161580156137b0576000805461ffff19166101011790555b6137b861431b565b6137c061431b565b6137ca8686614342565b6137d5600033614382565b6137ed6000805160206150e683398151915233614382565b61013080546001600160a01b0319166001600160a01b03891617905561012e84905561012d83905561012f829055801561382d576000805461ff00191690555b50505050505050565b60655460ff161561387c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610711565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586135ed3390565b6001600160a01b0382166139075760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610711565b613913600083836139aa565b80603560008282546139259190614ac5565b90915550506001600160a01b03821660009081526033602052604081208054839290613952908490614ac5565b90915550506040518181526001600160a01b038316906000906000805160206151068339815191529060200160405180910390a3610aee60008383613c84565b6000610a368284614e8f565b6000610a368284614e3d565b61013060009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156139fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a229190614c16565b15613a735760405162461bcd60e51b815260206004820152602d602482015260008051602061512683398151915260448201526c1c9cc8185c99481c185d5cd959609a1b6064820152608401610711565b60655460ff1615613ac85760405162461bcd60e51b815260206004820152603e602482015260008051602061512683398151915260448201526000805160206150c68339815191526064820152608401610711565b6001600160a01b03831615801590613ae857506001600160a01b03821615155b8015613b745750610130546040516331a9108f60e11b815261238f60048201526001600160a01b0390911690636352211e90602401602060405180830381865afa158015613b3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b5e9190614b0b565b6001600160a01b0316826001600160a01b031614155b8015613c005750610130546040516331a9108f60e11b815261238f60048201526001600160a01b0390911690636352211e90602401602060405180830381865afa158015613bc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bea9190614b0b565b6001600160a01b0316836001600160a01b031614155b15613c7957613c10838383610eba565b613c795760405162461bcd60e51b815260206004820152603460248201527f466961743234546f6b656e3a205472616e73666572206e6f7420616c6c6f776560448201527332103337b9103b30b934b7bab9903932b0b9b7b760611b6064820152608401610711565b610a6f83838361438c565b6001600160a01b03831615801590613ca457506001600160a01b03821615155b8015613d305750610130546040516331a9108f60e11b815261238f60048201526001600160a01b0390911690636352211e90602401602060405180830381865afa158015613cf6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d1a9190614b0b565b6001600160a01b0316826001600160a01b031614155b8015613dbc5750610130546040516331a9108f60e11b815261238f60048201526001600160a01b0390911690636352211e90602401602060405180830381865afa158015613d82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613da69190614b0b565b6001600160a01b0316836001600160a01b031614155b15610a6f57610130546040516302af047960e41b81526000916001600160a01b031690632af0479090613df390879060040161472d565b602060405180830381865afa158015613e10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e349190614a27565b905080158015613eb45750610130546040516370a0823160e01b81526000916001600160a01b0316906370a0823190613e7190889060040161472d565b602060405180830381865afa158015613e8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613eb29190614a27565b115b15613f315761013054604051632f745c5960e01b81526001600160a01b0390911690632f745c5990613eed908790600090600401614b73565b602060405180830381865afa158015613f0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f2e9190614a27565b90505b610130546040516302af047960e41b81526000916001600160a01b031690632af0479090613f6390879060040161472d565b602060405180830381865afa158015613f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fa49190614a27565b9050801580156140245750610130546040516370a0823160e01b81526000916001600160a01b0316906370a0823190613fe190889060040161472d565b602060405180830381865afa158015613ffe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140229190614a27565b115b156140a15761013054604051632f745c5960e01b81526001600160a01b0390911690632f745c599061405d908790600090600401614b73565b602060405180830381865afa15801561407a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061409e9190614a27565b90505b610130546001600160a01b0316634bedccf4836140bd866128bd565b6040518363ffffffff1660e01b81526004016140da929190614c54565b600060405180830381600087803b1580156140f457600080fd5b505af1158015614108573d6000803e3d6000fd5b5050610130546001600160a01b03169150634bedccf490508261412a866128bd565b6040518363ffffffff1660e01b8152600401614147929190614c54565b600060405180830381600087803b15801561416157600080fd5b505af1158015614175573d6000803e3d6000fd5b505050505050505050565b6060600061418f836002614e8f565b61419a906002614ac5565b6001600160401b038111156141b1576141b16144eb565b6040519080825280601f01601f1916602001820160405280156141db576020820181803683370190505b509050600360fc1b816000815181106141f6576141f6614df8565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061422557614225614df8565b60200101906001600160f81b031916908160001a9053506000614249846002614e8f565b614254906001614ac5565b90505b60018111156142cc576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061428857614288614df8565b1a60f81b82828151811061429e5761429e614df8565b60200101906001600160f81b031916908160001a90535060049490941c936142c581614e65565b9050614257565b508315610a365760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610711565b600054610100900460ff16610b5d5760405162461bcd60e51b815260040161071190614f15565b600054610100900460ff166143695760405162461bcd60e51b815260040161071190614f15565b60366143758382614fa6565b506037610a6f8282614fa6565b610aee828261348a565b60655460ff1615610a6f5760405162461bcd60e51b815260206004820152602a60248201527f45524332305061757361626c653a20746f6b656e207472616e736665722077686044820152691a5b19481c185d5cd95960b21b6064820152608401610711565b8015158114610c0a57600080fd5b60006020828403121561441257600080fd5b8135610a36816143f2565b60006020828403121561442f57600080fd5b81356001600160e01b031981168114610a3657600080fd5b60005b8381101561446257818101518382015260200161444a565b50506000910152565b60008151808452614483816020860160208601614447565b601f01601f19169290920160200192915050565b602081526000610a36602083018461446b565b6001600160a01b0381168114610c0a57600080fd5b600080604083850312156144d257600080fd5b82356144dd816144aa565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261451257600080fd5b81356001600160401b038082111561452c5761452c6144eb565b604051601f8301601f19908116603f01168101908282118183101715614554576145546144eb565b8160405283815286602085880101111561456d57600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080604083850312156145a057600080fd5b82356001600160401b03808211156145b757600080fd5b6145c386838701614501565b935060208501359150808211156145d957600080fd5b506145e685828601614501565b9150509250929050565b60006020828403121561460257600080fd5b81356001600160401b0381111561461857600080fd5b61462484828501614501565b949350505050565b60006020828403121561463e57600080fd5b5035919050565b60008060006060848603121561465a57600080fd5b8335614665816144aa565b92506020840135614675816144aa565b929592945050506040919091013590565b6000806040838503121561469957600080fd5b8235915060208301356146ab816144aa565b809150509250929050565b600080604083850312156146c957600080fd5b8235915060208301356001600160401b038111156146e657600080fd5b6145e685828601614501565b6000806000806080858703121561470857600080fd5b8435614713816144aa565b966020860135965060408601359560600135945092505050565b6001600160a01b0391909116815260200190565b60006020828403121561475357600080fd5b8135610a36816144aa565b6000806000806080858703121561477457600080fd5b843593506020850135925060408501356001600160401b038082111561479957600080fd5b6147a588838901614501565b935060608701359150808211156147bb57600080fd5b506147c887828801614501565b91505092959194509250565b600080600080600060a086880312156147ec57600080fd5b853594506020860135935060408601356001600160401b038082111561481157600080fd5b61481d89838a01614501565b9450606088013591508082111561483357600080fd5b61483f89838a01614501565b9350608088013591508082111561485557600080fd5b5061486288828901614501565b9150509295509295909350565b6000806040838503121561488257600080fd5b823561488d816144aa565b915060208301356146ab816144aa565b600080604083850312156148b057600080fd5b50508035926020909101359150565b600080600080608085870312156148d557600080fd5b8435935060208501356001600160401b03808211156148f357600080fd5b6148ff88838901614501565b94506040870135935060608701359150808211156147bb57600080fd5b6020808252601c908201527b2334b0ba191a2a37b5b2b71d102737ba1030b71037b832b930ba37b960211b604082015260600190565b600181811c9082168061496657607f821691505b60208210810361498657634e487b7160e01b600052602260045260246000fd5b50919050565b6000835161499e818460208801614447565b602d60f81b90830190815283516149bc816001840160208801614447565b01600101949350505050565b600082516149da818460208701614447565b9190910192915050565b600084516149f6818460208901614447565b845190830190614a0a818360208901614447565b8451910190614a1d818360208801614447565b0195945050505050565b600060208284031215614a3957600080fd5b5051919050565b60008551614a52818460208a01614447565b855190830190614a66818360208a01614447565b602d60f81b91018181528551909190614a86816001850160208a01614447565b60019201918201528351614aa1816002840160208801614447565b016002019695505050505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561076a5761076a614aaf565b6020808252601990820152782334b0ba191a2a37b5b2b71d102737ba1030b71030b236b4b760391b604082015260600190565b600060208284031215614b1d57600080fd5b8151610a36816144aa565b6020808252602b908201527f466961743234546f6b656e3a20616d6f756e74203c206d696e696d616c20706160408201526a1e5bdd5d08185b5bdd5b9d60aa1b606082015260800190565b6001600160a01b03929092168252602082015260400190565b848152836020820152608060408201526000614bab608083018561446b565b8281036060840152614bbd818561446b565b979650505050505050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b600060208284031215614c2857600080fd5b8151610a36816143f2565b600060208284031215614c4557600080fd5b815160068110610a3657600080fd5b918252602082015260400190565b634e487b7160e01b600052602160045260246000fd5b6020808252818101527f466961743234546f6b656e3a204e6f7420612043617368204f70657261746f72604082015260600190565b60208082526026908201527f466961743234546f6b656e3a207061637330303820616c72656164792070726f60408201526518d95cdcd95960d21b606082015260800190565b838152606060208201526000614d0c606083018561446b565b8281036040840152614d1e818561446b565b9695505050505050565b848152608060208201526000614d41608083018661446b565b8281036040840152614d53818661446b565b90508281036060840152614bbd818561446b565b606081526000614d7a606083018661446b565b8281036020840152614d8c818661446b565b90508281036040840152614d1e818561446b565b86815285602082015260c060408201526000614dbf60c083018761446b565b8281036060840152614dd1818761446b565b905084608084015282810360a0840152614deb818561446b565b9998505050505050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201614e2057614e20614aaf565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082614e4c57614e4c614e27565b500490565b600082614e6057614e60614e27565b500690565b600081614e7457614e74614aaf565b506000190190565b8181038181111561076a5761076a614aaf565b808202811582820484141761076a5761076a614aaf565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351614ed8816017850160208801614447565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614f09816028840160208801614447565b01602801949350505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b601f821115610a6f57600081815260208120601f850160051c81016020861015614f875750805b601f850160051c820191505b8181101561280657828155600101614f93565b81516001600160401b03811115614fbf57614fbf6144eb565b614fd381614fcd8454614952565b84614f60565b602080601f8311600181146150085760008415614ff05750858301515b600019600386901b1c1916600185901b178555612806565b600085815260208120601f198616915b8281101561503757888601518255948401946001909101908401615018565b50858210156150555787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fe466961743234546f6b656e3a20416c6c206163636f756e74207472616e73666561b5aec2618015d8ed22811fd54e1879a653e6ed114e9a9aeff7c53e4bf0ec60dc8b1416a064e54e8fcba3f3bc78e3cce2f7fdb81752ac1a2e9b70b7acaf194f7273206f6620746869732063757272656e63792061726520706175736564000097667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef466961743234546f6b656e3a20616c6c206163636f756e74207472616e7366654fde3dfe3090fae85f62f8d63bf4c5b6a33f0bc579a46c4e5af6407837a11171a264697066735822122053b1a0c29d7cbb1cdfc4e2e4a4a857995485de83012323b2a0d9b933a510d8e464736f6c63430008120033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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